Differences between revisions 5 and 9 (spanning 4 versions)
Revision 5 as of 2020-12-06 20:17:57
Size: 1318
Comment: Minor fix
Revision 9 as of 2022-06-04 23:55:25
Size: 1681
Editor: PaulWise
Comment: typos
Deletions are marked like this. Additions are marked like this.
Line 21: Line 21:
|| [[DebianPts:gcc-9-riscv64-linux-gnu|gcc-9-riscv64-linux-gnu]] || C compiler || || [[DebianPts:gcc-riscv64-unknown-elf|gcc-riscv64-unknown-elf]] || C compiler || use --print-multi-lib to see compile targets, use for example -march=rv32imac -mabi=ilp32 ||
|| [[DebianPts:llvm-defaults|clang]] || C compiler || use --print-targets to check support, use --target=riscv32 to build ||
Line 42: Line 43:

==== chroot ====

DebianPackage:qemu-user-static supports riscv32 if you would like to install a 32-bit RISC-V Linux distro into a chroot.

This page contains details about cross-compiling for the RISC-V architecture called riscv32.

The RISC-V architecture provides 32-bit, 64-bit, and 128-bit variants.

While theoretically possible to run Debian on a 32-bit RISC-V architecture, most available 32-bit CPUs are limited to microcontrollers or low-memory systems.

Available devices

Description and website

Docs

SeeedStudio GD32

Soft core on Fomu FPGA

docs

PineCone BL602

docs

Compilers and libraries

gcc-riscv64-unknown-elf

C compiler

use --print-multi-lib to see compile targets, use for example -march=rv32imac -mabi=ilp32

clang

C compiler

use --print-targets to check support, use --target=riscv32 to build

Emulators

QEMU

Install:

apt install qemu-system-misc opensbi

Run:

qemu-system-riscv32 \
   -M virt -nographic -m 500M \
   -bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf \
   -kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf \
   -device virtio-blk-device,drive=hd0 \
   -netdev user,id=net0 -device virtio-net-device,netdev=net0

chroot

qemu-user-static supports riscv32 if you would like to install a 32-bit RISC-V Linux distro into a chroot.