From d46862a5bd2319c595b11427f781201ca063d194 Mon Sep 17 00:00:00 2001 From: Thomas Albers Raviola Date: Tue, 3 Dec 2024 21:45:47 +0100 Subject: Add bootloader --- Makefile | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index b1b2c0d..ea09b19 100644 --- a/Makefile +++ b/Makefile @@ -15,14 +15,16 @@ SRC=font.c\ tty.c\ menu.c -OBJ=$(ASM:%.asm=build/%.rel)\ - $(SRC:%.c=build/%.rel) +INCLUDE=include +BUILD=build -IHX=build/$(PROJECT).ihx -TARGET=build/$(PROJECT).hex -BOOTLOADER=build/boot/bootloader.hex +OBJ=$(ASM:%.asm=$(BUILD)/%.rel)\ + $(SRC:%.c=$(BUILD)/%.rel) + +IHX=$(BUILD)/$(PROJECT).ihx +TARGET=$(BUILD)/$(PROJECT).hex +BOOTLOADER=$(BUILD)/boot/bootloader.hex -INCLUDE=include CFLAGS=-mz80 -I$(INCLUDE) --Werror LDFLAGS=-mz80 --no-std-crt0\ --code-loc 0x0100\ @@ -34,17 +36,17 @@ ROM_CHIP=AT28C256 all : $(TARGET) -$(OBJ): | build +$(OBJ): | $(BUILD) -build: - @mkdir -p build +$(BUILD): + @mkdir -p $(BUILD) -build/%.rel : asm/%.asm +$(BUILD)/%.rel : asm/%.asm @echo ' (AS)' $< - @$(CPP) -P -I$(INCLUDE) -DASSEMBLY $< > build/$(notdir $<) - @$(AS) -g -o $@ build/$(notdir $<) + @$(CPP) -P -I$(INCLUDE) -DASSEMBLY $< > $(BUILD)/$(notdir $<) + @$(AS) -g -o $@ $(BUILD)/$(notdir $<) -build/%.rel : src/%.c +$(BUILD)/%.rel : src/%.c @echo ' (CC)' $< @$(CC) $(CFLAGS) -c -o $@ $< @@ -54,15 +56,16 @@ $(IHX) : $(OBJ) $(TARGET) : $(IHX) $(BOOTLOADER) @hex2bin.py -l 32768 $< $@ - @dd if=$(BOOTLOADER) of=$@ obs=1024 seek=28 conv=notrunc + @dd if=$(BOOTLOADER) of=$@ obs=1024 seek=28 conv=notrunc 2>/dev/null +.PHONY : $(BOOTLOADER) $(BOOTLOADER) : - make -C boot + @make -C boot -.PHONE : flash +.PHONY : flash flash : @minipro -y -sp $(ROM_CHIP) -w $(TARGET) .PHONY : clean clean : - @find build -type f -delete + @find $(BUILD) -type f -delete -- cgit v1.2.3