adding flash (jlink)

This commit is contained in:
hathach 2019-03-16 01:34:26 +07:00
parent e49efde730
commit d56e7fd913
2 changed files with 20 additions and 3 deletions

View File

@ -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) $<

View File

@ -41,7 +41,6 @@ else
endif
endif
# flash target using on-board stlink or jlink
flash: $(BUILD)/$(BOARD)-firmware.elf
# flash target using on-board stlink
flash-stlink: $(BUILD)/$(BOARD)-firmware.elf
$(STM32Prog) --connect port=swd --write $< --go
#JLinkExe