diff --git a/Makefile b/Makefile index e99f036..aaabb9a 100644 --- a/Makefile +++ b/Makefile @@ -86,7 +86,10 @@ hopper: all hopperv4 -l RAW --base-address 0x80000 --entrypoint 0x80000 --file-offset 0 --aarch64 -e kernel8.img openocd: - $(OPENOCD) -f interface/jlink.cfg -f ./doc/rpi3_jlink.cfg + $(OPENOCD) -f interface/jlink.cfg -f ./doc/rpi3_jlink_suse.cfg + +openocd_naotako: + $(OPENOCD) -f interface/jlink.cfg -f ./doc/rpi3_jlink_naotako.cfg gdb: kernel8.img make nm | grep _SEGGER_RTT | awk '{print $$1}' | ./make-gdb-connect.sh diff --git a/doc/rpi3_jlink_naotaco.cfg b/doc/rpi3_jlink_naotaco.cfg new file mode 100644 index 0000000..39d4d5f --- /dev/null +++ b/doc/rpi3_jlink_naotaco.cfg @@ -0,0 +1,46 @@ +# +# Docker image naotaco/openocd:armv8 configures JTAG similar to this +# Extracted via: +# $ docker run --rm naotaco/openocd:armv8 /bin/sh -c "cat /usr/local/share/openocd/scripts/target/rpi3.cfg" +# +transport select jtag + +# we need to enable srst even though we don't connect it +reset_config trst_and_srst + +adapter_khz 4000 +jtag_ntrst_delay 500 + +if { [info exists CHIPNAME] } { + set _CHIPNAME $CHIPNAME +} else { + set _CHIPNAME rpi3 +} + +# +# Main DAP +# +if { [info exists DAP_TAPID] } { + set _DAP_TAPID $DAP_TAPID +} else { + set _DAP_TAPID 0x4ba00477 +} + +jtag newtap $_CHIPNAME dap -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_DAP_TAPID -enable + +set _TARGETNAME $_CHIPNAME.cpu + +set DBGBASE {0x80010000 0x80012000 0x80014000 0x80016000} +set CTIBASE {0x80018000 0x80019000 0x8001a000 0x8001b000} +set _cores 4 + +for { set _core 0 } { $_core < $_cores } { incr _core } { + + target create $_TARGETNAME.$_core aarch64 \ + -chain-position $_CHIPNAME.dap -coreid $_core \ + -dbgbase [lindex $DBGBASE $_core] -ctibase [lindex $CTIBASE $_core] +} + +# In contrast with SUSE config, naotaco only configures core0 events +$_TARGETNAME.0 configure -event reset-assert-post "aarch64 dbginit" +$_TARGETNAME.0 configure -event gdb-attach { halt } diff --git a/doc/rpi3_jlink.cfg b/doc/rpi3_jlink_suse.cfg similarity index 92% rename from doc/rpi3_jlink.cfg rename to doc/rpi3_jlink_suse.cfg index b70d17a..86a73f8 100644 --- a/doc/rpi3_jlink.cfg +++ b/doc/rpi3_jlink_suse.cfg @@ -1,3 +1,6 @@ +# +# https://www.suse.com/c/debugging-raspberry-pi-3-with-jtag/ configures JTAG like this +# transport select jtag # we need to enable srst even though we don't connect it