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