diff --git a/.gitignore b/.gitignore index 02b314dfc..02e32989b 100644 --- a/.gitignore +++ b/.gitignore @@ -113,5 +113,6 @@ platform/galileo/bsp/libc/newlib-2.2.0-1* platform/galileo/bsp/grub/src/ platform/galileo/bsp/grub/bin/ -# galileo build artefacts +# galileo build and debug artefacts *.galileo +LOG_OPENOCD diff --git a/platform/galileo/Makefile.customrules-galileo b/platform/galileo/Makefile.customrules-galileo new file mode 100644 index 000000000..0ab0e662c --- /dev/null +++ b/platform/galileo/Makefile.customrules-galileo @@ -0,0 +1,8 @@ +GDB ?= gdb +OPENOCD_SCRIPTS = $(CONTIKI)/platform/galileo/bsp/openocd-scripts + +.PHONY: debug + +debug: $(CONTIKI_PROJECT).$(TARGET) + @openocd -s $(OPENOCD_SCRIPTS) -f debug.cfg &> $(shell pwd)/LOG_OPENOCD & + @$(GDB) $< -ex "target remote :3333" diff --git a/platform/galileo/bsp/openocd-scripts/debug.cfg b/platform/galileo/bsp/openocd-scripts/debug.cfg new file mode 100644 index 000000000..bbe8a5919 --- /dev/null +++ b/platform/galileo/bsp/openocd-scripts/debug.cfg @@ -0,0 +1,11 @@ +source [find interface/ftdi/flyswatter2.cfg]; +source [find board/quark_x10xx_board.cfg]; + +quark_x10xx.cpu configure -event gdb-attach { + halt +} + +quark_x10xx.cpu configure -event gdb-detach { + resume + shutdown +}