Skip to content
Ron Evans edited this page Jul 7, 2019 · 2 revisions

This page is for notes on using RISC-V with TinyGo, until a more "formal" place exists.

To use TinyGo with the SiFive HiFive1 Rev B board, you will need to install the SiFive "GNU Embedded Toolchain" from https://www.sifive.com/boards/

You must build llvm from source, in order to get a version of llvm with the risc-v support.

You might want to backup the llvm-build directory before you do this.

Run these commands:

make llvm-build
make

The HiFIve1 RevB board needs a firmware update in order to be flash correctly. Obtain the software from https://www.segger.com/downloads/jlink then once installed, run the following command:

JLinkExe

You should see output something like this:

SEGGER J-Link Commander V6.46g (Compiled Jun 14 2019 19:36:40)
DLL version V6.46g, compiled Jun 14 2019 19:36:30

Connecting to J-Link via USB...Updating firmware:  J-Link OB-K22-SiFive compiled May 27 2019 15:39:22
Replacing firmware: J-Link OB-K22-SiFive compiled Mar 15 2019 12:47:14
Waiting for new firmware to boot
New firmware booted successfully
O.K.
Firmware: J-Link OB-K22-SiFive compiled May 27 2019 15:39:22
Hardware version: V1.00

Now you can build and flash your board with the "blinky" example. The HiFive1 will appear to your computer like a USB drive. Determine the path to the board, for example on Linux it will be something like /media/[USERNAME]/HiFive.

Run the following command, substituting the correct drive path:

./build/tinygo build -o /media/yourname/HiFive/flash.hex -target=hifive1b examples/blinky1

The board should restart, and the built-in LED should start blinking.

Clone this wiki locally