diff options
author | Thomas Albers Raviola <thomas@thomaslabs.org> | 2025-02-13 01:48:01 +0100 |
---|---|---|
committer | Thomas Albers Raviola <thomas@thomaslabs.org> | 2025-02-13 01:48:01 +0100 |
commit | 70af8cae86d75b4b02e9f7bd7d3614262bc5eb16 (patch) | |
tree | 831401e72b02956863e31e6663aa9ab3b9b66eac /Makefile | |
parent | 13c0217bf19a2ddfb24b673455f6d362a46ebf7b (diff) |
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 61 |
1 files changed, 35 insertions, 26 deletions
@@ -1,34 +1,43 @@ -export PROJECT_ROOT=$(abspath .) +include scripts/config.mk + +PROJECT_ROOT = . +BUILD = build + +TARGET = $(BUILD)/rom.hex +BOOTLOADER = $(BUILD)/boot/bootloader.hex +FIRMWARE = $(BUILD)/firmware.hex + +SRC =\ + asm/crt0.asm\ + asm/delay.asm\ + asm/isr.asm\ + src/font.c\ + src/i2c.c\ + src/input.c\ + src/main.c\ + src/menu.c\ + src/tft.c\ + src/tty.c + +OBJ = $(patsubst %,$(BUILD)/%.rel,$(basename $(SRC))) +DEPS += $(patsubst %.rel,%.d,$(OBJ)) -BUILD=build - -TARGET=$(BUILD)/rom.hex -BOOTLOADER=$(BUILD)/boot/bootloader.hex -FIRMWARE=$(BUILD)/firmware.hex - -CODE_LOC=0x8100 -DATA_LOC=0xC000 -STACK_LOC=0x0000 -GSINIT_LOC=0x8080 - -ROM_CHIP=AT28C256 +all : $(TARGET) -DIRS=$(addprefix $(BUILD)/,asm src) +include boot/Makefile +include scripts/rules.mk -ASM=$(wildcard asm/*.asm) -SRC=$(wildcard src/*.c) +$(BUILD)/firmware.ihx : EXTRA_LDFLAGS=$(SYSTEM_LDFLAGS) +$(BUILD)/firmware.ihx : $(OBJ) -all : $(TARGET) +$(OBJ) : | $(BUILD) $(BUILD)/asm $(BUILD)/src +$(BUILD) $(BUILD)/asm $(BUILD)/src: + @mkdir -p $@ $(TARGET) : $(BOOTLOADER) $(FIRMWARE) - cat $^ > $@ - cp $(BOOTLOADER) /tmp/rom.hex - dd if=$(FIRMWARE) of=/tmp/rom.hex obs=4096 seek=3 conv=notrunc 2>/dev/null - mv /tmp/rom.hex $@ - -.PHONY : $(BOOTLOADER) -$(BOOTLOADER) : - make -C boot + @cp $(BOOTLOADER) /tmp/rom.hex + @dd if=$(FIRMWARE) of=/tmp/rom.hex obs=4096 seek=3 conv=notrunc 2>/dev/null + @mv /tmp/rom.hex $@ .PHONY : flash flash : @@ -38,4 +47,4 @@ flash : clean : @find $(BUILD) -type f -delete -include include.mk +-include $(DEPS) |