zephyr: arch.interrupt: fails on NXP Cortex-M0+ platforms

Describe the bug test_isr_offload_job_multiple cause hard fault

To Reproduce Steps to reproduce the behavior:

  1. cd tests/kernel/interrupt ;mkdir build; cd build
  2. cmake -DBOARD=frdm_kl25z …
  3. make falsh
  4. See error

Expected behavior Test pass

Impact interrupt handle

Logs and console output

   *** Booting Zephyr OS build zephyr-v2.5.0-3761-g730acbd6ed85  ***

    Running test suite interrupt_feature

    ===================================================================

    START - test_isr_dynamic

    installing dynamic ISR for IRQ 0

     PASS - test_isr_dynamic in 0.3 seconds

    ===================================================================

    START - test_nested_isr

    Triggering irq : 29

    isr0: Enter

    Triggering irq : 28

    isr1: Enter

    isr1: Leave

    isr0: Leave

     PASS - test_nested_isr in 0.19 seconds

    ===================================================================

    START - test_prevent_interruption

    locking interrupts

    unlocking interrupts

    timer fired

     PASS - test_prevent_interruption in 2.5 seconds

    ===================================================================

    START - test_isr_regular

     SKIP - test_isr_regular in 0.1 seconds

    ===================================================================

    START - test_isr_offload_job_multiple

    case 0

    case 0

    

    ASSERTION FAIL [work->queue != ((void *)0)] @ WEST_TOPDIR/zephyr/kernel/work.c:334

    E: ***** HARD FAULT *****

    E: ARCH_EXCEPT with reason 4

    

    E: r0/a1:  0x00000004  r1/a2:  0x0000014e  r2/a3:  0x00006e75

    E: r3/a4:  0x00003879 r12/ip:  0x00000000 r14/lr:  0x00003883

    E:  xpsr:  0x0100000b

    E: Faulting instruction address (r15/pc): 0x00005720

    E: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0

    E: Fault during interrupt handling

    

    E: Current thread: 0x1ffff480 (ztest_thread)

    E: Halting system

Environment (please complete the following information):

  • OS: (e.g. Linux)
  • Toolchain (e.g Zephyr SDK, …)
  • Commit SHA or Version used: v2.6.0-rc1

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 19 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Hi, @hakehuang @erwango Yes, it is not relative to #35061.

And this test case is supported by using the irq_offload() to trigger the SW interrupt, it is tested. According to the error msg, it seems like when trying to offload job to a k_work by calling k_work_submit_to_queue(). But the first parameter &wq_queue(a global variable) is NULL in the ISR handler.

Please let me see if I can have a frdm_kl25z board to reproduce this and figure this out, thanks.

Great, @MaureenHelm , this information helps. Could you please help to try whether this change also works when you got a change? thank you so much!

diff --git a/tests/kernel/interrupt/src/interrupt_offload.c b/tests/kernel/interrupt/src/interrupt_offload.c
index d00a6167c5..4dbc48ee97 100644
--- a/tests/kernel/interrupt/src/interrupt_offload.c
+++ b/tests/kernel/interrupt/src/interrupt_offload.c
@@ -200,6 +200,7 @@ static void run_test_offload(int case_type, int real_irq)
                        "offload job done, the original thread run");

        k_thread_abort(tid);
+       k_thread_join(tid, K_FOREVER);
 }

 /**

This change does not work

The same problem (same assert failed, followed by a HardFault) occurs on some STM32 boards:

  • nucleo_f091rc (cortex M0)
  • nucleo_l073 (cortex M0+)
  • nucleo_l152re (cortex M3)

But it is passed on other boards including nucleo_f103rb (cortex M3) and nucleo_g071rb (cortex M0+)