sandeepmistry / rtl8710-openocd

Unofficial mirror of https://bitbucket.org/rebane/rtl8710_openocd
GNU General Public License v2.0
6 stars 6 forks source link

Support for Olimex ARM-USB-OCD-H #2

Open chevdor opened 5 years ago

chevdor commented 5 years ago

I am not (yet) opening a PR for this one because I am not sure my change does not break anything for other platform. Instead, I am documenting my change here for others to find.

@sandeepmistry if you want a PR, just say the word :)

My goal/context is to use openocd with a realtek RTL8710 using my Olimex ARM-USB-OCD-H.

Building this repo did work fine. After connecting everything, I ran into the following issue:

openocd -s script -s <somepath...>/tcl -f interface/ftdi/olimex-arm-usb-ocd-h.cfg -f script/rtl8710.ocd -c "init" -c "reset halt" -c "rtl8710_flash_read_id" -c "rtl8710_flash_read dump.bin 0 1048576" -c "shutdown"
Open On-Chip Debugger 0.10.0+dev-00867-g2b78f65a (2019-05-18-19:11)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
script/rtl8710.ocd:36: Error: DAP name invalid!
in procedure 'script' 
at file "embedded:startup.tcl", line 26
at file "script/rtl8710.ocd", line 36

I could fix it with a small change in the generated script/rtl8710.ocd. Search for target create $_TARGETNAME cortex_m -endian $_ENDIAN -chain-position $_TARGETNAME and replace by

set _DAPNAME $_CHIPNAME.dap
dap create $_DAPNAME -chain-position $_TARGETNAME
target create $_TARGETNAME cortex_m -endian $_ENDIAN -dap $_DAPNAME
kissste commented 3 years ago

Thank you for the code snippet @chevdor