Reply by Robert Adsett April 11, 20042004-04-11
Patrick and I took this discussion off list so we could continue it w/o
burden everyone with the details. We appear to have found and fixed the
source of the problem.

The upshot is the library he was using already had dummy newlib stubs in
it. So when linking they were taken in preference to the ones in
libnewlib-lpc.a unless the replacements were linked in explicitly.

Two solutions:

The quick and dirty one is to remove the dummy stubs from the library
(libc.a). If you try this remember to backup the original first :)

The other solutions (the more correct one?) is to rebuild newlib without
the pre-existing stubs (an option something like
-DREENTRANT_SYSCALLS_PROVIDED if I remember correctly). Check Bill
Gatliff's article and the newlib documentation before proceeding.

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



An Engineer's Guide to the LPC2100 Series

Reply by Patrick Dohmen April 9, 20042004-04-09
Andreas told me about the "newlib-lpc" and i have tried to write a Tutorial.
So i have Compiled the newlib-lpc and wanted to create my own
prject-environment including a sample-Makefile.
Everything went very fine. I could build my own "Hello, World!" with the
first time I called this Makefile.
This "Hello, World!" should use the first UART, and print - uhm, i think you
can guess what :-)

But then, as I had downloaded the intel-hex-file to my LPC2106, nothing
seemed to happen.
I was wondering because all the samples delivered with newlib-lpc ran very
nice. So I copied my source file into the newlib-source-directory and added
it to the Makefile (example.mak, I think) like all the other example
sources.
Now my "Hello, World!" appeared after downloading to the processor...
So I did some thoughts about the things that happen in this example
Makefile. I found out, that everyone of these testX examples is linked
directly to the objectfiles of the lib. I tried to link again these
objectfiles, too, in my Makefile and I was wondering that the resulting
hexfile ran this time!
Up to now, I have not been able to resolve the Problem...but I found out,
that if I link the file _write_r.o directly, my "Hello, World!" string
appears on the serial port.
So, there is at least one problem with this objectfile.
I don't know if this is precise enough to solve our problem.

If you would need more information, I could give you access to my sample
project at

http://wiki.mikrocontroller.net/upload/f/f4/LPC2106-gcc-Demo_2.zip

Thanks in advance,
Patrick Dohmen... "Robert Adsett" <> schrieb im Newsbeitrag
news:.
> At 09:48 AM 4/6/04 +0000, you wrote:
> >linking directly to the object files of newlib-lpc (as it is done in the
> >example.mak) works perfectly, but linking to libnewlib-lpc.a doesn't
> >(the elf file size differs by a few bytes and the program does not run
> >correctly).
> >
> >My linker command line:
> >arm-elf-ld -o myexample.elf crt0.o myexample.o -lnewlib-lpc -Tlpc210x.ld
>
> Might be link order. I added the following to my load file when I started
> using the library.
>
> /* Libraries to link against.
*/
> INPUT( -lc -lnewlib-lpc -lc -lgcc ) > Try having ld dump a map file for the two links and compare, that should
> narrow down the possibilities as well.
>
> 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




Reply by Robert Adsett April 6, 20042004-04-06
At 09:48 AM 4/6/04 +0000, you wrote:
>linking directly to the object files of newlib-lpc (as it is done in the
>example.mak) works perfectly, but linking to libnewlib-lpc.a doesn't
>(the elf file size differs by a few bytes and the program does not run
>correctly).
>
>My linker command line:
>arm-elf-ld -o myexample.elf crt0.o myexample.o -lnewlib-lpc -Tlpc210x.ld

Might be link order. I added the following to my load file when I started
using the library.

/* Libraries to link against. */
INPUT( -lc -lnewlib-lpc -lc -lgcc ) Try having ld dump a map file for the two links and compare, that should
narrow down the possibilities as well.

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


Reply by Andreas Schwarz April 6, 20042004-04-06
Hi,

linking directly to the object files of newlib-lpc (as it is done in the
example.mak) works perfectly, but linking to libnewlib-lpc.a doesn't
(the elf file size differs by a few bytes and the program does not run
correctly).

My linker command line:
arm-elf-ld -o myexample.elf crt0.o myexample.o -lnewlib-lpc -Tlpc210x.ld

Anything wrong here?

Andreas