Skip to content

Commit e3d4385

Browse files
authored
Merge pull request hathach#2150 from kkitayam/flash-jlink-for-windows
Fix flash-jlink target to work on Windows command prompt
2 parents 973c7d4 + efa8b4a commit e3d4385

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

examples/rules.mk

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,16 @@ endif
9999
JLINK_IF ?= swd
100100

101101
# Jlink script
102-
define jlink_script
103-
halt
104-
loadfile $^
105-
r
106-
go
107-
exit
108-
endef
109-
export jlink_script
102+
$(BUILD)/$(BOARD).jlink: $(BUILD)/$(PROJECT).hex
103+
@echo halt > $@
104+
@echo loadfile $^ >> $@
105+
@echo r >> $@
106+
@echo go >> $@
107+
@echo exit >> $@
110108

111109
# Flash using jlink
112-
flash-jlink: $(BUILD)/$(PROJECT).hex
113-
@echo "$$jlink_script" > $(BUILD)/$(BOARD).jlink
114-
$(JLINKEXE) -device $(JLINK_DEVICE) -if $(JLINK_IF) -JTAGConf -1,-1 -speed auto -CommandFile $(BUILD)/$(BOARD).jlink
110+
flash-jlink: $(BUILD)/$(BOARD).jlink
111+
$(JLINKEXE) -device $(JLINK_DEVICE) -if $(JLINK_IF) -JTAGConf -1,-1 -speed auto -CommandFile $<
115112

116113
# Flash STM32 MCU using stlink with STM32 Cube Programmer CLI
117114
flash-stlink: $(BUILD)/$(PROJECT).elf

0 commit comments

Comments
 (0)