diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..dbc5712 --- /dev/null +++ b/Makefile @@ -0,0 +1,54 @@ +IMAGE = fpga-tools +PODMAN = podman run --rm -v $(CURDIR):/workspace $(IMAGE) + +# Which C program to build. Override: make PROG=test_uart +PROG ?= blink + +# ── Host-side C compilation (sdcc on host) ────────────────────────────────── + +blink.hex: PIC/blink.c + sdcc --use-non-free -mpic14 -p16f84a $< + +test_uart.hex: PIC/test_uart.c + sdcc --use-non-free -mpic14 -p16f84a $< + +# program.hex is what the testbench loads at runtime +program.hex: $(PROG).hex + cp $< $@ + +# prog_rom.vhd embeds the program for synthesis +PIC/prog_rom.vhd: program.hex + python3 hex2rom.py $< > $@ + +# Regenerate ROM from an arbitrary hex file: make rom HEX=foo.hex +rom: + python3 hex2rom.py $(HEX) > PIC/prog_rom.vhd + +# ── Container targets ──────────────────────────────────────────────────────── + +all: PIC/prog_rom.vhd + $(PODMAN) make -f Makefile.inner + +sim: program.hex + $(PODMAN) make -f Makefile.inner sim + +flash: pic_top.fs + openFPGALoader -b tangprimer25k $< + +show-top: + $(PODMAN) make -f Makefile.inner pic_top.dot + xdot pic_top.dot + +show-uart: + $(PODMAN) make -f Makefile.inner uart.dot + xdot uart.dot + +# ── Clean ──────────────────────────────────────────────────────────────────── + +clean: + $(PODMAN) make -f Makefile.inner clean + rm -f program.hex PIC/prog_rom.vhd + rm -f blink.hex blink.asm blink.cod blink.lst + rm -f test_uart.hex test_uart.asm test_uart.cod test_uart.lst + +.PHONY: all sim clean flash show-top show-uart rom |
