Please help: R3000 cross compiler problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear Sir/Madam,

Dear All,

For the past several days I'm trying to find a toolchain able to compile a C/C++ program to ELF format for the processor MIPS R3000. I exhausted all the solutions I found on the Internet, without any help.

What I need:
  - a crosstool for MIPS R3000, running on Linux (or even Windows)
  - the output should be in ELF format
  - Standard C Library support with static linking is required

Purpose:
- the ELF executables will run on an "in-house" simulator. The IO system functions (like printf) will not be used. The input and result of the program will be added/read directly from memory


What I tried:
After trying several solutions, the best results I obtained with two of them: an old GNUPro, and a "fresh" GNU-based crosstool. However, none of the solution is complete.


GNUPro (release mips3264-020217)
~~~~~~~~~~~~~~~~~~~~~~
 - tested on Windows, downloaded from ftp://ftp.mips.com/pub/redhat/win32/

It comes in both binary and source format. Unfortunately, the binary version contain the libc.a library compiled for mips6 (not mips1, as I desire). Trying to build again from sources (from the same link) came to be a nightmare, since some of the C files contain a lot of errors, some of them trivial (like putting a string on multiple lines, without ending previous line with "\"), some of them not. After several hours of "pain", I gave up, since it seems to be almost an impossible task.

GNU cross tool
~~~~~~~~~~~~~
I used the build script demo-mipsel.sh from http://kegel.com/crosstool/ (version -0.28-rc37), but before running it, I performed the following changes:


demo-mipsel.sh:
+ commented out all lines starting with "eval" (only one was uncommented)
+ add line
eval `cat mipsel.dat gcc-3.3.4-glibc-2.3.2.dat` sh all.sh --notest


mipsel.config:
 + in CPU section, set the CPU to R3000:
        CONFIG_CPU_R3000=y

After runnign the script (demo-mipsel) I obtatined a crosstool for MIPS R3000 Little Endian with the following configuration: gcc-3.3.4, glibc-2.3.2, binutils-2.15, linux-2.6.8

Problems: I cannot use the switch --gc-sections for the linker. Therefore when I attempt to link statically the library libc.a, the entire library is included in my executable, making the executable to exceed the small memory requiments I have. I really need to use the "--gc-sections for" in order to reduce the executable size. The command I issued (together with the error):

mipsel-unknown-linux-gnu-gcc -static test.c -s -O2 -Wl,--gc-sections -o test.elf

/home/dorin/MIPS-CROSS-COMPILER/opt/crosstool/mipsel-unknown-linux-gnu/gcc-3.3.4-glibc-2.3.2/lib/gcc-lib/mipsel-unknown-linux-gnu/3.3.4/../../../../mipsel-unknown-linux-gnu/bin/ld: BFD 2.15 assertion fail /home/dorin/MIPS-CROSS-COMPILER/crosstool-0.28-rc37/build/mipsel-unknown-linux-gnu/gcc-3.3.4-glibc-2.3.2/binutils-2.15/bfd/elfxx-mips.c:2075

If possible, please teach me how to make my executable smaller (with static linking) or indicate me an alternative solution.

Your help will be greatly appreciated.

All my best,
  David

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux