This is an automated email from Gerrit. Luis de Arquer ([email protected]) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/6125
-- gerrit commit ad4bbf8bf5feeb5315edaa77a5a08bedbd545606 Author: Luis de Arquer <[email protected]> Date: Wed Mar 24 17:16:07 2021 +0100 board/spc560d-dis: Initial support for ST SPC560D Discovery Board This commit provides an example on initialisation of the OnCE TAP interface on the ST SPC560D MCU. After running this script, OnCE commands can be passed to the MCU by using $CHIP.once argument. Some examples: -Read CPU register r3: once_read_gpr $CHIP.once 3 -Write stack pointer (CPU register r1) with value 0x40002000: once_write_gpr $CHIP.once 1 0x40002000 -Read SRAM memory location 0x40002000: once_read32 $CHIP.once 0x40002000 Change-Id: I9d604e62513827fa378715c07f765d3c8c432d5e Signed-off-by: Luis de Arquer <[email protected]> diff --git a/contrib/60-openocd.rules b/contrib/60-openocd.rules index 0358b60..f448f64 100644 --- a/contrib/60-openocd.rules +++ b/contrib/60-openocd.rules @@ -181,4 +181,7 @@ ATTRS{idVendor}=="c251", ATTRS{idProduct}=="2750", MODE="660", GROUP="plugdev", # CMSIS-DAP compatible adapters ATTRS{product}=="*CMSIS-DAP*", MODE="660", GROUP="plugdev", TAG+="uaccess" +# ST SPC560D-DIS Discovery Board +ATTRS{idVendor}=="263d", ATTRS{idProduct}=="4001", MODE="660", GROUP="plugdev", TAG+="uaccess" + LABEL="openocd_rules_end" diff --git a/tcl/board/spc560d-dis.cfg b/tcl/board/spc560d-dis.cfg new file mode 100644 index 0000000..69b0e43 --- /dev/null +++ b/tcl/board/spc560d-dis.cfg @@ -0,0 +1,108 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# ST SPC560D Discovery Board +# +# Copyright (c) 2021, Hsin Chong Machinery Works Co., Ltd +# Copyright (c) 2021, Inertim Research, SL +# [email protected] +# +# + +# Layout: FTDI FT2232HL +# ADBUS0 TCK +# ADBUS1 TDI +# ADBUS2 TDO (input) +# ADBUS3 TMS +# ADBUS4 TMS +# ADBUS5 NC (test point TP100) +# ADBUS6 NC +# ADBUS7 LED_1 (active high) +# ACBUS0 nTRST +# ACBUS1 nSRST +# ACBUS2-4 NC +# ACBUS5 nSRST DIR (high for output) +# ACBUS6 TMS DIR (high for output) +# ACBUS7 LED_2 (active high) +# BDBUS0 TX +# BDBUS1 RX (input) +# + +adapter driver ftdi +ftdi_device_desc "SPC560D-DIS Discovery Board" +ftdi_vid_pid 0x263D 0x4001 + +ftdi_layout_init 0x6108 0xE38b +ftdi_layout_signal nTRST -data 0x0100 +ftdi_layout_signal nSRST -data 0x0200 -oe 0x2000 +ftdi_layout_signal LED -data 0x0080 +ftdi_layout_signal LED2 -data 0x8000 + +source [find target/once.cfg] + +# Set JTAG to 2MHz +adapter speed 2000 +transport select jtag + +set CHIP spc560d + +reset_config srst_only + +jtag newtap $CHIP cpu -irlen 5 -expected-id 0x3ae44041 +jtag newtap $CHIP once -irlen 10 -disable + +jtag configure $CHIP.once -event tap-enable { + irscan $CHIP.cpu 0x11 + return 1 +} + +jtag configure $CHIP.cpu -event tap-disable { + return 1 +} + +init +echo "\nSending IDCODE command" +irscan $CHIP.cpu 0x01 +drscan $CHIP.cpu 32 0x00000000 + + +echo "\nEnter OnCE TAP" +jtag tapenable $CHIP.once +jtag tapdisable $CHIP.cpu + + +# Read JTAG ID for ONCE tap, and print it +set once_id [once_read_jtag_id $CHIP.once] +echo "OnCE JTAG ID = $once_id" + +set osr [once_read_osr $CHIP.once] +echo "OSR = $osr" + + +echo "Enter debug mode..." +once_enter_debug_mode $CHIP.once + + +# Initialise SRAM ECC (write full words of whatever to all locations) +for {set i 0} {$i < 16384} {set i [expr $i + 0x80]} { + set wbbr [expr $i + 0x40000000] + set wbbr [format 0x%08X $wbbr] + #puts "ADDR = $wbbr" + once_single_step_wbbr $CHIP.once 0x18010900 $wbbr +} + + +# Read MCU ID registers +set id1 [once_read32 $CHIP.once 0xC3F9_0004] +set id2 [once_read32 $CHIP.once 0xC3F9_0008] +echo "MCU ID 1: $id1" +echo "MCU ID 2: $id2" + +set partnum [expr $id1 >> 16] +set partnum [format 0x%04X $partnum] +if { $partnum == 0x5601} { + puts "Detected SPC560 MCU (128 KB)" +} elseif { $partnum == 0x5602} { + puts "Detected SPC560 MCU (256 KB)" +} else { + puts "SPC560 not detected" +} -- _______________________________________________ OpenOCD-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openocd-devel
