aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAustin Seipp <aseipp@pobox.com>2019-01-11 14:54:29 -0600
committerAustin Seipp <aseipp@pobox.com>2019-01-11 16:09:07 -0600
commit4900ebb6938a7f1720bc5f765c1e7f31ffd35407 (patch)
tree6a0ee13f04eff7c0c5c953eebb533c1cccbd03ee
parentfc71cadda4310b081fb0dd08b5afdd3270e868f2 (diff)
downloadpicorv32-4900ebb6938a7f1720bc5f765c1e7f31ffd35407.tar.gz
picorv32-4900ebb6938a7f1720bc5f765c1e7f31ffd35407.zip
scripts/icestorm: force -march=rv32i
The IceStorm example core doesn't include compressed instructions or the MULT extension; it is an rv32i core, not rv32i[m|c]. If the given riscv32 toolchain is not explicitly told to generate rv32i code for the firmware, it may generate invalid instructions which cause a trap during simulation or on the hardware itself (although CATCH_ILLINSN is set to zero in this case, too). Luckily, any rv32i* toolchain (rv32imc for example) can fit the bill here -- there's no use of libgcc or anything (which might introduce illegal instructions generated previously) so just forcing the compiler to generate the right code works nicely. Signed-off-by: Austin Seipp <aseipp@pobox.com>
-rw-r--r--scripts/icestorm/Makefile2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/icestorm/Makefile b/scripts/icestorm/Makefile
index ea4efff..e2771b1 100644
--- a/scripts/icestorm/Makefile
+++ b/scripts/icestorm/Makefile
@@ -4,7 +4,7 @@ TOOLCHAIN_PREFIX = riscv32-unknown-elf-
all: example.bin
firmware.elf: firmware.S firmware.c firmware.lds
- $(TOOLCHAIN_PREFIX)gcc -Os -ffreestanding -nostdlib -o $@ firmware.S firmware.c \
+ $(TOOLCHAIN_PREFIX)gcc -march=rv32i -Os -ffreestanding -nostdlib -o $@ firmware.S firmware.c \
--std=gnu99 -Wl,-Bstatic,-T,firmware.lds,-Map,firmware.map,--strip-debug -lgcc
chmod -x $@