Hi there, Iam using Keil uVision3(MDK 3.11) with GNU compiler for my LPC2368 based project.
Iam seeing the following error (undefined reference to '__udivsi3') and warnings( missing braces around initializer) :
Build target 'MCB2300' assembling Startup.s... compiling LPC2000_CAN_Driver.c... src/LPC2000_CAN_Driver.c(72): warning: missing braces around initializer src/LPC2000_CAN_Driver.c(72): warning: (near initialization for 'CAN_Send_Data[0].DataField') compiling target.c... compiling irq.c... compiling LPC2000_CAN_SYS.c... linking... lpc2000_can_sys.o(.text+0x21c): In function 'uart0_config': src/LPC2000_CAN_SYS.c(225): error: undefined reference to '__udivsi3' collect2: ld returned 1 exit status Target not created
The error message points to the code line "temp_uart0 = (Fpclk/16)/Baudrate; " in the following source code :
void uart0_config(UInt32 Baudrate,UART0MODE U0_config) { UInt32 temp_uart0; U0LCR = 0x80; // DLAB=1, Can use U0DLM, U0DLL temp_uart0 = (Fpclk/16)/Baudrate; U0DLM = temp_uart0>>8; U0DLL = temp_uart0&0xFF; temp_uart0 = U0_config.Datalength - 5; if( U0_config.Stopbit == 2 ) temp_uart0 |= 0x04; if( U0_config.Paritybit != 0 ) { U0_config.Paritybit = U0_config.Paritybit - 1; temp_uart0 |= 0x08; } temp_uart0 |= U0_config.Paritybit<<4; U0LCR = temp_uart0; U0FCR = 0x07; U0IER = IER_RBR | IER_RLS; }
The warning points to the following code:
lpc2000CANdriver_TXObj_t CAN_Send_Data[] = {{0x00080000,0x00000001,0x12345678,0x12345678}, {0x00080000,0x00000002,0x12345678,0x12345678}, {0x00080000,0x00000347,0x12345678,0x12345678}, {0x00080000,0x000003F1,0x1643F6E5,0xD4C3B2A1}};
I have observed that, in the Linker settings if the option "Donot use Standard system libraries" is not selected then the error is not reported by the compiler. But, the UART doesnot work.
I have tried out the same program using Real View Compiler and it works fine.
Kindly give me your suggestions.