From 2c5c5fb3d7012e7e5eebd5a75fb12a04b15daf8f Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Wed, 1 May 2019 01:24:46 +0200 Subject: [PATCH] sort out jtag config files --- .../at91sam7s256-armusbocd-flash-program.cfg | 39 -------------- tools/at91sam7s256-armusbocd.cfg | 29 ---------- tools/at91sam7s256-jtagkey.cfg | 24 --------- tools/at91sam7s256-wiggler.cfg | 39 -------------- tools/at91sam7s512-busblaster.cfg | 54 ------------------- tools/at91sam7s512-buspirate.cfg | 52 ------------------ tools/at91sam7s512-jlink.cfg | 38 ------------- tools/at91sam7s512-jtagkey.cfg | 41 -------------- .../chip-at91sam7s.cfg} | 12 +---- tools/jtag_openocd/interface-armusbocd.cfg | 12 +++++ tools/jtag_openocd/interface-busblaster.cfg | 14 +++++ tools/jtag_openocd/interface-buspirate.cfg | 20 +++++++ tools/jtag_openocd/interface-jlink.cfg | 7 +++ tools/jtag_openocd/interface-jtagkey.cfg | 12 +++++ tools/jtag_openocd/interface-wiggler.cfg | 9 ++++ tools/jtag_openocd/openocd_flash_recovery.sh | 12 +++++ 16 files changed, 88 insertions(+), 326 deletions(-) delete mode 100644 tools/at91sam7s256-armusbocd-flash-program.cfg delete mode 100644 tools/at91sam7s256-armusbocd.cfg delete mode 100644 tools/at91sam7s256-jtagkey.cfg delete mode 100644 tools/at91sam7s256-wiggler.cfg delete mode 100644 tools/at91sam7s512-busblaster.cfg delete mode 100644 tools/at91sam7s512-buspirate.cfg delete mode 100644 tools/at91sam7s512-jlink.cfg delete mode 100644 tools/at91sam7s512-jtagkey.cfg rename tools/{at91sam7s256-jlink.cfg => jtag_openocd/chip-at91sam7s.cfg} (81%) create mode 100644 tools/jtag_openocd/interface-armusbocd.cfg create mode 100644 tools/jtag_openocd/interface-busblaster.cfg create mode 100644 tools/jtag_openocd/interface-buspirate.cfg create mode 100644 tools/jtag_openocd/interface-jlink.cfg create mode 100644 tools/jtag_openocd/interface-jtagkey.cfg create mode 100644 tools/jtag_openocd/interface-wiggler.cfg create mode 100755 tools/jtag_openocd/openocd_flash_recovery.sh diff --git a/tools/at91sam7s256-armusbocd-flash-program.cfg b/tools/at91sam7s256-armusbocd-flash-program.cfg deleted file mode 100644 index 1884407ae..000000000 --- a/tools/at91sam7s256-armusbocd-flash-program.cfg +++ /dev/null @@ -1,39 +0,0 @@ -#define our ports -telnet_port 4444 -gdb_port 3333 - -#commands specific to the Olimex ARM-USB-OCD Dongle -interface ft2232 -ft2232_device_desc "Olimex OpenOCD JTAG" -ft2232_layout "olimex-jtag" -ft2232_vid_pid 0x15BA 0x0003 -jtag_speed 2 -jtag_nsrst_delay 200 -jtag_ntrst_delay 200 - -#reset_config [combination] [trst_type] [srst_type] -reset_config srst_only srst_pulls_trst - -#jtag_device -jtag_device 4 0x1 0xf 0xe - -#daemon_startup <'attach'|'reset'> -daemon_startup reset - -#target [variant] -target arm7tdmi little run_and_init 0 arm7tdmi_r4 - -#run_and_halt_time -run_and_halt_time 0 30 - -# commands below are specific to AT91sam7 Flash Programming -# --------------------------------------------------------- - -#target_script specifies the flash programming script file -target_script 0 reset script.ocd - -#working_area
<'backup'|'nobackup'> -working_area 0 0x40000000 0x4000 nobackup - -#flash bank at91sam7 0 0 0 0 -flash bank at91sam7 0 0 0 0 0 diff --git a/tools/at91sam7s256-armusbocd.cfg b/tools/at91sam7s256-armusbocd.cfg deleted file mode 100644 index 3d0bdd248..000000000 --- a/tools/at91sam7s256-armusbocd.cfg +++ /dev/null @@ -1,29 +0,0 @@ -#define our ports -telnet_port 4444 -gdb_port 3333 - -#commands specific to the Olimex arm-usb-ocd -interface ft2232 -# Be careful to reflect the exact description here: -ft2232_device_desc "Olimex OpenOCD JTAG" -ft2232_layout "olimex-jtag" -ft2232_vid_pid 0x15BA 0x0003 -jtag_speed 2 -jtag_nsrst_delay 200 -jtag_ntrst_delay 200 - -#reset_config [combination] [trst_type] [srst_type] -reset_config srst_only srst_pulls_trst - -#jtag_device -jtag_device 4 0x1 0xf 0xe - -#daemon_startup <'attach'|'reset'> -daemon_startup reset - -#target [variant] -target arm7tdmi little run_and_init 0 arm7tdmi_r4 - -#run_and_halt_time -run_and_halt_time 0 30 - diff --git a/tools/at91sam7s256-jtagkey.cfg b/tools/at91sam7s256-jtagkey.cfg deleted file mode 100644 index 2c32b7955..000000000 --- a/tools/at91sam7s256-jtagkey.cfg +++ /dev/null @@ -1,24 +0,0 @@ -#define our ports -telnet_port 4444 -gdb_port 3333 - -#commands specific to the Amontec JTAGKey -interface ft2232 -ft2232_device_desc "Amontec JTAGkey A" -ft2232_layout jtagkey -ft2232_vid_pid 0x0403 0xcff8 -jtag_khz 200 -jtag_nsrst_delay 200 -jtag_ntrst_delay 200 - -#reset_config [combination] [trst_type] [srst_type] -reset_config srst_only srst_pulls_trst - -jtag newtap sam7x256 cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0x3f0f0f0f - -target create sam7x256.cpu arm7tdmi -endian little -chain-position sam7x256.cpu -variant arm7tdmi - -gdb_memory_map enable - -sam7x256.cpu configure -work-area-virt 0 -work-area-phys 0x00200000 -work-area-size 0x10000 -work-area-backup 0 -flash bank at91sam7 0x100000 0x40000 0 4 sam7x256.cpu diff --git a/tools/at91sam7s256-wiggler.cfg b/tools/at91sam7s256-wiggler.cfg deleted file mode 100644 index 83180dc9f..000000000 --- a/tools/at91sam7s256-wiggler.cfg +++ /dev/null @@ -1,39 +0,0 @@ -telnet_port 4444 -gdb_port 3333 - -interface parport -parport_port 0x378 -parport_cable wiggler -jtag_speed 0 -jtag_nsrst_delay 200 -jtag_ntrst_delay 200 - -reset_config srst_only srst_pulls_trst - -jtag newtap sam7x256 cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0x3f0f0f0f -#jtag newtap xilinx tap -irlen 6 -ircapture 0x1 -irmask 0xf -expected-id 0x1c1a093 - -target create sam7x256.cpu arm7tdmi -endian little -chain-position sam7x256.cpu -variant arm7tdmi -sam7x256.cpu configure -event reset-init { - # disable watchdog - mww 0xfffffd44 0x00008000 - # enable user reset - mww 0xfffffd08 0xa5000001 - # CKGR_MOR : enable the main oscillator - mww 0xfffffc20 0x00000601 - sleep 10 - # CKGR_PLLR: 16 MHz * (5+1) /1 = 96Mhz - mww 0xfffffc2c 0x00051c01 - sleep 10 - # PMC_MCKR : MCK = PLL / 2 = 48 MHz - mww 0xfffffc30 0x00000007 - sleep 10 - # MC_FMR: flash mode (FWS=1,FMCN=60) - mww 0xffffff60 0x003c0100 - sleep 100 -} - -gdb_memory_map enable - -sam7x256.cpu configure -work-area-virt 0 -work-area-phys 0x00200000 -work-area-size 0x10000 -work-area-backup 0 -flash bank at91sam7 0 0 0 0 0 diff --git a/tools/at91sam7s512-busblaster.cfg b/tools/at91sam7s512-busblaster.cfg deleted file mode 100644 index 6555936b4..000000000 --- a/tools/at91sam7s512-busblaster.cfg +++ /dev/null @@ -1,54 +0,0 @@ -## General OpenOCD configuration -# Ports -telnet_port 4444 -gdb_port 3333 - -## Interface configuration section -# Interface - -# you can use -#source [find interface/ftdi/dp_busblaster.cfg] -# or - -interface ftdi -ftdi_device_desc "Dual RS232-HS" -ftdi_vid_pid 0x0403 0x6010 - -ftdi_layout_init 0x0c08 0x0f1b -ftdi_layout_signal nTRST -data 0x0100 -noe 0x0400 -ftdi_layout_signal nSRST -data 0x0200 -noe 0x0800 - -adapter_khz 1000 - -## Chipset configuration section -# use combined on interfaces or targets that can't set TRST/SRST separately -reset_config srst_only srst_pulls_trst - -jtag newtap sam7x cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0x3f0f0f0f - -target create sam7x.cpu arm7tdmi -endian little -chain-position sam7x.cpu - -sam7x.cpu configure -event reset-init { - soft_reset_halt - mww 0xfffffd00 0xa5000004 # RSTC_CR: Reset peripherals - mww 0xfffffd44 0x00008000 # WDT_MR: disable watchdog - mww 0xfffffd08 0xa5000001 # RSTC_MR enable user reset - mww 0xfffffc20 0x00005001 # CKGR_MOR : enable the main oscillator - sleep 10 - mww 0xfffffc2c 0x000b1c02 # CKGR_PLLR: 16MHz * 12/2 = 96MHz - sleep 10 - mww 0xfffffc30 0x00000007 # PMC_MCKR : MCK = PLL / 2 = 48 MHz - sleep 10 - mww 0xffffff60 0x00480100 # MC_FMR: flash mode (FWS=1,FMCN=72) - sleep 100 - -} - -# GDB can also flash my flash! -gdb_memory_map enable -gdb_breakpoint_override hard -#armv4_5 core_state arm - -sam7x.cpu configure -work-area-virt 0 -work-area-phys 0x00200000 -work-area-size 0x10000 -work-area-backup 0 -flash bank sam7x512.flash.0 at91sam7 0 0 0 0 sam7x.cpu 0 0 0 0 0 0 0 18432 -flash bank sam7x512.flash.1 at91sam7 0 0 0 0 sam7x.cpu 1 0 0 0 0 0 0 18432 diff --git a/tools/at91sam7s512-buspirate.cfg b/tools/at91sam7s512-buspirate.cfg deleted file mode 100644 index 64473667a..000000000 --- a/tools/at91sam7s512-buspirate.cfg +++ /dev/null @@ -1,52 +0,0 @@ -# Ports -telnet_port 4444 -gdb_port 3333 - -# Interface -interface buspirate -buspirate_port /dev/ttyUSB0 -adapter_khz 1000 - -# Communication speed -buspirate_speed normal # or fast - -# Voltage regulator: enabled = 1 or disabled = 0 -buspirate_vreg 1 - -# Pin mode: normal or open-drain -buspirate_mode normal - -# Pull-up state: enabled = 1 or disabled = 0 -buspirate_pullup 1 - -# use combined on interfaces or targets that can't set TRST/SRST separately -reset_config srst_only srst_pulls_trst - -jtag newtap sam7x cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0x3f0f0f0f - -target create sam7x.cpu arm7tdmi -endian little -chain-position sam7x.cpu - -sam7x.cpu configure -event reset-init { - soft_reset_halt - mww 0xfffffd00 0xa5000004 # RSTC_CR: Reset peripherals - mww 0xfffffd44 0x00008000 # WDT_MR: disable watchdog - mww 0xfffffd08 0xa5000001 # RSTC_MR enable user reset - mww 0xfffffc20 0x00005001 # CKGR_MOR : enable the main oscillator - sleep 10 - mww 0xfffffc2c 0x000b1c02 # CKGR_PLLR: 16MHz * 12/2 = 96MHz - sleep 10 - mww 0xfffffc30 0x00000007 # PMC_MCKR : MCK = PLL / 2 = 48 MHz - sleep 10 - mww 0xffffff60 0x00480100 # MC_FMR: flash mode (FWS=1,FMCN=72) - sleep 100 - -} - -gdb_memory_map enable -#gdb_breakpoint_override hard -#armv4_5 core_state arm - -sam7x.cpu configure -work-area-virt 0 -work-area-phys 0x00200000 -work-area-size 0x10000 -work-area-backup 0 -flash bank sam7x512.flash.0 at91sam7 0 0 0 0 sam7x.cpu 0 0 0 0 0 0 0 18432 -flash bank sam7x512.flash.1 at91sam7 0 0 0 0 sam7x.cpu 1 0 0 0 0 0 0 18432 - diff --git a/tools/at91sam7s512-jlink.cfg b/tools/at91sam7s512-jlink.cfg deleted file mode 100644 index 8582dc02b..000000000 --- a/tools/at91sam7s512-jlink.cfg +++ /dev/null @@ -1,38 +0,0 @@ -#define our ports -telnet_port 4444 -gdb_port 3333 - -interface jlink -transport select jtag -adapter_khz 1000 - -#reset_config [combination] [trst_type] [srst_type] -reset_config srst_only srst_pulls_trst - -jtag newtap sam7x cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0x3f0f0f0f - -target create sam7x.cpu arm7tdmi -endian little -chain-position sam7x.cpu - -sam7x.cpu configure -event reset-init { - soft_reset_halt - mww 0xfffffd00 0xa5000004 # RSTC_CR: Reset peripherals - mww 0xfffffd44 0x00008000 # WDT_MR: disable watchdog - mww 0xfffffd08 0xa5000001 # RSTC_MR enable user reset - mww 0xfffffc20 0x00005001 # CKGR_MOR : enable the main oscillator - sleep 10 - mww 0xfffffc2c 0x000b1c02 # CKGR_PLLR: 16MHz * 12/2 = 96MHz - sleep 10 - mww 0xfffffc30 0x00000007 # PMC_MCKR : MCK = PLL / 2 = 48 MHz - sleep 10 - mww 0xffffff60 0x00480100 # MC_FMR: flash mode (FWS=1,FMCN=72) - sleep 100 -} - -gdb_memory_map enable -#gdb_breakpoint_override hard -#armv4_5 core_state arm - -sam7x.cpu configure -work-area-virt 0 -work-area-phys 0x00200000 -work-area-size 0x10000 -work-area-backup 0 -#flash bank sam7x.flash.0 at91sam7 0x100000 0x40000 0 4 sam7x.cpu -flash bank sam7x512.flash.0 at91sam7 0 0 0 0 sam7x.cpu 0 0 0 0 0 0 0 18432 -flash bank sam7x512.flash.1 at91sam7 0 0 0 0 sam7x.cpu 1 0 0 0 0 0 0 18432 diff --git a/tools/at91sam7s512-jtagkey.cfg b/tools/at91sam7s512-jtagkey.cfg deleted file mode 100644 index 3bcc5120b..000000000 --- a/tools/at91sam7s512-jtagkey.cfg +++ /dev/null @@ -1,41 +0,0 @@ -#define our ports -telnet_port 4444 -gdb_port 3333 - -#commands specific to the Amontec JTAGKey -interface ft2232 -ft2232_device_desc "Amontec JTAGkey A" -ft2232_layout jtagkey -ft2232_vid_pid 0x0403 0xcff8 -jtag_khz 200 -jtag_nsrst_delay 200 -jtag_ntrst_delay 200 - -#reset_config [combination] [trst_type] [srst_type] -reset_config srst_only srst_pulls_trst - -jtag newtap sam7x cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0x3f0f0f0f - -target create sam7x.cpu arm7tdmi -endian little -chain-position sam7x.cpu -variant arm7tdmi - -sam7x.cpu configure -event reset-init { - soft_reset_halt - mww 0xfffffd00 0xa5000004 # RSTC_CR: Reset peripherals - mww 0xfffffd44 0x00008000 # WDT_MR: disable watchdog - mww 0xfffffd08 0xa5000001 # RSTC_MR enable user reset - mww 0xfffffc20 0x00005001 # CKGR_MOR : enable the main oscillator - sleep 10 - mww 0xfffffc2c 0x000b1c02 # CKGR_PLLR: 16MHz * 12/2 = 96MHz - sleep 10 - mww 0xfffffc30 0x00000007 # PMC_MCKR : MCK = PLL / 2 = 48 MHz - sleep 10 - mww 0xffffff60 0x00480100 # MC_FMR: flash mode (FWS=1,FMCN=72) - sleep 100 -} - -gdb_memory_map enable -gdb_breakpoint_override hard -armv4_5 core_state arm - -sam7x.cpu configure -work-area-virt 0 -work-area-phys 0x00200000 -work-area-size 0x10000 -work-area-backup 0 -flash bank at91sam7 0x100000 0x40000 0 4 sam7x.cpu diff --git a/tools/at91sam7s256-jlink.cfg b/tools/jtag_openocd/chip-at91sam7s.cfg similarity index 81% rename from tools/at91sam7s256-jlink.cfg rename to tools/jtag_openocd/chip-at91sam7s.cfg index c022c59a1..a0787770a 100644 --- a/tools/at91sam7s256-jlink.cfg +++ b/tools/jtag_openocd/chip-at91sam7s.cfg @@ -1,12 +1,5 @@ -#define our ports -telnet_port 4444 -gdb_port 3333 - -interface jlink -transport select jtag -adapter_khz 1000 - -#reset_config [combination] [trst_type] [srst_type] +## Chipset configuration section +# use combined on interfaces or targets that can't set TRST/SRST separately reset_config srst_only srst_pulls_trst jtag newtap sam7x cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0x3f0f0f0f @@ -33,6 +26,5 @@ gdb_memory_map enable #armv4_5 core_state arm sam7x.cpu configure -work-area-virt 0 -work-area-phys 0x00200000 -work-area-size 0x10000 -work-area-backup 0 -#flash bank sam7x.flash.0 at91sam7 0x100000 0x40000 0 4 sam7x.cpu flash bank sam7x.flash.0 at91sam7 0 0 0 0 sam7x.cpu 0 0 0 0 0 0 0 18432 flash bank sam7x.flash.1 at91sam7 0 0 0 0 sam7x.cpu 1 0 0 0 0 0 0 18432 diff --git a/tools/jtag_openocd/interface-armusbocd.cfg b/tools/jtag_openocd/interface-armusbocd.cfg new file mode 100644 index 000000000..4f5c6bb93 --- /dev/null +++ b/tools/jtag_openocd/interface-armusbocd.cfg @@ -0,0 +1,12 @@ +#define our ports +telnet_port 4444 +gdb_port 3333 + +#commands specific to the Olimex ARM-USB-OCD Dongle +interface ft2232 +ft2232_device_desc "Olimex OpenOCD JTAG" +ft2232_layout "olimex-jtag" +ft2232_vid_pid 0x15BA 0x0003 +jtag_speed 2 +jtag_nsrst_delay 200 +jtag_ntrst_delay 200 diff --git a/tools/jtag_openocd/interface-busblaster.cfg b/tools/jtag_openocd/interface-busblaster.cfg new file mode 100644 index 000000000..4d3ac032e --- /dev/null +++ b/tools/jtag_openocd/interface-busblaster.cfg @@ -0,0 +1,14 @@ +## General OpenOCD configuration +# Ports +telnet_port 4444 +gdb_port 3333 + +interface ftdi +ftdi_device_desc "Dual RS232-HS" +ftdi_vid_pid 0x0403 0x6010 + +ftdi_layout_init 0x0c08 0x0f1b +ftdi_layout_signal nTRST -data 0x0100 -noe 0x0400 +ftdi_layout_signal nSRST -data 0x0200 -noe 0x0800 + +adapter_khz 1000 diff --git a/tools/jtag_openocd/interface-buspirate.cfg b/tools/jtag_openocd/interface-buspirate.cfg new file mode 100644 index 000000000..66d0ce614 --- /dev/null +++ b/tools/jtag_openocd/interface-buspirate.cfg @@ -0,0 +1,20 @@ +# Ports +telnet_port 4444 +gdb_port 3333 + +# Interface +interface buspirate +buspirate_port /dev/ttyUSB0 +adapter_khz 1000 + +# Communication speed +buspirate_speed normal # or fast + +# Voltage regulator: enabled = 1 or disabled = 0 +buspirate_vreg 1 + +# Pin mode: normal or open-drain +buspirate_mode normal + +# Pull-up state: enabled = 1 or disabled = 0 +buspirate_pullup 1 diff --git a/tools/jtag_openocd/interface-jlink.cfg b/tools/jtag_openocd/interface-jlink.cfg new file mode 100644 index 000000000..fe6c892f8 --- /dev/null +++ b/tools/jtag_openocd/interface-jlink.cfg @@ -0,0 +1,7 @@ +#define our ports +telnet_port 4444 +gdb_port 3333 + +interface jlink +transport select jtag +adapter_khz 1000 diff --git a/tools/jtag_openocd/interface-jtagkey.cfg b/tools/jtag_openocd/interface-jtagkey.cfg new file mode 100644 index 000000000..305dfd7da --- /dev/null +++ b/tools/jtag_openocd/interface-jtagkey.cfg @@ -0,0 +1,12 @@ +#define our ports +telnet_port 4444 +gdb_port 3333 + +#commands specific to the Amontec JTAGKey +interface ft2232 +ft2232_device_desc "Amontec JTAGkey A" +ft2232_layout jtagkey +ft2232_vid_pid 0x0403 0xcff8 +jtag_khz 200 +jtag_nsrst_delay 200 +jtag_ntrst_delay 200 diff --git a/tools/jtag_openocd/interface-wiggler.cfg b/tools/jtag_openocd/interface-wiggler.cfg new file mode 100644 index 000000000..024ed9710 --- /dev/null +++ b/tools/jtag_openocd/interface-wiggler.cfg @@ -0,0 +1,9 @@ +telnet_port 4444 +gdb_port 3333 + +interface parport +parport_port 0x378 +parport_cable wiggler +jtag_speed 0 +jtag_nsrst_delay 200 +jtag_ntrst_delay 200 diff --git a/tools/jtag_openocd/openocd_flash_recovery.sh b/tools/jtag_openocd/openocd_flash_recovery.sh new file mode 100755 index 000000000..06a92990b --- /dev/null +++ b/tools/jtag_openocd/openocd_flash_recovery.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Example for 512kb version, using Segger Jlink: +CONFIG_CHIP=chip-at91sam7s.cfg +CONFIG_IF=interface-jlink.cfg +IMAGE=../../recovery/proxmark3_recovery.bin + +if [ ! -e "$IMAGE" ]; then + echo "$IMAGE missing. Abort!" + exit 1 +fi +openocd -f $CONFIG_IF -f $CONFIG_CHIP -c "init;halt;flash erase_sector 0 0 15;flash erase_sector 1 0 15;flash write_image $IMAGE 0x100000;exit"