summaryrefslogtreecommitdiff
path: root/template/Makefile
diff options
context:
space:
mode:
authorThomas Albers <thomas@thomaslabs.org>2023-08-14 10:47:54 +0200
committerThomas Albers <thomas@thomaslabs.org>2023-08-14 10:47:54 +0200
commitad2623d8c4bc51638343ae9a628f8647ff558155 (patch)
treed41e8390824e6fee4c02eb044c7f5acb94b478bf /template/Makefile
Initial commitHEADmaster
Diffstat (limited to 'template/Makefile')
-rw-r--r--template/Makefile31
1 files changed, 31 insertions, 0 deletions
diff --git a/template/Makefile b/template/Makefile
new file mode 100644
index 0000000..32ce503
--- /dev/null
+++ b/template/Makefile
@@ -0,0 +1,31 @@
+ASM=crt0.asm
+SRC=bootloader.c
+
+OBJ=$(ASM:%.asm=build/%.rel) $(SRC:%.c=build/%.rel)
+IHX=output/bootloader.ihx
+TARGET=bootloader.hex
+
+CFLAGS=-mz80
+LDFLAGS=-mz80 --no-std-crt0 --code-loc 0x4010 -Wl-b_GSINIT=0x4150
+
+all : $(TARGET)
+
+output/%.rel : %.asm
+ sdasz80 -g -o $@ $<
+
+output/%.rel : %.c
+ sdcc $(CFLAGS) -c -o $@ $<
+
+$(IHX) : $(OBJ)
+ sdcc $(LDFLAGS) -o $@ $(OBJ)
+
+$(TARGET) : $(IHX)
+ hex2bin.py $< $@
+
+.PHONY: upload
+upload:
+ z80up $(TARGET) -p /dev/ttyUSB0
+
+.PHONY : clean
+clean :
+ @rm -rf output/* $(TARGET)