From: Xavier L. <Ba...@us...> - 2012-05-15 11:54:30
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 7e52949ac9a86441f90a1066ffa97cab74d46bc8 (commit) from 73a9d3f6a300ae96cc23d523d57126f1885c1fbc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7e52949ac9a86441f90a1066ffa97cab74d46bc8 Author: Xavier Lagorce <Xav...@cr...> Date: Tue May 15 13:53:59 2012 +0200 [Sensor_actuator] jtag flashing script ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/jtag/flash.cfg b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/jtag/flash.cfg new file mode 100644 index 0000000..da25c23 --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/jtag/flash.cfg @@ -0,0 +1,8 @@ +jtag_khz 1000 +init +reset halt +stm32f1x mass_erase 0 +flash write_bank 0 fw.bin 0 +reset init +reset run +shutdown diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/jtag/flash.mk b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/jtag/flash.mk new file mode 100644 index 0000000..a2a35bb --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/jtag/flash.mk @@ -0,0 +1,8 @@ +# rule to flash the firmware + +flash: size + @cp $(BUILDDIR)/$(PROJECT).bin jtag/fw.bin + @cd jtag; openocd -f openocd.cfg -f flash.cfg + @rm jtag/fw.bin + +# *** EOF *** diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/jtag/flash.sh b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/jtag/flash.sh new file mode 100755 index 0000000..aacb0a8 --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/jtag/flash.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +file=images/*.bin +cp $file jtag/fw.bin +cd jtag +openocd -f openocd.cfg -f flash.cfg +rm -f fw.bin + diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/jtag/openocd.cfg b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/jtag/openocd.cfg new file mode 100644 index 0000000..0e09b2b --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/jtag/openocd.cfg @@ -0,0 +1,84 @@ +# +# Olimex ARM-USB-OCD +# +# http://www.olimex.com/dev/arm-usb-ocd.html +# + +interface ft2232 +ft2232_device_desc "Olimex OpenOCD JTAG" +ft2232_layout olimex-jtag +ft2232_vid_pid 0x15ba 0x0003 + +# script for stm32 + +if { [info exists CHIPNAME] } { + set _CHIPNAME $CHIPNAME +} else { + set _CHIPNAME stm32 +} + +if { [info exists ENDIAN] } { + set _ENDIAN $ENDIAN +} else { + set _ENDIAN little +} + +# Work-area is a space in RAM used for flash programming +# Use the correct size for the card +set WORKAREASIZE 0xF000 + +# By default use 16kB +if { [info exists WORKAREASIZE] } { + set _WORKAREASIZE $WORKAREASIZE +} else { + set _WORKAREASIZE 0x4000 +} + +# JTAG speed should be <= F_CPU/6. F_CPU after reset is 8MHz, so use F_JTAG = 1MHz +jtag_khz 1000 + +jtag_nsrst_delay 100 +jtag_ntrst_delay 100 + +#jtag scan chain +if { [info exists CPUTAPID ] } { + set _CPUTAPID $CPUTAPID +} else { + # See STM Document RM0008 + # Section 26.6.3 + set _CPUTAPID 0x3ba00477 +} +jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID + +if { [info exists BSTAPID ] } { + # FIXME this never gets used to override defaults... + set _BSTAPID $BSTAPID +} else { + # See STM Document RM0008 + # Section 29.6.2 + # Low density devices, Rev A + set _BSTAPID1 0x06412041 + # Medium density devices, Rev A + set _BSTAPID2 0x06410041 + # Medium density devices, Rev B and Rev Z + set _BSTAPID3 0x16410041 + # High density devices, Rev A + set _BSTAPID4 0x06414041 + # Connectivity line devices, Rev A and Rev Z + set _BSTAPID5 0x06418041 +} +jtag newtap $_CHIPNAME bs -irlen 5 -expected-id $_BSTAPID1 \ + -expected-id $_BSTAPID2 -expected-id $_BSTAPID3 \ + -expected-id $_BSTAPID4 -expected-id $_BSTAPID5 + +set _TARGETNAME $_CHIPNAME.cpu +target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNAME + +$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0 + +set _FLASHNAME $_CHIPNAME.flash +flash bank $_FLASHNAME stm32f1x 0 0 0 0 $_TARGETNAME + +# For more information about the configuration files, take a look at: +# openocd.texi + diff --git a/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/jtag/target.ini b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/jtag/target.ini new file mode 100644 index 0000000..da18158 --- /dev/null +++ b/elec/boards/Sensor_Actuator/Firmware/sensor_actuator/jtag/target.ini @@ -0,0 +1,93 @@ +# +# GDB init file for STM32x family +# + +set complaints 1 +set output-radix 16 +set input-radix 16 + +# GDB must be set to big endian mode first if needed. +#set endian little + +# add str9lib src to gdb search path +#dir /cygdrive/c/progra~1/anglia/idealist/examples/stm32/libstr32x/src +#dir C:/Progra~1/Anglia/IDEaliST/examples/stm32/libstm32x/src + +# change gdb prompt +set prompt (arm-gdb) + +# You will need to change this to reflect the address of your jtag interface. +#target remote localhost:2000 + +# The libremote daemon must be set to big endian before the +# executable is loaded. +#monitor endian little + +# Increase the packet size to improve download speed. +# to view current setting use: +# show remote memory-write-packet-size + +set remote memory-write-packet-size 1024 +set remote memory-write-packet-size fixed + +set remote memory-read-packet-size 1024 +set remote memory-read-packet-size fixed +set remote hardware-watchpoint-limit 6 +set remote hardware-breakpoint-limit 6 + +# Load the program executable (ram only) +#load + +# Set a breakpoint at main(). +#b main + +# Run to the breakpoint. +#c + +# +# GDB command helpers +# + +# +# reset and map 0 to internal ram +# + +define ramreset +reset +set *(int*)0xE000ED08 = 0x20000000 +echo Internal RAM set to address 0x0. +end + +# +# reset and map 0 to flash +# + +define flashreset +reset +thb main +echo Internal Flash set to address 0x0. +end + +# +# reset target +# + +define reset +monitor reset +end + +document ramreset +ramreset +Causes a target reset, remaps Internal RAM to address 0x0. +end + +document flashreset +flashreset +Causes a target reset, remaps Internal Flash to address 0x0. +A temporary breakpoint is set at start of function main +end + +document reset +reset +Causes a target reset. +end hooks/post-receive -- krobot |