Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] Re: Linking Error....iButton Test program Robert Adsett's Port

2006-04-09 by Robert Adsett

At 06:46 PM 4/9/2006 +0000, ocnek1 wrote:
>--- In lpc2000@yahoogroups.com, Robert Adsett <subscriptions@...> wrote:
> >
> > At 06:25 PM 4/8/06 +0000, ocnek1 wrote:
> > >Hi Robert,
> > >
> > >Thanks for the help.
> > >
> > >The codes is actually your TEST1.c program from the ibutton download.
> > >  Thats why I'm pretty sure it is my problem...  Do you still have the
> > >makefile from when you compiled the test1.c? (there is a hex file but
> > >no make)
> >
> > There is a makefile but I doubt it would be of much use, it's pretty
> > localized to the setup I use.  If this next little bit doesn't get you
> > going I'll send it along though.
> >
> > I think I have an idea as to what's going on.  A question
> >
> >          Are you using a recent release of newlib-lpc?
> >
> > I think you are from other questions you asked.  If so GCC should be 
> giving
> > you complaints about prototype mismatches if you have been using test1.c
> > without modifications.
> >
> > Also what crystal speed have you been using?
>
>Yes I'm using the new (5a) newlib-lpc and I am getting the prototype
>warnings.  The dev board has a 14.746Mhz crystal on it.

OK, two things you will need to modify.  I can illustrate this with a 
single line from test1.c

  (void)SetNativeSpeed(_impure_ptr, 10000uL);    /*lint !e920 void cast*/

The first issue is the use of _impure_ptr.  The initial versions used it 
but it was dropped early on so all the calls that use it should be 
modified.  You can check the documentation for confirmation of the 
arguments needed.  The one wire support hasn't been touched in some time so 
it is using the older form.  It is only the test drivers that should be 
affected though.  Changing the function calls using _impure_ptr should get 
rid of your prototype mismatch complaints.  I'll add a note to the download 
to indicate that this is a problem until I get a chance to fix this.

The second item is specific to this call.  The second argument (first when 
you remove _impure_ptr) is the speed of your crystal in kHz.  It is used by 
newlib-lpc and the one-wire to determine internal timing for the baud rate 
and timing.  It is also used when setting up the cpu clock speed so you can 
get all sorts of interesting problems if that is wrong.

So the line now becomes

  (void)SetNativeSpeed(14746uL); /*lint !e920 void cast*/

>I must say that I am having fun with this though.  Learning about
>makefiles/ linker scripts and build libraries is actually quite
>interesting.

Good, it's a lot easier when it's fun.

>Maybe you could answer this question:  Building Libraries...When
>building a library file for the ownet do I need to include the
>newlib-lpc.c and .h files with all the ownet files when building the
>library?  If not how do I ownet.a to link with newlib-lpc.a ?  Is this
>in the linker script / make file?

No they can be separate.  Just be aware that since ld is by default a 
single pass linker the one wire library must precede the newlib-lpc 
library.  And yes this is set up with the link script or on the link line 
in the makefile (just list the onewire library archive at the end of the 
object files).

>Thanks for the help Robert...sorry to be a pain asking these dumb
>quesitons.

You're entirely welcome.  Generally I learn as much trying to help others 
understand something as I do first understanding it myself.

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,   be 
they legal, genetic, or physical.  If you don't believe me, try to chew a 
radio signal. "  -- Kelvin Throop, III
http://www.aeolusdevelopment.com/

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.