2017-07-29 10:01:39 -04:00
|
|
|
|
2019-11-14 06:26:47 -05:00
|
|
|
CROSS=riscv32-unknown-elf-
|
|
|
|
CFLAGS=
|
|
|
|
|
2017-08-07 09:13:27 -04:00
|
|
|
# ---- iCE40 HX8K Breakout Board ----
|
|
|
|
|
2018-10-01 08:00:21 -04:00
|
|
|
hx8ksim: hx8kdemo_tb.vvp hx8kdemo_fw.hex
|
|
|
|
vvp -N $< +firmware=hx8kdemo_fw.hex
|
2017-08-07 16:36:58 -04:00
|
|
|
|
2018-10-01 08:00:21 -04:00
|
|
|
hx8ksynsim: hx8kdemo_syn_tb.vvp hx8kdemo_fw.hex
|
2019-02-11 17:13:05 -05:00
|
|
|
vvp -N $< +firmware=hx8kdemo_fw.hex
|
2017-08-07 16:36:58 -04:00
|
|
|
|
2020-08-09 21:58:19 -04:00
|
|
|
hx8kdemo.json: hx8kdemo.v spimemio.v simpleuart.v picosoc.v ../picorv32.v
|
|
|
|
yosys -ql hx8kdemo.log -p 'synth_ice40 -top hx8kdemo -json hx8kdemo.json' $^
|
2017-08-07 09:13:27 -04:00
|
|
|
|
2017-08-11 13:30:53 -04:00
|
|
|
hx8kdemo_tb.vvp: hx8kdemo_tb.v hx8kdemo.v spimemio.v simpleuart.v picosoc.v ../picorv32.v spiflash.v
|
2021-12-27 04:18:30 -05:00
|
|
|
iverilog -s testbench -o $@ $^ `yosys-config --datdir/ice40/cells_sim.v` -DNO_ICE40_DEFAULT_ASSIGNMENTS
|
2017-08-07 16:36:58 -04:00
|
|
|
|
|
|
|
hx8kdemo_syn_tb.vvp: hx8kdemo_tb.v hx8kdemo_syn.v spiflash.v
|
2021-12-27 04:18:30 -05:00
|
|
|
iverilog -s testbench -o $@ $^ `yosys-config --datdir/ice40/cells_sim.v` -DNO_ICE40_DEFAULT_ASSIGNMENTS
|
2017-08-07 16:36:58 -04:00
|
|
|
|
2021-12-27 04:18:30 -05:00
|
|
|
hx8kdemo_syn.v: hx8kdemo.json
|
|
|
|
yosys -p 'read_json hx8kdemo.json; write_verilog hx8kdemo_syn.v'
|
2017-08-07 16:36:58 -04:00
|
|
|
|
2020-08-09 21:58:19 -04:00
|
|
|
hx8kdemo.asc: hx8kdemo.pcf hx8kdemo.json
|
|
|
|
nextpnr-ice40 --hx8k --package ct256 --asc hx8kdemo.asc --json hx8kdemo.json --pcf hx8kdemo.pcf
|
2017-08-07 09:13:27 -04:00
|
|
|
|
|
|
|
hx8kdemo.bin: hx8kdemo.asc
|
|
|
|
icetime -d hx8k -c 12 -mtr hx8kdemo.rpt hx8kdemo.asc
|
|
|
|
icepack hx8kdemo.asc hx8kdemo.bin
|
|
|
|
|
2018-08-30 16:27:34 -04:00
|
|
|
hx8kprog: hx8kdemo.bin hx8kdemo_fw.bin
|
2017-09-21 13:45:41 -04:00
|
|
|
iceprog hx8kdemo.bin
|
2018-08-30 16:27:34 -04:00
|
|
|
iceprog -o 1M hx8kdemo_fw.bin
|
2017-09-21 13:45:41 -04:00
|
|
|
|
2018-08-30 16:27:34 -04:00
|
|
|
hx8kprog_fw: hx8kdemo_fw.bin
|
|
|
|
iceprog -o 1M hx8kdemo_fw.bin
|
2017-09-21 13:45:41 -04:00
|
|
|
|
2019-03-01 19:57:22 -05:00
|
|
|
hx8kdemo_sections.lds: sections.lds
|
2019-11-14 06:26:47 -05:00
|
|
|
$(CROSS)cpp -P -DHX8KDEMO -o $@ $^
|
2019-02-11 17:44:47 -05:00
|
|
|
|
|
|
|
hx8kdemo_fw.elf: hx8kdemo_sections.lds start.s firmware.c
|
2020-06-03 03:48:04 -04:00
|
|
|
$(CROSS)gcc $(CFLAGS) -DHX8KDEMO -mabi=ilp32 -march=rv32imc -Wl,--build-id=none,-Bstatic,-T,hx8kdemo_sections.lds,--strip-debug -ffreestanding -nostdlib -o hx8kdemo_fw.elf start.s firmware.c
|
2018-08-19 07:38:59 -04:00
|
|
|
|
|
|
|
hx8kdemo_fw.hex: hx8kdemo_fw.elf
|
2019-11-14 06:26:47 -05:00
|
|
|
$(CROSS)objcopy -O verilog hx8kdemo_fw.elf hx8kdemo_fw.hex
|
2018-08-19 07:38:59 -04:00
|
|
|
|
|
|
|
hx8kdemo_fw.bin: hx8kdemo_fw.elf
|
2019-11-14 06:26:47 -05:00
|
|
|
$(CROSS)objcopy -O binary hx8kdemo_fw.elf hx8kdemo_fw.bin
|
2018-08-19 07:38:59 -04:00
|
|
|
|
2018-08-18 14:17:21 -04:00
|
|
|
# ---- iCE40 IceBreaker Board ----
|
|
|
|
|
2018-10-01 08:00:21 -04:00
|
|
|
icebsim: icebreaker_tb.vvp icebreaker_fw.hex
|
|
|
|
vvp -N $< +firmware=icebreaker_fw.hex
|
2018-08-18 14:17:21 -04:00
|
|
|
|
2018-10-01 08:00:21 -04:00
|
|
|
icebsynsim: icebreaker_syn_tb.vvp icebreaker_fw.hex
|
|
|
|
vvp -N $< +firmware=icebreaker_fw.hex
|
2018-08-18 14:17:21 -04:00
|
|
|
|
2019-02-11 17:13:05 -05:00
|
|
|
icebreaker.json: icebreaker.v ice40up5k_spram.v spimemio.v simpleuart.v picosoc.v ../picorv32.v
|
2021-09-02 12:35:38 -04:00
|
|
|
yosys -ql icebreaker.log -p 'synth_ice40 -dsp -top icebreaker -json icebreaker.json' $^
|
2018-08-18 14:17:21 -04:00
|
|
|
|
2019-02-11 17:13:05 -05:00
|
|
|
icebreaker_tb.vvp: icebreaker_tb.v icebreaker.v ice40up5k_spram.v spimemio.v simpleuart.v picosoc.v ../picorv32.v spiflash.v
|
2021-12-27 04:18:30 -05:00
|
|
|
iverilog -s testbench -o $@ $^ `yosys-config --datdir/ice40/cells_sim.v` -DNO_ICE40_DEFAULT_ASSIGNMENTS
|
2018-08-18 14:17:21 -04:00
|
|
|
|
|
|
|
icebreaker_syn_tb.vvp: icebreaker_tb.v icebreaker_syn.v spiflash.v
|
2021-12-27 04:18:30 -05:00
|
|
|
iverilog -s testbench -o $@ $^ `yosys-config --datdir/ice40/cells_sim.v` -DNO_ICE40_DEFAULT_ASSIGNMENTS
|
2018-08-18 14:17:21 -04:00
|
|
|
|
|
|
|
icebreaker_syn.v: icebreaker.json
|
|
|
|
yosys -p 'read_json icebreaker.json; write_verilog icebreaker_syn.v'
|
|
|
|
|
|
|
|
icebreaker.asc: icebreaker.pcf icebreaker.json
|
2021-09-02 12:35:38 -04:00
|
|
|
nextpnr-ice40 --freq 13 --up5k --package sg48 --asc icebreaker.asc --pcf icebreaker.pcf --json icebreaker.json
|
2018-08-18 14:17:21 -04:00
|
|
|
|
|
|
|
icebreaker.bin: icebreaker.asc
|
|
|
|
icetime -d up5k -c 12 -mtr icebreaker.rpt icebreaker.asc
|
|
|
|
icepack icebreaker.asc icebreaker.bin
|
|
|
|
|
2018-08-19 07:38:59 -04:00
|
|
|
icebprog: icebreaker.bin icebreaker_fw.bin
|
2018-08-18 14:17:21 -04:00
|
|
|
iceprog icebreaker.bin
|
2018-08-19 07:38:59 -04:00
|
|
|
iceprog -o 1M icebreaker_fw.bin
|
2018-08-18 14:17:21 -04:00
|
|
|
|
2018-08-19 07:38:59 -04:00
|
|
|
icebprog_fw: icebreaker_fw.bin
|
|
|
|
iceprog -o 1M icebreaker_fw.bin
|
2017-08-07 09:13:27 -04:00
|
|
|
|
2019-02-11 17:44:47 -05:00
|
|
|
icebreaker_sections.lds: sections.lds
|
2019-11-14 06:26:47 -05:00
|
|
|
$(CROSS)cpp -P -DICEBREAKER -o $@ $^
|
2019-02-11 17:44:47 -05:00
|
|
|
|
|
|
|
icebreaker_fw.elf: icebreaker_sections.lds start.s firmware.c
|
2020-06-03 03:48:04 -04:00
|
|
|
$(CROSS)gcc $(CFLAGS) -DICEBREAKER -mabi=ilp32 -march=rv32ic -Wl,-Bstatic,-T,icebreaker_sections.lds,--strip-debug -ffreestanding -nostdlib -o icebreaker_fw.elf start.s firmware.c
|
2017-07-29 10:01:39 -04:00
|
|
|
|
2018-08-19 07:38:59 -04:00
|
|
|
icebreaker_fw.hex: icebreaker_fw.elf
|
2019-11-14 06:26:47 -05:00
|
|
|
$(CROSS)objcopy -O verilog icebreaker_fw.elf icebreaker_fw.hex
|
2017-07-29 10:01:39 -04:00
|
|
|
|
2018-08-19 07:38:59 -04:00
|
|
|
icebreaker_fw.bin: icebreaker_fw.elf
|
2019-11-14 06:26:47 -05:00
|
|
|
$(CROSS)objcopy -O binary icebreaker_fw.elf icebreaker_fw.bin
|
2017-07-29 10:01:39 -04:00
|
|
|
|
2017-09-21 13:45:41 -04:00
|
|
|
# ---- Testbench for SPI Flash Model ----
|
|
|
|
|
2021-12-27 04:18:30 -05:00
|
|
|
spiflash_tb: spiflash_tb.vvp icebreaker_fw.hex
|
|
|
|
vvp -N $< +firmware=icebreaker_fw.hex
|
2017-09-21 13:45:41 -04:00
|
|
|
|
|
|
|
spiflash_tb.vvp: spiflash.v spiflash_tb.v
|
|
|
|
iverilog -s testbench -o $@ $^
|
|
|
|
|
2017-10-01 09:45:46 -04:00
|
|
|
# ---- ASIC Synthesis Tests ----
|
|
|
|
|
|
|
|
cmos.log: spimemio.v simpleuart.v picosoc.v ../picorv32.v
|
|
|
|
yosys -l cmos.log -p 'synth -top picosoc; abc -g cmos2; opt -fast; stat' $^
|
|
|
|
|
2017-08-07 09:13:27 -04:00
|
|
|
# ---- Clean ----
|
2017-07-29 10:01:39 -04:00
|
|
|
|
|
|
|
clean:
|
2017-08-05 11:08:16 -04:00
|
|
|
rm -f testbench.vvp testbench.vcd spiflash_tb.vvp spiflash_tb.vcd
|
2018-08-19 07:38:59 -04:00
|
|
|
rm -f hx8kdemo_fw.elf hx8kdemo_fw.hex hx8kdemo_fw.bin cmos.log
|
|
|
|
rm -f icebreaker_fw.elf icebreaker_fw.hex icebreaker_fw.bin
|
2024-06-17 02:20:13 -04:00
|
|
|
rm -f hx8kdemo.json hx8kdemo.log hx8kdemo.asc hx8kdemo.rpt hx8kdemo.bin
|
2017-08-07 16:36:58 -04:00
|
|
|
rm -f hx8kdemo_syn.v hx8kdemo_syn_tb.vvp hx8kdemo_tb.vvp
|
2018-08-18 14:17:21 -04:00
|
|
|
rm -f icebreaker.json icebreaker.log icebreaker.asc icebreaker.rpt icebreaker.bin
|
|
|
|
rm -f icebreaker_syn.v icebreaker_syn_tb.vvp icebreaker_tb.vvp
|
2017-07-29 10:01:39 -04:00
|
|
|
|
2018-08-18 14:17:21 -04:00
|
|
|
.PHONY: spiflash_tb clean
|
|
|
|
.PHONY: hx8kprog hx8kprog_fw hx8ksim hx8ksynsim
|
|
|
|
.PHONY: icebprog icebprog_fw icebsim icebsynsim
|