Use the value of nuttx CONFIG_ARMV7M_STACKCHECK to configure PX4 build for HW stack checking

This commit is contained in:
David Sidrane 2016-05-18 14:00:51 -10:00 committed by Lorenz Meier
parent be92040fe9
commit 4e26c7fcd4
1 changed files with 20 additions and 0 deletions

View File

@ -202,6 +202,16 @@ function(px4_nuttx_add_export)
add_dependencies(nuttx_patch nuttx_patch_${patch_name})
endforeach()
# Read defconfig to see if CONFIG_ARMV7M_STACKCHECK is yes
# note: CONFIG will be BOARD in the future evaluation of ${hw_stack_check_${CONFIG}
file(STRINGS "${CMAKE_SOURCE_DIR}/nuttx-configs/${CONFIG}/${config_nuttx_config}/defconfig"
hw_stack_check_${CONFIG}
REGEX "CONFIG_ARMV7M_STACKCHECK=y"
)
if ("${hw_stack_check_${CONFIG}}" STREQUAL "CONFIG_ARMV7M_STACKCHECK=y")
set(config_nuttx_hw_stack_check_${CONFIG} y CACHE INTERNAL "" FORCE)
endif()
# copy and export
file(GLOB_RECURSE config_files ${CMAKE_SOURCE_DIR}/nuttx-configs/${CONFIG}/*)
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${CONFIG}.export
@ -428,6 +438,16 @@ function(px4_os_add_flags)
set(added_exe_linker_flags) # none currently
set(instrument_flags)
if ("${config_nuttx_hw_stack_check_${BOARD}}" STREQUAL "y")
set(instrument_flags
-finstrument-functions
-ffixed-r10
)
list(APPEND c_flags ${instrument_flags})
list(APPEND cxx_flags ${instrument_flags})
endif()
set(cpu_flags)
if (${BOARD} STREQUAL "px4fmu-v1")
set(cpu_flags