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

Using semihosting with sdk11?

How to enable semihosting in sdk11 examples?

This works, but I can't port it to examples/periferal/template_project :(

changes:

pca10028/armgcc/Makefile:

  • adding line LDFLAGS += --specs=rdimon.specs -Wl,--start-group -lgcc -lc -lc -lm -lrdimon -Wl,--end-group
  • removing -lc -lnosys from linker options)

adding to main.c:

  • #include <stdio.h>

  • extern void initialize_...

  • initialise_monitor_handles(); in int main(void) {

  • printf("hllwrld"); in while loop

I also use STLink v2 mini, so flash and run with Makefile options looks:

flash:

$(OPENOCD) -f $(OPENOCD_CFG) -c "init; reset halt; nrf51 mass_erase; program $(OUTPUT_BINARY_DIRECTORY)/nrf51422_xxac.hex verify reset; shutdown;"

run:

$(OPENOCD) -f $(OPENOCD_CFG) -f openocd-run.cfg

openocd-run.cfg and openocd.cfg - from this repo

Related