2019-03-20 05:34:51 +01:00
|
|
|
SDCC ?= sdcc
|
2019-04-01 01:29:37 +02:00
|
|
|
STCCODESIZE ?= 13312
|
2019-05-02 09:27:01 +02:00
|
|
|
SDCCOPTS ?= --code-size $(STCCODESIZE) --xram-size 256 --idata-loc 0x80
|
2019-04-01 01:29:37 +02:00
|
|
|
#SDCCOPTS ?= --code-size $(STCCODESIZE) --xram-size 256 --stack-auto --model-large
|
2019-03-20 05:34:51 +01:00
|
|
|
FLASHFILE ?= main.hex
|
2019-04-01 01:29:37 +02:00
|
|
|
LARGE_LDFLAGS += -L/usr/share/sdcc/lib/large/
|
2019-03-20 05:34:51 +01:00
|
|
|
|
2019-04-01 01:20:28 +02:00
|
|
|
SRC = src/lcd.c src/key.c src/utils.c src/decn/decn.c src/calc.c
|
2019-03-20 05:34:51 +01:00
|
|
|
|
|
|
|
OBJ=$(patsubst src%.c,build%.rel, $(SRC))
|
|
|
|
|
|
|
|
all: main
|
|
|
|
|
|
|
|
build/%.rel: src/%.c src/%.h
|
|
|
|
mkdir -p $(dir $@)
|
|
|
|
$(SDCC) $(SDCCOPTS) -o $@ -c $<
|
|
|
|
|
|
|
|
main: $(OBJ)
|
|
|
|
$(SDCC) -o build/ src/$@.c $(SDCCOPTS) $(CFLAGS) $^
|
2019-04-01 01:29:37 +02:00
|
|
|
# $(SDCC) -o build/ src/$@.c $(SDCCOPTS) $(CFLAGS) $(LARGE_LDFLAGS) $^
|
2019-03-20 05:34:51 +01:00
|
|
|
@ 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
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f *.ihx *.hex *.bin
|
|
|
|
rm -rf build/*
|
|
|
|
|
|
|
|
cpp: SDCCOPTS+=-E
|
|
|
|
cpp: main
|