Skip to content

Commit

Permalink
Add suport for xvc probe
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavosr8 authored and augustofg committed Oct 9, 2023
1 parent 1d3c051 commit 11bc629
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
- { flags: -DBOARD=afc -DVERSION=4.0 -DDEBUG_PROBE=jlink -DOPENOCD_TRANSPORT=swd }
- { flags: -DBOARD=afc -DVERSION=4.0 -DDEBUG_PROBE=cmsis-dap -DOPENOCD_TRANSPORT=swd }
- { flags: -DBOARD=afc -DVERSION=4.0 -DDEBUG_PROBE=digilent_jtag_hs3 -DOPENOCD_TRANSPORT=jtag }
- { flags: -DBOARD=afc -DVERSION=4.0 -DDEBUG_PROBE=xvc -DOPENOCD_TRANSPORT=jtag -DXVC_HOST=host -DXVC_PORT=0000}
steps:
- uses: actions/checkout@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ To make a debug build (to include symbols into elf file, turn off optimizations,
## Programming

### OpenOCD
Flashing the MMC microcontroller via SWD/JTAG is supported for CMSIS-DAP and Jlink compatible probes through OpenOCD. You can specify the debug probe with the flag `-DDEBUG_PROBE=<probe_name>`, valid options are `cmsis-dap` (default) and `jlink`.
Flashing the MMC microcontroller via SWD/JTAG is supported for CMSIS-DAP and Jlink compatible probes through OpenOCD. You can specify the debug probe with the flag `-DDEBUG_PROBE=<probe_name>`, valid options are `cmsis-dap` (default), `jlink`, `digilent_jtag_hs3` and `xvc` (support is not merged to the official OpenOCD source yet, so you build our patched version: https://github.com/lnls-dig/openocd/tree/fix-afcv3-flashing).

cmake ~/openmmc/ -DBOARD=afc -DVERSION=3.1 -DDEBUG_PROBE=cmsis-dap

Expand Down
2 changes: 1 addition & 1 deletion probe/openocd.cfg.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source [find ${OPENOCD_DEBUG_PROBE_FILE}]
${OPENOCD_DEBUG_PROBE_CMD}

transport select ${OPENOCD_TRANSPORT}

Expand Down
15 changes: 12 additions & 3 deletions probe/openocd.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,23 @@ else()

# Selects the OpenOCD debug probe file
if(${DEBUG_PROBE} STREQUAL "digilent_jtag_hs3")
set(OPENOCD_DEBUG_PROBE_FILE "interface/ftdi/digilent_jtag_hs3.cfg")
set(OPENOCD_DEBUG_PROBE_CMD "source [find interface/ftdi/digilent_jtag_hs3.cfg]")
check_probe_transport("jtag" ${OPENOCD_TRANSPORT})
elseif(${DEBUG_PROBE} STREQUAL "cmsis-dap")
set(OPENOCD_DEBUG_PROBE_FILE "interface/cmsis-dap.cfg")
set(OPENOCD_DEBUG_PROBE_CMD "source [find interface/cmsis-dap.cfg]")
check_probe_transport("jtag;swd" ${OPENOCD_TRANSPORT})
elseif(${DEBUG_PROBE} STREQUAL "jlink")
set(OPENOCD_DEBUG_PROBE_FILE "interface/jlink.cfg")
set(OPENOCD_DEBUG_PROBE_CMD "source [find interface/jlink.cfg]")
check_probe_transport("jtag;swd" ${OPENOCD_TRANSPORT})
elseif(${DEBUG_PROBE} STREQUAL "xvc")
if(NOT XVC_HOST)
message(FATAL_ERROR "No xvc host selected, use -DXVC_HOST=<hostname> to select it.")
elseif(NOT XVC_PORT)
message(FATAL_ERROR "No xvc port selected, use -DXVC_PORT=<port> to select it.")
else()
set(OPENOCD_DEBUG_PROBE_CMD "adapter driver xvc\nxvc_host ${XVC_HOST}\nxvc_port ${XVC_PORT}\nreset_config none")
check_probe_transport("jtag" ${OPENOCD_TRANSPORT})
endif()
else()
message(FATAL_ERROR "${DEBUG_PROBE} not supported!")
endif()
Expand Down

0 comments on commit 11bc629

Please sign in to comment.