zephyr: Interrupts on Cortex-M do not work with CONFIG_MULTITHREADING=n
Describe the bug
When CONFIG_MULTITHREADING=n then interrupts are initially disabled (see bug #8393) when they are enabled then usage fault happens immediately (seems that it happens during returning from interrupt).
To Reproduce Steps to reproduce the behavior:
- modify hello_world:
void main(void)
{
/* enable interrupts */
irq_unlock(0);
printk("Hello World! %s\n", CONFIG_BOARD);
/* wait for interrupt coming from LF clock being started. */
k_busy_wait(1000000);
}
prj.conf:
CONFIG_MULTITHREADING=n
CONFIG_LOG=y
- buid and run. I used nrf52840dk_nrf52840 board
- See error
*** Booting Zephyr OS build zephyr-v2.3.0-979-ga043d48c5472 ***
[00:00:02.426,116] <err> os: ***** USAGE FAULT *****
[00:00:02.426,116] <err> os: Illegal load of EXC_RETURN into PC
[00:00:02.426,116] <err> os: r0/a1: 0x00000004 r1/a2: 0x00000001 r2/a3: 0x00000001
[00:00:02.426,116] <err> os: r3/a4: 0x00000000 r12/ip: 0x00000020 r14/lr: 0x000029db
[00:00:02.426,116] <err> os: xpsr: 0x00000000
[00:00:02.426,147] <err> os: Faulting instruction address (r15/pc): 0xe000ed00
[00:00:02.426,147] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
[00:00:02.426,147] <err> os: Current thread: 0x00000000 (unknown)
[00:00:03.378,143] <err> os: Halting system
Expected behavior No error should appear.
Impact Interrupts cannot be used when multithreading is off. User cannot use any driver (even out of tree which does not use kernel synchronization apis).
Environment (please complete the following information):
- Commit a043d48c54726082521f3e335d807dc649cc02f3
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 21 (11 by maintainers)
@anangl thanks for the study you did - itโs half of the work already ๐
Note that #26372 was probably failing because of that, too (apart from kernel API usage).