Rebuilding GNUARM toolchain for LPC2129

Started by krazykyran March 8, 2007
Hi Everybody,

I am using GNUARM with Keil uVision and discovered that the crt0.s
_start function executes AngelSWI syscalls. I guess I need to rebuild
GNUARM if I am to avoid this, and use lpc-gnuarm package to include the
syscalls. I have tried WinARM and Yagarto but Keil wont work with those
toolsets.

So my question is how do I rebuild the GNUARM (newlib) toolchain so I
can use my own syscall functions?

More to the point, is there a simple step by step process to rebuild
GNUARM 4.1.1(newlib) in Cygwin? I have tried and it failed on the first
package, binutils.

Thanks and Regards,
Kyran McGlasson.

An Engineer's Guide to the LPC2100 Series

At 10:16 PM 3/8/07 +0000, krazykyran wrote:
>Hi Everybody,
>
>I am using GNUARM with Keil uVision and discovered that the crt0.s
>_start function executes AngelSWI syscalls. I guess I need to rebuild
>GNUARM if I am to avoid this, and use lpc-gnuarm package to include the
>syscalls. I have tried WinARM and Yagarto but Keil wont work with those
>toolsets.

You should be able to get away with just replacing the stubs. There's a
set of stubs here
http://www.aeolusdevelopment.com/Articles/download.html You can simply
remove the stubs using the angle calls from the archive and substitute new
ones (or just remove the stubs and link the new ones in as a separate library).

The stubs and the startup can have some dependencies. The startup and
linker scripts may provides symbols used by memory allocation functions as
a for instance.

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."
--- In l..., Robert Adsett
wrote:
>
> At 10:16 PM 3/8/07 +0000, krazykyran wrote:
> >Hi Everybody,
> >
> >I am using GNUARM with Keil uVision and discovered that the crt0.s
> >_start function executes AngelSWI syscalls. I guess I need to
rebuild
> >GNUARM if I am to avoid this, and use lpc-gnuarm package to
include the
> >syscalls. I have tried WinARM and Yagarto but Keil wont work with
those
> >toolsets.
>
> You should be able to get away with just replacing the stubs.
There's a
> set of stubs here
> http://www.aeolusdevelopment.com/Articles/download.html You can
simply
> remove the stubs using the angle calls from the archive and
substitute new
> ones (or just remove the stubs and link the new ones in as a
separate library).
>
> The stubs and the startup can have some dependencies. The startup
and
> linker scripts may provides symbols used by memory allocation
functions as
> a for instance.
>
> Robert
>
> http://www.aeolusdevelopment.com/

Thanks Robert.

I had looked at this website about a week ago, I tried the newlib-lpc
port layer, hoping that the compiler/linker would replace the new
port layer functions with the exisiting ones, however the linker
displayed an error message saying that the new functions already
existed in the newlib library.

If there is a way of overiding the existing functions (or stubs as
you called it) I dont know how to do that. All I do know is that in
assembler you can declare a function as a ".weak" symbol and it will
be overidden. How this helps I dont know.

Like I have said before, I use Keil uvision IDE because I like GUI
tools, I am not experienced in building from the command line, maybe
there is a tutorial to this as well somewhere on the net?

I will use those stubs though, when I can figure it all out! In the
meantime I have reversed engineered an swi handler to interpret all
those SWI calls. I had trouble with the first SWI call, the HeapInfo
call, but it is working now, and I can direct the Write calls to the
UART. That has enabled me to continue development, but I would like
to use the stubs if I can.

Regards,
Kyran McGlasson.
--- In l..., "krazykyran" wrote:
>
> --- In l..., Robert Adsett
> wrote:
> > You should be able to get away with just replacing the stubs. There's
a
> > set of stubs here
> > http://www.aeolusdevelopment.com/Articles/download.html You can simply
> > remove the stubs using the angle calls from the archive and substitute
new
> > ones (or just remove the stubs and link the new ones in as a separate
library).
> >
> > The stubs and the startup can have some dependencies. The startup and
> > linker scripts may provides symbols used by memory allocation functions
as
> > a for instance.
> > I had looked at this website about a week ago, I tried the newlib-lpc
> port layer, hoping that the compiler/linker would replace the new
> port layer functions with the exisiting ones, however the linker
> displayed an error message saying that the new functions already
> existed in the newlib library.
>
> If there is a way of overiding the existing functions (or stubs as
> you called it) I dont know how to do that. All I do know is that in
> assembler you can declare a function as a ".weak" symbol and it will
> be overidden. How this helps I dont know.

I don't think there is a good way of overriding the library symbols (you
could just link everything explicitly). What you need to do is

- Back up the existing library
- Use ar to remove the angel stubs (I think ar will give you enough help)
- Then either add the new stubs or link them in separately.
- You may need to modify the startup to provide heap symbols if you use
malloc functions even indirectly (I think some of the *printf function use
the same memory allocation stubs).

weak symbols are useful for doing something like putting in default
interrupt hooks. That way they always have something but if the user wants
to override them they don't have to re-edit the source just add new ones.

Robert

--------------------------------
mail2web.com - Microsoft Exchange solutions from a leading provider -
http://link.mail2web.com/Business/Exchange