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.
static __inline__ void init_uart(void)
{
- int16_t tmp;
// chip setup for UART0 use
PAPER = 0x0030;
PAOUT = 0x0000;
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;
}