summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorhathach <[email protected]>2019-03-16 01:34:26 +0700
committerhathach <[email protected]>2019-03-16 01:34:26 +0700
commitd56e7fd9131a5c1a1c2035f846f0afeaf844412d (patch)
treefec2ae167331e9c48a72f964c0df7d3c9f8ab54e /examples
parente49efde730d215a64ae4469a2cc1b4f36baa3544 (diff)
adding flash (jlink)
Diffstat (limited to 'examples')
-rw-r--r--examples/device/cdc_msc_hid/Makefile18
1 files changed, 18 insertions, 0 deletions
diff --git a/examples/device/cdc_msc_hid/Makefile b/examples/device/cdc_msc_hid/Makefile
index a8430b4af..21dd059c7 100644
--- a/examples/device/cdc_msc_hid/Makefile
+++ b/examples/device/cdc_msc_hid/Makefile
@@ -111,6 +111,10 @@ $(BUILD)/$(BOARD)-firmware.elf: $(OBJ)
$(BUILD)/$(BOARD)-firmware.bin: $(BUILD)/$(BOARD)-firmware.elf
@echo CREATE $@
@$(OBJCOPY) -O binary -j .vectors -j .text -j .data $^ $@
+
+$(BUILD)/$(BOARD)-firmware.hex: $(BUILD)/$(BOARD)-firmware.elf
+ @echo CREATE $@
+ @$(OBJCOPY) -O ihex $^ $@
# We set vpath to point to the top of the tree so that the source files
# can be located. By following this scheme, it allows a single build rule
@@ -139,6 +143,20 @@ $(BUILD)/obj/%.o: %.S
@echo AS $(notdir $@)
@$(CC) -x assembler-with-cpp $(ASFLAGS) -c -o $@ $<
+# Flash binary using Jlink
+ifeq ($(OS),Windows_NT)
+ JLINKEXE = JLink.exe
+else
+ JLINKEXE = JLinkExe
+endif
+
+flash: $(BUILD)/$(BOARD)-firmware.hex
+ @echo halt > $(BUILD)/$(BOARD).jlink
+ @echo loadfile $^ >> $(BUILD)/$(BOARD).jlink
+ @echo go >> $(BUILD)/$(BOARD).jlink
+ @echo exit >> $(BUILD)/$(BOARD).jlink
+ #$(JLINKEXE) -device stm32f407vg -if swd -speed auto -CommandFile $(BUILD)/$(BOARD).jlink
+
size: $(BUILD)/$(BOARD)-firmware.elf
-@echo ''
@$(SIZE) $<