From 4b94981fcfe9e893527ed913fe903902be1d2c4a Mon Sep 17 00:00:00 2001 From: lottaviano Date: Thu, 27 Aug 2009 09:17:49 +0000 Subject: [PATCH] Update 'make flash' support for ARM chips. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2788 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/cpu/arm/scripts/flash.sh | 13 ++++++++++--- .../arm/scripts/openocd/{cpu.tcl => at91sam7.cfg} | 14 +++----------- bertos/cpu/arm/scripts/openocd/flash.cfg | 8 ++++++++ .../openocd/{interface.tcl => jtag-tiny.cfg} | 0 4 files changed, 21 insertions(+), 14 deletions(-) rename bertos/cpu/arm/scripts/openocd/{cpu.tcl => at91sam7.cfg} (87%) rename bertos/cpu/arm/scripts/openocd/{interface.tcl => jtag-tiny.cfg} (100%) diff --git a/bertos/cpu/arm/scripts/flash.sh b/bertos/cpu/arm/scripts/flash.sh index 998cf4be..a1eb3a3a 100755 --- a/bertos/cpu/arm/scripts/flash.sh +++ b/bertos/cpu/arm/scripts/flash.sh @@ -2,8 +2,9 @@ set -x BASE_DIR=`dirname $0` -INT_FILE=${BASE_DIR}/openocd/${PROGRAMMER_TYPE}.tcl -CPU_FILE=${BASE_DIR}/openocd/${PROGRAMMER_CPU}.tcl +INT_FILE=${BASE_DIR}/openocd/${PROGRAMMER_TYPE}.cfg +CPU_FILE=${BASE_DIR}/openocd/${PROGRAMMER_CPU}.cfg +OUT_FILE="openocd.tmp" if [ ! -f ${INT_FILE} ]; then printf "Interface ${PROGRAMMER_TYPE} not supported\n"; @@ -15,4 +16,10 @@ if [ ! -f ${CPU_FILE} ]; then exit 1; fi -sed -e "s#PROGRAMMER_TYPE#${INT_FILE}#" ${BASE_DIR}/openocd/flash.cfg | sed -e "s#PROGRAMMER_CPU#${CPU_FILE}#" > openocd.tmp +sed -e "s#PROGRAMMER_TYPE#${INT_FILE}#" ${BASE_DIR}/openocd/flash.cfg | sed -e "s#PROGRAMMER_CPU#${CPU_FILE}#" \ + | sed -e "s#IMAGE_FILE#${IMAGE_FILE}#" > ${OUT_FILE} + +openocd -f ${OUT_FILE} +OCD_RET=$? +rm -f ${OUT_FILE} +exit $OCD_RET diff --git a/bertos/cpu/arm/scripts/openocd/cpu.tcl b/bertos/cpu/arm/scripts/openocd/at91sam7.cfg similarity index 87% rename from bertos/cpu/arm/scripts/openocd/cpu.tcl rename to bertos/cpu/arm/scripts/openocd/at91sam7.cfg index 5d5dad63..a20eafa3 100644 --- a/bertos/cpu/arm/scripts/openocd/cpu.tcl +++ b/bertos/cpu/arm/scripts/openocd/at91sam7.cfg @@ -24,8 +24,8 @@ jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CP set _TARGETNAME [format "%s.cpu" $_CHIPNAME] target create $_TARGETNAME arm7tdmi -endian $_ENDIAN -chain-position $_TARGETNAME -variant arm7tdmi -$_TARGETNAME configure -event reset-start [ - halt +proc cpu_setup {} { + soft_reset_halt sleep 10 arm7_9 dcc_downloads enable @@ -45,15 +45,7 @@ $_TARGETNAME configure -event reset-start [ mww 0xffffff60 0x003c0100 # MC_FMR: flash mode (FWS=1,FMCN=60) # arm7_9 force_hw_bkpts enable # program resides in flash sleep 10 - - poll - flash probe 0 - flash write_image IMAGE_FILE 0x0100000 bin -] - -#"script at91sam7_write_to_flash.script" - -$_TARGETNAME configure -event reset-end "shutdown" +} $_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x00200000 -work-area-size 0x4000 -work-area-backup 0 diff --git a/bertos/cpu/arm/scripts/openocd/flash.cfg b/bertos/cpu/arm/scripts/openocd/flash.cfg index f0e625a1..ad672e95 100644 --- a/bertos/cpu/arm/scripts/openocd/flash.cfg +++ b/bertos/cpu/arm/scripts/openocd/flash.cfg @@ -11,5 +11,13 @@ source [find PROGRAMMER_TYPE] source [find PROGRAMMER_CPU] +$_TARGETNAME configure -event reset-start { + cpu_setup + # this will work only with (intel) hex files, which have ROM address information + flash write_image IMAGE_FILE +} + +$_TARGETNAME configure -event reset-end "shutdown" + init reset run diff --git a/bertos/cpu/arm/scripts/openocd/interface.tcl b/bertos/cpu/arm/scripts/openocd/jtag-tiny.cfg similarity index 100% rename from bertos/cpu/arm/scripts/openocd/interface.tcl rename to bertos/cpu/arm/scripts/openocd/jtag-tiny.cfg -- 2.25.1