Skip to content

Conversation

@keith-packard
Copy link

This series allows these tests to be built using picolibc.

The first patch adds a stub for _exit so that code can use assert(0) when compiled against picolibc.

The other two patches avoid compiler warnings (which become errors when built under twister).

When assert is used, picolibc will eventually call _exit. Provide
a stub for that which spins to cause failing test cases to timeout.

Signed-off-by: Keith Packard <keithp@keithp.com>
The compiler need not assume that the only valid values
for err are those defined in the enum, so it may think
that the function falls off the end. Add an assert(0)
to cause the test to fail if that actually happens.

The compiler can still validate that all enum values are present in
the switch statement, providing the desired diagnostic at compile
time.

Signed-off-by: Keith Packard <keithp@keithp.com>
When built with -DNDEBUG, the assert in char_to_uint8_t will be
disabled causing the function will fall off the end and generating a
compiler message. Undefine NDEBUG defined before including
<assert.h> to make sure assert is active in this file.

Signed-off-by: Keith Packard <keithp@keithp.com>
keith-packard added a commit to keith-packard/zephyr that referenced this pull request Dec 4, 2025
This module also needs some small changes to build with picolibc.

This has not been merged to the Zephyr tf-m-tests repository yet,
that PR is:

zephyrproject-rtos/tf-m-tests#17

Signed-off-by: Keith Packard <keithp@keithp.com>
Copy link
Collaborator

@tomi-font tomi-font left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same drill here, please base your PR on zephyr_tf-m-tests_v2.2.2 and follow the same commit guidelines.
Besides, could those changes be sent upstream?

@stephanosio stephanosio deleted the branch zephyrproject-rtos:main December 4, 2025 12:36
@stephanosio stephanosio closed this Dec 4, 2025
@keith-packard
Copy link
Author

keith-packard commented Dec 4, 2025

The two non-picolibc changes were already in the 2.2.2 branch, so they weren't needed. That leaves only the picolibc stubs; those are not suitable for upstream as upstream is moving away from using libc at all.

I've re-submitted that change as #18 and tagged it with [zep noup] indicating that it should be considered a temporary zephyr-only fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants