Skip to main content

Developing RISC-V Applications

This page covers standard RISC-V applications that do not use Signaloid's UxHw distribution-extended computation. If your application needs to perform arithmetic on probability distributions, see Developing UxHw Applications instead.

You program the built-in Signaloid SoC (ISA/ABI: rv32i / ilp32) in C and flash your binaries over the SD interface. See the shared operational model for the coprocessor workflow, and Getting Started for the end-to-end flow.

The Signaloid SoC is based on the open-source PicoRV32 project, extended to support a subset of Signaloid's distribution-extended computation, as well as communication with the host over the SD interface.

Install the RISC-V GNU cross-compilation toolchain

Compiling applications for the Signaloid SoC requires the open-source RISC-V GNU toolchain, built for the rv32i / ilp32 configuration.

caution

The pre-built binaries in the RISC-V GNU toolchain releases do not contain the standard C libraries compiled for the rv32i / ilp32 configuration that the Signaloid SoC needs; using them results in fatal compilation errors. Build the toolchain from source using the steps below.

Step A: clone the toolchain

git clone --recursive https://github.com/riscv-collab/riscv-gnu-toolchain.git

Step B: install GCC (macOS 14+ only)

This step is required on macOS 14+ with Apple clang 15.0.0. Skip it on earlier macOS versions and on Linux.

Install gcc-mp-13 and g++-mp-13:

sudo port install gcc13

Set CC and CXX so the configure step picks them up:

export CXX=g++-mp-13 CC=gcc-mp-13

Step C: configure

Configure the build for the rv32i ISA with the ilp32 ABI. Set --prefix to your desired installation directory. --disable-gdb skips building gdb; remove it if you want gdb.

./configure --prefix=/path/to/installation/dir --with-arch=rv32i --with-abi=ilp32 --disable-gdb

Step D: build

make

Optionally parallelize with -j, for example make -j4. The build takes several minutes; when it finishes, the toolchain is in the directory you passed to --prefix.

Compile your application

Example Makefiles for the Signaloid SoC are in the signaloid-soc-examples/ directory of the C0-microSD-Hardware repository. Edit each Makefile to point at your toolchain installation path before building.

Flash and run

The Signaloid SoC initializes its memory from the first 128 KiB of the flash user-data sector, so flash your binary with the -u option while the device is in Bootloader mode, then switch to Signaloid SoC mode and power-cycle:

sudo python3 ./C0_microSD_toolkit.py -t /dev/sdb -b program.bin -u

See Getting Started for the full identify → flash → run sequence.

Host application

To communicate with the application running on the C0-microSD, you need a host application that runs on the host system and exchanges data with the device application over the SD interface. See Host Interface and Protocol for the communication model, the host-side block offsets, and a worked host-application example. The demo applications in the Signaloid-C0-microSD-Demo repositories serve as examples of how you can build a host application.

Next steps