diff options
author | Thomas Albers <thomas@thomaslabs.org> | 2023-08-08 18:52:32 +0200 |
---|---|---|
committer | Thomas Albers <thomas@thomaslabs.org> | 2023-08-08 18:52:32 +0200 |
commit | 3c1c8415713f80cd0919f7bd5244d292f1c3cfe1 (patch) | |
tree | e82494ef6bf73c06628f254c3ae01b7e11156e55 /Makefile |
Initial commit
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 41 |
1 files changed, 41 insertions, 0 deletions
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) |