diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-10-31 14:04:11 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-10-31 14:04:11 -0600 |
commit | f2d53195fd86023d2ff9fcce68d2e150bfd97059 (patch) | |
tree | 04a6b38e05e53555735cd2235611cb588ab0a586 | |
parent | a3ddac4e4e52aac6865276755164abe72835a97b (diff) |
cmake part of stack sizes
-rw-r--r-- | cmd/sbc_harness/CMakeLists.txt | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/cmd/sbc_harness/CMakeLists.txt b/cmd/sbc_harness/CMakeLists.txt index d59e2b5..85e61ab 100644 --- a/cmd/sbc_harness/CMakeLists.txt +++ b/cmd/sbc_harness/CMakeLists.txt @@ -5,13 +5,15 @@ if (PICO_PLATFORM STREQUAL "rp2040") -add_executable(sbc_harness +# Main compilation ############################################################# + +add_library(sbc_harness_objs main.c usb_keyboard.c ) -target_include_directories(sbc_harness PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/config) -target_include_directories(sbc_harness PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) -target_link_libraries(sbc_harness +target_include_directories(sbc_harness_objs PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/config) +target_include_directories(sbc_harness_objs PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) +target_link_libraries(sbc_harness_objs pico_stdlib hardware_flash @@ -20,13 +22,30 @@ target_link_libraries(sbc_harness #libdhcp libhw ) -target_compile_options(sbc_harness PUBLIC "-fcallgraph-info=su,da") +pico_enable_stdio_usb(sbc_harness_objs 0) +pico_enable_stdio_uart(sbc_harness_objs 1) +pico_enable_stdio_semihosting(sbc_harness_objs 0) +pico_enable_stdio_rtt(sbc_harness_objs 0) + +# Stack analysis ############################################################### + +target_compile_options(sbc_harness_objs PUBLIC "-fcallgraph-info=su,da") +set_source_files_properties(sbc_harness_stack.c PROPERTIES + GENERATED true +) +add_custom_command( + OUTPUT sbc_harness_stack.c + COMMAND set -o pipefail && cat -- "$<LIST:TRANSFORM,$<LIST:FILTER,$<TARGET_OBJECTS:sbc_harness_objs>,INCLUDE,\.c\.o(bj)?$>,REPLACE,\.o(bj)?$,.ci>" | sed 's,^,//,' >sbc_harness_stack.c + COMMAND_EXPAND_LISTS + DEPENDS $<TARGET_OBJECTS:sbc_harness_objs> + COMMENT "Calculating sbc_harness required stack sizes" +) -pico_enable_stdio_usb(sbc_harness 0) -pico_enable_stdio_uart(sbc_harness 1) -pico_enable_stdio_semihosting(sbc_harness 0) -pico_enable_stdio_rtt(sbc_harness 0) +# Link ######################################################################### +add_executable(sbc_harness) +target_link_libraries(sbc_harness sbc_harness_objs) +target_sources(sbc_harness PRIVATE sbc_harness_stack.c) pico_add_extra_outputs(sbc_harness) # create .map/.bin/.hex/.uf2 files in addition to .elf pico_set_program_url(sbc_harness "https://git.lukeshu.com/sbc-harness") |