From 3c1c8415713f80cd0919f7bd5244d292f1c3cfe1 Mon Sep 17 00:00:00 2001 From: Thomas Albers Date: Tue, 8 Aug 2023 18:52:32 +0200 Subject: Initial commit --- Makefile | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..bd309f5 --- /dev/null +++ b/Makefile @@ -0,0 +1,41 @@ +ASM=crt0.asm +SRC=crc16.c zbootloader.c + +OBJ=$(ASM:%.asm=build/%.rel) $(SRC:%.c=build/%.rel) +IHX=build/bootloader.ihx +TARGET=bootloader.hex + +CFLAGS=-mz80 -I. --Werror +LDFLAGS=-mz80 --no-std-crt0 --code-loc 0x100 --data-loc 0x8000 -Wl-b_GSINIT=0x80 + +ROM_CHIP=SST39SF020A + +all : $(TARGET) + +build/%.rel : %.asm + @echo ' (AS)' $< + @sdcpp -P -I. -DASSEMBLY $< > build/$< + @sdasz80 -g -o $@ build/$< + +build/%.rel : %.c + @echo ' (CC)' $< + @sdcc $(CFLAGS) -c -o $@ $< + +$(IHX) : $(OBJ) + @echo ' (LD)' $(OBJ) + @sdcc $(LDFLAGS) -o $@ $(OBJ) + +$(TARGET) : $(IHX) + @hex2bin.py $< $@ + +.PHONY : upload +upload : + z80up $(TARGET) -p /dev/ttyUSB0 + +.PHONE : flash +flash : + minipro -y -sp $(ROM_CHIP) -w $(TARGET) + +.PHONY : clean +clean : + @rm -rf build/* $(TARGET) -- cgit v1.2.3