2017-07-29 10:01:39 -04:00
|
|
|
|
2017-08-07 09:13:27 -04:00
|
|
|
# ---- iCE40 HX8K Breakout Board ----
|
|
|
|
|
2017-08-07 16:36:58 -04:00
|
|
|
hx8ksim: hx8kdemo_tb.vvp firmware.hex
|
|
|
|
vvp -N $<
|
|
|
|
|
|
|
|
hx8ksynsim: hx8kdemo_syn_tb.vvp firmware.hex
|
|
|
|
vvp -N $<
|
|
|
|
|
2017-08-11 13:30:53 -04:00
|
|
|
hx8kdemo.blif: hx8kdemo.v spimemio.v simpleuart.v picosoc.v ../picorv32.v
|
2017-08-07 09:13:27 -04:00
|
|
|
yosys -ql hx8kdemo.log -p 'synth_ice40 -top hx8kdemo -blif hx8kdemo.blif' $^
|
|
|
|
|
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
|
2017-09-17 14:38:03 -04:00
|
|
|
iverilog -s testbench -o $@ -D DEBUGREGS $^ `yosys-config --datdir/ice40/cells_sim.v`
|
2017-08-07 16:36:58 -04:00
|
|
|
|
|
|
|
hx8kdemo_syn_tb.vvp: hx8kdemo_tb.v hx8kdemo_syn.v spiflash.v
|
|
|
|
iverilog -s testbench -o $@ $^ `yosys-config --datdir/ice40/cells_sim.v`
|
|
|
|
|
|
|
|
hx8kdemo_syn.v: hx8kdemo.blif
|
|
|
|
yosys -p 'read_blif -wideports hx8kdemo.blif; write_verilog hx8kdemo_syn.v'
|
|
|
|
|
2017-08-07 09:13:27 -04:00
|
|
|
hx8kdemo.asc: hx8kdemo.pcf hx8kdemo.blif
|
|
|
|
arachne-pnr -d 8k -o hx8kdemo.asc -p hx8kdemo.pcf hx8kdemo.blif
|
|
|
|
|
|
|
|
hx8kdemo.bin: hx8kdemo.asc
|
|
|
|
icetime -d hx8k -c 12 -mtr hx8kdemo.rpt hx8kdemo.asc
|
|
|
|
icepack hx8kdemo.asc hx8kdemo.bin
|
|
|
|
|
2017-09-21 13:45:41 -04:00
|
|
|
hx8kprog: hx8kdemo.bin firmware.bin
|
|
|
|
iceprog hx8kdemo.bin
|
|
|
|
iceprog -o 1M firmware.bin
|
|
|
|
|
|
|
|
hx8kprog_fw: firmware.bin
|
|
|
|
iceprog -o 1M firmware.bin
|
|
|
|
|
2017-08-07 09:13:27 -04:00
|
|
|
# ---- Example Firmware ----
|
|
|
|
|
2017-09-15 09:35:26 -04:00
|
|
|
firmware.elf: sections.lds start.s firmware.c
|
2017-09-21 22:52:44 -04:00
|
|
|
riscv32-unknown-elf-gcc -march=rv32imc -Wl,-Bstatic,-T,sections.lds,--strip-debug -ffreestanding -nostdlib -o firmware.elf start.s firmware.c
|
2017-07-29 10:01:39 -04:00
|
|
|
|
2017-09-15 09:19:48 -04:00
|
|
|
firmware.hex: firmware.elf
|
2017-09-16 16:08:05 -04:00
|
|
|
riscv32-unknown-elf-objcopy -O verilog firmware.elf /dev/stdout | sed -e '1 s/@00000000/@00100000/; 2,65537 d;' > firmware.hex
|
2017-07-29 10:01:39 -04:00
|
|
|
|
|
|
|
firmware.bin: firmware.elf
|
2017-09-15 09:19:48 -04:00
|
|
|
riscv32-unknown-elf-objcopy -O binary firmware.elf /dev/stdout | tail -c +1048577 > firmware.bin
|
2017-07-29 10:01:39 -04:00
|
|
|
|
2017-09-21 13:45:41 -04:00
|
|
|
# ---- Testbench for SPI Flash Model ----
|
|
|
|
|
|
|
|
spiflash_tb: spiflash_tb.vvp firmware.hex
|
|
|
|
vvp -N $<
|
|
|
|
|
|
|
|
spiflash_tb.vvp: spiflash.v spiflash_tb.v
|
|
|
|
iverilog -s testbench -o $@ $^
|
|
|
|
|
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
|
2017-09-15 09:19:48 -04:00
|
|
|
rm -f firmware.elf firmware.hex firmware.bin
|
2017-08-07 09:13:27 -04:00
|
|
|
rm -f hx8kdemo.blif 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
|
2017-07-29 10:01:39 -04:00
|
|
|
|
2017-09-21 13:45:41 -04:00
|
|
|
.PHONY: spiflash_tb hx8kprog hx8kprog_fw hx8ksim hx8ksynsim clean
|
2017-07-29 10:01:39 -04:00
|
|
|
|