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

Maximum limit of stack size using flag -D__STACK_SIZE NRF52382

Hi,

I am running an application in which I set -D__STACK_SIZE=0x4000. After some research, I come to know that RAM is divided into 4 blocks the lower one is for the soft device and the final block is divided into two half one heap section one stack section. By keeping Heap section to zero I am able to use the whole block for the stack. My Question is what is the maximum limit which is permissible.If I want to use 2 blocks of RAM as stack size can it be done using -D__STACK_SIZE=0x8000

And is stack size defines how much Ram is in use?.Apart from that, any other parameter.

Thanks.

Parents
  • Hi Prashant,

    I am assuming that you referring to the portioning of the RAM shown below, when you say that RAM is divided in to four blocks.

    image description

    The maximum limit that __STACK_SIZE can be set to will depend on how much RAM the application needs, but the absolute limit, i.e. if the application does not use RAM will be 0x20000000 + - APP_RAM_BASE. Usually, that is not the case, so you'll have to take a look in the .map file to find out how much RAM the application uses and then adjust the stack size accordingly. If you get linker error when compiling then you know that the stack is to large and you will have to reduce the size until it successfully compiles and then use the .map file as mentioned above.

    If you do not define__STACK_SIZE, then it is usually set to 8192 bytes, see the gcc_startup_nrf52.S file in components\toolchain\gcc\

    Bjørn

Reply Children
No Data
Related