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

Stack overflow

Hello,

I have been running this program without any problem then I added some code to read and write to flash using NVS when the error shown below appeared.

I am running a single ( main() ) thread application in Segger Embedded Studio v5.34a.

*** Booting Zephyr OS build v2.4.99-ncs1-rc1 ***
[00:00:13.434,600] [1;31m<err> os: ***** USAGE FAULT *****
[00:00:13.434,600] [1;31m<err> os: Stack overflow (context area not valid)
[00:00:13.434,600] [1;31m<err> os: r0/a1: 0x00000000 r1/a2: 0x0000cbfd r2/a3: 0x00000000
[00:00:13.434,600] [1;31m<err> os: r3/a4: 0x0000cbfd r12/ip: 0x207bc4ae r14/lr: 0x77fadffe
[00:00:13.434,600] [1;31m<err> os: xpsr: 0xfdd9ca00
[00:00:13.434,600] [1;31m<err> os: Faulting instruction address (r15/pc): 0x05221210
[00:00:13.434,631] [1;31m<err> os: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
[00:00:13.434,631] [1;31m<err> os: Current thread: 0x20000668 (unknown)
[00:00:13.696,472] [1;31m<err> fatal_error: Resetting system

If I the solution is to increase the stack size, how do I do it?

Can someone please help?

Kind regards

Mohamed

Parents Reply
  • Hi Simon,

    I increased the stack size to 8192 in prj.conf

    CONFIG_MAIN_STACK_SIZE=8192

    But I am still seeing this error upon entering main and before executing any of the application instructions.

    In the SES debugger, the yellow arrow points to the first curly bracket  '{' in main(). I then click Go (F5) to move the cursor to the first instruction in main() then the error appears.

    *** Booting Zephyr OS build v2.4.99-ncs1-rc1 ***
    [00:00:41.795,043] <err> os: ***** USAGE FAULT *****
    [00:00:41.795,043] <err> os: Stack overflow (context area not valid)
    [00:00:41.795,043] <err> os: r0/a1: 0x245bc4ae r1/a2: 0x77fb5ffe r2/a3: 0x05821210
    [00:00:41.795,074] <err> os: r3/a4: 0xbdd9cba6 r12/ip: 0x0405a049 r14/lr: 0x77faebb6
    [00:00:41.795,074] <err> os: xpsr: 0x9ed6fa00
    [00:00:41.795,074] <err> os: Faulting instruction address (r15/pc): 0x00aec010
    [00:00:41.795,074] <err> os: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
    [00:00:41.795,074] <err> os: Current thread: 0x20000668 (unknown)
    [00:00:42.056,854] <err> fatal_error: Resetting system

    It looks like something is going before main() starts running.

    Please help.

    Kind regards

    Mohamed

Children
No Data
Related