I have an in memory log variable that I write to on various BLE and device manager events. If there is ever a serious error, my implementation of app_error_handler() now takes that in memory log and writes it to the flash using the pstorage module. I use a single pstorage block of size 1024 bytes, so my base handle is also my one and only block handle.
When I inspect the variable for my block handle in gdb, I see this:
(gdb) print pstorage_handle
$1 = {module_id = 1, block_id = 260096}
How do I get from a block ID to a memory address?
My goal is to be able to read the flash memory back to the host machine using gdb or using the Segger JLink commander. I might end up with a makefile target such as this:
readmem: readmem.jlink
$(JLINK) readmem.jlink
readmem.jlink:
echo "r\nmem32 0x000000002000239c 0x1\nr\nexit\n" > readmem.jlink