diff --git a/Makefile b/Makefile index fd8ed8aa4..8fe8b39db 100644 --- a/Makefile +++ b/Makefile @@ -200,7 +200,9 @@ arm_sdk_clean: $(V1) [ ! -d "$(ARM_SDK_DIR)" ] || $(RM) -r $(ARM_SDK_DIR) # Set up openocd tools -OPENOCD_DIR := $(TOOLS_DIR)/openocd +OPENOCD_DIR := $(TOOLS_DIR)/openocd +OPENOCD_WIN_DIR := $(TOOLS_DIR)/openocd_win +OPENOCD_BUILD_DIR := $(DL_DIR)/openocd-build .PHONY: openocd_install openocd_install: | $(DL_DIR) $(TOOLS_DIR) @@ -211,42 +213,139 @@ openocd_install: openocd_clean $(V1) wget -N -P "$(DL_DIR)" --trust-server-name "$(OPENOCD_URL)" # extract the source - $(V1) [ ! -d "$(DL_DIR)/openocd-build" ] || $(RM) -r "$(DL_DIR)/openocd-build" - $(V1) mkdir -p "$(DL_DIR)/openocd-build" - $(V1) tar -C $(DL_DIR)/openocd-build -xjf "$(DL_DIR)/$(OPENOCD_FILE)" + $(V1) [ ! -d "$(OPENOCD_BUILD_DIR)" ] || $(RM) -r "$(OPENOCD_BUILD_DIR)" + $(V1) mkdir -p "$(OPENOCD_BUILD_DIR)" + $(V1) tar -C $(OPENOCD_BUILD_DIR) -xjf "$(DL_DIR)/$(OPENOCD_FILE)" # build and install $(V1) mkdir -p "$(OPENOCD_DIR)" $(V1) ( \ - cd $(DL_DIR)/openocd-build/openocd-0.5.0 ; \ + cd $(OPENOCD_BUILD_DIR)/openocd-0.5.0 ; \ ./configure --prefix="$(OPENOCD_DIR)" --enable-ft2232_libftdi --enable-buspirate; \ $(MAKE) --silent ; \ $(MAKE) --silent install ; \ ) # delete the extracted source when we're done - $(V1) [ ! -d "$(DL_DIR)/openocd-build" ] || $(RM) -rf "$(DL_DIR)/openocd-build" + $(V1) [ ! -d "$(OPENOCD_BUILD_DIR)" ] || $(RM) -rf "$(OPENOCD_BUILD_DIR)" + +.PHONY: ftd2xx_install + +FTD2XX_DIR := $(DL_DIR)/ftd2xx + +ftd2xx_install: | $(DL_DIR) +ftd2xx_install: FTD2XX_URL := http://www.ftdichip.com/Drivers/CDM/Beta/CDM20817.zip +ftd2xx_install: FTD2XX_FILE := CDM20817.zip +ftd2xx_install: ftd2xx_clean + # download the file only if it's newer than what we already have + $(V0) @echo " DOWNLOAD $(FTD2XX_URL)" + $(V1) wget -q -N -P "$(DL_DIR)" "$(FTD2XX_URL)" + + # extract the source + $(V0) @echo " EXTRACT $(FTD2XX_FILE) -> $(FTD2XX_DIR)" + $(V1) mkdir -p "$(FTD2XX_DIR)" + $(V1) unzip -q -d "$(FTD2XX_DIR)" "$(DL_DIR)/$(FTD2XX_FILE)" + +.PHONY: ftd2xx_clean +ftd2xx_clean: + $(V0) @echo " CLEAN $(FTD2XX_DIR)" + $(V1) [ ! -d "$(FTD2XX_DIR)" ] || $(RM) -r "$(FTD2XX_DIR)" + +.PHONY: ftd2xx_install + +LIBUSB_WIN_DIR := $(DL_DIR)/libusb-win32-bin-1.2.6.0 + +libusb_win_install: | $(DL_DIR) +libusb_win_install: LIBUSB_WIN_URL := http://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.6.0/libusb-win32-bin-1.2.6.0.zip/download +libusb_win_install: LIBUSB_WIN_FILE := libusb-win32-bin-1.2.6.0.zip +libusb_win_install: libusb_win_clean + # download the file only if it's newer than what we already have + $(V0) @echo " DOWNLOAD $(LIBUSB_WIN_URL)" + $(V1) wget -q -N -P "$(DL_DIR)" --trust-server-name "$(LIBUSB_WIN_URL)" + + # extract the source + $(V0) @echo " EXTRACT $(LIBUSB_WIN_FILE) -> $(LIBUSB_WIN_DIR)" + $(V1) mkdir -p "$(LIBUSB_WIN_DIR)" + $(V1) unzip -q -d "$(DL_DIR)" "$(DL_DIR)/$(LIBUSB_WIN_FILE)" + + # fixup .h file needed by openocd build + $(V0) @echo " FIXUP $(LIBUSB_WIN_DIR)" + $(V1) ln -s "$(LIBUSB_WIN_DIR)/include/lusb0_usb.h" "$(LIBUSB_WIN_DIR)/include/usb.h" + +.PHONY: libusb_win_clean +libusb_win_clean: + $(V0) @echo " CLEAN $(LIBUSB_WIN_DIR)" + $(V1) [ ! -d "$(LIBUSB_WIN_DIR)" ] || $(RM) -r "$(LIBUSB_WIN_DIR)" + +.PHONY: openocd_git_win_install + +openocd_git_win_install: | $(DL_DIR) $(TOOLS_DIR) +openocd_git_win_install: OPENOCD_URL := git://openocd.git.sourceforge.net/gitroot/openocd/openocd +openocd_git_win_install: OPENOCD_REV := dec6b913809bd3f857af31be178ffde65e42dbab +openocd_git_win_install: openocd_win_clean libusb_win_install ftd2xx_install + # download the source + $(V0) @echo " DOWNLOAD $(OPENOCD_URL) @ $(OPENOCD_REV)" + $(V1) [ ! -d "$(OPENOCD_BUILD_DIR)" ] || $(RM) -rf "$(OPENOCD_BUILD_DIR)" + $(V1) mkdir -p "$(OPENOCD_BUILD_DIR)" + $(V1) git clone --depth 1 --no-checkout $(OPENOCD_URL) "$(DL_DIR)/openocd-build" + $(V1) ( \ + cd $(OPENOCD_BUILD_DIR) ; \ + git checkout -q $(OPENOCD_REV) ; \ + ) + + # apply patches + $(V0) @echo " PATCH $(OPENOCD_BUILD_DIR)" + $(V1) ( \ + cd $(OPENOCD_BUILD_DIR) ; \ + git apply < $(ROOT_DIR)/flight/Project/OpenOCD/0001-armv7m-remove-dummy-FP-regs-for-new-gdb.patch ; \ + git apply < $(ROOT_DIR)/flight/Project/OpenOCD/0002-rtos-add-stm32_stlink-to-FreeRTOS-targets.patch ; \ + ) + + # build and install + $(V0) @echo " BUILD $(OPENOCD_WIN_DIR)" + $(V1) mkdir -p "$(OPENOCD_WIN_DIR)" + $(V1) ( \ + cd $(OPENOCD_BUILD_DIR) ; \ + ./bootstrap ; \ + ./configure --enable-maintainer-mode --prefix="$(OPENOCD_WIN_DIR)" \ + --build=i686-pc-linux-gnu --host=i586-mingw32msvc \ + CPPFLAGS=-I$(LIBUSB_WIN_DIR)/include \ + LDFLAGS=-L$(LIBUSB_WIN_DIR)/lib/gcc \ + --enable-ft2232_ftd2xx --with-ftd2xx-win32-zipdir=$(FTD2XX_DIR) \ + --disable-werror \ + --enable-stlink ; \ + $(MAKE) ; \ + $(MAKE) install ; \ + ) + + # delete the extracted source when we're done + $(V1) [ ! -d "$(OPENOCD_BUILD_DIR)" ] || $(RM) -rf "$(OPENOCD_BUILD_DIR)" + +.PHONY: openocd_win_clean +openocd_win_clean: + $(V0) @echo " CLEAN $(OPENOCD_WIN_DIR)" + $(V1) [ ! -d "$(OPENOCD_WIN_DIR)" ] || $(RM) -r "$(OPENOCD_WIN_DIR)" .PHONY: openocd_git_install openocd_git_install: | $(DL_DIR) $(TOOLS_DIR) openocd_git_install: OPENOCD_URL := git://openocd.git.sourceforge.net/gitroot/openocd/openocd -openocd_git_install: OPENOCD_REV := bce7009e31b23250d4325637c7b7cdbae0efed9a +openocd_git_install: OPENOCD_REV := dec6b913809bd3f857af31be178ffde65e42dbab openocd_git_install: openocd_clean # download the source $(V0) @echo " DOWNLOAD $(OPENOCD_URL) @ $(OPENOCD_REV)" - $(V1) [ ! -d "$(DL_DIR)/openocd-build" ] || $(RM) -rf "$(DL_DIR)/openocd-build" - $(V1) mkdir -p "$(DL_DIR)/openocd-build" - $(V1) git clone --depth 1 --no-checkout $(OPENOCD_URL) "$(DL_DIR)/openocd-build" + $(V1) [ ! -d "$(OPENOCD_BUILD_DIR)" ] || $(RM) -rf "$(OPENOCD_BUILD_DIR)" + $(V1) mkdir -p "$(OPENOCD_BUILD_DIR)" + $(V1) git clone --depth 1 --no-checkout $(OPENOCD_URL) "$(OPENOCD_BUILD_DIR)" $(V1) ( \ - cd $(DL_DIR)/openocd-build ; \ + cd $(OPENOCD_BUILD_DIR) ; \ git checkout -q $(OPENOCD_REV) ; \ ) # apply patches $(V0) @echo " PATCH $(OPENOCD_DIR)" $(V1) ( \ - cd $(DL_DIR)/openocd-build ; \ + cd $(OPENOCD_BUILD_DIR) ; \ git apply < $(ROOT_DIR)/flight/Project/OpenOCD/0001-armv7m-remove-dummy-FP-regs-for-new-gdb.patch ; \ git apply < $(ROOT_DIR)/flight/Project/OpenOCD/0002-rtos-add-stm32_stlink-to-FreeRTOS-targets.patch ; \ ) @@ -255,7 +354,7 @@ openocd_git_install: openocd_clean $(V0) @echo " BUILD $(OPENOCD_DIR)" $(V1) mkdir -p "$(OPENOCD_DIR)" $(V1) ( \ - cd $(DL_DIR)/openocd-build ; \ + cd $(OPENOCD_BUILD_DIR) ; \ ./bootstrap ; \ ./configure --enable-maintainer-mode --prefix="$(OPENOCD_DIR)" --enable-ft2232_libftdi --enable-buspirate --enable-stlink ; \ $(MAKE) ; \ @@ -263,7 +362,7 @@ openocd_git_install: openocd_clean ) # delete the extracted source when we're done - $(V1) [ ! -d "$(DL_DIR)/openocd-build" ] || $(RM) -r "$(DL_DIR)/openocd-build" + $(V1) [ ! -d "$(OPENOCD_BUILD_DIR)" ] || $(RM) -rf "$(OPENOCD_BUILD_DIR)" .PHONY: openocd_clean openocd_clean: diff --git a/flight/Bootloaders/CopterControl/Makefile b/flight/Bootloaders/CopterControl/Makefile index b24d210da..d52541791 100644 --- a/flight/Bootloaders/CopterControl/Makefile +++ b/flight/Bootloaders/CopterControl/Makefile @@ -414,7 +414,7 @@ $(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),$(OPENOCD_CONFIG))) +$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BL_BANK_BASE),$(BL_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG))) .PHONY: elf lss sym hex bin bino elf: $(OUTDIR)/$(TARGET).elf diff --git a/flight/Bootloaders/PipXtreme/Makefile b/flight/Bootloaders/PipXtreme/Makefile index 5a788e7e6..8711ccbd9 100644 --- a/flight/Bootloaders/PipXtreme/Makefile +++ b/flight/Bootloaders/PipXtreme/Makefile @@ -418,7 +418,7 @@ $(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),$(OPENOCD_CONFIG))) +$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BL_BANK_BASE),$(BL_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG))) .PHONY: elf lss sym hex bin bino elf: $(OUTDIR)/$(TARGET).elf diff --git a/flight/Bootloaders/Revolution/Makefile b/flight/Bootloaders/Revolution/Makefile index b058a4c2c..be2ade0e3 100644 --- a/flight/Bootloaders/Revolution/Makefile +++ b/flight/Bootloaders/Revolution/Makefile @@ -328,7 +328,7 @@ $(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin $(eval $(call OPFW_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BOARD_TYPE),$(BOARD_REVISION))) # Add jtag targets (program and wipe) -$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BL_BANK_BASE),$(BL_BANK_SIZE),$(OPENOCD_CONFIG))) +$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BL_BANK_BASE),$(BL_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG))) .PHONY: elf lss sym hex bin bino elf: $(OUTDIR)/$(TARGET).elf diff --git a/flight/CopterControl/Makefile b/flight/CopterControl/Makefile index 71e487997..796d34e8d 100644 --- a/flight/CopterControl/Makefile +++ b/flight/CopterControl/Makefile @@ -583,7 +583,7 @@ $(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin $(eval $(call OPFW_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),$(OPENOCD_CONFIG))) +$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(FW_BANK_BASE),$(FW_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG))) .PHONY: elf lss sym hex bin bino opfw elf: $(OUTDIR)/$(TARGET).elf diff --git a/flight/PipXtreme/Makefile b/flight/PipXtreme/Makefile index a21fdb74a..8c18afcbd 100644 --- a/flight/PipXtreme/Makefile +++ b/flight/PipXtreme/Makefile @@ -392,7 +392,7 @@ $(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin $(eval $(call OPFW_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),$(OPENOCD_CONFIG))) +$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(FW_BANK_BASE),$(FW_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG))) .PHONY: elf lss sym hex bin bino opfw elf: $(OUTDIR)/$(TARGET).elf diff --git a/flight/Project/OpenOCD/0001-armv7m-remove-dummy-FP-regs-for-new-gdb.patch b/flight/Project/OpenOCD/0001-armv7m-remove-dummy-FP-regs-for-new-gdb.patch index d5f8e8374..85db22e44 100644 --- a/flight/Project/OpenOCD/0001-armv7m-remove-dummy-FP-regs-for-new-gdb.patch +++ b/flight/Project/OpenOCD/0001-armv7m-remove-dummy-FP-regs-for-new-gdb.patch @@ -1,58 +1,58 @@ -From 7a8a1dbf856a2183c91f441cfdd2eee5b3d9151b Mon Sep 17 00:00:00 2001 +From 8fd5040df32511f57b898bdbff412f61fbe28516 Mon Sep 17 00:00:00 2001 From: Stacey Sheldon Date: Thu, 2 Feb 2012 22:42:03 -0500 Subject: [PATCH 1/2] armv7m: remove dummy FP regs for new gdb --- - src/rtos/rtos_standard_stackings.c | 6 ++++++ + src/rtos/rtos_standard_stackings.c | 7 +++++++ src/target/armv7m.c | 16 ++++++++++++++++ - 2 files changed, 22 insertions(+), 0 deletions(-) + 2 files changed, 23 insertions(+), 0 deletions(-) diff --git a/src/rtos/rtos_standard_stackings.c b/src/rtos/rtos_standard_stackings.c -index 278d3ef..7ef4659 100644 +index 30d9cd9..6ea6565 100644 --- a/src/rtos/rtos_standard_stackings.c +++ b/src/rtos/rtos_standard_stackings.c @@ -41,6 +41,7 @@ static const struct stack_register_offset rtos_standard_Cortex_M3_stack_offsets[ - { -2, 32 }, /* sp */ - { 0x34, 32 }, /* lr */ - { 0x38, 32 }, /* pc */ + { -2, 32 }, /* sp */ + { 0x34, 32 }, /* lr */ + { 0x38, 32 }, /* pc */ +#ifdef USE_DUMMY_FP_REGS - { -1, 96 }, /* FPA1 */ - { -1, 96 }, /* FPA2 */ - { -1, 96 }, /* FPA3 */ -@@ -50,6 +51,7 @@ static const struct stack_register_offset rtos_standard_Cortex_M3_stack_offsets[ - { -1, 96 }, /* FPA7 */ - { -1, 96 }, /* FPA8 */ - { -1, 32 }, /* FPS */ + { -1, 96 }, /* FPA1 */ + { -1, 96 }, /* FPA2 */ + { -1, 96 }, /* FPA3 */ +@@ -50,13 +51,19 @@ static const struct stack_register_offset rtos_standard_Cortex_M3_stack_offsets[ + { -1, 96 }, /* FPA7 */ + { -1, 96 }, /* FPA8 */ + { -1, 32 }, /* FPS */ +#endif - { 0x3c, 32 }, /* xPSR */ + { 0x3c, 32 }, /* xPSR */ }; -@@ -58,7 +60,11 @@ const struct rtos_register_stacking rtos_standard_Cortex_M3_stacking = - { - 0x40, /* stack_registers_size */ - -1, /* stack_growth_direction */ ++ + const struct rtos_register_stacking rtos_standard_Cortex_M3_stacking = { + 0x40, /* stack_registers_size */ + -1, /* stack_growth_direction */ +#ifdef USE_DUMMY_FP_REGS - 26, /* num_output_registers */ + 26, /* num_output_registers */ +#else + 17, +#endif - 8, /* stack_alignment */ - rtos_standard_Cortex_M3_stack_offsets /* register_offsets */ + 8, /* stack_alignment */ + rtos_standard_Cortex_M3_stack_offsets /* register_offsets */ }; diff --git a/src/target/armv7m.c b/src/target/armv7m.c -index 6c1732e..7bb53c7 100644 +index 258653e..50b26d4 100644 --- a/src/target/armv7m.c +++ b/src/target/armv7m.c -@@ -272,6 +272,7 @@ int armv7m_get_gdb_reg_list(struct target *target, struct reg **reg_list[], int +@@ -267,6 +267,7 @@ int armv7m_get_gdb_reg_list(struct target *target, struct reg **reg_list[], int struct armv7m_common *armv7m = target_to_armv7m(target); int i; +#ifdef USE_DUMMY_FP_REGS *reg_list_size = 26; - *reg_list = malloc(sizeof(struct reg*) * (*reg_list_size)); + *reg_list = malloc(sizeof(struct reg *) * (*reg_list_size)); -@@ -302,6 +303,21 @@ int armv7m_get_gdb_reg_list(struct target *target, struct reg **reg_list[], int +@@ -295,6 +296,21 @@ int armv7m_get_gdb_reg_list(struct target *target, struct reg **reg_list[], int (*reg_list)[25] = &armv7m->core_cache->reg_list[ARMV7M_xPSR]; #endif diff --git a/flight/Project/OpenOCD/0002-rtos-add-stm32_stlink-to-FreeRTOS-targets.patch b/flight/Project/OpenOCD/0002-rtos-add-stm32_stlink-to-FreeRTOS-targets.patch index b0a3ac65c..f299c7ff2 100644 --- a/flight/Project/OpenOCD/0002-rtos-add-stm32_stlink-to-FreeRTOS-targets.patch +++ b/flight/Project/OpenOCD/0002-rtos-add-stm32_stlink-to-FreeRTOS-targets.patch @@ -1,34 +1,35 @@ -From fceb681b4421dd00eb47085990b77c0f0716517d Mon Sep 17 00:00:00 2001 +From e29b134e142cd759c85de4ea7c26084e87380ce1 Mon Sep 17 00:00:00 2001 From: Stacey Sheldon Date: Thu, 2 Feb 2012 22:42:26 -0500 Subject: [PATCH 2/2] rtos: add stm32_stlink to FreeRTOS targets --- - src/rtos/FreeRTOS.c | 11 +++++++++++ - 1 files changed, 11 insertions(+), 0 deletions(-) + src/rtos/FreeRTOS.c | 12 ++++++++++++ + 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/src/rtos/FreeRTOS.c b/src/rtos/FreeRTOS.c -index eeab134..e57806e 100644 +index c7b4643..e99d471 100644 --- a/src/rtos/FreeRTOS.c +++ b/src/rtos/FreeRTOS.c -@@ -63,6 +63,17 @@ const struct FreeRTOS_params FreeRTOS_params_list[] = - 0, // thread_stack_offset; - 52, // thread_name_offset; - &rtos_standard_Cortex_M3_stacking, // stacking_info -+ }, -+ { "stm32_stlink", // target_name -+ 4, // thread_count_width; -+ 4, // pointer_width; -+ 16, // list_next_offset; -+ 20, // list_width; -+ 8, // list_elem_next_offset; -+ 12, // list_elem_content_offset -+ 0, // thread_stack_offset; -+ 52, // thread_name_offset; -+ &rtos_standard_Cortex_M3_stacking, // stacking_info - } - +@@ -57,6 +57,18 @@ const struct FreeRTOS_params FreeRTOS_params_list[] = { + 0, /* thread_stack_offset; */ + 52, /* thread_name_offset; */ + &rtos_standard_Cortex_M3_stacking, /* stacking_info */ ++ }, ++ { ++ "stm32_stlink", /* target_name */ ++ 4, /* thread_count_width; */ ++ 4, /* pointer_width; */ ++ 16, /* list_next_offset; */ ++ 20, /* list_width; */ ++ 8, /* list_elem_next_offset; */ ++ 12, /* list_elem_content_offset */ ++ 0, /* thread_stack_offset; */ ++ 52, /* thread_name_offset; */ ++ &rtos_standard_Cortex_M3_stacking, /* stacking_info */ + } }; + -- 1.7.1 diff --git a/flight/Project/OpenOCD/stm32f4xx.stlink.cfg b/flight/Project/OpenOCD/stm32f4xx.stlink.cfg index 04f8958e2..3d55f6da5 100644 --- a/flight/Project/OpenOCD/stm32f4xx.stlink.cfg +++ b/flight/Project/OpenOCD/stm32f4xx.stlink.cfg @@ -30,5 +30,5 @@ target create $_TARGETNAME stm32_stlink -chain-position $_TARGETNAME -rtos auto $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0 -#set _FLASHNAME $_CHIPNAME.flash -#flash bank $_FLASHNAME stm32f2x 0x08000000 0 0 0 $_TARGETNAME +set _FLASHNAME $_CHIPNAME.flash +flash bank $_FLASHNAME stm32f2x 0x08000000 0 0 0 $_TARGETNAME diff --git a/flight/Revolution/Makefile b/flight/Revolution/Makefile index 1545d7b33..f627b97d8 100644 --- a/flight/Revolution/Makefile +++ b/flight/Revolution/Makefile @@ -419,7 +419,7 @@ $(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin $(eval $(call OPFW_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),$(OPENOCD_CONFIG))) +$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(FW_BANK_BASE),$(FW_BANK_SIZE),$(OPENOCD_JTAG_CONFIG),$(OPENOCD_CONFIG))) .PHONY: elf lss sym hex bin bino opfw elf: $(OUTDIR)/$(TARGET).elf diff --git a/make/boards/coptercontrol/board-info.mk b/make/boards/coptercontrol/board-info.mk index 7369ad788..dcad2f43e 100644 --- a/make/boards/coptercontrol/board-info.mk +++ b/make/boards/coptercontrol/board-info.mk @@ -9,6 +9,7 @@ BOARD := STM32103CB_CC_Rev1 MODEL := MD MODEL_SUFFIX := _CC +OPENOCD_JTAG_CONFIG := foss-jtag.revb.cfg OPENOCD_CONFIG := stm32f1x.cfg # Note: These must match the values in link_$(BOARD)_memory.ld diff --git a/make/boards/pipxtreme/board-info.mk b/make/boards/pipxtreme/board-info.mk index dbcb314df..19d05baf9 100644 --- a/make/boards/pipxtreme/board-info.mk +++ b/make/boards/pipxtreme/board-info.mk @@ -9,6 +9,9 @@ BOARD := STM32103CB_PIPXTREME MODEL := MD MODEL_SUFFIX := +OPENOCD_JTAG_CONFIG := foss-jtag.revb.cfg +OPENOCD_CONFIG := stm32f1x.cfg + # Note: These must match the values in link_$(BOARD)_memory.ld BL_BANK_BASE := 0x08000000 # Start of bootloader flash BL_BANK_SIZE := 0x00003000 # Should include BD_INFO region diff --git a/make/boards/revolution/board-info.mk b/make/boards/revolution/board-info.mk index b2e1002ea..ef1ce081f 100644 --- a/make/boards/revolution/board-info.mk +++ b/make/boards/revolution/board-info.mk @@ -9,7 +9,8 @@ BOARD := STM32F4xx_OP MODEL := HD MODEL_SUFFIX := -OPENOCD_CONFIG := stm32f4xx.cfg +OPENOCD_JTAG_CONFIG := stlink-v2.cfg +OPENOCD_CONFIG := stm32f4xx.stlink.cfg # Note: These must match the values in link_$(BOARD)_memory.ld BL_BANK_BASE := 0x08000000 # Start of bootloader flash diff --git a/make/firmware-defs.mk b/make/firmware-defs.mk index 2eb0a13d8..087792b45 100644 --- a/make/firmware-defs.mk +++ b/make/firmware-defs.mk @@ -203,7 +203,8 @@ endef # $(1) = Name of binary image to write # $(2) = Base of flash region to write/wipe # $(3) = Size of flash region to write/wipe -# $(4) = OpenOCD configuration file to use +# $(4) = OpenOCD JTAG interface configuration file to use +# $(5) = OpenOCD configuration file to use define JTAG_TEMPLATE # --------------------------------------------------------------------------- # Options for OpenOCD flash-programming @@ -216,7 +217,7 @@ OOCD_EXE ?= openocd OOCD_JTAG_SETUP = -d0 # interface and board/target settings (using the OOCD target-library here) OOCD_JTAG_SETUP += -s $(TOP)/flight/Project/OpenOCD -OOCD_JTAG_SETUP += -f foss-jtag.revb.cfg -f $(4) +OOCD_JTAG_SETUP += -f $(4) -f $(5) # initialize OOCD_BOARD_RESET = -c init