diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/sbc_harness/CMakeLists.txt | 16 | ||||
-rw-r--r-- | cmd/srv9p/CMakeLists.txt | 38 | ||||
-rwxr-xr-x | cmd/srv9p/static.h.gen | 10 |
3 files changed, 7 insertions, 57 deletions
diff --git a/cmd/sbc_harness/CMakeLists.txt b/cmd/sbc_harness/CMakeLists.txt index 85e61ab..2018cf7 100644 --- a/cmd/sbc_harness/CMakeLists.txt +++ b/cmd/sbc_harness/CMakeLists.txt @@ -5,7 +5,7 @@ if (PICO_PLATFORM STREQUAL "rp2040") -# Main compilation ############################################################# +# Compile ###################################################################### add_library(sbc_harness_objs main.c @@ -27,19 +27,9 @@ 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 ############################################################### +# Analyze the stack ############################################################ -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" -) +add_stack_analysis(sbc_harness_stack.c sbc_harness_objs) # Link ######################################################################### diff --git a/cmd/srv9p/CMakeLists.txt b/cmd/srv9p/CMakeLists.txt index 4c170fb..b747882 100644 --- a/cmd/srv9p/CMakeLists.txt +++ b/cmd/srv9p/CMakeLists.txt @@ -5,15 +5,14 @@ if (PICO_PLATFORM STREQUAL "host") -set(static_srcs - static/README.md - static/Documentation/x -) - add_executable(srv9p main.c static9p.c ) +target_embed_sources(srv9p static.h + static/README.md + static/Documentation/x +) target_include_directories(srv9p PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) target_include_directories(srv9p PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/config) target_link_libraries(srv9p @@ -23,33 +22,4 @@ target_link_libraries(srv9p lib9p ) -set(static_objs) -foreach(static_src ${static_srcs}) - add_custom_command( - OUTPUT "${static_src}.obj" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND dirname -- ${CMAKE_CURRENT_BINARY_DIR}/${static_src}.obj | xargs mkdir -p -- - COMMAND ${CMAKE_LINKER} -r -b binary -o ${CMAKE_CURRENT_BINARY_DIR}/${static_src}.obj ${static_src} - DEPENDS "${static_src}" - ) - list(APPEND static_objs "${static_src}.obj") -endforeach() - -set_source_files_properties(${static_objs} PROPERTIES - EXTERNAL_OBJECT true - GENERATED true -) - -set_source_files_properties(static.h PROPERTIES - GENERATED true -) - -add_custom_command( - OUTPUT static.h - DEPENDS ${static_objs} static.h.gen - COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/static.h.gen ${static_objs} >static.h -) - -target_sources(srv9p PRIVATE ${static_objs} static.h) - endif() diff --git a/cmd/srv9p/static.h.gen b/cmd/srv9p/static.h.gen deleted file mode 100755 index a93419f..0000000 --- a/cmd/srv9p/static.h.gen +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# srv9p/static.h.gen - Generate C definitions for GNU `ld -r -b binary` files -# -# Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com> -# SPDX-License-Identifier: AGPL-3.0-or-later - -nm --format=posix "$@" | - sed -n -E \ - -e 's/(.*_(end|start)) D .*/extern char \1[];/p' \ - -e 's/(.*_size) A .*/extern size_t \1;/p' |