CMakeLists.txt 1.1 KB

12345678910111213141516171819202122232425262728
  1. # The following lines of boilerplate have to be in your project's CMakeLists
  2. # in this exact order for cmake to work correctly
  3. cmake_minimum_required(VERSION 3.5)
  4. set(COMPONENTS esptool_py main)
  5. include($ENV{IDF_PATH}/tools/cmake/project.cmake)
  6. project(test_panic)
  7. # Enable UBSAN checks
  8. #
  9. # shift-base sanitizer is disabled due to the following pattern found in register header files:
  10. # #define SOME_FIELD 0xFFFF
  11. # #define SOME_FIELD_M ((SOME_FIELD_V)<<(SOME_FIELD_S))
  12. # #define SOME_FIELD_V 0xFFFF
  13. # #define SOME_FIELD_S 16
  14. # here SOME_FIELD_V doesn't have an unsigned (U) prefix, so the compiler flags
  15. # SOME_FIELD_M expansion (0xFFFF << 16) as generating integer overflow.
  16. #
  17. set(ubsan_options "-fsanitize=undefined" "-fno-sanitize=shift-base")
  18. # Only enable UBSAN for a few components related to the panic test,
  19. # due to RAM size limitations.
  20. foreach(component main espcoredump esp_system spi_flash
  21. esp_common esp_hw_support soc hal freertos)
  22. idf_component_get_property(lib ${component} COMPONENT_LIB)
  23. target_compile_options(${lib} PRIVATE ${ubsan_options})
  24. endforeach()