From 0960ceb53ac076d313d65d0279274a8b801f8a96 Mon Sep 17 00:00:00 2001 From: Artturin Date: Fri, 14 Mar 2025 01:09:02 +0200 Subject: [PATCH] rv_tests/hello_world: Rename PREFIX var to CROSS_PREFIX and make it configurable And set it in devShell --- flake.nix | 3 +++ rv_tests/hello_world/Makefile | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index 500d77e..06f0db8 100644 --- a/flake.nix +++ b/flake.nix @@ -62,6 +62,9 @@ riscv64-linux.binutils riscv64-linux.glibc ]; + shellHook = '' + export CROSS_PREFIX="riscv64-none-elf" + ''; }; } ) { }; diff --git a/rv_tests/hello_world/Makefile b/rv_tests/hello_world/Makefile index 7a70dc4..f362111 100644 --- a/rv_tests/hello_world/Makefile +++ b/rv_tests/hello_world/Makefile @@ -1,9 +1,9 @@ # RISC-V toolchain -PREFIX = riscv64-unknown-elf -CC = $(PREFIX)-gcc -AS = $(PREFIX)-as -LD = $(PREFIX)-ld -OBJCOPY = $(PREFIX)-objcopy +CROSS_PREFIX ?= riscv64-unknown-elf +CC = $(CROSS_PREFIX)-gcc +AS = $(CROSS_PREFIX)-as +LD = $(CROSS_PREFIX)-ld +OBJCOPY = $(CROSS_PREFIX)-objcopy QEMU = qemu-system-riscv64 # Compilation flags