forked from zerog2k/stc_diyclock
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
40 lines (31 loc) · 931 Bytes
/
Makefile
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
SDCC ?= sdcc
STCCODESIZE ?= 4089
SDCCOPTS ?= --code-size $(STCCODESIZE) --xram-size 0 --data-loc 0x30 --disable-warning 126 --disable-warning 59
SDCCREV ?= -Dstc15f204ea
STCGAL ?= stcgal/stcgal.py
STCGALOPTS ?=
STCGALPORT ?= /dev/ttyUSB0
STCGALPROT ?= auto
FLASHFILE ?= main.hex
SYSCLK ?= 11059
CFLAGS ?= -DWITH_ALT_LED9 -DWITHOUT_LEDTABLE_RELOC
SRC = src/adc.c src/ds1302.c
OBJ=$(patsubst src%.c,build%.rel, $(SRC))
all: main
build/%.rel: src/%.c src/%.h
mkdir -p $(dir $@)
$(SDCC) $(SDCCOPTS) $(SDCCREV) -o $@ -c $<
main: $(OBJ)
$(SDCC) -o build/ src/$@.c $(SDCCOPTS) $(SDCCREV) $(CFLAGS) $^
@ tail -n 5 build/main.mem | head -n 2
@ tail -n 1 build/main.mem
cp build/$@.ihx $@.hex
eeprom:
sed -ne '/:..1/ { s/1/0/2; p }' main.hex > eeprom.hex
flash:
$(STCGAL) -p $(STCGALPORT) -P $(STCGALPROT) -t $(SYSCLK) $(STCGALOPTS) $(FLASHFILE)
clean:
rm -f *.ihx *.hex *.bin
rm -rf build/*
cpp: SDCCOPTS+=-E
cpp: main