Skip to content

Commit 163f444

Browse files
committed
Make JTAG upload more generic to simplify use of other boards.
Replaces the OpenOCD wrapper scripts with a direct call to OpenOCD using the stock interface and board configuration scripts. Signed-off-by: David Kiliani <[email protected]>
1 parent 5d05638 commit 163f444

File tree

7 files changed

+16
-354
lines changed

7 files changed

+16
-354
lines changed

Makefile

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ PRODUCT_ID := 0003
3434
BOARD ?= maple
3535
MEMORY_TARGET ?= flash
3636

37+
OOCD ?= openocd
38+
OOCD_INTERFACE ?= olimex-arm-usb-ocd
39+
OOCD_BOARD ?= olimex_stm32_h103
40+
3741
# $(BOARD)- and $(MEMORY_TARGET)-specific configuration
3842
include $(MAKEDIR)/target-config.mk
3943

@@ -90,7 +94,7 @@ $(foreach m,$(LIBMAPLE_MODULES),$(eval $(call LIBMAPLE_MODULE_template,$(m))))
9094
##
9195

9296
# main target
93-
include $(SRCROOT)/build-targets.mk
97+
include build-targets.mk
9498

9599
.PHONY: install sketch clean help debug cscope tags ctags ram flash jtag doxygen mrproper
96100

@@ -101,7 +105,13 @@ UPLOAD_ram := $(SUPPORT_PATH)/scripts/reset.py && \
101105
UPLOAD_flash := $(SUPPORT_PATH)/scripts/reset.py && \
102106
sleep 1 && \
103107
$(DFU) -a1 -d $(VENDOR_ID):$(PRODUCT_ID) -D $(BUILD_PATH)/$(BOARD).bin -R
104-
UPLOAD_jtag := $(OPENOCD_WRAPPER) flash
108+
UPLOAD_jtag := $(OOCD) -f interface/$(OOCD_INTERFACE).cfg \
109+
-f board/$(OOCD_BOARD).cfg \
110+
-c "init" -c "reset init" \
111+
-c "flash write_image erase unlock $(BUILD_PATH)/$(BOARD).elf 0" \
112+
-c "verify_image $(BUILD_PATH)/$(BOARD).elf" \
113+
-c "reset run" \
114+
-c "shutdown"
105115

106116
# Conditionally upload to whatever the last build was
107117
install: INSTALL_TARGET = $(shell cat $(BUILD_PATH)/build-type 2>/dev/null)
@@ -154,7 +164,10 @@ help:
154164
@echo " "
155165

156166
debug:
157-
$(OPENOCD_WRAPPER) debug
167+
$(OOCD) -f interface/$(OOCD_INTERFACE).cfg \
168+
-f board/$(OOCD_BOARD).cfg \
169+
-c "init" -c "reset init" \
170+
-c "reset halt"
158171

159172
cscope:
160173
rm -rf *.cscope

support/make/build-rules.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ DISAS := arm-none-eabi-objdump
99
OBJDUMP := arm-none-eabi-objdump
1010
SIZE := arm-none-eabi-size
1111
DFU := dfu-util
12-
OPENOCD_WRAPPER := support/scripts/openocd-wrapper.sh
1312

1413
# Suppress annoying output unless V is set
1514
ifndef V

support/openocd/debug_0.3.cfg

Lines changed: 0 additions & 75 deletions
This file was deleted.

support/openocd/debug_0.4.cfg

Lines changed: 0 additions & 75 deletions
This file was deleted.

support/openocd/flash_0.3.cfg

Lines changed: 0 additions & 89 deletions
This file was deleted.

support/openocd/flash_0.4.cfg

Lines changed: 0 additions & 95 deletions
This file was deleted.

0 commit comments

Comments
 (0)