From: Dan White Date: Sun, 1 Feb 2015 19:27:55 +0000 (-0600) Subject: Workaround unused-but-set-variable warning. X-Git-Tag: cheetah~7 X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=d8af276be32af24f2797ba121d958cfd7156c1d4;p=430.git Workaround unused-but-set-variable warning. The UART status register must be read to clear the flags and enable operation. Previously, it was read into a dummy variable which triggered the warning. Attempts to suppress the warning didn't work for some reason, but the statement "UART0_SR;" is sufficient to emit assembly to read the register. I don't trust this to always work, so there is a comment with the purpose of the line. --- diff --git a/msp4th/main.c b/msp4th/main.c index e14e849..c389cbd 100644 --- a/msp4th/main.c +++ b/msp4th/main.c @@ -89,7 +89,6 @@ static void __inline__ eint(void){ static __inline__ void init_uart(void) { - int16_t tmp; // chip setup for UART0 use PAPER = 0x0030; PAOUT = 0x0000; @@ -99,7 +98,9 @@ static __inline__ void init_uart(void) UART0_CR = UARTEn; // a read clears the register -- ready for TX/RX - tmp = UART0_SR; + // NOTE: make sure the ASM actually reads this register + // and isn't "optimized" out. So far, no problems... + UART0_SR; }