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

How to set stack size in NRF5340

Hi,
 
We are writing an application for nrf5340 similar to rpmsg sample with zephyr.
We see that the application encounters stack overflow issue when flashed on target.
We tried to increase the stack using CONFIG_MPSL_SIGNAL_STACK_SIZE in prj.conf to a value as high as 8kB. We also tried increasing CONFIG_MAIN_STACK_SIZE.
However, we were still encountering stack overflow error. However, avoiding a variable of around 400bytes in main() seemed to solve the issue. So, the above setting does not seem to help.
So, can you let me know how can the stack size be altered for app core applications on nrf5340? Also what is the default stack size?
 
Regards,
Divya
Parents Reply Children
  • Hi Håkon Holdhus,

    We were able to figure out this. Changing CONFIG_MAIN_STACK_SIZE and reloading the project helped. 

    However, I am facing malloc() issue. malloc() would return NULL. On setting 

    CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE, malloc() started to return non-NULL values. However, accessing this memory is creating data access violation error on nrf5340. Any help on this will be helpful.
    Regards,
    Divya
Related