diff options
author | David Lamparter <equinox@diac24.net> | 2012-09-22 23:31:08 +0200 |
---|---|---|
committer | David Lamparter <equinox@diac24.net> | 2012-09-22 23:31:44 +0200 |
commit | 75aa2df2c319a43186c6853dce551d63b3425bdf (patch) | |
tree | dce30a433ef4fcaa2a632e748082dd1d5b210834 | |
parent | 6966eb287f160c68c597105e60b191806a63b9ba (diff) |
tick: optional SP debugging
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | tick.c | 11 |
2 files changed, 13 insertions, 2 deletions
@@ -8,7 +8,7 @@ CFLAGS_OPT=-Os \ -fwhole-program CFLAGS_WARN=-std=gnu99 -Wall -Wextra -Wno-unused -pedantic CFLAGS_LD=-Wl,-T,avr4-signature.x -CFLAGS=${CFLAGS_WARN} ${CFLAGS_OPT} ${CFLAGS_LD} +CFLAGS_=${CFLAGS_WARN} ${CFLAGS_OPT} ${CFLAGS_LD} ${CFLAGS} MCU_door=48 MCU_lightctrl=88 AVRDUDE=avrdude @@ -32,4 +32,4 @@ endif %.flash: %.elf Makefile avr-objcopy -j .text -j .data -O ihex $< $@ %.elf: %.c *.c *.x Makefile - avr-gcc -mmcu=atmega$(MCU_$(basename $@)) ${CFLAGS} -o $@ $< + avr-gcc -mmcu=atmega$(MCU_$(basename $@)) ${CFLAGS_} -o $@ $< @@ -13,6 +13,7 @@ ISR(TIMER1_COMPA_vect) static void uart_puttick(void) { uint16_t frac = TCNT1; + _uart_putch('@'); uart_puthex(systick.u8[3]); uart_puthex(systick.u8[2]); @@ -20,6 +21,16 @@ static void uart_puttick(void) uart_puthex(systick.u8[0]); _uart_putch('.'); uart_puthex16(frac); +#if DEBUG_SP + _uart_putch('~'); + uint8_t spl, sph; + asm ("\n\ + in %[spl], 0x3d\n\ + in %[sph], 0x3e\n\ + " : [spl] "=r" (spl), [sph] "=r" (sph)); + uart_puthex(sph); + uart_puthex(spl); +#endif _uart_putch(' '); } |