75XX Cross Compiling

From embeddedTS Manuals
Revision as of 11:55, 1 August 2011 by Mark (talk | contribs)

If your sources are large enough that compiling on the board is too encumbering, we provide toolchains that you can use from another Linux or Cygwin environment.

For this board you will want to use this toolchain. Extract it to the root of your filesystem, and run that version of gcc to prepare the ARM binary.

To Compile:

[user@localhost]$ /usr/local/arm-oabi-toolchain/arm-unknown-linux-gnu/bin/arm-unknown-linux-gnu-gcc hello.c -o hello
[user@localhost]$ file hello
hello: ELF 32-bit LSB executable, ARM, version 1, dynamically linked (uses shared libs), for GNU/Linux 2.6.26, not stripped

There are many ways to transfer the compiled binaries to the board. Using a network filesystem such as sshfs or NFS will be the simplest to use if you are frequently updating data, but will require more setup. See your linux distribution's manual for more details.

The simplest method is using ssh/sftp. You can use winscp if from windows, or scp from linux. Make sure you set a password from debian for root. Otherwise the ssh server will deny connections. From winscp, enter the ip address of the SBC, the root username, and the password you have set. This will provide you with an explorer window you can drag files into.

For scp in linux, run:

#replace with your app name and your SBC IP address
scp hello root@192.168.0.50:/root/

After transferring the file to the board, execute it:

ts7500:~# ./hello 
Hello world!

When compiling for c++, you must add in the compile option '-mhard-float'. This will make floating point operations throw an exception to the kernel which will properly handle the floating operations in a software FPU. Compiling without this option will result in a floating point error.

If you receive an error in a natively compiled application containing ILLEGAL INSTRUCTION, remove '-mcpu=arm9' if you have it and use '-mcpu=arm7'. Even though this is an ARM9 CPU, gcc will sometimes generate instructions that aren't covered by arm9 itself (like thumb instructions even when specifying -mno-thumb-interwork).