This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

z_arm_exc_spurious

Hi.
I use NCS SDK 1.5.1 with NRF5340.

I took the project from: \zephyr\samples\portability\cmsis_rtos_v2\philosophers\ as base and try to add two additional tasks.

Application works when:
1) Optimization for size and the the main has infinite loop with delay.

2) Optimizaion for size, the the main terminated but without 2 additional tasks (only example tasks).

In other cases I get z_arm_exc_spurious. This happens when optimization disabled (base example) or when main has not infinite loop.

How can I understand what is a reason?

Thanks.

Parents
  • Would you ble able to upload your modified sample in a zipped file? Then I can reproduce it myself and it's easier to investigate.

    Best regards,

    Simon

  • I can't reproduce the initial trouble. It started to work. I reinstall the SDK and upload the project. May be tried different Scheduler configuration.
    In any case, I get the z_arm_exc_spurious if I run the projects without optimization: Optimize nothing.
    For example, project \v1.5.1\zephyr\samples\portability\cmsis_rtos_v2 or the same project for SDK v1.4.99-dev1.

    When optimization for Size of Debugging, it works.

  • Setting CONFIG_IDLE_STACK_SIZE=2048 in the prj.conf file should resolve this issue.


    Explanation:

    I was able to reproduce this by setting CONFIG_NO_OPTIMIZATIONS=y, I also set these:

    CONFIG_LOG=y
    CONFIG_RESET_ON_FATAL_ERROR=n
    CONFIG_THREAD_NAME=y

    Which provided me with this log:

    *** Booting Zephyr OS build v2.4.99-ncs2  ***
    [1B][2J[1B][15;1HDemo Description
    ----------------
    An implementation of a solution to the Dining Philosophers
    problem (a classic multi-thread synchronization problem) using
    CMSIS RTOS V2 APIs. This particular implementation demonstrates the
    usage of multiple preemptible threads of differing
    priorities, as well as semaphores and thread sleeping.
    [00:00:00.570,739] [1B][1;31m<err> os: ***** USAGE FAULT *****[1B][0m
    [00:00:00.570,800] [1B][1;31m<err> os:   Stack overflow (context area not valid)[1B][0m
    [00:00:00.570,831] [1B][1;31m<err> os: r0/a1:  0x0000da2e  r1/a2:  0x41000200  r2/a3:  0xaaaaaaaa[1B][0m
    [00:00:00.570,831] [1B][1;31m<err> os: r3/a4:  0x20005f88 r12/ip:  0xaaaaaaaa r14/lr:  0x20001520[1B][0m
    [00:00:00.570,861] [1B][1;31m<err> os:  xpsr:  0xaaaaaa00[1B][0m
    [00:00:00.570,861] [1B][1;31m<err> os: Faulting instruction address (r15/pc): 0x00000000[1B][0m
    [00:00:00.570,892] [1B][1;31m<err> os: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0[1B][0m
    [00:00:00.570,922] [1B][1;31m<err> os: Current thread: 0x200015c8 (idle 00)[1B][0m
    [00:00:00.628,997] [1B][1;31m<err> os: Halting system[1B][0m
    

    As you can see, a stack overflow occured in the idle thread, and increasing CONFIG_IDLE_STACK_SIZE solves the problem.

    Best regards,

    Simon

Reply
  • Setting CONFIG_IDLE_STACK_SIZE=2048 in the prj.conf file should resolve this issue.


    Explanation:

    I was able to reproduce this by setting CONFIG_NO_OPTIMIZATIONS=y, I also set these:

    CONFIG_LOG=y
    CONFIG_RESET_ON_FATAL_ERROR=n
    CONFIG_THREAD_NAME=y

    Which provided me with this log:

    *** Booting Zephyr OS build v2.4.99-ncs2  ***
    [1B][2J[1B][15;1HDemo Description
    ----------------
    An implementation of a solution to the Dining Philosophers
    problem (a classic multi-thread synchronization problem) using
    CMSIS RTOS V2 APIs. This particular implementation demonstrates the
    usage of multiple preemptible threads of differing
    priorities, as well as semaphores and thread sleeping.
    [00:00:00.570,739] [1B][1;31m<err> os: ***** USAGE FAULT *****[1B][0m
    [00:00:00.570,800] [1B][1;31m<err> os:   Stack overflow (context area not valid)[1B][0m
    [00:00:00.570,831] [1B][1;31m<err> os: r0/a1:  0x0000da2e  r1/a2:  0x41000200  r2/a3:  0xaaaaaaaa[1B][0m
    [00:00:00.570,831] [1B][1;31m<err> os: r3/a4:  0x20005f88 r12/ip:  0xaaaaaaaa r14/lr:  0x20001520[1B][0m
    [00:00:00.570,861] [1B][1;31m<err> os:  xpsr:  0xaaaaaa00[1B][0m
    [00:00:00.570,861] [1B][1;31m<err> os: Faulting instruction address (r15/pc): 0x00000000[1B][0m
    [00:00:00.570,892] [1B][1;31m<err> os: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0[1B][0m
    [00:00:00.570,922] [1B][1;31m<err> os: Current thread: 0x200015c8 (idle 00)[1B][0m
    [00:00:00.628,997] [1B][1;31m<err> os: Halting system[1B][0m
    

    As you can see, a stack overflow occured in the idle thread, and increasing CONFIG_IDLE_STACK_SIZE solves the problem.

    Best regards,

    Simon

Children
No Data
Related