I've tried a trivial example (blinky-like, compiled by gcc using proper startup and ld scripts) on nRF52 devkit, but I always only get hard fault.
Debugging through the reset handler, I have found the ResetHandler calls into SystemInit which goes through few ftpan_'s, but fault on return.
I have realized it's because the return addres, written to stack, reads back as zero and further investigation revealed that the whole second half of memory doesn't work - ignores writes, or at least reads as zero.
After I updated my linker script to only use 32kB of RAM (so the stack got into the lower half of 64kB array), it started working.
Is there any known issue regarding RAM that would render half of the memory inoperable?
I have verified all my memory was turned on:
40000900 = 0000FFFF 00000000 00000000 00000000
40000910 = 0000FFFF 00000000 00000000 00000000
40000920 = 0000FFFF 00000000 00000000 00000000
40000930 = 0000FFFF 00000000 00000000 00000000
40000940 = 0000FFFF 00000000 00000000 00000000
40000950 = 0000FFFF 00000000 00000000 00000000
40000960 = 0000FFFF 00000000 00000000 00000000
40000970 = 0000FFFF 00000000 00000000 00000000
but only first 32kB work for me....
This is an errata entry for the nRF52-series at this moment:
Code and data RAM shall ideally be mirrored (up to 64K), but instead it's one 32k block located at each address-start.
Ah, now I fully understand that errata 34.
Do you have a linker script handy that would let the linker use both and pick the placement automatically?
Or perhaps this is a good incentive to play more with code in RAM, for faster execution and lower power anyway, any template for this?