I am using sample UART code download from website and it is uses the following function. When i reboot the LPC2148 board, i got junk char display in hypter terminal, i verified the serial port settings.
void initUART0(int baud) {
int divisor = divide(getCclk(), (VPBDIV * 16 * baud));
U0LCR = 0x83; // 8 bit, 1 stop bit, no parity, enable DLAB
U0DLL = divisor & 0xFF;
U0DLM = (divisor >> 8) & 0xFF;
//U0DLL = 0x10; // = 60,000,000 / VPBDIV / (16 * 115200)
U0LCR &= ~0x80; // Disable DLAB
PINSEL0 = (PINSEL0 & 0xFFFFFFF0) | 0x00000005;
U0FCR = 0x03;
}
int put(int ch) {
if (ch == ‘\n’) {
while (!(U0LSR & 0x20));
U0THR = ‘\r’;
}
while (!(U0LSR & 0x20));
U0THR = ch;
}
When i use KEIL compiled uart code which is using SWI. It works well.
But i can’t use the same SWI routine in my GCC WinARM environment. I got the following error.
src/startup/crt.s: Assembler messages:
src/startup/crt.s:122: Error: bad instruction `dcd SWI_Cnt’
src/startup/crt.s:124: Error: bad instruction `import __SWI_8’
src/startup/crt.s:125: Error: bad instruction `import __SWI_9’
src/startup/crt.s:128: Error: bad instruction `dcd SWI_Dead’
src/startup/crt.s:129: Error: bad instruction `dcd SWI_Dead’
src/startup/crt.s:130: Error: bad instruction `dcd SWI_Dead’
src/startup/crt.s:131: Error: bad instruction `dcd SWI_Dead’
src/startup/crt.s:132: Error: bad instruction `dcd SWI_Dead’
src/startup/crt.s:133: Error: bad instruction `dcd SWI_Dead’
src/startup/crt.s:134: Error: bad instruction `dcd SWI_Dead’
src/startup/crt.s:135: Error: bad instruction `dcd SWI_Dead’
src/startup/crt.s:136: Error: bad instruction `dcd __SWI_8’
src/startup/crt.s:137: Error: bad instruction `dcd __SWI_9’
src/startup/crt.s:139: Error: bad instruction `swi_end’
Can you guess what might be a problem?