riscv-software-src / homebrew-riscv

homebrew (macOS) packages for RISC-V toolchain
https://riscv.org
310 stars 50 forks source link

Add support for RISC-V OpenOCD #70

Closed tuupola closed 3 years ago

tuupola commented 3 years ago

This PR adds support for installing the RISC-V version of OpenOCD.

Since the repository does not seem to tag versions I followed the example from other recipes and used the repository as the url and branch name as the version. This recipe installs cleanly on macOS Catalina 10.15.7 (19H1323). Recipe installs as a keg because it conflicts with the vanilla OpenOCD provided by Homebrew.

I can successfully compile and upload Nuclei SDK examples to a Longan Nano board. I have not tried with any other boards.

$ make SOC=gd32vf103 BOARD=gd32vf103c_longan_nano upload
...
JTAG tap: riscv.cpu tap/device found: 0x1000563d (mfg: 0x31e (Andes Technology Corporation), part: 0x0005, ver: 0x1)
JTAG tap: auto0.tap tap/device found: 0xffffffff (mfg: 0x7ff (<invalid>), part: 0xffff, ver: 0xf)
Loading section .init, size 0x26c lma 0x8000000
Loading section .text, size 0x241e lma 0x8000280
Loading section .rodata, size 0x484 lma 0x80026a0
Loading section .data, size 0x6c lma 0x8002b24
Start address 0x0800015c, load size 11130
Transfer rate: 6 KB/sec, 2782 bytes/write.
A debugging session is active.

    Inferior 1 [Remote target] will be detached.

Quit anyway? (y or n) [answered Y; input not from terminal]
[Inferior 1 (Remote target) detached]
$
sbeamer commented 3 years ago

Thank you for this contribution! It is great to add OpenOCD!

Since this has significant dependences to run (not just build), would it be possible to not include this in the default riscv-tools? In other words, keep the commit creating the formula, drop the commit adding it to riscv-tools, and add a commit to advertise the availability of OpenOCD in the README?

tuupola commented 3 years ago

Done. Does it look ok?

sbeamer commented 3 years ago

Looks great! Thanks!