Skip to content

Commit

Permalink
AP_HAL_ESP32: ensure malloc is wrapped to zero memory
Browse files Browse the repository at this point in the history
The relevant linker flag needed to be put in the CMake script.
  • Loading branch information
tpwrules authored and peterbarker committed Jan 4, 2025
1 parent b0ebbd7 commit 716a9dc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libraries/AP_HAL_ESP32/targets/esp32/esp-idf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ target_link_libraries(${elf_file}
# linker script generation, partition_table generation, etc.
idf_build_executable(${elf_file})

# wrap malloc to ensure memory is zeroed
target_link_options(${elf_file} PRIVATE "-Wl,--wrap,malloc")

set(CMAKE_EXPORT_COMPILE_COMMANDS 1)

# Additional targets for measuring RAM use: size, size-components, size-files
Expand Down
3 changes: 3 additions & 0 deletions libraries/AP_HAL_ESP32/targets/esp32s3/esp-idf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ target_link_libraries(${elf_file}
# linker script generation, partition_table generation, etc.
idf_build_executable(${elf_file})

# wrap malloc to ensure memory is zeroed
target_link_options(${elf_file} PRIVATE "-Wl,--wrap,malloc")

set(CMAKE_EXPORT_COMPILE_COMMANDS 1)

# Additional targets for measuring RAM use: size, size-components, size-files
Expand Down

0 comments on commit 716a9dc

Please sign in to comment.