diff --git a/flight/AHRS/Makefile b/flight/AHRS/Makefile index c203fdd59..2c9f409b5 100644 --- a/flight/AHRS/Makefile +++ b/flight/AHRS/Makefile @@ -290,21 +290,8 @@ LDFLAGS += -lc -lgcc LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_sections.ld -OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin -# Program -OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(FW_BANK_BASE) bin" -# Verify -OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(FW_BANK_BASE) bin" -# reset target -OOCD_CL+=-c "reset run" -# terminate OOCD after programming -OOCD_CL+=-c shutdown - - # Define programs and commands. REMOVE = $(REMOVE_CMD) -f -###SHELL = sh -###COPY = cp # List of all source files. ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) @@ -336,14 +323,6 @@ endif endif endif -# Program the device. -ifeq ($(FLASH_TOOL),OPENOCD) -# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script". -program: $(OUTDIR)/$(TARGET).bin - @echo ${quote}Programming with OPENOCD${quote} - $(OOCD_EXE) $(OOCD_CL) -endif - # Link: create ELF output file from object files. $(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ))) @@ -375,6 +354,9 @@ $(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin $(eval $(call OPF_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION))) +# Add jtag targets (program and wipe) +$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(FW_BANK_BASE),$(FW_BANK_SIZE))) + .PHONY: elf lss sym hex bin bino opf elf: $(OUTDIR)/$(TARGET).elf lss: $(OUTDIR)/$(TARGET).lss @@ -439,4 +421,4 @@ else endif # Listing of phony targets. -.PHONY : all build clean clean_list program install +.PHONY : all build clean clean_list install diff --git a/flight/Bootloaders/AHRS/Makefile b/flight/Bootloaders/AHRS/Makefile index 1df91a1ab..41518fe7d 100644 --- a/flight/Bootloaders/AHRS/Makefile +++ b/flight/Bootloaders/AHRS/Makefile @@ -291,20 +291,8 @@ LDFLAGS += -lc -lgcc LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_BL_sections.ld -OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin -# Program -OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(BL_BANK_BASE) bin" -# Verify -OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(BL_BANK_BASE) bin" -# reset target -OOCD_CL+=-c "reset run" -# terminate OOCD after programming -OOCD_CL+=-c shutdown - # Define programs and commands. REMOVE = $(REMOVE_CMD) -f -###SHELL = sh -###COPY = cp # List of all source files. ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) @@ -336,14 +324,6 @@ endif endif endif -# Program the device. -ifeq ($(FLASH_TOOL),OPENOCD) -# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script". -program: $(OUTDIR)/$(TARGET).bin - @echo "Programming with OPENOCD" - $(OOCD_EXE) $(OOCD_CL) -endif - # Link: create ELF output file from object files. $(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ))) @@ -373,6 +353,9 @@ $(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM)) $(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin +# Add jtag targets (program and wipe) +$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BL_BANK_BASE),$(BL_BANK_SIZE))) + .PHONY: elf lss sym hex bin bino elf: $(OUTDIR)/$(TARGET).elf lss: $(OUTDIR)/$(TARGET).lss @@ -437,4 +420,4 @@ else endif # Listing of phony targets. -.PHONY : all build clean clean_list program install +.PHONY : all build clean clean_list install diff --git a/flight/Bootloaders/CopterControl/Makefile b/flight/Bootloaders/CopterControl/Makefile index 413749cca..6507c022c 100644 --- a/flight/Bootloaders/CopterControl/Makefile +++ b/flight/Bootloaders/CopterControl/Makefile @@ -343,20 +343,8 @@ LDFLAGS += -lc -lgcc LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_BL_sections.ld -OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin -# Program -OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(BL_BANK_BASE) bin" -# Verify -OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(BL_BANK_BASE) bin" -# reset target -OOCD_CL+=-c "reset run" -# terminate OOCD after programming -OOCD_CL+=-c shutdown - # Define programs and commands. REMOVE = $(REMOVE_CMD) -f -###SHELL = sh -###COPY = cp # List of all source files. ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) @@ -396,14 +384,6 @@ ${OUTDIR}/InitMods.c: Makefile @echo ${quote}${foreach MOD, ${MODNAMES}, ${MOD}Initialize();}${quote} >> ${OUTDIR}/InitMods.c @echo ${quote}}${quote} >> ${OUTDIR}/InitMods.c -# Program the device. -ifeq ($(FLASH_TOOL),OPENOCD) -# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script". -program: $(OUTDIR)/$(TARGET).bin - @echo ${quote}Programming with OPENOCD${quote} - $(OOCD_EXE) $(OOCD_CL) -endif - # Link: create ELF output file from object files. $(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ))) @@ -433,6 +413,9 @@ $(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM)) $(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin +# Add jtag targets (program and wipe) +$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BL_BANK_BASE),$(BL_BANK_SIZE))) + .PHONY: elf lss sym hex bin bino elf: $(OUTDIR)/$(TARGET).elf lss: $(OUTDIR)/$(TARGET).lss @@ -497,4 +480,4 @@ else endif # Listing of phony targets. -.PHONY : all build clean clean_list program install +.PHONY : all build clean clean_list install diff --git a/flight/Bootloaders/OpenPilot/Makefile b/flight/Bootloaders/OpenPilot/Makefile index 1167693b3..a53479546 100644 --- a/flight/Bootloaders/OpenPilot/Makefile +++ b/flight/Bootloaders/OpenPilot/Makefile @@ -346,20 +346,8 @@ LDFLAGS += -lc -lgcc LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_BL_sections.ld -OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin -# Program -OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(BL_BANK_BASE) bin" -# Verify -OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(BL_BANK_BASE) bin" -# reset target -OOCD_CL+=-c "reset run" -# terminate OOCD after programming -OOCD_CL+=-c shutdown - # Define programs and commands. REMOVE = $(REMOVE_CMD) -f -###SHELL = sh -###COPY = cp # List of all source files. ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) @@ -399,14 +387,6 @@ ${OUTDIR}/InitMods.c: Makefile @echo ${quote}${foreach MOD, ${MODNAMES}, ${MOD}Initialize();}${quote} >> ${OUTDIR}/InitMods.c @echo ${quote}}${quote} >> ${OUTDIR}/InitMods.c -# Program the device. -ifeq ($(FLASH_TOOL),OPENOCD) -# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script". -program: $(OUTDIR)/$(TARGET).bin - @echo ${quote}Programming with OPENOCD${quote} - $(OOCD_EXE) $(OOCD_CL) -endif - # Link: create ELF output file from object files. $(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ))) @@ -436,6 +416,9 @@ $(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM)) $(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin +# Add jtag targets (program and wipe) +$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BL_BANK_BASE),$(BL_BANK_SIZE))) + .PHONY: elf lss sym hex bin bino elf: $(OUTDIR)/$(TARGET).elf lss: $(OUTDIR)/$(TARGET).lss @@ -500,4 +483,4 @@ else endif # Listing of phony targets. -.PHONY : all build clean clean_list program install +.PHONY : all build clean clean_list install diff --git a/flight/Bootloaders/PipXtreme/Makefile b/flight/Bootloaders/PipXtreme/Makefile index c91713cd9..faf30bc37 100644 --- a/flight/Bootloaders/PipXtreme/Makefile +++ b/flight/Bootloaders/PipXtreme/Makefile @@ -342,20 +342,8 @@ LDFLAGS += -lc -lgcc LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_BL_sections.ld -OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin -# Program -OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(BL_BANK_BASE) bin" -# Verify -OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(BL_BANK_BASE) bin" -# reset target -OOCD_CL+=-c "reset run" -# terminate OOCD after programming -OOCD_CL+=-c shutdown - # Define programs and commands. REMOVE = $(REMOVE_CMD) -f -###SHELL = sh -###COPY = cp # List of all source files. ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) @@ -395,14 +383,6 @@ ${OUTDIR}/InitMods.c: Makefile @echo ${quote}${foreach MOD, ${MODNAMES}, ${MOD}Initialize();}${quote} >> ${OUTDIR}/InitMods.c @echo ${quote}}${quote} >> ${OUTDIR}/InitMods.c -# Program the device. -ifeq ($(FLASH_TOOL),OPENOCD) -# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script". -program: $(OUTDIR)/$(TARGET).bin - @echo ${quote}Programming with OPENOCD${quote} - $(OOCD_EXE) $(OOCD_CL) -endif - # Link: create ELF output file from object files. $(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ))) @@ -432,6 +412,9 @@ $(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM)) $(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin +# Add jtag targets (program and wipe) +$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BL_BANK_BASE),$(BL_BANK_SIZE))) + .PHONY: elf lss sym hex bin bino elf: $(OUTDIR)/$(TARGET).elf lss: $(OUTDIR)/$(TARGET).lss @@ -496,4 +479,4 @@ else endif # Listing of phony targets. -.PHONY : all build clean clean_list program install +.PHONY : all build clean clean_list install diff --git a/flight/CopterControl/Makefile b/flight/CopterControl/Makefile index 942bc45a9..f6c3c6158 100644 --- a/flight/CopterControl/Makefile +++ b/flight/CopterControl/Makefile @@ -466,21 +466,9 @@ LDFLAGS += -lc -lgcc LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_sections.ld -OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin -# Program -OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(FW_BANK_BASE) bin" -# Verify -OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(FW_BANK_BASE) bin" -# reset target -OOCD_CL+=-c "reset run" -# terminate OOCD after programming -OOCD_CL+=-c shutdown - # Define programs and commands. REMOVE = $(REMOVE_CMD) -f PYTHON = python -###SHELL = sh -###COPY = cp # List of all source files. ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) @@ -531,13 +519,6 @@ ${OUTDIR}/InitMods.c: Makefile # @$(PYTHON) $(PYMITETOOLS)/pmGenPmFeatures.py $(PYMITEPLAT)/pmfeatures.py > $(OUTDIR)/pmfeatures.h # @$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -u -o $(OUTDIR)/pmlibusr_img.c --native-file=$(OUTDIR)/pmlibusr_nat.c $(FLIGHTPLANS)/test.py -ifeq ($(FLASH_TOOL),OPENOCD) -# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script". -program: $(OUTDIR)/$(TARGET).bin - @echo ${quote}Programming with OPENOCD${quote} - $(OOCD_EXE) $(OOCD_CL) -endif - # Link: create ELF output file from object files. $(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ))) @@ -569,6 +550,9 @@ $(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin $(eval $(call OPF_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION))) +# Add jtag targets (program and wipe) +$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(FW_BANK_BASE),$(FW_BANK_SIZE))) + .PHONY: elf lss sym hex bin bino opf elf: $(OUTDIR)/$(TARGET).elf lss: $(OUTDIR)/$(TARGET).lss @@ -636,4 +620,4 @@ else endif # Listing of phony targets. -.PHONY : all build clean clean_list program gencode install +.PHONY : all build clean clean_list gencode install diff --git a/flight/INS/Makefile b/flight/INS/Makefile index 1af2a912a..5691f6a7d 100644 --- a/flight/INS/Makefile +++ b/flight/INS/Makefile @@ -298,20 +298,8 @@ LDFLAGS += -lc -lgcc LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_sections.ld -OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).elf -# Program -OOCD_CL+=-c "flash write_image $(OOCD_LOADFILE)" -# Verify -OOCD_CL+=-c "verify_image $(OOCD_LOADFILE)" -# reset target -OOCD_CL+=-c "reset run" -# # terminate OOCD after programming -OOCD_CL+=-c shutdown - # Define programs and commands. REMOVE = $(REMOVE_CMD) -f -###SHELL = sh -###COPY = cp # List of all source files. ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) @@ -343,14 +331,6 @@ endif endif endif -# Program the device. -ifeq ($(FLASH_TOOL),OPENOCD) -# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script". -program: $(OUTDIR)/$(TARGET).bin - @echo ${quote}Programming with OPENOCD${quote} - $(OOCD_EXE) $(OOCD_CL) -endif - # Link: create ELF output file from object files. $(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ))) @@ -382,6 +362,9 @@ $(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin $(eval $(call OPF_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION))) +# Add jtag targets (program and wipe) +$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(FW_BANK_BASE),$(FW_BANK_SIZE))) + .PHONY: elf lss sym hex bin bino opf elf: $(OUTDIR)/$(TARGET).elf lss: $(OUTDIR)/$(TARGET).lss @@ -445,4 +428,4 @@ else endif # Listing of phony targets. -.PHONY : all build clean clean_list program install +.PHONY : all build clean clean_list install diff --git a/flight/OpenPilot/Makefile b/flight/OpenPilot/Makefile index c14a4381c..91149ae57 100644 --- a/flight/OpenPilot/Makefile +++ b/flight/OpenPilot/Makefile @@ -442,22 +442,9 @@ LDFLAGS += -lc -lgcc LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_sections.ld -OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin -# Program -OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(FW_BANK_BASE) bin" -# Verify -OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(FW_BANK_BASE) bin" -# reset target -OOCD_CL+=-c "reset run" -# terminate OOCD after programming -OOCD_CL+=-c shutdown - - # Define programs and commands. REMOVE = $(REMOVE_CMD) -f PYTHON = python -###SHELL = sh -###COPY = cp # List of all source files. ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) @@ -510,14 +497,6 @@ ${OUTDIR}/pmlib_img.c ${OUTDIR}/pmlib_nat.c ${OUTDIR}/pmlibusr_img.c ${OUTDIR}/p @$(PYTHON) $(PYMITETOOLS)/pmGenPmFeatures.py $(PYMITEPLAT)/pmfeatures.py > $(OUTDIR)/pmfeatures.h @$(PYTHON) $(PYMITETOOLS)/pmImgCreator.py -f $(PYMITEPLAT)/pmfeatures.py -c -u -o $(OUTDIR)/pmlibusr_img.c --native-file=$(OUTDIR)/pmlibusr_nat.c $(FLIGHTPLANS)/test.py -# Program the device. -ifeq ($(FLASH_TOOL),OPENOCD) -# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script". -program: $(OUTDIR)/$(TARGET).bin - @echo ${quote}Programming with OPENOCD${quote} - $(OOCD_EXE) $(OOCD_CL) -endif - # Link: create ELF output file from object files. $(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ))) @@ -549,6 +528,9 @@ $(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin $(eval $(call OPF_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION))) +# Add jtag targets (program and wipe) +$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(FW_BANK_BASE),$(FW_BANK_SIZE))) + .PHONY: elf lss sym hex bin bino opf elf: $(OUTDIR)/$(TARGET).elf lss: $(OUTDIR)/$(TARGET).lss @@ -616,4 +598,4 @@ else endif # Listing of phony targets. -.PHONY : all build clean clean_list program gencode install +.PHONY : all build clean clean_list gencode install diff --git a/flight/PipXtreme/Makefile b/flight/PipXtreme/Makefile index 57dbfb8f0..1e9f3c48c 100644 --- a/flight/PipXtreme/Makefile +++ b/flight/PipXtreme/Makefile @@ -329,20 +329,8 @@ LDFLAGS += -lc -lgcc LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_memory.ld LDFLAGS += -T$(LINKERSCRIPTPATH)/link_$(BOARD)_sections.ld -OOCD_LOADFILE+=$(OUTDIR)/$(TARGET).bin -# Program -OOCD_CL+=-c "flash write_image erase $(OOCD_LOADFILE) $(FW_BANK_BASE) bin" -# Verify -OOCD_CL+=-c "verify_image $(OOCD_LOADFILE) $(FW_BANK_BASE) bin" -# reset target -OOCD_CL+=-c "reset run" -# terminate OOCD after programming -OOCD_CL+=-c shutdown - # Define programs and commands. REMOVE = $(REMOVE_CMD) -f -###SHELL = sh -###COPY = cp # List of all source files. ALLSRC = $(ASRCARM) $(ASRC) $(SRCARM) $(SRC) $(CPPSRCARM) $(CPPSRC) @@ -374,14 +362,6 @@ endif endif endif -# Program the device. -ifeq ($(FLASH_TOOL),OPENOCD) -# Program the device with Dominic Rath's OPENOCD in "batch-mode", needs cfg and "reset-script". -program: $(OUTDIR)/$(TARGET).bin - @echo ${quote}Programming with OPENOCD${quote} - $(OOCD_EXE) $(OOCD_CL) -endif - # Link: create ELF output file from object files. $(eval $(call LINK_TEMPLATE, $(OUTDIR)/$(TARGET).elf, $(ALLOBJ))) @@ -413,6 +393,9 @@ $(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin $(eval $(call OPF_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION))) +# Add jtag targets (program and wipe) +$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(FW_BANK_BASE),$(FW_BANK_SIZE))) + .PHONY: elf lss sym hex bin bino opf elf: $(OUTDIR)/$(TARGET).elf lss: $(OUTDIR)/$(TARGET).lss @@ -478,4 +461,4 @@ else endif # Listing of phony targets. -.PHONY : all build clean clean_list program install +.PHONY : all build clean clean_list install diff --git a/make/firmware-defs.mk b/make/firmware-defs.mk index 9680edb16..64a553f29 100644 --- a/make/firmware-defs.mk +++ b/make/firmware-defs.mk @@ -47,6 +47,8 @@ MSG_PYMITEINIT := ${quote} PY ${quote} MSG_INSTALLING := ${quote} INSTALL ${quote} MSG_OPFIRMWARE := ${quote} OPF ${quote} MSG_FWINFO := ${quote} FWINFO ${quote} +MSG_JTAG_PROGRAM := ${quote} JTAG-PGM ${quote} +MSG_JTAG_WIPE := ${quote} JTAG-WIPE ${quote} toprel = $(subst $(realpath $(TOP))/,,$(abspath $(1))) @@ -96,6 +98,9 @@ gccversion : $(V1) $(NM) -n $< > $@ define SIZE_TEMPLATE +.PHONY: size +size: $(1)_size + .PHONY: $(1)_size $(1)_size: $(1) @echo $(MSG_SIZE) $$(call toprel, $$<) @@ -191,21 +196,48 @@ $($(1):.c=.s) : %.s : %.c $(V1) $(CC) -S $$(CFLAGS) $$(CONLYFLAGS) $$< -o $$@ endef +# $(1) = Name of binary image to write +# $(2) = Base of flash region to write/wipe +# $(3) = Size of flash region to write/wipe +define JTAG_TEMPLATE # --------------------------------------------------------------------------- # Options for OpenOCD flash-programming # see openocd.pdf/openocd.texi for further information # if OpenOCD is in the $PATH just set OPENOCDEXE=openocd -OOCD_EXE=openocd +OOCD_EXE ?= openocd + # debug level -OOCD_CL=-d0 +OOCD_JTAG_SETUP = -d0 # interface and board/target settings (using the OOCD target-library here) -OOCD_CL+=-s $(TOP)/flight/Project/OpenOCD -OOCD_CL+=-f foss-jtag.revb.cfg -f stm32.cfg +OOCD_JTAG_SETUP += -s $(TOP)/flight/Project/OpenOCD +OOCD_JTAG_SETUP += -f foss-jtag.revb.cfg -f stm32.cfg # initialize -OOCD_CL+=-c init +OOCD_BOARD_RESET = -c init # show the targets -OOCD_CL+=-c targets +#OOCD_BOARD_RESET += -c targets # commands to prepare flash-write -OOCD_CL+= -c "reset halt" +OOCD_BOARD_RESET += -c "reset halt" + +.PHONY: program +program: $(1) + @echo $(MSG_JTAG_PROGRAM) $$(call toprel, $$<) + $(V1) $(OOCD_EXE) \ + $$(OOCD_JTAG_SETUP) \ + $$(OOCD_BOARD_RESET) \ + -c "flash write_image erase $$< $(2) bin" \ + -c "verify_image $$< $(2) bin" \ + -c "reset run" \ + -c "shutdown" + +.PHONY: wipe +wipe: + @echo $(MSG_JTAG_WIPE) wiping $(3) bytes starting from $(2) + $(V1) $(OOCD_EXE) \ + $$(OOCD_JTAG_SETUP) \ + $$(OOCD_BOARD_RESET) \ + -c "flash erase_address pad $(2) $(3)" \ + -c "reset run" \ + -c "shutdown" +endef \ No newline at end of file