This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Sendchar error LPC2148

Hello,

When I try to compile my program I get the following error:

'project.axf: Error L6218E: Undefined symbol sendchar (referred from retarget.o).'

I've tried to solve this error for quite a while now, but it doesn't work out. I've read other forum threads and I've searched through the net, but I can't find a satisfying answer.

Some background info:
I'm trying to get the UART0 working on the LPC2148.
I use Keil uVision3 and I use the Philips LPC2000 Flash Utility V2.2.3 to upload the .hex file to the microcontroller.

I'm new with the UART and I find it quite difficult to work with.

This is the Retarget.c:

#include <stdio.h>
#include <rt_misc.h>

#pragma import(__use_no_semihosting_swi)

extern int sendchar(int ch);

struct __FILE (int handle;);
FILE __stdout;

int fputc(int ch, FILE *f) {
return (sendchar(ch));
}

int ferror(FILE*f) {
return EOF;
}

void _ttywrch(int ch) {
sendchar(ch);
}

void _sys_exit (int return_code) {
label: goto label;
}

I've tried several codes and everytime I get the same error. I've also tried the example code from 'The Insiders Guide To The Philips ARM7-Based Microcontrollers' for initializing the UART, which is:

#include "lpc214x.h"

void init_serial (void)
{
PINSEL0 = 0x00050000;
U1LCR = 0x00000083;
U1DLL = 0x000000C2;
U1LCR = 0x00000003;
}

int putchar (int ch)
{
if (ch == '\n') {
while (!(U1LSR & 0x20));
U1THR = CR
}
while (!(U1LSR & 0x20));
return (U1THR = ch);
}

int getchar (void)
{
while (!(U1LSR & 0x01));
return (U1RBR);
}

If I try to compile that, I get the error:

schiet.axf: Error: L6218E: Undefined symbol main (referred from kernel.o).

For my school project I need to get the LPC2148 communicating with a scoreboard. All that I have to get the LPC2148 to do is sending a code to the scoreboard to raise the score with '1' and I need to retrieve it's current score. But I have no ideas left how to get this working.

I hope that I've made my problem clear enough!

Kind regards!

Parents
  • Thanks for the feedback.
    Actually I'm very new indeed, but I'm trying my best to get this working for my school project.

    We've tried to define the sendchar function, but we simply didn't know how. Until now we only had to use delays and work with cases. That went well, but this is different :-P

    With help from a friend yesterday we got data echoed back, but that only worked in the debug mode. So the program was fine, you'd think. When we tried to connect the LPC2148 with a terminal, it didn't send anything back. So that was our poblem yesterday. But today we were unable to get our program compiled, we obviously changed something. We'll work on it tomorrow and I hope to give you some more details then.

    Thank you for your time,
    Kind regards.

Reply
  • Thanks for the feedback.
    Actually I'm very new indeed, but I'm trying my best to get this working for my school project.

    We've tried to define the sendchar function, but we simply didn't know how. Until now we only had to use delays and work with cases. That went well, but this is different :-P

    With help from a friend yesterday we got data echoed back, but that only worked in the debug mode. So the program was fine, you'd think. When we tried to connect the LPC2148 with a terminal, it didn't send anything back. So that was our poblem yesterday. But today we were unable to get our program compiled, we obviously changed something. We'll work on it tomorrow and I hope to give you some more details then.

    Thank you for your time,
    Kind regards.

Children
No data