Our application needs to preserve a block of RAM memory across software reset. This requires selecting an area which the boot ROM will not overwrite during the reset.
Which areas of RAM are guaranteed to not to be overwritten by any previous of future versions of the LPC804 boot ROM? I am only interested in normal reset and IAP programming, ISP mode is not required.
The user manual defines the memory usage of the bootloader in the sections quoted below and I had interpreted the text as the boot ROM using 0x1000 0128 - 0x1000 03A7 and 0x1000 0FE0 - 0x1000 0FFF only.
We have recently encountered a problem with memory outside of these ranges being overwritten on reset. Debugging shows that version 13.1 of the boot ROM places its initial stack at the end of RAM and adopting a lower stack only on entering ISP mode. This ends up overwriting the top 44 bytes (0x1000 0FD4 - 0x1000 0FFB) during a normal startup.
Our earlier testing may have used a different ROM version using less stack space. I am have not been able to confirm this, however it leaves me reluctant to relocate the memory usage of our application without a well-defined memory usage specification.
Thank you in advance for your support.
Regards,
Johan
Excerpt from UM11065 rev 1.3 (pages 15, 21 and 34):
3.5.1 Memory map after any reset
The boot ROM block is 8 KB in size. The boot block is located in the memory region starting from address 0x0F00 0000. The bootloader is designed to run from this memory area, but both the ISP and IAP software use parts of the on-chip RAM. The RAM usage is described in Section 4.3.7 “ISP interrupt and SRAM use”. The interrupt vectors residing in the boot block of the on-chip flash memory also become active after reset, that is, the bottom 512 bytes of the boot block are also visible in the memory region starting from the address 0x0000 0000.
...
4.3.7 ISP interrupt and SRAM use
...
4.3.7.2 RAM used by ISP command handlers
The stack of UART ISP commands is located at address 0x1000 03A8. The maximum
stack usage is 640 bytes (0x280) and grows downwards.
The ISP flash programming commands use the top 4 bytes of on-chip RAM.
4.3.7.3 RAM used by IAP command handlers
The IAP flash programming commands use the top 4 bytes of on-chip RAM.
...
4.6 IAP commands
The flash memory is not accessible during a write or erase operation. IAP commands,
which results 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 be use this space if IAP flash
programming is permitted in the application.