drivers: sensor: migrate simulated sensors to DEVICE_API - #30
Closed
kapi-no wants to merge 3 commits into
Closed
Conversation
Skip Zephyr tests that fail in NCS CI after the upmerge until the underlying issues are resolved. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Update python packages. Add PYSEC-2026-3447 to pip whitelist. Setuptools cannot be updated atm due to conflict with spsdk package Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no> Signed-off-by: Jan Gałda <jan.galda@nordicsemi.no>
Upstream Zephyr moved device API structs into per-class iterable linker sections and made the sensor accessors resolve the API through DEVICE_API_GET(sensor, dev). With CONFIG_DEVICE_API_ASSERT enabled (default when CONFIG_ASSERT=y) this asserts that dev->api points inside the _sensor_driver_api section, otherwise it fails at runtime with "device API is not sensor". The Nordic sensor_sim and sensor_stub drivers still declared their API as a plain "static const struct sensor_driver_api", so the struct was not placed in that section and the assert fired the first time the CAF sensor manager called sensor_sample_fetch(). This broke the caf_sensor_manager.core test (sensor_sim) and the caf_sensor_manager sample (sensor_stub) on qemu_cortex_m3 after the upmerge. Declared both driver APIs with DEVICE_API(sensor, ...), matching the idiom used by all upstream sensor drivers, so the API lands in the _sensor_driver_api iterable section and passes the runtime check. Ref: NCSDK-40421 Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
mkapala-nordic
approved these changes
Jul 20, 2026
Author
|
Ready for integrating into the upmerge branch. |
Owner
|
Cherry-picked into the upmerge branch, thanks |
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.
Upstream Zephyr moved device API structs into per-class iterable linker sections and made the sensor accessors resolve the API through DEVICE_API_GET(sensor, dev). With CONFIG_DEVICE_API_ASSERT enabled (default when CONFIG_ASSERT=y) this asserts that dev->api points inside the _sensor_driver_api section, otherwise it fails at runtime with "device API is not sensor".
The Nordic sensor_sim and sensor_stub drivers still declared their API as a plain "static const struct sensor_driver_api", so the struct was not placed in that section and the assert fired the first time the CAF sensor manager called sensor_sample_fetch(). This broke the caf_sensor_manager.core test (sensor_sim) and the caf_sensor_manager sample (sensor_stub) on qemu_cortex_m3 after the upmerge.
Declared both driver APIs with DEVICE_API(sensor, ...), matching the idiom used by all upstream sensor drivers, so the API lands in the _sensor_driver_api iterable section and passes the runtime check.
Ref: NCSDK-40421