2017-07-29 22:01:39 +08:00
|
|
|
|
2017-08-05 23:08:16 +08:00
|
|
|
testbench: testbench.vvp firmware.hex
|
2017-07-29 22:01:39 +08:00
|
|
|
vvp -N $<
|
|
|
|
|
2017-08-07 19:38:07 +08:00
|
|
|
testbench.vvp: spiflash.v spimemio.v testbench.v picosoc.v ../picorv32.v
|
2017-08-05 23:08:16 +08:00
|
|
|
iverilog -s testbench -o $@ $^
|
|
|
|
|
|
|
|
spiflash_tb: spiflash_tb.vvp firmware.hex
|
|
|
|
vvp -N $<
|
|
|
|
|
|
|
|
spiflash_tb.vvp: spiflash.v spiflash_tb.v
|
|
|
|
iverilog -s testbench -o $@ $^
|
|
|
|
|
2017-07-29 22:01:39 +08:00
|
|
|
prog: design.bin firmware.bin
|
|
|
|
iceprog design.bin
|
|
|
|
iceprog -o 1M firmware.bin
|
|
|
|
|
|
|
|
firmware.elf: firmware.s
|
|
|
|
riscv32-unknown-elf-gcc -c -o firmware.elf firmware.s
|
|
|
|
|
|
|
|
firmware_vma.elf: firmware.elf
|
|
|
|
riscv32-unknown-elf-objcopy --change-section-vma .text=0x00100000 firmware.elf firmware_vma.elf
|
|
|
|
|
|
|
|
firmware.hex: firmware_vma.elf
|
|
|
|
riscv32-unknown-elf-objcopy -O verilog firmware_vma.elf firmware.hex
|
|
|
|
|
|
|
|
firmware.bin: firmware.elf
|
|
|
|
riscv32-unknown-elf-objcopy -O binary firmware.elf firmware.bin
|
|
|
|
|
2017-08-07 19:38:07 +08:00
|
|
|
design.blif: spimemio.v picosoc.v ../picorv32.v
|
|
|
|
yosys -ql design.log -p 'synth_ice40 -top picosoc -blif design.blif' $^
|
2017-07-29 22:01:39 +08:00
|
|
|
|
|
|
|
design.asc: pinout.pcf design.blif
|
|
|
|
arachne-pnr -d 8k -o design.asc -p pinout.pcf design.blif
|
|
|
|
|
|
|
|
design.bin: design.asc
|
|
|
|
icetime -d hx8k -c 12 -mtr design.rpt design.asc
|
|
|
|
icepack design.asc design.bin
|
|
|
|
|
|
|
|
clean:
|
2017-08-05 23:08:16 +08:00
|
|
|
rm -f testbench.vvp testbench.vcd spiflash_tb.vvp spiflash_tb.vcd
|
2017-07-29 22:01:39 +08:00
|
|
|
rm -f firmware.elf firmware_vma.elf firmware.hex firmware.bin
|
|
|
|
rm -f design.blif design.log design.asc design.rpt design.bin
|
|
|
|
|
2017-08-05 23:08:16 +08:00
|
|
|
.PHONY: testbench spiflash_tb prog clean
|
2017-07-29 22:01:39 +08:00
|
|
|
|