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