Hi all,
this is not a question per se but rather a warning to those who are attempting to debug Flash related operations with the SEGGER J-Link GDB Server (v4.84a for Linux).
I implemented a simple bootloader for the nRF51822, which uses Flash erase to erase the old application and overwrite it with a new one. I encountered a strange issue, where the erase operations did not erase the ROM pages, even though I had no memory protection active. Even reading the ROM contents to a variable in the debugger showed that the memory was not erased.
After quite a bit of debugging, I realised that the source of the problem was the Segger JLink GDB server, which assumes that it is safe to cache the programmed HEX file and use its contents when handling memory accesses to the memory range of the HEX file instead of reading the actual ROM contents.
I'm not the first one to encounter this, see forum.segger.com/index.php
I have not found a way to disable this behaviour on the Linux version of the GDB server.
Best regards, Lasse