fix(coap): declare coap_resource_zlet_coap_service iterable section in the infra#44
Merged
Merged
Conversation
`COAP_SERVICE_DEFINE(zlet_coap_service, ...)` in
zephlet_coap_frontend.c plus each codegen-emitted
`COAP_RESOURCE_DEFINE(<type>_coap_resource, zlet_coap_service, ...)`
produces references to `_coap_resource_zlet_coap_service_list_{start,end}`.
The infra never declared the matching ITERABLE_SECTION_RAM, so every
app that flips CONFIG_ZEPHLETS_COAP=y hit an undefined-reference link
error and had to replicate the test app's local linker glue.
Move the registration into `frontends/coap/CMakeLists.txt` under the
existing `if(CONFIG_ZEPHLETS_COAP)` block, plus a sibling
`sections-ram.ld` that declares the iterable section. Drop the now-
redundant local copies from tests/coap_functional/.
The infra-side declaration is single-source: an app that also adds
its own `zephyr_iterable_section(...)` for this name ends up with two
adjacent section ranges and broken resource lookup at runtime, so
consumers must rely solely on the infra-side registration.
Verified:
- `just docker-test` on native_sim/native/64: 35/35 cases pass.
- Consuming app (ports_adapters_zbus) links cleanly with no local
linker workaround and serves CoAP RPCs end-to-end via aiocoap and
libcoap coap-client.
Closes #42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
coap_resource_zlet_coap_serviceiterable-section declaration intofrontends/coap/so apps that enableCONFIG_ZEPHLETS_COAPjust work — no per-app linker boilerplate.tests/coap_functional/.Why
COAP_SERVICE_DEFINE(zlet_coap_service, ...)inzephlet_coap_frontend.cproduces references to_coap_resource_zlet_coap_service_list_{start,end}. Those symbols are only emitted when the consumer registersITERABLE_SECTION_RAM(coap_resource_zlet_coap_service, ...)via the Zephyr linker glue. The test app did this locally; the infra never did, so every other consumer hit:Discovered while wiring the
uizephlet's CoAP frontend into theports_adapters_zbusexample app. After this PR merges, the app gets a companion commit on main that opts UI into CoAP without any CMake glue.Test plan
just docker-testonnative_sim/native/64: 35/35 cases pass (coap_functional/{smoke,rpc}plus the rest).feat(ui,coap)queued locally) links and serves CoAP RPCs end-to-end from macOS via aiocoap and libcoapcoap-client.Note
The infra-side declaration is single-source. An app that also adds its own
zephyr_iterable_section(...)for this name ends up with two adjacent section ranges and broken resource lookup at runtime — verified during development. So once this lands, consumers must rely solely on the infra-side registration.Closes #42