LPC11U68 User Manual says: "IAP commands, which result in a flash write/erase operation, use 32 bytes of space in the top portion of the on-chip RAM for execution. The user program should not use this space if IAP flash programming is permitted in the application."
There are three areas of RAM on this chip. I am assuming that they are talking about SRAM0 (correct?)
The Linker Script for the LPCXpresso IAP/Flash example "periph_flashiap_flashsig_Debug.ld" places the stack at the very top of SRAM0 (I see no definition for "__user_stack_top" in the project):
PROVIDE(_vStackTop = DEFINED(__user_stack_top) ? __user_stack_top : __top_Ram0_32 - 0);
__top_Ram0_32 = 0x10000000 + 0x8000; // From "periph_flashiap_flashsig_Debug_mem.ld"
But the excerpt from the User Manual suggests to me that when using IAP to write Flash, the linker script should actually be modified to place the stack below the top 32 bytes, leaving those bytes for IAP, so it would need to be:
PROVIDE(_vStackTop = DEFINED(__user_stack_top) ? __user_stack_top : __top_Ram0_32 - 32);
I have seen no guidance regarding modifying the default linker scripts when using IAP, and the example project itself does not seem to take this into account when assigning the value for the top of the stack, so I'm confused about what's needed.
I intend to write Flash using IAP. Can I use the default linker script as provided in the example code, or does it actually need to be modified as I proposed above?
I want to avoid stack corruption crashes - can anyone please comment on this?