Cross toolchain EM7075
From Eminent Opensource
Installing the toolchain
For the EM7075 we have used the Sourcery toolchain. The lite version is available for those who wish to compile their own applications.
- Download the toolchain from
wget http://www.codesourcery.com/sgpp/lite/mips/portal/package3548/public/mips-linux-gnu/mips-4.3-51-mips-linux-gnu.bin
- Run the installation package. It is a self-installing binary file
chmod +x mips-4.3-51-mips-linux-gnu.bin ./mips-4.3-51-mips-linux-gnu.bin
- Follow the steps on-screen and select a suitable folder to install.
- We will be using /opt/Sourcery_G++_Lite in several examples, so it's best to install it there.
- Follow the steps and confirmation prompts until the toolchain is installed.
Once the toolchain is installed, you are almost ready to build your first application.
Compiler flags
The EM7075 uses a powerfull 500mhz MIPS, Little Endian cpu. Since the toolchain can be configured for multiple targets, it's best to use a single 'build.sh' script and edit that to ensure correct CFLAGS and LDFLAGS are used. You will always need to use at least CFLAGS="-EL " to get the correct binary files..
Cross-Compilation script example: Zlib
Below example shows how to compile Zlib libraries:
#!/bin/sh mkdir /usr/local/mips #wget http://www.zlib.net/zlib-1.2.3.tar.gz # needs nothing wget http://google-desktop-for-linux-mirror.googlecode.com/files/zlib-1.2.3.tar.gz tar -xvzf zlib-1.2.3.tar.gz cd ./zlib/1.2.3 make clean export CFLAGS="-EL " export CC="/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-gcc" export PATH=/opt/Sourcery_G++_Lite/bin:$PATH export AR="/opt/Sourcery_G++_Lite/bin/mips-linux-gnu-ar rc" export LDFLAGS=" -s -Xlinker -rpath /lib -Xlinker -rpath-link /opt/Sourcery_G++_Lite/lib/gcc/mips-linux-gnu/4.3.2/el" ./configure --prefix=/usr/local/mips make
Once the compile is complete, you could also do a 'make install' to install the libraries into /usr/local/mips. This would be your target output folder to use for all cross-compiled targets. (Note in the example, we're using some extra LDFLAGS to produce a more compact binary.)
