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: (Resend) cross-compiler for PowerPC without operating system


Sorry, the mail software took the vertical ellipsis (sp?) as end-of-message.

-----Original Message-----
From: Duszczak, Richard 
Sent: Wednesday, June 23, 1999 11:36 AM
To: 'crossgcc@cygnus.com'
Subject: RE: cross-compiler for PowerPC without operating system


Hi Erik,

I can't answer all of your questions but I have just built a PowerPC
cross-compiler myself and thought I'd share my results.

>I'm trying to build a cross-compiler for PowerPC using the following:
>
>- gcc-2.8.1
>- binutils-2.9.1
>- newlib-1.8.1

This configuration may also work, but I used

- egcs-1.1.2
- binutils-2.9.1
- newlib-1.8.1

Also, check out http://www.users.surfaid.org/~fiddes/coldfire/.  Granted
this page is geared towards ColdFire, but if you substitute PowerPC for
ColdFire the instructions are very good.  I have successfully built a
compiler using them.

>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 have never tried powerpc-motorola-eabi, but powerpc-elf definitely works.
I had built another version of the compiler previously using powerpc-eabi
but the compiler/linker generated incorrect code.  I am not sure what caused
it, though.

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

Sorry, I know very little about EABI.  I probably should though....

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

If everything goes right, the code in crt0.S should do that for you.  Just
make sure to edit the linker file (eg ads.ld) to specify where the stack
should go and your memory regions.  It should look something like this:

OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc",
	      "elf32-powerpc")
OUTPUT_ARCH(powerpc)
ENTRY(_start)
/* Do we need any of these for elf?
   __DYNAMIC = 0;    */

PROVIDE (__stack = 0x400000);

MEMORY
{
  ram (rwx) : ORIGIN = 0x10000, LENGTH = 0x400000
}

SECTIONS
{
  /* Read-only sections, merged into text segment: */
  . = 0x10000 + SIZEOF_HEADERS;
  .interp   : { *(.interp) }
  .hash		  : { *(.hash)		}
z               .
z               .
z               .


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

Yes, you do.  There should be one provided.  If this code will execute first
after bootup you need to put your init code in it.  Check out
http://www.mot-sps.com/products/microprocessors/32_bit/mpc800/mpc860tools.ht
ml and look for MCUInit 3.1 and UPM860.  These should help you generate
initialization 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?

If your PowerPC board has a BDM connector you could use an ICE to download
to RAM.  The ICE should come with a conversion program.  If you are using a
Motorola dev board (such as the ADS860) you could use the ADI port (37-pin
D-sub Male connector) along with the MPC8BUG software (downloadable from
Motorola).  

Good luck and if you have any other questions feel free to ask.  Please let
me know how it turns out.

Richard E. Duszczak
Design/Software Engineer
Enikia, Inc.
E-mail: richd@enikia.com
(732) 980-1200 x2777 (Voice)
(732) 980-0700 (Fax)
http://www.enikia.com/
_______________________________________________
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]