blob: 9311c3eafe8bca5236768606863a02fe57d36909 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
PROJECT=firmware
AS=sdasz80
CC=sdcc
CPP=sdcpp
ASM=crt0.asm\
isr.asm\
delay.asm
SRC=crc16.c\
bootloader.c\
font.c\
i2c.c\
input.c\
main.c\
tft.c\
tty.c\
menu.c
OBJ=$(ASM:%.asm=build/%.rel)\
$(SRC:%.c=build/%.rel)
IHX=build/$(PROJECT).ihx
TARGET=build/$(PROJECT).hex
INCLUDE=include
CFLAGS=-mz80 -I$(INCLUDE) --Werror
LDFLAGS=-mz80 --no-std-crt0\
--code-loc 0x0100\
--data-loc 0x8010\
-Wl-b_ISR_TABLE=0x0070\
-Wl-b_GSINIT=0x0080
ROM_CHIP=AT28C256
all : $(TARGET)
$(OBJ): | build
build:
@mkdir -p build
build/%.rel : asm/%.asm
@echo ' (AS)' $<
@$(CPP) -P -I$(INCLUDE) -DASSEMBLY $< > build/$(notdir $<)
@$(AS) -g -o $@ build/$(notdir $<)
build/%.rel : src/%.c
@echo ' (CC)' $<
@$(CC) $(CFLAGS) -c -o $@ $<
$(IHX) : $(OBJ)
@echo ' (LD)' $(OBJ)
@$(CC) $(LDFLAGS) -o $@ $(OBJ)
$(TARGET) : $(IHX)
@hex2bin.py $< $@
.PHONE : flash
flash :
@minipro -y -sp $(ROM_CHIP) -w $(TARGET)
.PHONY : clean
clean :
@find build -type f -delete
|