Forums

GNUARM Eclipse Problems (Philips LPC2103)

Started by Richard January 2, 2007
Toolset assemnbled ala Lynch tutorial. I am starting to add UART code
to blinky.
I have added a uart.c and uart.h. uart.c added to Makefile.

In uart.h I have declared: void uart0Putch(unsigned char byte_out);

In main.c I call: uart0Putch(0xAA);

This results in a "undefined reference" error at this line.

I add a void to get: void uart0Putch(0xAA);

and I get the errors: "parse error before numeric constant" and
conflicting types for ' uart0Putch'

there is also an error in uart.h at the function declaration:
'previous declaration of uart0Putch was here'

What gives?

Thanks

Rich

An Engineer's Guide to the LPC2100 Series

At 07:01 PM 1/2/07 +0000, Richard wrote:
>Toolset assemnbled ala Lynch tutorial. I am starting to add UART code
>to blinky.
>I have added a uart.c and uart.h. uart.c added to Makefile.
>
>In uart.h I have declared: void uart0Putch(unsigned char byte_out);
>
>In main.c I call: uart0Putch(0xAA);

You do have #include "uart.h" before the call? Sorry just making sure.

>This results in a "undefined reference" error at this line.
>
>I add a void to get: void uart0Putch(0xAA);

Well that's just not valid C.
>and I get the errors: "parse error before numeric constant" and
>conflicting types for ' uart0Putch'
>
>there is also an error in uart.h at the function declaration:
>'previous declaration of uart0Putch was here'

You've either got an order issue or a bug earlier than the message is
pointing out. Try reducing main.c to something like

#include "uart.h"

int main(void)
{
uart0Putch(0xAA);
}

and compile with -wall -pedantic and any other error flag you can think
of. If the problem is still non-obvious and uart.h is small let us take a
quick look.

Robert

http://www.aeolusdevelopment.com/

From the Divided by a Common Language File (Edited to protect the guilty)
ME - "I'd like to get Price and delivery for connector Part # XXXXX"
Dist./Rep - "$X.XX Lead time 37 days"
ME - "Anything we can do about lead time? 37 days seems a bit high."
Dist./Rep - "that is the lead time given because our stock is live.... we
currently have stock."
Yes, not valid C but it produced some interesting results. I will
simplify as you suggest and see what happens. I will also look into
those compiler flags, I am not familiar with them.

Thanks Robert.

Rich
--- In l..., Robert Adsett wrote:
>
> At 07:01 PM 1/2/07 +0000, Richard wrote:
> >Toolset assemnbled ala Lynch tutorial. I am starting to add UART code
> >to blinky.
> >I have added a uart.c and uart.h. uart.c added to Makefile.
> >
> >In uart.h I have declared: void uart0Putch(unsigned char byte_out);
> >
> >In main.c I call: uart0Putch(0xAA);
>
> You do have #include "uart.h" before the call? Sorry just making sure.
>
> >This results in a "undefined reference" error at this line.
> >
> >I add a void to get: void uart0Putch(0xAA);
>
> Well that's just not valid C.
> >and I get the errors: "parse error before numeric constant" and
> >conflicting types for ' uart0Putch'
> >
> >there is also an error in uart.h at the function declaration:
> >'previous declaration of uart0Putch was here'
>
> You've either got an order issue or a bug earlier than the message is
> pointing out. Try reducing main.c to something like
>
> #include "uart.h"
>
> int main(void)
> {
> uart0Putch(0xAA);
> }
>
> and compile with -wall -pedantic and any other error flag you can think
> of. If the problem is still non-obvious and uart.h is small let us
take a
> quick look.
>
> Robert
>
> http://www.aeolusdevelopment.com/
>
> From the Divided by a Common Language File (Edited to protect the
guilty)
> ME - "I'd like to get Price and delivery for connector Part # XXXXX"
> Dist./Rep - "$X.XX Lead time 37 days"
> ME - "Anything we can do about lead time? 37 days seems a bit high."
> Dist./Rep - "that is the lead time given because our stock is
live.... we
> currently have stock."
>
Weirdness. The function name and the function call are spelled
exactly the same. Yet, when I copy and paste one name over the other,
all is well. Hidden control characters??

Thanks

Rich

--- In l..., Robert Adsett wrote:
>
> At 07:01 PM 1/2/07 +0000, Richard wrote:
> >Toolset assemnbled ala Lynch tutorial. I am starting to add UART code
> >to blinky.
> >I have added a uart.c and uart.h. uart.c added to Makefile.
> >
> >In uart.h I have declared: void uart0Putch(unsigned char byte_out);
> >
> >In main.c I call: uart0Putch(0xAA);
>
> You do have #include "uart.h" before the call? Sorry just making sure.
>
> >This results in a "undefined reference" error at this line.
> >
> >I add a void to get: void uart0Putch(0xAA);
>
> Well that's just not valid C.
> >and I get the errors: "parse error before numeric constant" and
> >conflicting types for ' uart0Putch'
> >
> >there is also an error in uart.h at the function declaration:
> >'previous declaration of uart0Putch was here'
>
> You've either got an order issue or a bug earlier than the message is
> pointing out. Try reducing main.c to something like
>
> #include "uart.h"
>
> int main(void)
> {
> uart0Putch(0xAA);
> }
>
> and compile with -wall -pedantic and any other error flag you can think
> of. If the problem is still non-obvious and uart.h is small let us
take a
> quick look.
>
> Robert
>
> http://www.aeolusdevelopment.com/
>
> From the Divided by a Common Language File (Edited to protect the
guilty)
> ME - "I'd like to get Price and delivery for connector Part # XXXXX"
> Dist./Rep - "$X.XX Lead time 37 days"
> ME - "Anything we can do about lead time? 37 days seems a bit high."
> Dist./Rep - "that is the lead time given because our stock is
live.... we
> currently have stock."
>
On Tue, 2007-01-02 at 19:01 +0000, Richard wrote:
> Toolset assemnbled ala Lynch tutorial. I am starting to add UART code
> to blinky.

I am using Eclipse and I have a UART example running. Where is this
Lynch tutorial you speak of ?

> I have added a uart.c and uart.h. uart.c added to Makefile.
>
OK.

> In uart.h I have declared: void uart0Putch(unsigned char byte_out);
>
> In main.c I call: uart0Putch(0xAA);
>
> This results in a "undefined reference" error at this line.

Is this a compile error or a linker error ? Have you added to UART
code to the project ? Is your make command creating ? Have
you included uart.h ?

> I add a void to get: void uart0Putch(0xAA);
>
> and I get the errors: "parse error before numeric constant" and
> conflicting types for ' uart0Putch'
>
That sounds like the function definition doesn't match the header
prototype.

> there is also an error in uart.h at the function declaration:
> 'previous declaration of uart0Putch was here'
>
> What gives?
>
Yeah. If you change the function definition you have to change the
declaration too, so that they match. That error also occurs if you
double include an include file.

>
At 09:14 PM 1/2/2007 +0000, Richard wrote:
>Weirdness. The function name and the function call are spelled
>exactly the same. Yet, when I copy and paste one name over the other,
>all is well. Hidden control characters??

Possibly, although I would really expect the compiler to complain about
that case (invalid character). Maybe confusion between O and 0 or
something similar.

Robert
Another sign of the end of civilization, our technical magazines are
getting chatty
From an EETimes product descriptions 2006/08/09
".... systems that can sample gobs of inputs simultaneously"
Now just what is the technical definition for gobs again?
http://www.aeolusdevelopment.com/