From a065e21bed43804d37d60f3b24263bacb3f7208c Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Thu, 4 Feb 2021 13:10:29 +0100 Subject: [PATCH] Update openocd configurations --- ...chip-at91sam7s.cfg => board-at91sam7s.cfg} | 2 ++ tools/jtag_openocd/interface-armusbocd.cfg | 8 ----- tools/jtag_openocd/interface-busblaster.cfg | 10 ------ tools/jtag_openocd/interface-buspirate.cfg | 8 ++--- tools/jtag_openocd/interface-c232hm.cfg | 11 +------ tools/jtag_openocd/interface-jlink.cfg | 4 --- tools/jtag_openocd/interface-jtagkey.cfg | 8 ----- tools/jtag_openocd/interface-raspberrypi.cfg | 21 +----------- tools/jtag_openocd/interface-raspberrypi2.cfg | 21 +----------- tools/jtag_openocd/interface-shikra.cfg | 6 ---- tools/jtag_openocd/interface-wiggler.cfg | 7 ---- .../jtag_openocd/openocd_configuration.sample | 33 +++++++++++++++++-- tools/jtag_openocd/openocd_flash_dump.sh | 2 +- tools/jtag_openocd/openocd_flash_recovery.sh | 2 +- tools/jtag_openocd/openocd_interactive.sh | 2 +- 15 files changed, 41 insertions(+), 104 deletions(-) rename tools/jtag_openocd/{chip-at91sam7s.cfg => board-at91sam7s.cfg} (96%) delete mode 100644 tools/jtag_openocd/interface-armusbocd.cfg delete mode 100644 tools/jtag_openocd/interface-busblaster.cfg delete mode 100644 tools/jtag_openocd/interface-jlink.cfg delete mode 100644 tools/jtag_openocd/interface-jtagkey.cfg delete mode 100644 tools/jtag_openocd/interface-shikra.cfg delete mode 100644 tools/jtag_openocd/interface-wiggler.cfg diff --git a/tools/jtag_openocd/chip-at91sam7s.cfg b/tools/jtag_openocd/board-at91sam7s.cfg similarity index 96% rename from tools/jtag_openocd/chip-at91sam7s.cfg rename to tools/jtag_openocd/board-at91sam7s.cfg index 7c546e45a..960c1461b 100644 --- a/tools/jtag_openocd/chip-at91sam7s.cfg +++ b/tools/jtag_openocd/board-at91sam7s.cfg @@ -28,3 +28,5 @@ gdb_memory_map enable 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 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 +transport select jtag +adapter speed 1000 diff --git a/tools/jtag_openocd/interface-armusbocd.cfg b/tools/jtag_openocd/interface-armusbocd.cfg deleted file mode 100644 index 4820136f0..000000000 --- a/tools/jtag_openocd/interface-armusbocd.cfg +++ /dev/null @@ -1,8 +0,0 @@ -# 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 deleted file mode 100644 index bd1df2c5f..000000000 --- a/tools/jtag_openocd/interface-busblaster.cfg +++ /dev/null @@ -1,10 +0,0 @@ -# Commands specific to the Bus Blaster -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 index 8eccadd79..cb14b2365 100644 --- a/tools/jtag_openocd/interface-buspirate.cfg +++ b/tools/jtag_openocd/interface-buspirate.cfg @@ -1,10 +1,8 @@ # Commands specific to the BusPirate -interface buspirate -buspirate_port /dev/ttyUSB0 -adapter_khz 1000 -# Communication speed -buspirate_speed normal # or fast +source [find interface/buspirate.cfg] + +buspirate_port /dev/ttyUSB0 # Voltage regulator: enabled = 1 or disabled = 0 buspirate_vreg 1 diff --git a/tools/jtag_openocd/interface-c232hm.cfg b/tools/jtag_openocd/interface-c232hm.cfg index f4d0f471a..af37913de 100644 --- a/tools/jtag_openocd/interface-c232hm.cfg +++ b/tools/jtag_openocd/interface-c232hm.cfg @@ -11,13 +11,4 @@ # Black <> GND # Red <> 3.3 (don't connect if C232HM-EDSL-0! power via USB instead) -interface ftdi -#ftdi_device_desc "C232HM-DDHSL-0" -#ftdi_device_desc "C232HM-EDHSL-0" -ftdi_vid_pid 0x0403 0x6014 - -ftdi_layout_init 0x0008 0x400b -ftdi_layout_signal LED -ndata 0x4000 - -transport select jtag -adapter_khz 1000 +source [find interface/ftdi/c232hm.cfg] diff --git a/tools/jtag_openocd/interface-jlink.cfg b/tools/jtag_openocd/interface-jlink.cfg deleted file mode 100644 index 011cb7844..000000000 --- a/tools/jtag_openocd/interface-jlink.cfg +++ /dev/null @@ -1,4 +0,0 @@ -# Commands specific to the Segger J-Link -interface jlink -transport select jtag -adapter_khz 1000 diff --git a/tools/jtag_openocd/interface-jtagkey.cfg b/tools/jtag_openocd/interface-jtagkey.cfg deleted file mode 100644 index 420e6e97e..000000000 --- a/tools/jtag_openocd/interface-jtagkey.cfg +++ /dev/null @@ -1,8 +0,0 @@ -# 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-raspberrypi.cfg b/tools/jtag_openocd/interface-raspberrypi.cfg index 984afe41b..6cb9af881 100644 --- a/tools/jtag_openocd/interface-raspberrypi.cfg +++ b/tools/jtag_openocd/interface-raspberrypi.cfg @@ -12,26 +12,7 @@ # 6 <> GND # 1 <> 3.3 -interface bcm2835gpio - -# This file is meant for first versions of Raspberry Pi -# You can check yours with: -# dd if=/proc/device-tree/soc/ranges bs=4 skip=1 count=1 2>/dev/null|xxd -p -# if it returns 20000000, you're fine -# if it returns 3F000000, use interface-raspberrypi2.cfg -bcm2835gpio_peripheral_base 0x20000000 - -# Transition delay calculation: SPEED_COEFF/khz - SPEED_OFFSET -# These depend on system clock, calibrated for stock 700MHz -# bcm2835gpio_speed SPEED_COEFF SPEED_OFFSET -bcm2835gpio_speed_coeffs 113714 28 - -# Each of the JTAG lines need a gpio number set: tck tms tdi tdo -# Header pin numbers: 23 22 19 21 -bcm2835gpio_jtag_nums 11 25 10 9 +source [find interface/raspberrypi-native.cfg] bcm2835gpio_srst_num 18 reset_config srst_only srst_push_pull - -transport select jtag -adapter_khz 1000 diff --git a/tools/jtag_openocd/interface-raspberrypi2.cfg b/tools/jtag_openocd/interface-raspberrypi2.cfg index dc97479d5..52cb74ea9 100644 --- a/tools/jtag_openocd/interface-raspberrypi2.cfg +++ b/tools/jtag_openocd/interface-raspberrypi2.cfg @@ -12,26 +12,7 @@ # 6 <> GND # 1 <> 3.3 -interface bcm2835gpio - -# This file is meant for recent versions of Raspberry Pi -# You can check yours with: -# dd if=/proc/device-tree/soc/ranges bs=4 skip=1 count=1 2>/dev/null|xxd -p -# if it returns 20000000, use interface-raspberrypi.cfg -# if it returns 3F000000, you're fine -bcm2835gpio_peripheral_base 0x3F000000 - -# Transition delay calculation: SPEED_COEFF/khz - SPEED_OFFSET -# These depend on system clock, calibrated for stock 700MHz -# bcm2835gpio_speed SPEED_COEFF SPEED_OFFSET -bcm2835gpio_speed_coeffs 146203 36 - -# Each of the JTAG lines need a gpio number set: tck tms tdi tdo -# Header pin numbers: 23 22 19 21 -bcm2835gpio_jtag_nums 11 25 10 9 +source [find interface/raspberrypi2-native.cfg] bcm2835gpio_srst_num 18 reset_config srst_only srst_push_pull - -transport select jtag -adapter_khz 1000 diff --git a/tools/jtag_openocd/interface-shikra.cfg b/tools/jtag_openocd/interface-shikra.cfg deleted file mode 100644 index ba4b21419..000000000 --- a/tools/jtag_openocd/interface-shikra.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Commands specific to the Shikra -interface ftdi -transport select jtag -ftdi_vid_pid 0x0403 0x6014 -ftdi_layout_init 0x0c08 0x0f1b -adapter_khz 2000 diff --git a/tools/jtag_openocd/interface-wiggler.cfg b/tools/jtag_openocd/interface-wiggler.cfg deleted file mode 100644 index ce9a1da06..000000000 --- a/tools/jtag_openocd/interface-wiggler.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# Commands specific to the Wiggler -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_configuration.sample b/tools/jtag_openocd/openocd_configuration.sample index 466e28d9b..10262de65 100644 --- a/tools/jtag_openocd/openocd_configuration.sample +++ b/tools/jtag_openocd/openocd_configuration.sample @@ -1,7 +1,34 @@ CONFIG_GEN=general.cfg -CONFIG_CHIP=chip-at91sam7s.cfg +CONFIG_BOARD=board-at91sam7s.cfg IMAGE=../../recovery/proxmark3_recovery.bin DUMP="dump_$(date +'%Y%m%d-%H%M%S').bin" -# Example using Segger Jlink: -CONFIG_IF=interface-jlink.cfg +# One can use openocd-provided interfaces or local interface files +# Here are a few examples + +# Segger Jlink: +CONFIG_IF=interface/jlink.cfg + +# Raspberry Pi models Pi1, Pi2 and Pi Zero (read interface-raspberrypi.cfg for pinout) +#CONFIG_IF=interface-raspberrypi.cfg + +# Raspberry Pi models 2+ and above (read interface-raspberrypi2.cfg for pinout) +#CONFIG_IF=interface-raspberrypi2.cfg + +# DP BusBlaster: +#CONFIG_IF=interface/ftdi/dp_busblaster.cfg + +# BusPirate: +#CONFIG_IF=interface-buspirate.cfg + +# C232HM-DDHSL-0 and C232HM-EDSL-0 (beware! read interface-c232hm.cfg instructions) +#CONFIG_IF=interface-c232hm.cfg + +# Olimex ARM-USB-OCD Dongle: +#CONFIG_IF=interface/ftdi/olimex-arm-usb-ocd.cfg + +# Amontec JTAGKey: +#CONFIG_IF=interface/ftdi/jtagkey.cfg + +# Wiggler: +#CONFIG_IF=interface/parport.cfg diff --git a/tools/jtag_openocd/openocd_flash_dump.sh b/tools/jtag_openocd/openocd_flash_dump.sh index 4791b9112..040c8530c 100755 --- a/tools/jtag_openocd/openocd_flash_dump.sh +++ b/tools/jtag_openocd/openocd_flash_dump.sh @@ -7,4 +7,4 @@ if [ -e "$DUMP" ]; then echo "$DUMP exists already. Abort!" exit 1 fi -openocd -f $CONFIG_GEN -f $CONFIG_IF -f $CONFIG_CHIP -c "init;halt;dump_image $DUMP 0x100000 0x80000;exit" +openocd -f $CONFIG_GEN -f $CONFIG_IF -f $CONFIG_BOARD -c "init;halt;dump_image $DUMP 0x100000 0x80000;exit" diff --git a/tools/jtag_openocd/openocd_flash_recovery.sh b/tools/jtag_openocd/openocd_flash_recovery.sh index 490cf4abd..d902274db 100755 --- a/tools/jtag_openocd/openocd_flash_recovery.sh +++ b/tools/jtag_openocd/openocd_flash_recovery.sh @@ -7,4 +7,4 @@ if [ ! -e "$IMAGE" ]; then echo "$IMAGE missing. Abort!" exit 1 fi -openocd -f $CONFIG_GEN -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" +openocd -f $CONFIG_GEN -f $CONFIG_IF -f $CONFIG_BOARD -c "init;halt;flash erase_sector 0 0 15;flash erase_sector 1 0 15;flash write_image $IMAGE 0x100000;exit" diff --git a/tools/jtag_openocd/openocd_interactive.sh b/tools/jtag_openocd/openocd_interactive.sh index 995ee6913..c4f7e4142 100755 --- a/tools/jtag_openocd/openocd_interactive.sh +++ b/tools/jtag_openocd/openocd_interactive.sh @@ -6,4 +6,4 @@ cd $(dirname "$0") echo "*********************************************" echo "Connect to OpenOCD via: telnet localhost $(awk '/^telnet_port/{print$2}' $CONFIG_GEN)" echo "*********************************************" -openocd -f $CONFIG_GEN -f $CONFIG_IF -f $CONFIG_CHIP +openocd -f $CONFIG_GEN -f $CONFIG_IF -f $CONFIG_BOARD