From eb3e19a367b490d9a9d4c34186464d317021656b Mon Sep 17 00:00:00 2001 From: Luis Donatien Date: Wed, 21 Feb 2024 17:33:34 +0100 Subject: [PATCH 1/2] Add OpenOCD configuration to use BSCAN --- Makefile | 4 +++ README.md | 2 +- docs/source/How_to/Debug.md | 10 +++++++ tb/core-v-mini-mcu-pynq-z2-bscan.cfg | 44 ++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 tb/core-v-mini-mcu-pynq-z2-bscan.cfg diff --git a/Makefile b/Makefile index b4367afd3..4d4244008 100644 --- a/Makefile +++ b/Makefile @@ -232,6 +232,10 @@ flash-prog: openOCD_epflp: xterm -e openocd -f ./tb/core-v-mini-mcu-pynq-z2-esl-programmer.cfg; +## Run openOCD w/ BSCAN of Xilinx FPGAs +openOCD_bscan: + xterm -e openocd -f ./tb/core-v-mini-mcu-pynq-z2-bscan.cfg; + ## Start GDB gdb_connect: $(MAKE) -C sw gdb_connect diff --git a/README.md b/README.md index 7d70ff44d..9e41c2386 100644 --- a/README.md +++ b/README.md @@ -476,7 +476,7 @@ The success of the script is not required for merging of a PR. ## Debug -Follow the [Debug](./Debug.md) guide to debug core-v-mini-mcu. +Follow the [Debug](./docs/source/How_to/Debug.md) guide to debug core-v-mini-mcu. Alternatively, in case you are used to developing using Integrated Development Environments (IDEs), please check [the IDE readme](./IDEs.md). diff --git a/docs/source/How_to/Debug.md b/docs/source/How_to/Debug.md index 4ec743f3d..cc71507bd 100644 --- a/docs/source/How_to/Debug.md +++ b/docs/source/How_to/Debug.md @@ -202,6 +202,16 @@ or with the EPFL Programmer also using this other command (**strongly recommende make openOCD_epflp ``` +or with the BSCAN of Xilinx FPGAs using this command: +``` +openocd -f ./tb/core-v-mini-mcu-pynq-z2-bscan.cfg +``` + +or with the BSCAN of Xilinx FPGAs also using this other command (**strongly recommended**): + +``` +make openOCD_bscan +``` If you get this error: diff --git a/tb/core-v-mini-mcu-pynq-z2-bscan.cfg b/tb/core-v-mini-mcu-pynq-z2-bscan.cfg new file mode 100644 index 000000000..d71936a2c --- /dev/null +++ b/tb/core-v-mini-mcu-pynq-z2-bscan.cfg @@ -0,0 +1,44 @@ +adapter driver ftdi +adapter speed 1000 +transport select jtag + + +# FT2232HQ Adapter Pynq Z2 +ftdi vid_pid 0x0403 0x6010 + +ftdi channel 0 +ftdi layout_init 0x0088 0x008b + +reset_config none + +echo "ftdi setting..." + +set _CHIPNAME riscv +jtag newtap $_CHIPNAME cpu -irlen 6 -expected-id 0x23727093 +jtag newtap arm_dap_0 tap -irlen 4 -expected-id 0x4ba00477 + +set _TARGETNAME $_CHIPNAME.cpu +target create $_TARGETNAME riscv -chain-position $_TARGETNAME -coreid 0x000 + +echo "target created..." + +#log_output openocd_fpga.log + +riscv set_ir idcode 0x09 +riscv set_ir dtmcs 0x22 +riscv set_ir dmi 0x23 + +riscv set_reset_timeout_sec 2000 +riscv set_command_timeout_sec 2000 + +echo "setting preferences..." + +scan_chain + +init + +echo "init routine started" + +halt + +echo "Ready for Remote Connections" \ No newline at end of file From 63f581cb43b4fa9403862565876446abed1d6a2b Mon Sep 17 00:00:00 2001 From: Luis Donatien Date: Wed, 21 Feb 2024 17:41:53 +0100 Subject: [PATCH 2/2] Change documentation --- Makefile | 2 +- docs/source/How_to/Debug.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 4d4244008..6db5f17c1 100644 --- a/Makefile +++ b/Makefile @@ -232,7 +232,7 @@ flash-prog: openOCD_epflp: xterm -e openocd -f ./tb/core-v-mini-mcu-pynq-z2-esl-programmer.cfg; -## Run openOCD w/ BSCAN of Xilinx FPGAs +## Run openOCD w/ BSCAN of the Pynq-Z2 board openOCD_bscan: xterm -e openocd -f ./tb/core-v-mini-mcu-pynq-z2-bscan.cfg; diff --git a/docs/source/How_to/Debug.md b/docs/source/How_to/Debug.md index cc71507bd..6472e8868 100644 --- a/docs/source/How_to/Debug.md +++ b/docs/source/How_to/Debug.md @@ -202,12 +202,12 @@ or with the EPFL Programmer also using this other command (**strongly recommende make openOCD_epflp ``` -or with the BSCAN of Xilinx FPGAs using this command: +or with the BSCAN of the Pynq-Z2 board using this command: ``` openocd -f ./tb/core-v-mini-mcu-pynq-z2-bscan.cfg ``` -or with the BSCAN of Xilinx FPGAs also using this other command (**strongly recommended**): +or with the BSCAN of the Pynq-Z2 board also using this other command (**strongly recommended**): ``` make openOCD_bscan