This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Cannot acces upper 16K memory through GDB on nrf51

I have a BLE-Nano v1.5 board with 32KB of ram starting at address 0x20000000 (til 0x20008000). However when I want to read a byte of the uper 16K (0x2004000+), I get a 'cannot acces memory error'. The debugger is a MK20 usb board.

According to the following registers the MPU is disabled:

PERR0=0                                
RLENR0=1635459840                
PROTENSET0=0                  
PROTENSET1=0                                      
DISABLEINDEBUG=1                                 
PROTBLOCKSIZE=0

Information about ram in the FICR registers confirm the specs of my board:

NUMRAMBLOCK=4
SIZERAMBLOCKS=8192

The rams are also powered:

RAMON=3
RAMONB=3
RAMSTATUS=15

When I add the following lines to my code:

uint32_t k=*((uint32_t volatile*)0x20003ffc);                                                     │
uint32_t j=*((uint32_t volatile*)0x20004000); 

I can both acces k and j as expected:

(gdb) p k
$1 = 49439
(gdb) p j
$2 = 3738084845
(gdb) p &k
$3 = (uint32_t *) 0x20003f98
(gdb) p &j
$4 = (uint32_t *) 0x20003f94

Because both are located in the lower section

This happens when I want to read those addresses directly through gdb:

(gdb) x /d 0x20003ffc
0x20003ffc:     49439
(gdb) x /d 0x20004000
0x20004000:     Cannot access memory at address 0x20004000

I use pyocd as gdb server and arm-none-eabi-gdb as client

Related