From 6abf03e019383ce5c269318dd72e9d237377cbe5 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@38d2e660-2303-0410-9eaa-f027e97ec537> Date: Wed, 26 Aug 2009 18:05:21 +0000 Subject: [PATCH] Move all Openocd-related files to separate folder; initial 'make flash' support for ARM CPUs. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2787 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/cpu/arm/scripts/flash.sh | 18 +++++++ .../scripts/{ => openocd}/at91sam7_new.gdb | 0 .../scripts/{ => openocd}/at91sam7_ram.gdb | 0 .../scripts/{ => openocd}/at91sam7_rom.gdb | 0 .../at91sam7_write_to_flash.script | 0 .../cpu.tcl} | 47 +++++++++++-------- bertos/cpu/arm/scripts/openocd/flash.cfg | 15 ++++++ bertos/cpu/arm/scripts/openocd/interface.tcl | 4 ++ .../openocd-0.2.0_at91sam7_gdb.cfg | 0 .../openocd-0.2.0_at91sam7_rom_flash.cfg | 17 +++++++ .../openocd_at91sam7_flash.script | 0 .../openocd_at91sam7_ftdi_ram.cfg | 0 .../openocd_at91sam7_ftdi_ram_win.cfg | 0 .../openocd_at91sam7_ftdi_rom.cfg | 0 .../openocd_at91sam7_ftdi_rom_win.cfg | 0 .../openocd_at91sam7_reset.script | 0 .../openocd_new_at91sam7_ftdi_ram.cfg | 0 .../openocd_new_at91sam7_ftdi_rom.cfg | 0 .../arm/scripts/{ => openocd}/openocd_ram.bat | 0 .../arm/scripts/{ => openocd}/openocd_rom.bat | 0 20 files changed, 82 insertions(+), 19 deletions(-) create mode 100755 bertos/cpu/arm/scripts/flash.sh rename bertos/cpu/arm/scripts/{ => openocd}/at91sam7_new.gdb (100%) rename bertos/cpu/arm/scripts/{ => openocd}/at91sam7_ram.gdb (100%) rename bertos/cpu/arm/scripts/{ => openocd}/at91sam7_rom.gdb (100%) rename bertos/cpu/arm/scripts/{ => openocd}/at91sam7_write_to_flash.script (100%) rename bertos/cpu/arm/scripts/{openocd-0.2.0_at91sam7_rom_flash.cfg => openocd/cpu.tcl} (54%) create mode 100644 bertos/cpu/arm/scripts/openocd/flash.cfg create mode 100644 bertos/cpu/arm/scripts/openocd/interface.tcl rename bertos/cpu/arm/scripts/{ => openocd}/openocd-0.2.0_at91sam7_gdb.cfg (100%) create mode 100644 bertos/cpu/arm/scripts/openocd/openocd-0.2.0_at91sam7_rom_flash.cfg rename bertos/cpu/arm/scripts/{ => openocd}/openocd_at91sam7_flash.script (100%) rename bertos/cpu/arm/scripts/{ => openocd}/openocd_at91sam7_ftdi_ram.cfg (100%) rename bertos/cpu/arm/scripts/{ => openocd}/openocd_at91sam7_ftdi_ram_win.cfg (100%) rename bertos/cpu/arm/scripts/{ => openocd}/openocd_at91sam7_ftdi_rom.cfg (100%) rename bertos/cpu/arm/scripts/{ => openocd}/openocd_at91sam7_ftdi_rom_win.cfg (100%) rename bertos/cpu/arm/scripts/{ => openocd}/openocd_at91sam7_reset.script (100%) rename bertos/cpu/arm/scripts/{ => openocd}/openocd_new_at91sam7_ftdi_ram.cfg (100%) rename bertos/cpu/arm/scripts/{ => openocd}/openocd_new_at91sam7_ftdi_rom.cfg (100%) rename bertos/cpu/arm/scripts/{ => openocd}/openocd_ram.bat (100%) rename bertos/cpu/arm/scripts/{ => openocd}/openocd_rom.bat (100%) diff --git a/bertos/cpu/arm/scripts/flash.sh b/bertos/cpu/arm/scripts/flash.sh new file mode 100755 index 00000000..998cf4be --- /dev/null +++ b/bertos/cpu/arm/scripts/flash.sh @@ -0,0 +1,18 @@ +#! /usr/bin/env bash +set -x + +BASE_DIR=`dirname $0` +INT_FILE=${BASE_DIR}/openocd/${PROGRAMMER_TYPE}.tcl +CPU_FILE=${BASE_DIR}/openocd/${PROGRAMMER_CPU}.tcl + +if [ ! -f ${INT_FILE} ]; then + printf "Interface ${PROGRAMMER_TYPE} not supported\n"; + exit 1; +fi + +if [ ! -f ${CPU_FILE} ]; then + printf "CPU ${PROGRAMMER_CPU} not supported\n"; + exit 1; +fi + +sed -e "s#PROGRAMMER_TYPE#${INT_FILE}#" ${BASE_DIR}/openocd/flash.cfg | sed -e "s#PROGRAMMER_CPU#${CPU_FILE}#" > openocd.tmp diff --git a/bertos/cpu/arm/scripts/at91sam7_new.gdb b/bertos/cpu/arm/scripts/openocd/at91sam7_new.gdb similarity index 100% rename from bertos/cpu/arm/scripts/at91sam7_new.gdb rename to bertos/cpu/arm/scripts/openocd/at91sam7_new.gdb diff --git a/bertos/cpu/arm/scripts/at91sam7_ram.gdb b/bertos/cpu/arm/scripts/openocd/at91sam7_ram.gdb similarity index 100% rename from bertos/cpu/arm/scripts/at91sam7_ram.gdb rename to bertos/cpu/arm/scripts/openocd/at91sam7_ram.gdb diff --git a/bertos/cpu/arm/scripts/at91sam7_rom.gdb b/bertos/cpu/arm/scripts/openocd/at91sam7_rom.gdb similarity index 100% rename from bertos/cpu/arm/scripts/at91sam7_rom.gdb rename to bertos/cpu/arm/scripts/openocd/at91sam7_rom.gdb diff --git a/bertos/cpu/arm/scripts/at91sam7_write_to_flash.script b/bertos/cpu/arm/scripts/openocd/at91sam7_write_to_flash.script similarity index 100% rename from bertos/cpu/arm/scripts/at91sam7_write_to_flash.script rename to bertos/cpu/arm/scripts/openocd/at91sam7_write_to_flash.script diff --git a/bertos/cpu/arm/scripts/openocd-0.2.0_at91sam7_rom_flash.cfg b/bertos/cpu/arm/scripts/openocd/cpu.tcl similarity index 54% rename from bertos/cpu/arm/scripts/openocd-0.2.0_at91sam7_rom_flash.cfg rename to bertos/cpu/arm/scripts/openocd/cpu.tcl index 6f939b12..5d5dad63 100644 --- a/bertos/cpu/arm/scripts/openocd-0.2.0_at91sam7_rom_flash.cfg +++ b/bertos/cpu/arm/scripts/openocd/cpu.tcl @@ -1,18 +1,3 @@ -# Change the default telnet port... -telnet_port 4444 - -# Port for TCL connection. -tcl_port 6666 - -# GDB connects here -gdb_port 3333 - -interface ft2232 -ft2232_device_desc "Amontec JTAGkey" -ft2232_layout jtagkey -ft2232_vid_pid 0x0403 0xcff8 - - #use combined on interfaces or targets that can't set TRST/SRST separately reset_config srst_only srst_pulls_trst @@ -39,7 +24,34 @@ 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 "script at91sam7_write_to_flash.script" +$_TARGETNAME configure -event reset-start [ + halt + sleep 10 + + arm7_9 dcc_downloads enable + + armv4_5 core_state arm + arm7_9 fast_memory_access enable + + # Init - taken from the script openocd_at91sam7_ecr.script + mww 0xfffffd44 0x00008000 # disable watchdog + mww 0xfffffd08 0xa5000001 # enable user reset + mww 0xfffffc20 0x00000601 # CKGR_MOR : enable the main oscillator + sleep 10 + mww 0xfffffc2c 0x00481c0e # CKGR_PLLR: 96.1097 MHz + sleep 10 + mww 0xfffffc30 0x00000007 # PMC_MCKR : MCK = PLL / 2 ~= 48 MHz + sleep 10 + 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" @@ -47,6 +59,3 @@ $_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x00200000 -work-area-s #flash bank flash bank at91sam7 0 0 0 0 0 - -init -reset run diff --git a/bertos/cpu/arm/scripts/openocd/flash.cfg b/bertos/cpu/arm/scripts/openocd/flash.cfg new file mode 100644 index 00000000..f0e625a1 --- /dev/null +++ b/bertos/cpu/arm/scripts/openocd/flash.cfg @@ -0,0 +1,15 @@ +# Change the default telnet port... +telnet_port 4444 + +# Port for TCL connection. +tcl_port 6666 + +# GDB connects here +gdb_port 3333 + +source [find PROGRAMMER_TYPE] + +source [find PROGRAMMER_CPU] + +init +reset run diff --git a/bertos/cpu/arm/scripts/openocd/interface.tcl b/bertos/cpu/arm/scripts/openocd/interface.tcl new file mode 100644 index 00000000..e557ca3c --- /dev/null +++ b/bertos/cpu/arm/scripts/openocd/interface.tcl @@ -0,0 +1,4 @@ +interface ft2232 +ft2232_device_desc "Amontec JTAGkey" +ft2232_layout jtagkey +ft2232_vid_pid 0x0403 0xcff8 diff --git a/bertos/cpu/arm/scripts/openocd-0.2.0_at91sam7_gdb.cfg b/bertos/cpu/arm/scripts/openocd/openocd-0.2.0_at91sam7_gdb.cfg similarity index 100% rename from bertos/cpu/arm/scripts/openocd-0.2.0_at91sam7_gdb.cfg rename to bertos/cpu/arm/scripts/openocd/openocd-0.2.0_at91sam7_gdb.cfg diff --git a/bertos/cpu/arm/scripts/openocd/openocd-0.2.0_at91sam7_rom_flash.cfg b/bertos/cpu/arm/scripts/openocd/openocd-0.2.0_at91sam7_rom_flash.cfg new file mode 100644 index 00000000..3e7370d8 --- /dev/null +++ b/bertos/cpu/arm/scripts/openocd/openocd-0.2.0_at91sam7_rom_flash.cfg @@ -0,0 +1,17 @@ +# Change the default telnet port... +telnet_port 4444 + +# Port for TCL connection. +tcl_port 6666 + +# GDB connects here +gdb_port 3333 + +# configurable interface +source [find interface.tcl] + +# configurable cpu +source [find cpu.tcl] + +init +reset run diff --git a/bertos/cpu/arm/scripts/openocd_at91sam7_flash.script b/bertos/cpu/arm/scripts/openocd/openocd_at91sam7_flash.script similarity index 100% rename from bertos/cpu/arm/scripts/openocd_at91sam7_flash.script rename to bertos/cpu/arm/scripts/openocd/openocd_at91sam7_flash.script diff --git a/bertos/cpu/arm/scripts/openocd_at91sam7_ftdi_ram.cfg b/bertos/cpu/arm/scripts/openocd/openocd_at91sam7_ftdi_ram.cfg similarity index 100% rename from bertos/cpu/arm/scripts/openocd_at91sam7_ftdi_ram.cfg rename to bertos/cpu/arm/scripts/openocd/openocd_at91sam7_ftdi_ram.cfg diff --git a/bertos/cpu/arm/scripts/openocd_at91sam7_ftdi_ram_win.cfg b/bertos/cpu/arm/scripts/openocd/openocd_at91sam7_ftdi_ram_win.cfg similarity index 100% rename from bertos/cpu/arm/scripts/openocd_at91sam7_ftdi_ram_win.cfg rename to bertos/cpu/arm/scripts/openocd/openocd_at91sam7_ftdi_ram_win.cfg diff --git a/bertos/cpu/arm/scripts/openocd_at91sam7_ftdi_rom.cfg b/bertos/cpu/arm/scripts/openocd/openocd_at91sam7_ftdi_rom.cfg similarity index 100% rename from bertos/cpu/arm/scripts/openocd_at91sam7_ftdi_rom.cfg rename to bertos/cpu/arm/scripts/openocd/openocd_at91sam7_ftdi_rom.cfg diff --git a/bertos/cpu/arm/scripts/openocd_at91sam7_ftdi_rom_win.cfg b/bertos/cpu/arm/scripts/openocd/openocd_at91sam7_ftdi_rom_win.cfg similarity index 100% rename from bertos/cpu/arm/scripts/openocd_at91sam7_ftdi_rom_win.cfg rename to bertos/cpu/arm/scripts/openocd/openocd_at91sam7_ftdi_rom_win.cfg diff --git a/bertos/cpu/arm/scripts/openocd_at91sam7_reset.script b/bertos/cpu/arm/scripts/openocd/openocd_at91sam7_reset.script similarity index 100% rename from bertos/cpu/arm/scripts/openocd_at91sam7_reset.script rename to bertos/cpu/arm/scripts/openocd/openocd_at91sam7_reset.script diff --git a/bertos/cpu/arm/scripts/openocd_new_at91sam7_ftdi_ram.cfg b/bertos/cpu/arm/scripts/openocd/openocd_new_at91sam7_ftdi_ram.cfg similarity index 100% rename from bertos/cpu/arm/scripts/openocd_new_at91sam7_ftdi_ram.cfg rename to bertos/cpu/arm/scripts/openocd/openocd_new_at91sam7_ftdi_ram.cfg diff --git a/bertos/cpu/arm/scripts/openocd_new_at91sam7_ftdi_rom.cfg b/bertos/cpu/arm/scripts/openocd/openocd_new_at91sam7_ftdi_rom.cfg similarity index 100% rename from bertos/cpu/arm/scripts/openocd_new_at91sam7_ftdi_rom.cfg rename to bertos/cpu/arm/scripts/openocd/openocd_new_at91sam7_ftdi_rom.cfg diff --git a/bertos/cpu/arm/scripts/openocd_ram.bat b/bertos/cpu/arm/scripts/openocd/openocd_ram.bat similarity index 100% rename from bertos/cpu/arm/scripts/openocd_ram.bat rename to bertos/cpu/arm/scripts/openocd/openocd_ram.bat diff --git a/bertos/cpu/arm/scripts/openocd_rom.bat b/bertos/cpu/arm/scripts/openocd/openocd_rom.bat similarity index 100% rename from bertos/cpu/arm/scripts/openocd_rom.bat rename to bertos/cpu/arm/scripts/openocd/openocd_rom.bat -- 2.25.1