60 lines
1.3 KiB
Makefile
60 lines
1.3 KiB
Makefile
SDCC ?= sdcc
|
|
SDAR ?= sdar
|
|
STCCODESIZE ?= 4089
|
|
SDCCOPTS ?= -mmcs51 --iram-size 512 --code-size $(STCCODESIZE) --xram-size 0 --disable-warning 126 --disable-warning 59
|
|
SDCCREV ?= -Dstc15f204ea
|
|
STCGAL ?= stcgal
|
|
#/stcgal.py
|
|
STCGALOPTS ?=
|
|
STCGALPORT ?= /dev/ttyUSB0
|
|
STCGALPROT ?= auto
|
|
FLASHFILE ?= main.ihx
|
|
SYSCLK ?= 12000
|
|
CFLAGS ?= -DWITH_ALT_LED9 -DWITHOUT_LEDTABLE_RELOC -DSHOW_TEMP_DATE_WEEKDAY
|
|
|
|
LIBSRC = ports.c adc.c setpin_lo.c setpin_hi.c setpin.c ss_display.c stc15_configure_pin.c
|
|
|
|
|
|
LIBOBJ =$(patsubst %.c,%.rel, $(LIBSRC))
|
|
LIBNAME=mctools.lib
|
|
|
|
PRGSRC = main.c
|
|
PRGOBJ =$(patsubst %.c,%.rel, $(PRGSRC))
|
|
|
|
|
|
$(FLASHFILE): $(LIBNAME) $(PRGOBJ)
|
|
$(SDCC) -o $(FLASHFILE) $(SDCCOPTS) $(SDCCREV) $(CFLAGS) $(PRGOBJ) $(LIBNAME)
|
|
#// @ tail -n 5 build/main.mem | head -n 2
|
|
#// @ tail -n 1 build/main.mem
|
|
# cp build/$@.ihx $@.hex
|
|
|
|
|
|
|
|
$(LIBNAME): $(LIBOBJ)
|
|
$(SDAR) -rc $(LIBNAME) $(LIBOBJ)
|
|
#all:
|
|
# make uart2.ihx
|
|
|
|
%.rel: %.c
|
|
$(SDCC) $(SDCCOPTS) $(SDCCREV) -o $@ -c $<
|
|
|
|
eeprom:
|
|
sed -ne '/:..1/ { s/1/0/2; p }' main.hex > eeprom.hex
|
|
|
|
flash: $(FLASHFILE)
|
|
$(STCGAL) -p $(STCGALPORT) -P $(STCGALPROT) -t $(SYSCLK) $(STCGALOPTS) $(FLASHFILE)
|
|
|
|
clean:
|
|
rm -f *.ihx *.hex *.bin *.rst
|
|
rm -f *.map
|
|
rm -f *.rel
|
|
rm -f *.lst
|
|
rm -f *.sym
|
|
rm -f *.asm
|
|
rm -f *.lk
|
|
rm -f *.mem
|
|
rm -f *.lib
|
|
|
|
cpp: SDCCOPTS+=-E
|
|
cpp: main
|