Nordic nrf51822 and S130 never gets to my application code

878 views Asked by At

I am trying to run a NRF51822 chip using Emblocks and OpenOCD, the debugger interface is a ST-Link from a Discovery board, which supports SWD.

When I program the Blank device everything works fine, the program flow reaches the main function. However, when I flash S130, the program flow never reaches my main function (I don't have any other application code).

I have checked the assembly code and S130 is stuck on a (arm asm incoming) WFE and b.n instruction, to my knowledge, it seems like it is waiting for an interrupt, event or for a wake up to happen before doing anything... is this the expected behaviour or I am doing something wrong?

The only pins I have connected are the SWD lines (2 pins) GND and VDD (3 volts).

1

There are 1 answers

0
Wapers On BEST ANSWER

I solved it a long time ago, but forgot to post the solution. The problem was the script file provided with Emblocks, it needed to be modified.

I got it working by modifying the sections in the linker file from this:

MEMORY
{
SOFTD (rx) : ORIGIN = 0x00000000, LENGTH = 0x20000
FLASH (rx) : ORIGIN = 0x00020000, LENGTH = 0x20000
RAM (rwx) : ORIGIN = 0x20002800, LENGTH = 0x1800
}

To this:

MEMORY
{
SOFTD (rx) : ORIGIN = 0x00000000, LENGTH = 0x1C000
FLASH (rx) : ORIGIN = 0x0001C000, LENGTH = 0x24000
RAM (rwx) : ORIGIN = 0x20002800, LENGTH = 0x1800
}

Now the program flow reaches main.