Repository navigation
Conversation
lgirdwood
force-pushed
the
topic/zn-rtos-assert-shared
branch
2 times, most recently
from
December 4, 2026 13:08
b1333f3 to
8edd6d5
Compare
Member
Author
|
Intention is that user modules should use posix style assert macros, but kernel modules or code should use native zephyr. Pls check and rework the PR. |
On Zephyr, rtos/panic.h includes <zephyr/kernel.h>, so code that includes it for assert() also gets __ASSERT() and __ASSERT_NO_MSG(). Include the <zephyr/sys/__assert.h> stub from the host rtos/panic.h, so that the kernel code that is also built for the host can use the Zephyr macros without new includes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Kernel code uses the native Zephyr API, while user code, such as the audio modules, keeps the POSIX assert() so that it can be shared with POSIX programs. The kernel-only code that the Zephyr builds alone compile already uses __ASSERT_NO_MSG(). Convert the remaining kernel code, which is also built for the host: the IPC handlers, the IPC3 DAI code, the IPC4 notifications and the dummy DMA driver. The host provides the Zephyr assert macros through rtos/panic.h. On Zephyr, assert() is defined as __ASSERT_NO_MSG(). No lines are added or removed, so __LINE__ in verbose asserts does not change. No functional change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
lgirdwood
force-pushed
the
topic/zn-rtos-assert-shared
branch
from
December 5, 2026 12:09
8edd6d5 to
4d4fc69
Compare
Member
Author
|
Reworked in 4d4fc69: only the kernel code is converted now (9 sites in the IPC handlers, the IPC3 DAI code, the IPC4 notifications and the dummy DMA driver), and the user code keeps the POSIX |
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.
Use the Zephyr
__ASSERT_NO_MSG()instead ofassert()in the kernel code that is also built for the host. Part of #11517 (step 6).Reworked after review: kernel code uses the native Zephyr API, while user code, such as the audio modules, keeps the POSIX
assert()so that it can be shared with POSIX programs. The earlier version of this PR also converted the user code; that part is dropped.Patches
posix: the hostrtos/panic.hincludes the<zephyr/sys/__assert.h>stub, asrtos/panic.hgets the Zephyr macros through<zephyr/kernel.h>on Zephyr. The kernel code that is also built for the host then needs no new includes.kernel:assert()→__ASSERT_NO_MSG()in the remaining kernel code (9 sites): the IPC handlers (ipc-common-kernel.c, IPC3handler.c, IPC4handler-kernel.c), the IPC3 DAI code, the IPC4 notifications and the dummy DMA driver. No lines are added or removed, so__LINE__in verbose asserts does not change. The kernel-only code that only the Zephyr builds compile was converted in zephyr: use the Zephyr assert and panic macros in kernel-only code #11572.Not in this PR
User code (
src/audio,src/ipc,src/lib,src/module,src/samplesand the shared headers insrc/include) keepsassert().Functional change
None on Zephyr, where
assert()is defined as__ASSERT_NO_MSG(). On the host, these kernel asserts always end in the SOF panic.Testing
Tested together with #11598 on main 73a7797:
host-testbench.sh) pass all 19 component tests.🤖 Generated with Claude Code