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
  • Hi Divya

    The minimum size of CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE is 16 while the number of blocks is 1. The configuration for k_malloc seems to be the same. It appears that in order to get a 32kB heap, the CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE must be set to 32kB, assuming that the block can be split in any way. You should also double-check that CONFIG_MINIMAL_LIBC=y;

    Best regards,

    Simon

Reply
  • Hi Divya

    The minimum size of CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE is 16 while the number of blocks is 1. The configuration for k_malloc seems to be the same. It appears that in order to get a 32kB heap, the CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE must be set to 32kB, assuming that the block can be split in any way. You should also double-check that CONFIG_MINIMAL_LIBC=y;

    Best regards,

    Simon

Children
No Data
Related