scripts/icestorm: move SHIFT_COUNTER_BITS into Makefile

This makes it easier to build separate bitstreams for simulation targets
vs the real bitstream for hardware, without editing any source code.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
This commit is contained in:
Austin Seipp 2019-01-11 15:14:32 -06:00
parent 752790a4d7
commit 2944564ba8
2 changed files with 11 additions and 4 deletions

View File

@ -1,12 +1,18 @@
TOOLCHAIN_PREFIX = riscv32-unknown-elf- TOOLCHAIN_PREFIX = riscv32-unknown-elf-
# set to 4 for simulation
FIRMWARE_COUNTER_BITS=18
all: example.bin all: example.bin
## ------------------- ## -------------------
## firmware generation ## firmware generation
firmware.elf: firmware.S firmware.c firmware.lds firmware.elf: firmware.S firmware.c firmware.lds
$(TOOLCHAIN_PREFIX)gcc -march=rv32i -Os -ffreestanding -nostdlib -o $@ firmware.S firmware.c \ $(TOOLCHAIN_PREFIX)gcc \
-DSHIFT_COUNTER_BITS=$(FIRMWARE_COUNTER_BITS) \
-march=rv32i -Os -ffreestanding -nostdlib \
-o $@ firmware.S firmware.c \
--std=gnu99 -Wl,-Bstatic,-T,firmware.lds,-Map,firmware.map,--strip-debug -lgcc --std=gnu99 -Wl,-Bstatic,-T,firmware.lds,-Map,firmware.map,--strip-debug -lgcc
chmod -x $@ chmod -x $@

View File

@ -1,7 +1,8 @@
#include <stdint.h> #include <stdint.h>
// use SHIFT_COUNTER_BITS=4 for simulation #ifndef SHIFT_COUNTER_BITS
#define SHIFT_COUNTER_BITS 18 #error SHIFT_COUNTER_BITS must be defined as 4 (for simulation) or 18 (for hardware bitstreams)!
#endif
void output(uint8_t c) void output(uint8_t c)
{ {