From 9f1a4e3e4f333e5c064e4b13c8712980fb38ca8f Mon Sep 17 00:00:00 2001 From: Marek Matej Date: Wed, 29 May 2024 18:03:29 +0200 Subject: [PATCH] soc: espressif: esp32s3: add cross segment call check Add build check that would detect unwanted calls from the `iram0.loader_text`, which is the last bootloader segment to be alive. Signed-off-by: Marek Matej --- soc/espressif/esp32s3/CMakeLists.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/soc/espressif/esp32s3/CMakeLists.txt b/soc/espressif/esp32s3/CMakeLists.txt index 540881b45ab..d60d8aa6dc8 100644 --- a/soc/espressif/esp32s3/CMakeLists.txt +++ b/soc/espressif/esp32s3/CMakeLists.txt @@ -58,6 +58,7 @@ if (CONFIG_SOC_ESP32S3_APPCPU) endif() else() + ## Building for PROCPU set_property(TARGET bintools PROPERTY disassembly_flag_inline_source) @@ -77,6 +78,21 @@ else() endif() +if(CONFIG_MCUBOOT) + # search from cross references between bootloader sections + message("check_callgraph using: ${ESP_IDF_PATH}/tools/ci/check_callgraph.py") + set_property(GLOBAL APPEND PROPERTY extra_post_build_commands + COMMAND + ${PYTHON_EXECUTABLE} ${ESP_IDF_PATH}/tools/ci/check_callgraph.py + ARGS + --rtl-dirs ${CMAKE_BINARY_DIR}/zephyr + --elf-file ${CMAKE_BINARY_DIR}/zephyr/${CONFIG_KERNEL_BIN_NAME}.elf + find-refs + --from-section='.iram0.loader_text' + --to-section='.iram0.text' + --exit-code) +endif() + if(CONFIG_MCUBOOT) set(SOC_LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/mcuboot.ld CACHE INTERNAL "") elseif(CONFIG_SOC_ESP32S3_APPCPU)