Skip to content

Instantly share code, notes, and snippets.

@sprhawk
Created October 12, 2020 12:25
Show Gist options
  • Save sprhawk/db216cfeb628047a9192ecc658c61081 to your computer and use it in GitHub Desktop.
Save sprhawk/db216cfeb628047a9192ecc658c61081 to your computer and use it in GitHub Desktop.
openocd for rk3399
source [find interface/jlink.cfg]
transport select swd
adapter speed 1000
reset_config none
source [find target/rk3399.cfg]
# reset_config trst_only
# Rockchip RK3368 Target
source [find target/swj-dp.tcl]
if { [info exists CHIPNAME] } {
set _CHIPNAME $CHIPNAME
} else {
set _CHIPNAME rk3399
}
#
# Main DAP
#
if { [info exists DAP_TAPID] } {
set _DAP_TAPID $DAP_TAPID
} else {
set _DAP_TAPID 0x5ba02477
}
# declare the one SWD tap to access the DAP
swj_newdap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_DAP_TAPID
# create the DAP
dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu -ignore-syspwrupack
set _TARGETNAME $_CHIPNAME
set _CTINAME $_CHIPNAME.cti
set DBGBASE {0xfe430000 0xfe432000 0xfe434000 0xfe436000 0xfe610000 0xfe710000}
set CTIBASE {0xfe438000 0xfe439000 0xfe43A000 0xfe43B000 0xfe620000 0xfe720000}
set CORENAMES {a53 a53 a53 a53 a72 a72}
set _cores 6
for { set _core 0 } { $_core < $_cores } { incr _core } {
set _core_name [lindex $CORENAMES $_core]
cti create $_CTINAME.$_core_name.$_core -dap $_CHIPNAME.dap -ap-num 2 \
-ctibase [lindex $CTIBASE $_core]
target create $_TARGETNAME.$_core_name.$_core aarch64 \
-dap $_CHIPNAME.dap -coreid $_core \
-dbgbase [lindex $DBGBASE $_core] -cti $_CTINAME.$_core_name.$_core
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment