75XX Cross Compiling: Difference between revisions

From embeddedTS Manuals
No edit summary
No edit summary
Line 25: Line 25:
Hello world!
Hello world!
</source>
</source>
{{Note| There is a bug with the onboard compiler that can result in illegal instruction errors.  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).}}

Revision as of 17:01, 4 October 2011

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 your application, you only need to use the version of GCC in the cross toolchain instead of the version supplied with your distribution. The resulting binary will be for ARM.

[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 network 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!