This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] add basic SPARC support


On Sun, Apr 3, 2011 at 11:28 PM, Yann E. MORIN
<yann.morin.1998@anciens.enib.fr> wrote:
> Xun, Sam, All,
>
> On Monday 04 April 2011 00:15:52 Xun Li wrote:
>> On Sat, Apr 2, 2011 at 11:25 PM, Sam Ravnborg <sam@ravnborg.org> wrote:
>> > add basic SPARC support
> [--SNIP-]
>> > I have successfully been using the 4.5.2 version for a few months.
>> >
>> I used the patch and built the cross compiler for sparc, using
>> gcc-4.4.1, with bare-metal OS and newlib, without C++.
>> The build was successful. However when I tried to compile a simple
>> test program, the following error shows up:
>>
>> /research/tools/ct-ng/build-ct-ng-1.10.1/x-tools/sparc-unknown-elf/sysroot/lib/crt0.o:
>> In function `start':
>> (.text+0x0): undefined reference to `__stack'
> [--SNIP--]
>> Any clues?
>
> In case you are using bare-metal, you will have to provide low-level
> functions that are usually provided by the C library.
>
> Newlib is a 'limited' C library that has support only for 'high-level'
> API, such as printf, scanf... And relies on the developper to provide
> required 'low-level' functions, such as the ones that setup the stack,
> prepares the C environment...

Yes, the Sparc bare-metal build will require a Board Support Package
(BSP) to do things like hardware initialisation, setting up the stack and
providing exception handlers.

Some of those missing symbols, such as __stack and the "init hooks"
should be provided by the linker script, while others must be added in
the BSP.  The "winovf" and "winunf" handlers are very simple, and I think
there are examples in the Sparc architecture manual.

There are a number of resources around the net which you can use as a
guide to the steps in porting to embedded systems and writing a BSP.

> Are you sure you want bare-metal? If you are not sure, then you do not
> want bare-metal, so select 'Linux' as target OS.
>
> If you are sure, then maybe you are simply not linking in the required
> library that has the low-level stuff for your hardware...
>
> SPARC bare-metal does not really make sense, IMHO...

There are quite a few uses of embedded Sparc processors.  The Leon
in particular is quite popular since it's an open-source version of the
processor which can be used in system-on-a-chip projects.

I'm putting together such a system at the moment, and have most of
it working now.  The toolchain is pretty much done, and I just need some
tweaks to the BSP to finish it off :-)

Cheers,

David P.

--
For unsubscribe information see http://sourceware.org/lists.html#faq


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]