diff --git a/frontends/coap/CMakeLists.txt b/frontends/coap/CMakeLists.txt index 08b7abd..e18da5f 100644 --- a/frontends/coap/CMakeLists.txt +++ b/frontends/coap/CMakeLists.txt @@ -7,4 +7,14 @@ if(CONFIG_ZEPHLETS_COAP) zephlet_coap_uri.c ) zephyr_include_directories(include) + + # `COAP_SERVICE_DEFINE(zlet_coap_service, ...)` plus each codegen-emitted + # `COAP_RESOURCE_DEFINE(_coap_resource, zlet_coap_service, ...)` + # produces references to `_coap_resource_zlet_coap_service_list_{start,end}`. + # Declare the matching iterable section here so consuming apps don't need + # to replicate the linker glue. + zephyr_linker_sources(DATA_SECTIONS sections-ram.ld) + zephyr_iterable_section( + NAME coap_resource_zlet_coap_service + GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT}) endif() diff --git a/tests/coap_functional/sections-ram.ld b/frontends/coap/sections-ram.ld similarity index 100% rename from tests/coap_functional/sections-ram.ld rename to frontends/coap/sections-ram.ld diff --git a/tests/coap_functional/CMakeLists.txt b/tests/coap_functional/CMakeLists.txt index 63f2b4b..6d5aff9 100644 --- a/tests/coap_functional/CMakeLists.txt +++ b/tests/coap_functional/CMakeLists.txt @@ -29,12 +29,3 @@ zephyr_nanopb_sources(app ${LOCAL_PROTO_FILES_LIST}) set(CMAKE_CURRENT_SOURCE_DIR ${_saved_csd}) target_sources(app PRIVATE src/main.c) - -# `COAP_SERVICE_DEFINE(zlet_coap_service, ...)` declares an iterable -# section named `coap_resource_zlet_coap_service`. The test app owns -# the linker-side registration: sections-ram.ld covers the pre-link -# pass, zephyr_iterable_section covers the CMake linker generator path. -zephyr_linker_sources(DATA_SECTIONS sections-ram.ld) -zephyr_iterable_section( - NAME coap_resource_zlet_coap_service - GROUP DATA_REGION ${XIP_ALIGN_WITH_INPUT})