diff --git a/examples/lpc/lpc13xx/Makefile.include b/examples/lpc/lpc13xx/Makefile.include index 88941f1..f0efdf5 100644 --- a/examples/lpc/lpc13xx/Makefile.include +++ b/examples/lpc/lpc13xx/Makefile.include @@ -29,7 +29,7 @@ ARCH_FLAGS = -mthumb -mcpu=cortex-m3 $(FP_FLAGS) -mfix-cortex-m3-ldrd OOCD ?= openocd OOCD_INTERFACE ?= flossjtag -OOCD_BOARD ?= olimex_stm32_h103 +OOCD_TARGET ?= lpc13xx ################################################################################ # Black Magic Probe specific variables diff --git a/examples/lpc/lpc17xx/Makefile.include b/examples/lpc/lpc17xx/Makefile.include index 485fdb3..d66e08a 100644 --- a/examples/lpc/lpc17xx/Makefile.include +++ b/examples/lpc/lpc17xx/Makefile.include @@ -30,7 +30,7 @@ ARCH_FLAGS = -mthumb -mcpu=cortex-m3 $(FP_FLAGS) -mfix-cortex-m3-ldrd OOCD ?= openocd OOCD_INTERFACE ?= flossjtag -OOCD_BOARD ?= olimex_stm32_h103 +OOCD_TARGET ?= lpc17xx ################################################################################ # Black Magic Probe specific variables diff --git a/examples/lpc/lpc43xx/Makefile.include b/examples/lpc/lpc43xx/Makefile.include index d438bc9..2f62671 100644 --- a/examples/lpc/lpc43xx/Makefile.include +++ b/examples/lpc/lpc43xx/Makefile.include @@ -32,7 +32,7 @@ ARCH_FLAGS = -mthumb -mcpu=cortex-m4 $(FP_FLAGS) OOCD ?= openocd OOCD_INTERFACE ?= flossjtag -OOCD_BOARD ?= olimex_stm32_h103 +OOCD_TARGET ?= lpc4357 ################################################################################ # Black Magic Probe specific variables diff --git a/examples/rules.mk b/examples/rules.mk index 8a8da4a..10a83d0 100644 --- a/examples/rules.mk +++ b/examples/rules.mk @@ -225,27 +225,21 @@ styleclean: $(STYLECHECKFILES:=.styleclean) ifeq ($(STLINK_PORT),) ifeq ($(BMP_PORT),) -ifeq ($(OOCD_SERIAL),) -%.flash: %.hex +ifeq ($(OOCD_FILE),) +%.flash: %.elf @printf " FLASH $<\n" - @# IMPORTANT: Don't use "resume", only "reset" will work correctly! - $(Q)$(OOCD) -f interface/$(OOCD_INTERFACE).cfg \ - -f board/$(OOCD_BOARD).cfg \ - -c "init" -c "reset init" \ - -c "flash write_image erase $(*).hex" \ - -c "reset" \ - -c "shutdown" $(NULL) + $(Q)(echo "halt; program $(*).elf verify reset" | nc -4 localhost 4444 2>/dev/null) || \ + $(OOCD) -f interface/$(OOCD_INTERFACE).cfg \ + -f target/$(OOCD_TARGET).cfg \ + -c "program $(*).elf verify reset exit" \ + $(NULL) else -%.flash: %.hex +%.flash: %.elf @printf " FLASH $<\n" - @# IMPORTANT: Don't use "resume", only "reset" will work correctly! - $(Q)$(OOCD) -f interface/$(OOCD_INTERFACE).cfg \ - -f board/$(OOCD_BOARD).cfg \ - -c "ft2232_serial $(OOCD_SERIAL)" \ - -c "init" -c "reset init" \ - -c "flash write_image erase $(*).hex" \ - -c "reset" \ - -c "shutdown" $(NULL) + $(Q)(echo "halt; program $(*).elf verify reset" | nc -4 localhost 4444 2>/dev/null) || \ + $(OOCD) -f $(OOCD_FILE) \ + -c "program $(*).elf verify reset exit" \ + $(NULL) endif else %.flash: %.elf diff --git a/examples/sam/d/Makefile.include b/examples/sam/d/Makefile.include index f259f41..f9b6759 100644 --- a/examples/sam/d/Makefile.include +++ b/examples/sam/d/Makefile.include @@ -28,6 +28,6 @@ endif OOCD ?= openocd OOCD_INTERFACE ?= cmsis-dap -OOCD_BOARD ?= +OOCD_TARGET ?= at91samdXX include ../../../../rules.mk diff --git a/examples/stm32/f0/Makefile.include b/examples/stm32/f0/Makefile.include index e91e135..0e04a9f 100644 --- a/examples/stm32/f0/Makefile.include +++ b/examples/stm32/f0/Makefile.include @@ -28,8 +28,8 @@ ARCH_FLAGS = -mthumb -mcpu=cortex-m0 $(FP_FLAGS) # OpenOCD specific variables OOCD ?= openocd -OOCD_INTERFACE ?= flossjtag -OOCD_BOARD ?= olimex_stm32_h103 +OOCD_INTERFACE ?= stlink-v2-1 +OOCD_TARGET ?= stm32f0x ################################################################################ # Black Magic Probe specific variables diff --git a/examples/stm32/f1/Makefile.include b/examples/stm32/f1/Makefile.include index 864cfc9..503e154 100644 --- a/examples/stm32/f1/Makefile.include +++ b/examples/stm32/f1/Makefile.include @@ -29,7 +29,7 @@ ARCH_FLAGS = -mthumb -mcpu=cortex-m3 $(FP_FLAGS) -mfix-cortex-m3-ldrd OOCD ?= openocd OOCD_INTERFACE ?= flossjtag -OOCD_BOARD ?= olimex_stm32_h103 +OOCD_TARGET ?= stm32f1x ################################################################################ # Black Magic Probe specific variables diff --git a/examples/stm32/f1/obldc/usart_irq/Makefile b/examples/stm32/f1/obldc/usart_irq/Makefile index af12f39..411b7a4 100644 --- a/examples/stm32/f1/obldc/usart_irq/Makefile +++ b/examples/stm32/f1/obldc/usart_irq/Makefile @@ -19,7 +19,7 @@ BINARY = usart_irq -OOCD_BOARD = open-bldc +OOCD_FILE = board/open-bldc.cfg LDSCRIPT = ../obldc.ld diff --git a/examples/stm32/f2/Makefile.include b/examples/stm32/f2/Makefile.include index 2d0db79..34b43bd 100644 --- a/examples/stm32/f2/Makefile.include +++ b/examples/stm32/f2/Makefile.include @@ -31,7 +31,7 @@ ARCH_FLAGS = -mthumb -mcpu=cortex-m3 $(FP_FLAGS) -mfix-cortex-m3-ldrd OOCD ?= openocd OOCD_INTERFACE ?= flossjtag -OOCD_BOARD ?= olimex_stm32_h103 +OOCD_TARGET ?= stm32f2x ################################################################################ # Black Magic Probe specific variables diff --git a/examples/stm32/f3/Makefile.include b/examples/stm32/f3/Makefile.include index 69bb8b3..1f4a6d6 100644 --- a/examples/stm32/f3/Makefile.include +++ b/examples/stm32/f3/Makefile.include @@ -30,7 +30,7 @@ ARCH_FLAGS = -mthumb -mcpu=cortex-m4 $(FP_FLAGS) OOCD ?= openocd OOCD_INTERFACE ?= stlink-v2 -OOCD_BOARD ?= stm32f3discovery +OOCD_TARGET ?= stm32f3x ################################################################################ # Black Magic Probe specific variables diff --git a/examples/stm32/f4/Makefile.include b/examples/stm32/f4/Makefile.include index 643a39f..c5b125b 100644 --- a/examples/stm32/f4/Makefile.include +++ b/examples/stm32/f4/Makefile.include @@ -33,7 +33,7 @@ endif OOCD ?= openocd OOCD_INTERFACE ?= stlink-v2 -OOCD_BOARD ?= stm32f4discovery +OOCD_TARGET ?= stm32f4x ################################################################################ # Black Magic Probe specific variables diff --git a/examples/stm32/l0/Makefile.include b/examples/stm32/l0/Makefile.include index c2729ab..5cad08e 100644 --- a/examples/stm32/l0/Makefile.include +++ b/examples/stm32/l0/Makefile.include @@ -29,7 +29,7 @@ ARCH_FLAGS = -mthumb -mcpu=cortex-m0plus $(FP_FLAGS) OOCD ?= openocd OOCD_INTERFACE ?= stlink-v2-1 -OOCD_BOARD ?= stm32l0discovery +OOCD_TARGET ?= stm32l0 ################################################################################ # Black Magic Probe specific variables diff --git a/examples/stm32/l1/Makefile.include b/examples/stm32/l1/Makefile.include index 8f7ff26..4af62a4 100644 --- a/examples/stm32/l1/Makefile.include +++ b/examples/stm32/l1/Makefile.include @@ -29,7 +29,7 @@ ARCH_FLAGS = -mthumb -mcpu=cortex-m3 $(FP_FLAGS) -mfix-cortex-m3-ldrd OOCD ?= openocd OOCD_INTERFACE ?= stlink-v2 -OOCD_BOARD ?= stm32ldiscovery +OOCD_TARGET ?= stm32l1 ################################################################################ # Black Magic Probe specific variables diff --git a/examples/tiva/lm3s/Makefile.include b/examples/tiva/lm3s/Makefile.include index 680596c..34bb24d 100644 --- a/examples/tiva/lm3s/Makefile.include +++ b/examples/tiva/lm3s/Makefile.include @@ -29,7 +29,7 @@ ARCH_FLAGS = -mthumb -mcpu=cortex-m3 $(FP_FLAGS) OOCD ?= openocd OOCD_INTERFACE ?= flossjtag -OOCD_BOARD ?= olimex_stm32_h103 +OOCD_TARGET ?= stellaris ################################################################################ # Black Magic Probe specific variables diff --git a/examples/tiva/lm4f/Makefile.include b/examples/tiva/lm4f/Makefile.include index 827de43..c93af2a 100644 --- a/examples/tiva/lm4f/Makefile.include +++ b/examples/tiva/lm4f/Makefile.include @@ -29,10 +29,11 @@ ARCH_FLAGS = -mthumb -mcpu=cortex-m4 $(FP_FLAGS) # OpenOCD specific variables # Support for ICDI is available starting with openocd 0.7.0 +# but a board file maybe required to select jtag/swd transport OOCD ?= openocd OOCD_INTERFACE ?= ti-icdi -OOCD_BOARD ?= ek-lm4f120xl +OOCD_TARGET ?= stellaris ################################################################################ # Black Magic Probe specific variables diff --git a/examples/tiva/lm4f/stellaris-ek-lm4f120xl/miniblink/Makefile b/examples/tiva/lm4f/stellaris-ek-lm4f120xl/miniblink/Makefile index 0dead65..16169ac 100644 --- a/examples/tiva/lm4f/stellaris-ek-lm4f120xl/miniblink/Makefile +++ b/examples/tiva/lm4f/stellaris-ek-lm4f120xl/miniblink/Makefile @@ -18,7 +18,7 @@ ## BINARY = miniblink - +OOCD_FILE = board/ek-lm4f120xl.cfg LDSCRIPT = ../ek-lm4f120xl.ld include ../../Makefile.include diff --git a/examples/tiva/lm4f/stellaris-ek-lm4f120xl/uart_echo_interrupt/Makefile b/examples/tiva/lm4f/stellaris-ek-lm4f120xl/uart_echo_interrupt/Makefile index e3a5a62..c8d4d05 100644 --- a/examples/tiva/lm4f/stellaris-ek-lm4f120xl/uart_echo_interrupt/Makefile +++ b/examples/tiva/lm4f/stellaris-ek-lm4f120xl/uart_echo_interrupt/Makefile @@ -18,7 +18,7 @@ ## BINARY = uart_echo_interrupt - +OOCD_FILE = board/ek-lm4f120xl.cfg LDSCRIPT = ../ek-lm4f120xl.ld include ../../Makefile.include diff --git a/examples/tiva/lm4f/stellaris-ek-lm4f120xl/uart_echo_simple/Makefile b/examples/tiva/lm4f/stellaris-ek-lm4f120xl/uart_echo_simple/Makefile index b8e172a..2551ff9 100644 --- a/examples/tiva/lm4f/stellaris-ek-lm4f120xl/uart_echo_simple/Makefile +++ b/examples/tiva/lm4f/stellaris-ek-lm4f120xl/uart_echo_simple/Makefile @@ -18,7 +18,7 @@ ## BINARY = uart_echo_simple - +OOCD_FILE = board/ek-lm4f120xl.cfg LDSCRIPT = ../ek-lm4f120xl.ld include ../../Makefile.include diff --git a/examples/tiva/lm4f/stellaris-ek-lm4f120xl/usb_bulk_dev/Makefile b/examples/tiva/lm4f/stellaris-ek-lm4f120xl/usb_bulk_dev/Makefile index 3458512..362ae8f 100644 --- a/examples/tiva/lm4f/stellaris-ek-lm4f120xl/usb_bulk_dev/Makefile +++ b/examples/tiva/lm4f/stellaris-ek-lm4f120xl/usb_bulk_dev/Makefile @@ -18,7 +18,7 @@ ## BINARY = usb_bulk_dev - +OOCD_FILE = board/ek-lm4f120xl.cfg LDSCRIPT = ../ek-lm4f120xl.ld include ../../Makefile.include diff --git a/examples/tiva/lm4f/stellaris-ek-lm4f120xl/usb_to_serial_cdcacm/Makefile b/examples/tiva/lm4f/stellaris-ek-lm4f120xl/usb_to_serial_cdcacm/Makefile index 14df7a7..b784d66 100644 --- a/examples/tiva/lm4f/stellaris-ek-lm4f120xl/usb_to_serial_cdcacm/Makefile +++ b/examples/tiva/lm4f/stellaris-ek-lm4f120xl/usb_to_serial_cdcacm/Makefile @@ -18,7 +18,7 @@ ## BINARY = usb_to_serial_cdcacm - +OOCD_FILE = board/ek-lm4f120xl.cfg LDSCRIPT = ../ek-lm4f120xl.ld