scripts: check_init_priorities: use the Zephyr executable file

Rework check_init_priorities to use the main executable file instead of
the individual object files for discovering the devices.

This should make the script more robust in case of stale files in the
build directory, and also makes it work with LTO object files.

Additionally, keep track of the detected init calls, and add a handy
"-i" option to produce a human readable print of the initcalls in the
call sequence, which can be useful for debugging initialization problems
due to odd SYS_INIT and DEVICE interactions.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This commit is contained in:
Fabio Baltieri 2023-09-08 18:10:13 +00:00 committed by Fabio Baltieri
commit 5212a4c619
6 changed files with 352 additions and 269 deletions

View file

@ -1811,8 +1811,7 @@ if(CONFIG_CHECK_INIT_PRIORITIES)
list(APPEND
post_build_commands
COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/build/check_init_priorities.py
--build-dir ${PROJECT_BINARY_DIR}/..
--edt-pickle ${EDT_PICKLE}
--elf-file=${ZEPHYR_BINARY_DIR}/${KERNEL_ELF_NAME}
${fail_on_warning}
)
endif()