added facility to debug the stack pointer on P3_4 (LCD LED cathode)

roughly 139 bytes
functions were chosen by manually traversing pow_decn to the bottom
This commit is contained in:
Mirko Scholz
2020-09-08 23:46:41 +02:00
parent 7593260487
commit 4316f928f8
10 changed files with 167 additions and 16 deletions

View File

@ -4,8 +4,9 @@ SDCCOPTS ?= --code-size $(STCCODESIZE) --xram-size 256 --idata-loc 0x80
#SDCCOPTS ?= --code-size $(STCCODESIZE) --xram-size 256 --stack-auto --model-large
FLASHFILE ?= main.hex
LARGE_LDFLAGS += -L/usr/share/sdcc/lib/large/
# CFLAGS += -DSTACK_DEBUG # write the stack pointer to P3_4
SRC = src/lcd.c src/key.c src/utils.c src/decn/decn.c src/calc.c
SRC = src/lcd.c src/key.c src/utils.c src/decn/decn.c src/calc.c src/stack_debug.c
OBJ=$(patsubst src%.c,build%.rel, $(SRC))
@ -13,7 +14,7 @@ all: main
build/%.rel: src/%.c src/%.h
mkdir -p $(dir $@)
$(SDCC) $(SDCCOPTS) -o $@ -c $<
$(SDCC) $(SDCCOPTS) $(CFLAGS) -o $@ -c $<
main: $(OBJ)
$(SDCC) -o build/ src/$@.c $(SDCCOPTS) $(CFLAGS) $^
@ -21,7 +22,7 @@ main: $(OBJ)
@ 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