EasyManuals Logo

Espressif ESP32-S2 User Manual

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #1352 background imageLoading...
Page #1352 background image
Chapter 4. API Guides
Stack smashing protect failure!
abort() was called at PC 0x400d2138 on core 0
Backtrace: 0x4008e6c0:0x3ffc1780 0x4008e8b7:0x3ffc17a0 0x400d2138:0x3ffc17c0
,0x400e79d5:0x3ffc17e0 0x400e79a7:0x3ffc1840 0x400e79df:0x3ffc18a0
,0x400e2235:0x3ffc18c0 0x400e1916:0x3ffc18f0 0x400e19cd:0x3ffc1910
,0x400e1a11:0x3ffc1930 0x400e1bb2:0x3ffc1950 0x400d2c44:0x3ffc1a80
0
The backtrace should point to the function where stack smashing has occurred. Check the function code for un-
bounded access to local arrays.
Undefined behavior sanitizer (UBSAN) checks
Undefined behavior sanitizer (UBSAN) is a compiler feature which adds run-time checks for potentially incorrect
operations, such as:
overflows (multiplication overflow, signed integer overflow)
shift base or exponent errors (e.g. shift by more than 32 bits)
integer conversion errors
See GCC documentation of -fsanitize=undefined option for the complete list of supported checks.
Enabling UBSAN UBSAN is disabled by default. It can be enabled at file, component, or project level by adding
the -fsanitize=undefined compiler option in the build system.
When enabling UBSAN for code which uses the SOC hardware register header files (soc/xxx_reg.h), it is
recommended to disable shift-base sanitizer using -fno-sanitize=shift-base option. This is due to the
fact that ESP-IDF register header files currently contain patterns which cause false positives for this specific sanitizer
option.
To enable UBSAN at project level, add the following code at the end of the projects CMakeLists.txt file:
idf_build_set_property(COMPILE_OPTIONS "-fsanitize=undefined" "-fno-sanitize=shift-
,base" APPEND)
Alternatively, pass these options through the EXTRA_CFLAGS and EXTRA_CXXFLAGS environment variables.
Enabling UBSAN results in significant increase of code and data size. Most applications, except for the trivial ones,
will not fit into the available RAM of the microcontroller when UBSAN is enabled for the whole application. There-
fore it is recommended that UBSAN is instead enabled for specific components under test.
To enable UBSAN for a specific component (component_name) from the projects CMakeLists.txt file,
add the following code at the end of the file:
idf_component_get_property(lib component_name COMPONENT_LIB)
target_compile_options(${lib} PRIVATE "-fsanitize=undefined" "-fno-sanitize=shift-
,base")
Note: See the build system documentation for more information about build properties and component properties.
To enable UBSAN for a specific component (component_name) from CMakeLists.txt of the same compo-
nent, add the following at the end of the file:
target_compile_options(${COMPONENT_LIB} PRIVATE "-fsanitize=undefined" "-fno-
,sanitize=shift-base")
Espressif Systems 1341
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Espressif ESP32-S2 and is the answer not in the manual?

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish