This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.


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

Re: cross-compiler for PowerPC without operating system


e.van.hoek@philips.com wrote:

> - gcc-2.8.1
> - binutils-2.9.1
> - newlib-1.8.1

This should work.  I have used egcs-1.1.2 (the latest gcc/egcs release), binutils-2.9.1 and newlib-1.8.1.  I have hear rumours that newlib-1.8.0 works better than newlib-1.8.1 but I can neither confirm nor deny this.  If you have problems with
newlib-1.8.1 then try newlib-1.8.0.


> I'm building the cross-compiler with the option "powerpc-motorola-eabi" and there are a few questions that I have:
>
> 1:  Is "powerpc-motorola-eabi" the right option to build a compiler for PowerPC that runs native code (there is no Operating System on the PowerPC board) or should I use another build option?

I used "--target=powerpc-eabi".


> 2:  What is EABI and in how far does it handle register usage of the powerpc, i.e. do I need to set the stack pointer myself or does EABI handle this?

Yes.  The stack pointer is one of the first things you setup in crt0.S.  This a startup assembler file which you must write/modify.  It does things like test memory, clear the bsp, setup the stack and call main.  There are examples in the newlib source
and probably in the egcs source.


> 3:  How can I initialise the stack? I defined a memory section for the stack in the linker file, but how can i set the stackpointer to this region?

Just load r1 with the symbol defined in your linker script.  You can also define the symbol on the g++/gcc/ld command line I think.


> 4:  Do I need a crt0 function and what should be inside it?

see response to question 2.  I think this is explained in the CrossGCC FAQ.  Have a look.


> 5:  Executables generated by the compiler are in ELF-format. Is it possible to download such an executable in RAM memory and start it right at the base address or do i need to convert the executable to a binary format (using objcopy) and execute this?

If you use GDB or some other debugger that can interpret ELF files then it will do all the translations to write the appropriate data values to RAM.  Consult your debugger manual for more info.  eg. GDB> "load file.elf", "print $pc", "continue".


_______________________________________________
New CrossGCC FAQ: http://www.objsw.com/CrossGCC
_______________________________________________
To remove yourself from the crossgcc list, send
mail to crossgcc-request@cygnus.com with the
text 'unsubscribe' (without the quotes) in the
body of the message.

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