I figured out why my nRF51822 applications loaded just fine on the debugger and not on a power cycle / pin reset.  ….just in case this happens to you…


The quick answer: if you are using Eclipse and the GNU ARM toolchain, check to see if the link option:


is one of the linker options.  If it is, semihosting has been enabled and the binary will not load unless a debugger is present.


What the heck is semihosting? I liked Erich Styger’s definition the best: Semihosting is a technique to do printf() debugging through an active debug connection. So instead using a physical connection like RS-232 or USB CDC, the connection to the host machine is through the debugger.

Seems that semihosting is something concocted by Arm…Looking at this page from Arm, “if you are compiling for an ARMv6-M or ARMv7-M, for example a Cortex-M1 or Cortex-M3 processor, semihosting is implemented using the BKPT instruction.”  The nRF51822 uses the cortex-m0, which is based on the ARMv6-M architecture.

As noted on this page from Arm, The specific instruction sent by the binary to invoke semihosting is:


It turns out my .hex files all had the BKPT 0xAB command somewhere near the beginning of the file.  As the .hex was loaded and run, the cortex-m0 ran across the BKPT 0xAB and then waited patiently for the debugger to start communicating with it.  Since I hadn’t attached a debugger, “waiting patiently” turned into not running my nRF51822 app.

I found this out by exploring the .hex file with jlinkexe.  After loading the binary onto the chip, I opened a terminal window and started jlinkexe:

 jlinkexe -device nRF51422_xxAC

Once in the jlink utility, I executed the go command:


and (I think) the step command:



now the code sits at the breakpoint….

After reading Erich’s post on semihosting with the GNU ARM Eclipse Debug plugins, it turned out that yes indeed, the C template I had started with in Eclipse had included the —specs=rdimon.specs  !  Once this option had been removed, the binaries ran after a power cycle without the debugger.  YIPPEE!

I also removed the debugger settings Erich pointed out.