Hi,
I'm compiling this code for microblaze gcc
void uart1_printchar(unsigned char c) { while( (*(unsigned char *) UARTS_STATUS_REGISTER) & UART1_TX_BUFFER_FULL ); *(char *) UART1_TXRX_DATA = c; }
and when using no optimization the code works OK but when using -O2 to improve code optimization, mb-gcc generates this:
uart1_printchar: lbui r3,r0,UARTS_STATUS_REGISTER andi r5,r5,0x00ff andi r3,r3,UART1_TX_BUFFER_FULL #and1 $L2: bnei r3,$L2 sbi r5,r0,UART1_TXRX_DATA rtsd r15,8 nop
As you can see if the UART1_TX_BUFFER_FULL bit is 1 the program enters in infinite loop $L2
May be this is a broken mb-gcc? mb-gcc --version shows:
mb-gcc (GCC) 3.4.1 ( Xilinx EDK 8.2 Build EDK_Im.14 120906 ) Copyright (C) 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Thanks for any help Manuel