From 0fda8035c21f43a1ff6a4201cafb9c05ed7c1872 Mon Sep 17 00:00:00 2001 From: Stacey Sheldon Date: Sat, 17 Nov 2012 19:16:31 -0500 Subject: [PATCH] makefile: update to released openocd 0.6.1 --- Makefile | 16 +++++-- flight/Project/OpenOCD/stlink-v2.cfg | 11 ++--- flight/Project/OpenOCD/stm32f4xx.stlink.cfg | 47 ++++++++++++++++++--- 3 files changed, 59 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index b724e7c59..b03b2125a 100644 --- a/Makefile +++ b/Makefile @@ -228,8 +228,8 @@ OPENOCD_BUILD_DIR := $(DL_DIR)/openocd-build .PHONY: openocd_install openocd_install: | $(DL_DIR) $(TOOLS_DIR) -openocd_install: OPENOCD_URL := http://sourceforge.net/projects/openocd/files/openocd/0.5.0/openocd-0.5.0.tar.bz2/download -openocd_install: OPENOCD_FILE := openocd-0.5.0.tar.bz2 +openocd_install: OPENOCD_URL := http://sourceforge.net/projects/openocd/files/openocd/0.6.1/openocd-0.6.1.tar.bz2/download +openocd_install: OPENOCD_FILE := openocd-0.6.1.tar.bz2 openocd_install: openocd_clean # download the source only if it's newer than what we already have $(V1) wget -N -P "$(DL_DIR)" --trust-server-name "$(OPENOCD_URL)" @@ -239,11 +239,19 @@ openocd_install: openocd_clean $(V1) mkdir -p "$(OPENOCD_BUILD_DIR)" $(V1) tar -C $(OPENOCD_BUILD_DIR) -xjf "$(DL_DIR)/$(OPENOCD_FILE)" + # apply patches + $(V0) @echo " PATCH $(OPENOCD_DIR)" + $(V1) ( \ + cd $(OPENOCD_BUILD_DIR)/openocd-0.6.1 ; \ + patch -p1 < $(ROOT_DIR)/flight/Project/OpenOCD/0001-armv7m-remove-dummy-FP-regs-for-new-gdb.patch ; \ + patch -p1 < $(ROOT_DIR)/flight/Project/OpenOCD/0002-rtos-add-stm32_stlink-to-FreeRTOS-targets.patch ; \ + ) + # build and install $(V1) mkdir -p "$(OPENOCD_DIR)" $(V1) ( \ - cd $(OPENOCD_BUILD_DIR)/openocd-0.5.0 ; \ - ./configure --prefix="$(OPENOCD_DIR)" --enable-ft2232_libftdi ; \ + cd $(OPENOCD_BUILD_DIR)/openocd-0.6.1 ; \ + ./configure --prefix="$(OPENOCD_DIR)" --enable-ft2232_libftdi --enable-stlink ; \ $(MAKE) --silent ; \ $(MAKE) --silent install ; \ ) diff --git a/flight/Project/OpenOCD/stlink-v2.cfg b/flight/Project/OpenOCD/stlink-v2.cfg index c7f671477..585b1d92d 100644 --- a/flight/Project/OpenOCD/stlink-v2.cfg +++ b/flight/Project/OpenOCD/stlink-v2.cfg @@ -6,11 +6,12 @@ interface stlink stlink_layout usb stlink_device_desc "ST-LINK/V2" stlink_vid_pid 0x0483 0x3748 -# -# dummy values, not really needed -# -adapter_khz 1 -reset_config trst_and_srst + +# unused but set to disable warnings +adapter_khz 1000 + +#reset_config trst_and_srst +reset_config srst_only srst_nogate gdb_port 3333 tcl_port 6666 diff --git a/flight/Project/OpenOCD/stm32f4xx.stlink.cfg b/flight/Project/OpenOCD/stm32f4xx.stlink.cfg index 3d55f6da5..bae71ce74 100644 --- a/flight/Project/OpenOCD/stm32f4xx.stlink.cfg +++ b/flight/Project/OpenOCD/stm32f4xx.stlink.cfg @@ -1,27 +1,60 @@ # +# STM32f4x stlink pseudo target # + +if { [info exists CHIPNAME] == 0 } { + set CHIPNAME stm32f4x +} + +if { [info exists CPUTAPID] == 0 } { + set CPUTAPID 0x2ba01477 +} + +if { [info exists WORKAREASIZE] == 0 } { + set WORKAREASIZE 0x10000 +} + # +# stm32 stlink pseudo target +# + if { [info exists CHIPNAME] } { set _CHIPNAME $CHIPNAME } else { - set _CHIPNAME stm32f4x + set _CHIPNAME stm32f1x } # Work-area is a space in RAM used for flash programming -# By default use 64kB +# By default use 16kB if { [info exists WORKAREASIZE] } { set _WORKAREASIZE $WORKAREASIZE } else { - set _WORKAREASIZE 0x10000 + set _WORKAREASIZE 0x4000 } if { [info exists CPUTAPID] } { set _CPUTAPID $CPUTAPID } else { - set _CPUTAPID 0x2ba01477 + # this is the SW-DP tap id not the jtag tap id + set _CPUTAPID 0x1ba01477 } -transport select stlink_swd +if { [info exists TRANSPORT] } { + set _TRANSPORT $TRANSPORT + if { $TRANSPORT == "stlink_jtag" } { + if { [info exists CPUTAPID] == 0 } { + # jtag requires us to use the jtag tap id + set _CPUTAPID 0x3ba00477 + } + } +} else { + set _TRANSPORT stlink_swd +} + +# +# possibles value are stlink_swd or stlink_jtag +# +transport select $_TRANSPORT stlink newtap $_CHIPNAME cpu -expected-id $_CPUTAPID @@ -30,5 +63,7 @@ target create $_TARGETNAME stm32_stlink -chain-position $_TARGETNAME -rtos auto $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0 +# stm32f4x family uses stm32f2x driver set _FLASHNAME $_CHIPNAME.flash -flash bank $_FLASHNAME stm32f2x 0x08000000 0 0 0 $_TARGETNAME +flash bank $_FLASHNAME stm32f2x 0 0 0 0 $_TARGETNAME +