Enabling CONFIG_USE_SWITCH=y causes usage fault

Enabling CONFIG_USE_SWITCH=y causes usage fault on nRF54L15 with nRF Connect SDK v3.4.0-rc1.

Where it crashes: Context switch on interrupt exit, Zephyr arm-m-switch.c: arm_m_exc_exit()  arm_m_must_switch()  arm_m_do_switch()  arm_m_cpu_to_switch() / fpu_cs_copy() (~line 367).

SDK: nRF Connect SDK v3.4.0-rc1

Config: CONFIG_USE_SWITCH=y, CONFIG_FPU=y, CONFIG_FPU_SHARING=y, CONFIG_BUILTIN_STACK_GUARD=y, hard-float ABI.

Parents
  • Hello,

    I was able to reproduce the same fault using the Philosophers sample with the same config setting you listed. I also found that the fault did not trigger if I changed the optimisation level from -Os (default) to -Og. 

    Crash log after enabling CONFIG_LOG:

    [00:00:00.013,213] <err> os: ***** USAGE FAULT *****
    [00:00:00.013,220] <err> os:   Illegal use of the EPSR
    [00:00:00.013,227] <err> os:   Attempt to execute undefined instruction
    [00:00:00.013,243] <err> os: r0/a1:  0x00000000  r1/a2:  0x00000000  r2/a3:  0x01000000
    [00:00:00.013,252] <err> os: r3/a4:  0x20001148 r12/ip:  0x00000000 r14/lr:  0x00003959
    [00:00:00.013,259] <err> os:  xpsr:  0x01002200
    [00:00:00.013,273] <err> os: s[ 0]:  0x00000000  s[ 1]:  0x00000000  s[ 2]:  0x01002200  s[ 3]:  0x00000000
    [00:00:00.013,286] <err> os: s[ 4]:  0x00000000  s[ 5]:  0x01000000  s[ 6]:  0x20001148  s[ 7]:  0x20004644
    [00:00:00.013,298] <err> os: s[ 8]:  0x20000e68  s[ 9]:  0x00000000  s[10]:  0x00000000  s[11]:  0x00000002
    [00:00:00.013,311] <err> os: s[12]:  0xffffffff  s[13]:  0x00000000  s[14]:  0x00000010  s[15]:  0x00000000
    [00:00:00.013,318] <err> os: fpscr:  0x00003959
    [00:00:00.013,325] <err> os: Faulting instruction address (r15/pc): 0x00000000
    [00:00:00.013,345] <err> os: >>> ZEPHYR FATAL ERROR 36: Unknown error on CPU 0
    [00:00:00.013,367] <err> os: Current thread: 0x200007c0 (logging)
    [00:00:00.142,768] <err> os: Halting system

    I see the issue has already been raised upstream here: https://github.com/zephyrproject-rtos/zephyr/issues/105320 and I think the best we can do for now is to way for the maintainers to investigate it. 

    Best regards,

    Vidar 

Reply
  • Hello,

    I was able to reproduce the same fault using the Philosophers sample with the same config setting you listed. I also found that the fault did not trigger if I changed the optimisation level from -Os (default) to -Og. 

    Crash log after enabling CONFIG_LOG:

    [00:00:00.013,213] <err> os: ***** USAGE FAULT *****
    [00:00:00.013,220] <err> os:   Illegal use of the EPSR
    [00:00:00.013,227] <err> os:   Attempt to execute undefined instruction
    [00:00:00.013,243] <err> os: r0/a1:  0x00000000  r1/a2:  0x00000000  r2/a3:  0x01000000
    [00:00:00.013,252] <err> os: r3/a4:  0x20001148 r12/ip:  0x00000000 r14/lr:  0x00003959
    [00:00:00.013,259] <err> os:  xpsr:  0x01002200
    [00:00:00.013,273] <err> os: s[ 0]:  0x00000000  s[ 1]:  0x00000000  s[ 2]:  0x01002200  s[ 3]:  0x00000000
    [00:00:00.013,286] <err> os: s[ 4]:  0x00000000  s[ 5]:  0x01000000  s[ 6]:  0x20001148  s[ 7]:  0x20004644
    [00:00:00.013,298] <err> os: s[ 8]:  0x20000e68  s[ 9]:  0x00000000  s[10]:  0x00000000  s[11]:  0x00000002
    [00:00:00.013,311] <err> os: s[12]:  0xffffffff  s[13]:  0x00000000  s[14]:  0x00000010  s[15]:  0x00000000
    [00:00:00.013,318] <err> os: fpscr:  0x00003959
    [00:00:00.013,325] <err> os: Faulting instruction address (r15/pc): 0x00000000
    [00:00:00.013,345] <err> os: >>> ZEPHYR FATAL ERROR 36: Unknown error on CPU 0
    [00:00:00.013,367] <err> os: Current thread: 0x200007c0 (logging)
    [00:00:00.142,768] <err> os: Halting system

    I see the issue has already been raised upstream here: https://github.com/zephyrproject-rtos/zephyr/issues/105320 and I think the best we can do for now is to way for the maintainers to investigate it. 

    Best regards,

    Vidar 

Children
No Data
Related