Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf52_common.ld StackLimit symbol

Hello,

I wanted to know why StackLimit is not defined using HeapLimit in nrf52_common.ld?

Given the fact that the HardFault handler (HardFault_Handler) is checking the value of the Stack Pointer, it seems better to maximize the Stack size, with addresses reaching the HeapLimit address.

    /* -----------------------------------------------------------------
     * If we have selected MSP check if we may use stack safetly.
     * If not - reset the stack to the initial value. */
    "   ldr   r1, =__StackTop                  \n"
    "   ldr   r2, =__StackLimit                \n"

    /* MSP is in the range of the stack area */
    "   cmp   r0, r1                           \n"
    "   bhi   HardFault_MoveSP                 \n"
    "   cmp   r0, r2                           \n"
    "   bhi   HardFault_Handler_Continue       \n"
    /* ----------------------------------------------------------------- */

Best,

Parents Reply Children
No Data
Related