external_zblue/tests/kernel/fatal/exception
Robin Kastberg 8379abe04e arm: tests: kernel: fix bug in fatal_exception test
In ARM architectures the entry_cpu_exception_extend calls
svc #0 when trying to generate a `K_ERR_CPU_EXCEPTION`, however
z_arm_svc calls z_do_oops with a stack frame only, and gets the
reason from `r0`. This means that the test working was just lucky
and running it with another compiler (or setting the value of r0
before the svc #0 call, made the test fail).

Cortex-A/R 32-bit architectures was doing a BKPT, this works better
but will not be a hard exception when debugger is attached.

I switched all the Cortex 32-bits to the ARM specified undefined
instruction.

Also RISC-V has a designated unimp instruction that should be used to
guarantee trap.

Signed-off-by: Robin Kastberg <robin.kastberg@iar.com>
2026-04-20 17:55:43 +08:00
..
boards samples: tests: bluetooth: Add support for frdm_rw612 2026-04-20 17:23:48 +08:00
src arm: tests: kernel: fix bug in fatal_exception test 2026-04-20 17:55:43 +08:00
CMakeLists.txt
README
prj.conf tests: remove CONFIG_ZTEST_NEW_API in all tests 2026-04-20 16:44:15 +08:00
prj_arm_fpu_sharing.conf tests: remove CONFIG_ZTEST_NEW_API in all tests 2026-04-20 16:44:15 +08:00
prj_armv8m_mpu_stack_guard.conf tests: remove CONFIG_ZTEST_NEW_API in all tests 2026-04-20 16:44:15 +08:00
protection_no_userspace.conf tests: remove CONFIG_ZTEST_NEW_API in all tests 2026-04-20 16:44:15 +08:00
sentinel.conf tests: remove CONFIG_ZTEST_NEW_API in all tests 2026-04-20 16:44:15 +08:00
testcase.yaml tests: kernel.common.stack_sentinel: re-enable some platforms 2026-04-20 17:44:03 +08:00

README

This test case verifies that kernel fatal error handling works correctly.

If a thread causes a CPU exception, and it is not in an ISR or "essential"
thread, the thread gets aborted and the rest of the system executes normally.