aboutsummaryrefslogtreecommitdiff
path: root/boot/Makefile
diff options
context:
space:
mode:
authorThomas Albers Raviola <thomas@thomaslabs.org>2024-12-03 21:45:47 +0100
committerThomas Albers Raviola <thomas@thomaslabs.org>2024-12-03 21:45:47 +0100
commitd46862a5bd2319c595b11427f781201ca063d194 (patch)
treee83d3f40c60233a1da85334745b882f188b0be52 /boot/Makefile
parent9cd14efb76a4ddbcd013f44d50dc1ff93d56c4ca (diff)
Add bootloader
Diffstat (limited to 'boot/Makefile')
-rw-r--r--boot/Makefile50
1 files changed, 50 insertions, 0 deletions
diff --git a/boot/Makefile b/boot/Makefile
new file mode 100644
index 0000000..2fff22d
--- /dev/null
+++ b/boot/Makefile
@@ -0,0 +1,50 @@
+AS=sdasz80
+CC=sdcc
+CPP=sdcpp
+
+ASM=crt0.asm
+SRC=crc16.c\
+ bootloader.c
+
+INCLUDE=../include
+BUILD=../build/boot
+
+OBJ=$(ASM:%.asm=$(BUILD)/%.rel)\
+ $(SRC:%.c=$(BUILD)/%.rel)
+
+IHX=$(BUILD)/bootloader.ihx
+TARGET=$(BUILD)/bootloader.hex
+
+CFLAGS=-mz80 -I$(INCLUDE) --Werror
+LDFLAGS=-mz80 --no-std-crt0\
+ --code-loc 0x8100\
+ --data-loc 0xC000\
+ --stack-loc 0x0000\
+ -Wl-b_GSINIT=0x8080
+
+all : $(TARGET)
+
+$(OBJ): | $(BUILD)
+
+$(BUILD) :
+ @mkdir -p $(BUILD)
+
+$(BUILD)/%.rel : %.asm
+ @echo ' (AS)' $<
+ @$(CPP) -P -I$(INCLUDE) -DASSEMBLY $< > $(BUILD)/$(notdir $<)
+ @$(AS) -g -o $@ $(BUILD)/$(notdir $<)
+
+$(BUILD)/%.rel : %.c
+ @echo ' (CC)' $<
+ @$(CC) $(CFLAGS) -c -o $@ $<
+
+$(IHX) : $(OBJ)
+ @echo ' (LD)' $(OBJ)
+ @$(CC) $(LDFLAGS) -o $@ $(OBJ)
+
+$(TARGET) : $(IHX)
+ @hex2bin.py $< $@
+
+.PHONY : clean
+clean :
+ @find $(BUILD) -type f -delete