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


On Wed, Jun 23, 1999 at 02:15:23PM +0200, e.van.hoek@philips.com wrote:
> 
> 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?

EABI only defines object format, register usage etc. - on a system without
OS, you will have to provide your own startup code to intialize these
registers to an environment which matches the terms defined in EABI, so that
you are able to call EABI-compliant C code (ie. your main function).

This part is hardware dependant and usually done in assembler, since a C
function wants to save things in the stack frame that does not yet exist
after reset.

You might want to get and read the PPC EABI spec - sorry, the link was here
on the list and helped me a lot, but I don't remember where it was.

> 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?

Use assembler code to set R1 to the end of that area (properly aligned, and
leave some room for the back chain on the first function call). When really
using the back chain for debugging, you might want to initialize it,
although the code does not require this to run.

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

You can call this whatever you want - you only have to tell the linker to
place this code in a way so that it is executed from the reset vector.

You can look in the ecos PPC HAL source for sample code.

> 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?

Depends on your downloader. When eg. burning an EPROM, you need to convert -
the motorola mpc8bug can directly download ELF files (including symbol
names) without conversion.

cu
Michael
-- 
Michael Schwingen, Ahornstrasse 36, 52074 Aachen
_______________________________________________
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]