From: Luke Kenneth Casson Leighton Date: Thu, 8 Apr 2021 12:46:11 +0000 (+0100) Subject: add openocd jtag script X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=17ba9fe15e6b930f94055597af1187f67c1dbee6;p=soc-cxxrtl-sim.git add openocd jtag script --- diff --git a/small_jtag_test/idcode_test2.svf b/small_jtag_test/idcode_test2.svf new file mode 100644 index 0000000..a7545e0 --- /dev/null +++ b/small_jtag_test/idcode_test2.svf @@ -0,0 +1,46 @@ +STATE RESET IDLE; +TIR 0 ; +HIR 5 TDI (1f) SMASK (1f) ; +//HDR 1 TDI (00) SMASK (01) ; +TDR 0 ; +//Loading device with 'idcode' instruction. +SIR 4 TDI (1) SMASK (f) ; +//SDR 32 TDI (00000000) SMASK (ffffffff) TDO (00000c7f) SMASK (ffffffff) ; +SDR 32 TDI (00000000) SMASK (ffffffff) TDO (000018ff) MASK (ffffffff) ; +// + +// set to DMI "address" +SIR 4 TDI (8) SMASK (f) ; +// set DMI "ctrl" address (0) +SDR 8 TDI (0) SMASK (ff) ; +// set to DMI "data read" +SIR 4 TDI (9) SMASK (f) ; +// read 64 bit +SDR 64 TDI (0000000000000000) SMASK (0000000000000000) TDO (0000000000000004) MASK (ffffffffffffffff) ; + +// set to DMI "address" +SIR 4 TDI (8) SMASK (f) ; +// set DMI "ctrl" address (0) +SDR 8 TDI (0) SMASK (ff) ; +// set to DMI "data write-read" +SIR 4 TDI (a) SMASK (f) ; +// write-read 64 bit +SDR 64 TDI (0000000000000002) SMASK (ffffffffffffffff) TDO (0000000000000004) MASK (ffffffffffffffff) ; + +// set to DMI "address" +SIR 4 TDI (8) SMASK (f) ; +// set DMI "ctrl" address (0) +SDR 8 TDI (0) SMASK (ff) ; +// set to DMI "data read" +SIR 4 TDI (9) SMASK (f) ; +// read 64 bit +SDR 64 TDI (0000000000000000) SMASK (0000000000000000) TDO (0000000000000002) MASK (ffffffffffffffff) ; + +// set to DMI "address" +SIR 4 TDI (8) SMASK (f) ; +// set DMI "MSR" address (3) +SDR 8 TDI (3) SMASK (ff) ; +// set to DMI "data read" +SIR 4 TDI (9) SMASK (f) ; +// read 64 bit +SDR 64 TDI (0000000000000000) SMASK (0000000000000000) TDO (00000000deadbeef) MASK (ffffffffffffffff) ; diff --git a/small_jtag_test/main.cpp b/small_jtag_test/main.cpp index 73dd45b..d98ae9a 100644 --- a/small_jtag_test/main.cpp +++ b/small_jtag_test/main.cpp @@ -158,7 +158,7 @@ int main() { cxxrtl_design::p_add top; - bool prev_led = 0; + int sock = get_connection(); top.step(); for(int cycle=0;cycle<1000;++cycle){ diff --git a/small_jtag_test/openocd.cfg b/small_jtag_test/openocd.cfg new file mode 100644 index 0000000..0f78aa0 --- /dev/null +++ b/small_jtag_test/openocd.cfg @@ -0,0 +1,15 @@ + +interface remote_bitbang +remote_bitbang_port 5000 +remote_bitbang_host localhost + +# this should be irlen=4 +jtag newtap libresoc tap -irlen 4 -irmask 0xf -ircapture 0xf -expected-id 0x000018ff + +#set _TARGETNAME libresoc.tap +#target create $_TARGETNAME.0 ppc64 -chain-position $_TARGETNAME -rtos hwthread + +# Configure work area in on-chip SRAM +#$_TARGETNAME.0 configure -work-area-phys 0x80000000 \ +# -work-area-size 1000 -work-area-backup 0 + diff --git a/small_jtag_test/openocd_test.sh b/small_jtag_test/openocd_test.sh new file mode 100755 index 0000000..dcad497 --- /dev/null +++ b/small_jtag_test/openocd_test.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# run make followed by ./tb then run this script. + +openocd -f openocd.cfg -c init \ + -c 'svf idcode.svf' \ + -c shutdown