[Concept,08/13] ulib: riscv: Enable Rust demo for qemu-riscv64
Commit Message
From: Simon Glass <simon.glass@canonical.com>
The Rust ulib demo currently works on x86 (32-bit and 64-bit) but not
on RISC-V. Unlike x86, RISC-V has no calling-convention mismatch, so
Rust's extern "C" naturally matches the standard ABI with no extra
flags.
Add the riscv64gc-unknown-none-elf built-in Rust target (which already
has panic-strategy: abort) and enable CONFIG_RUST_EXAMPLES in the
qemu-riscv64 defconfig so that rust-demo.bin is produced alongside
demo.bin
Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---
configs/qemu-riscv64_defconfig | 1 +
scripts/Makefile.ulib-example | 2 ++
2 files changed, 3 insertions(+)
@@ -24,3 +24,4 @@ CONFIG_UTHREAD=y
CONFIG_UNIT_TEST=y
CONFIG_ULIB=y
CONFIG_EXAMPLES=y
+CONFIG_RUST_EXAMPLES=y
@@ -25,6 +25,8 @@ RUST_TARGET_x86 := i686-unknown-linux-gnu
RUST_TARGET_x86_64 := x86_64-unknown-none
RUST_FLAGS_x86 := -C panic=abort -C relocation-model=static
RUST_FLAGS_x86_64 :=
+RUST_TARGET_riscv := riscv64gc-unknown-none-elf
+RUST_FLAGS_riscv :=
ifdef CONFIG_X86_64
RUST_TARGET := $(RUST_TARGET_$(EXAMPLE_ARCH)_64)