mirror of https://github.com/YosysHQ/picorv32.git
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:
parent
752790a4d7
commit
2944564ba8
|
@ -1,13 +1,19 @@
|
|||
TOOLCHAIN_PREFIX = riscv32-unknown-elf-
|
||||
|
||||
# set to 4 for simulation
|
||||
FIRMWARE_COUNTER_BITS=18
|
||||
|
||||
all: example.bin
|
||||
|
||||
## -------------------
|
||||
## firmware generation
|
||||
|
||||
firmware.elf: firmware.S firmware.c firmware.lds
|
||||
$(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
|
||||
$(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
|
||||
chmod -x $@
|
||||
|
||||
firmware.bin: firmware.elf
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#include <stdint.h>
|
||||
|
||||
// use SHIFT_COUNTER_BITS=4 for simulation
|
||||
#define SHIFT_COUNTER_BITS 18
|
||||
#ifndef SHIFT_COUNTER_BITS
|
||||
#error SHIFT_COUNTER_BITS must be defined as 4 (for simulation) or 18 (for hardware bitstreams)!
|
||||
#endif
|
||||
|
||||
void output(uint8_t c)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue