This is the mail archive of the crossgcc@sources.redhat.com 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]

RE: help for mips


Hi,

What you can try is to make a very small simple program and then compile it
without the crt0.o. You should make an own startupcode (could be __main) and
an own linkerscript, so the compiler knows where to put your stuff.
(interrupt vectors, the code, the initialized data and the uninitialized
data)

for example :
(main.c)

int calc(int a, int b)
{
  return a+b;
}

int main(void)
{
  int x,y,z;
  
  x = y = z = 0;
  y=186;
  z=0x0ff3e;
  x = calc(y,z);
 
  return 0;
}

example linker-script :

OUTPUT_ARCH(<your thing>)   /* Specify the output machine architecture */
OUTPUT_FORMAT(srec) /*  Output format. Should be srec (S-records).   */
                    /* Same as the --oformat command-line option.    */

ENTRY(main);

SECTIONS {
  . = 0x400;
  .text :
    {
    *(.text)
    }
  . = 0xA00000;
  .data :
    {
    *(.data)
    }
  .bss  :
    {
    *(.bss)
      end = ALIGN(0x8);
    }
}  

Save this as "linker.ld".

Then try
mips-elf-gcc -save-temps -g -Wall -Wl,-Tlinker.ld -o test main.c
( -T indicates the linker file to use
  -g generates debug information, so gdb can show your source
  -save-temps is usefull for me, so i can see what kind of assembly code it
makes)

To debug: (first make a cross-gdb, or you could use
http://source.redhat.com/insight which is based on gdb5.0)
mips-elf-gdb test

PS: GDB is the native debugger for your linux/windows machine. It can only
understand your host target (maybe i586-linux-elf if you are running on
linux)

Have fun.
Please do read "info ld" for more information about linking

Jan


-----Original Message-----
From: Liu Yong [mailto:yliu@newavetech.com]
Sent: vrijdag 3 augustus 2001 2:49
To: crossgcc@sourceware.cygnus.com
Subject: help for mips


Hi.
I have got a cross-gcc and cross-gdb ( Thank all helped me ) .
Now I want to build really a program  for mips (IDT 79RC32332 ). But now I
don't know which crt0.o I should use.
It seemed too many crt0.o.
That the result of the command : csh/find /home/yliu/local -name crt0.o

/home/yliu/local/mipself/mips-elf/lib/soft-float/el/mips3/crt0.o
/home/yliu/local/mipself/mips-elf/lib/soft-float/el/crt0.o
/home/yliu/local/mipself/mips-elf/lib/soft-float/mips3/crt0.o
/home/yliu/local/mipself/mips-elf/lib/soft-float/crt0.o
/home/yliu/local/mipself/mips-elf/lib/single/el/mips3/crt0.o
/home/yliu/local/mipself/mips-elf/lib/single/el/crt0.o
/home/yliu/local/mipself/mips-elf/lib/single/mips3/crt0.o
/home/yliu/local/mipself/mips-elf/lib/single/crt0.o
/home/yliu/local/mipself/mips-elf/lib/el/mips3/crt0.o
/home/yliu/local/mipself/mips-elf/lib/el/crt0.o
/home/yliu/local/mipself/mips-elf/lib/mips3/crt0.o

So now these are my questions:
1. How can I know which files I should use (crt0.o , crtbegin.o ,...) ?
2. What shall I do specially for debugging(Gdb5.0) .
3. Where is the interface with the low level functions ? In the libgloss?
4. Next step I will use the IDT79s332 evaluation board , are there any
advices for me?

Too many questions , :-) . Would you mind tell me where can find the 
answer?
Maybe I need the doc really.

These is what have done and result :
 csh/ mips-elf-gcc -c hello.c
 csh/ mips-elf-ld -L
/home/yliu/local/mipself/lib/gcc-lib/mips-elf/2.95.3/ -o
 hello hello.o -lgcc -lc -v
 mips-elf-ld: warning: cannot find entry symbol _start ; defaulting to
 0000000000400000
 csh/ gdb hello (exec-file hello ; run )
 (gdb) don't how to run . Try " help target"
I don't know how to fix it. I think it is generated by no crt0.o used , 
am I
right? Or what shall I do ?

Thanks.

Best Regards.
Yong Liu



------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to
crossgcc-unsubscribe@sourceware.cygnus.com

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


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