aboutsummaryrefslogtreecommitdiff
path: root/tcl/target
diff options
context:
space:
mode:
authorTarek BOCHKATI <tarek.bouchkati@gmail.com>2021-02-20 23:40:56 +0100
committerAntonio Borneo <borneo.antonio@gmail.com>2021-03-10 21:36:54 +0000
commit77e1841f6420715953628c39ee6e4f515331e5ae (patch)
tree6def8d2e471fa7c0d9f6b6b95dca0ff6de0dd91d /tcl/target
parentf9b5e34e39fd7497fe9dfc965e2e3fa7e78616c1 (diff)
downloadriscv-openocd-77e1841f6420715953628c39ee6e4f515331e5ae.zip
riscv-openocd-77e1841f6420715953628c39ee6e4f515331e5ae.tar.gz
riscv-openocd-77e1841f6420715953628c39ee6e4f515331e5ae.tar.bz2
tcl/target: add BCM2837 configuration file
This is the Broadcom chip used in the Raspberry Pi 3, and in later models of the Raspberry Pi 2. Partial information is available in raspberry pi website: https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2837 https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2837b0 Change-Id: I1188a7866304c59f670a543809aca3927174786e Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/6069 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Diffstat (limited to 'tcl/target')
-rw-r--r--tcl/target/bcm2837.cfg64
1 files changed, 64 insertions, 0 deletions
diff --git a/tcl/target/bcm2837.cfg b/tcl/target/bcm2837.cfg
new file mode 100644
index 0000000..749de31
--- /dev/null
+++ b/tcl/target/bcm2837.cfg
@@ -0,0 +1,64 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+# This is the Broadcom chip used in the Raspberry Pi 3,
+# and in later models of the Raspberry Pi 2.
+
+# Partial information is available in raspberry pi website:
+# https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2837
+# https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2837b0
+
+if { [info exists CHIPNAME] } {
+ set _CHIPNAME $CHIPNAME
+} else {
+ set _CHIPNAME bcm2837
+}
+
+if { [info exists CHIPCORES] } {
+ set _cores $CHIPCORES
+} else {
+ set _cores 4
+}
+
+if { [info exists USE_SMP] } {
+ set _USE_SMP $USE_SMP
+} else {
+ set _USE_SMP 0
+}
+
+if { [info exists DAP_TAPID] } {
+ set _DAP_TAPID $DAP_TAPID
+} else {
+ set _DAP_TAPID 0x4ba00477
+}
+
+jtag newtap $_CHIPNAME cpu -expected-id $_DAP_TAPID -irlen 4
+adapter speed 4000
+
+dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
+
+# MEM-AP for direct access
+target create $_CHIPNAME.ap mem_ap -dap $_CHIPNAME.dap -ap-num 0
+
+# these addresses are obtained from the ROM table via 'dap info 0' command
+set _DBGBASE {0x80010000 0x80012000 0x80014000 0x80016000}
+set _CTIBASE {0x80018000 0x80019000 0x8001a000 0x8001b000}
+
+set _smp_command "target smp"
+
+for { set _core 0 } { $_core < $_cores } { incr _core } {
+ set _CTINAME $_CHIPNAME.cti$_core
+ set _TARGETNAME $_CHIPNAME.cpu$_core
+
+ cti create $_CTINAME -dap $_CHIPNAME.dap -ap-num 0 -baseaddr [lindex $_CTIBASE $_core]
+ target create $_TARGETNAME aarch64 -dap $_CHIPNAME.dap -ap-num 0 -dbgbase [lindex $_DBGBASE $_core] -cti $_CTINAME
+ $_TARGETNAME configure -event reset-assert-post { aarch64 dbginit }
+
+ set _smp_command "$_smp_command $_TARGETNAME"
+}
+
+if {$_USE_SMP} {
+ eval $_smp_command
+}
+
+# default target is cpu0
+targets $_CHIPNAME.cpu0