Files
esp-idf/tools/test_apps/system/panic/CMakeLists.txt
Sudeep Mohanty b562afa08e fix(panic_handler): Updated panic handler to use RTC WDT
This commit updates the following:
- Updates the panic handler to use only the RTC WDT to reset the system.
- Refactors some of the panic handler code.
- Updates Bluetooth files where in they now feed the WDTs instead of
  reconfiguring them.
- Removes some unnecessary configuration of WDTs from various files.
- Added a unit test to verify that the system does not lock up when the
  panic handler is stuck.
- Updates the memprot unit tests to work with the refactored panic
  handler.

Closes https://github.com/espressif/esp-idf/issues/15166
Closes https://github.com/espressif/esp-idf/issues/15018
Closes https://github.com/espressif/esp-idf/issues/10110
2025-02-18 15:40:54 +01:00

50 lines
2.0 KiB
CMake
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# The following lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)
set(COMPONENTS main espcoredump esp_gdbstub)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(test_panic)
if(CONFIG_TEST_MEMPROT)
# TODO: IDF-6821 - Refactor this to make it easy to add any new targets
if(CONFIG_SOC_MEMPROT_SUPPORTED)
target_link_libraries(${project_elf} PRIVATE "-Wl,--wrap=esp_panic_handler")
if(CONFIG_IDF_TARGET_ESP32C3)
target_link_libraries(${project_elf} PRIVATE "-Wl,--wrap=panic_arch_fill_info")
endif()
endif()
endif()
if(NOT CONFIG_TEST_MEMPROT AND NOT CONFIG_ESP_COREDUMP_CAPTURE_DRAM)
# Enable UBSAN checks
#
# shift-base sanitizer is disabled due to the following pattern found in register header files:
# #define SOME_FIELD 0xFFFF
# #define SOME_FIELD_M ((SOME_FIELD_V)<<(SOME_FIELD_S))
# #define SOME_FIELD_V 0xFFFF
# #define SOME_FIELD_S 16
# here SOME_FIELD_V doesn't have an unsigned (U) prefix, so the compiler flags
# SOME_FIELD_M expansion (0xFFFF << 16) as generating integer overflow.
#
set(ubsan_options "-fsanitize=undefined" "-fno-sanitize=shift-base")
# Only enable UBSAN for a few components related to the panic test,
# due to RAM size limitations.
set(ubsan_components main espcoredump esp_system spi_flash
esp_common esp_hw_support soc hal freertos)
if(CONFIG_ESP_COREDUMP_CHECKSUM_SHA256)
if(CONFIG_IDF_TARGET_ESP32S2)
# due to the ram limitation, coredump and freertos are removed from esp32s2 built
list(REMOVE_ITEM ubsan_components espcoredump freertos)
endif()
endif()
foreach(component IN LISTS ubsan_components)
idf_component_get_property(lib ${component} COMPONENT_LIB)
target_compile_options(${lib} PRIVATE ${ubsan_options})
endforeach()
target_link_libraries(${project_elf} PRIVATE "-Wl,--wrap=esp_panic_handler")
endif()