Skip to content

Instantly share code, notes, and snippets.

@gojimmypi
Created February 8, 2019 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gojimmypi/b85315b4f1786ffced390a1c051f59c8 to your computer and use it in GitHub Desktop.
Save gojimmypi/b85315b4f1786ffced390a1c051f59c8 to your computer and use it in GitHub Desktop.
TinyFGPA Makefile for picosoc example created on WSL using arachne-pnr
version = 1.2
riscvbin = /opt/riscv32i/bin/
tinyFPGA_COM ?= /dev/ttyS8
upload: hardware.bin firmware.bin
sudo chmod 0666 $(tinyFPGA_COM)
tinyprog --com $(tinyFPGA_COM) -p hardware.bin -u firmware.bin
hardware.blif: hardware.v spimemio.v simpleuart.v picosoc.v picorv32.v
yosys -ql hardware.log -p 'synth_ice40 -top hardware -blif hardware.blif' $^
# yosys -ql hardware.log -p 'synth_ice40 -top hardware -blif hardware.blif -json hardware.json ' $^
hardware.asc: hardware.pcf hardware.blif
arachne-pnr -r -d 8k -P cm81 -o hardware.asc -p hardware.pcf hardware.blif
# nextpnr-ice40 --lp8k --package cm81 --json hardware.json --pcf hardware.pcf --asc hardware.asc
hardware.bin: hardware.asc
icetime -d hx8k -c 12 -mtr hardware.rpt hardware.asc
icepack hardware.asc hardware.bin
firmware.elf: sections.lds start.S firmware.c
$(riscvbin)/riscv32-unknown-elf-gcc -march=rv32imc -nostartfiles -Wl,-Bstatic,-T,sections.lds,--strip-debug,-Map=firmware.map,--cref -ffreestanding -nostdlib -o firmware.elf start.S firmware.c
firmware.bin: firmware.elf
$(riscvbin)/riscv32-unknown-elf-objcopy -O binary firmware.elf /dev/stdout > firmware.bin
clean:
rm -f firmware.elf firmware.hex firmware.bin firmware.o firmware.map \
hardware.blif hardware.log hardware.asc hardware.rpt hardware.bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment