scripts: check_init_priorities: add extra verbose output
Add support for more verbose output enabling debugging output and add a
first debug print to output the file to device path mapping. Found this
to be extremely useful to find what file is instantiating a specific
device for non obvious cases.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
diff --git a/scripts/build/check_init_priorities.py b/scripts/build/check_init_priorities.py
index 404dba0..2361616 100755
--- a/scripts/build/check_init_priorities.py
+++ b/scripts/build/check_init_priorities.py
@@ -194,6 +194,9 @@
obj = ZephyrObjectFile(file)
if obj.defined_devices:
self._objs.append(obj)
+ for dev in obj.defined_devices:
+ dev_path = self._ord2node[dev].path
+ self.log.debug(f"{file}: {dev_path}")
self._dev_priorities = {}
for obj in self._objs:
@@ -279,8 +282,9 @@
parser.add_argument("-d", "--build-dir", default="build",
help="build directory to use")
- parser.add_argument("-v", "--verbose", action="store_true",
- help="enable verbose Output")
+ parser.add_argument("-v", "--verbose", action="count",
+ help=("enable verbose output, can be used multiple times "
+ "to increase verbosity level"))
parser.add_argument("-w", "--fail-on-warning", action="store_true",
help="fail on both warnings and errors")
parser.add_argument("--always-succeed", action="store_true",
@@ -306,7 +310,9 @@
file.setFormatter(logging.Formatter("%(levelname)s: %(message)s"))
log.addHandler(file)
- if verbose:
+ if verbose and verbose > 1:
+ log.setLevel(logging.DEBUG)
+ elif verbose and verbose > 0:
log.setLevel(logging.INFO)
else:
log.setLevel(logging.WARNING)