How are the four RAM banks divided up in the nRF51822? Is it an even split of the 16K total RAM (i.e. 4K per block)?
Furthermore, can I expect strange results if I turn on RAM-retention for the 8K of RAM the SoftDevice uses?
Thanks :)
How are the four RAM banks divided up in the nRF51822? Is it an even split of the 16K total RAM (i.e. 4K per block)?
Furthermore, can I expect strange results if I turn on RAM-retention for the 8K of RAM the SoftDevice uses?
Thanks :)
The size of the RAM blocks are given in section 3.2.2 in the PS.
I don't believe anything strange should happen if you enable RAM retention with the S110, but I'm not sure whether it has been tested or not.
It should be noted that you may need to take some care to avoid the RAM being zeroed on startup.
Such care will be toolchain specific, but this thread on Keil's forums contains some tips on how to do it with Keil:
RW_RTCRAM 0xE0084000 UNINIT 0x000007FF
{
main.o (rtc_ram)
}
Edit 1: Added info on how to avoid initialization. Edit 2: It seems that marking a section of the memory as NoInit in Keil's target options should also do the trick, according to this question.
Thanks. Looks like the RAM might be getting cleared at startup though as you mentioned. Any idea what would be the typical cause? (something in the startup file I assume?)
Thanks again.
Exactly how to do this will depend on toolchain used. I've edited my answer to provide a little more info.
Thanks for the hints. Unfortunately I am not using Keil but instead gcc-arm.
This is how you do it for GCC for those who are interested:
1. Add the following to the linker script (in SECTIONS, before bss):
.noinit (NOLOAD) :
{
*(.noinit*)
} > RAM
2. In your source code for each variable you want retained:
static uint8_t varName __attribute__ ((section(".noinit")));
That's it! Working perfectly :)