Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Copyright 2006 Aplix Corporation. All rights reserved. May, 2006 Tokyo Jamboree #8 Cross-Development on Mac André Krützfeldt.

Similar presentations


Presentation on theme: "1 Copyright 2006 Aplix Corporation. All rights reserved. May, 2006 Tokyo Jamboree #8 Cross-Development on Mac André Krützfeldt."— Presentation transcript:

1 1 Copyright 2006 Aplix Corporation. All rights reserved. May, 2006 Tokyo Jamboree #8 Cross-Development on Mac André Krützfeldt

2 2 Copyright 2006 Aplix Corporation. All rights reserved. Macintosh and Xcode OS X does come with Xcode bundled Newest version at: http://developer.apple.com/tools/xcode/index.html Includes all gnu compilers (4.0.1) and utilities Download is about 900MB Good for Apple development –you will need it For embedded systems, not applicable

3 3 Copyright 2006 Aplix Corporation. All rights reserved. Complete your Mac tools Make your development complete! Use fink http://fink.sourceforge.net/ It installs everything under /sw After install use FinkCommander

4 4 Copyright 2006 Aplix Corporation. All rights reserved. Complete your Mac tools (2) Add the fink distribution to your path –Easy: more “test -r /sw/bin/init.sh &&. /sw/bin/init.sh” >>.profile Close your terminal window and open it again. Now the path should look like: $ echo $PATH –/sw/bin:/sw/sbin:/bin:/sbin:/usr/bin:/usr/local/bin: /usr/sbin:/usr/local/teTeX/bin/powerpc-apple-darwin- current:/usr/X11R6/bin

5 5 Copyright 2006 Aplix Corporation. All rights reserved. Compile the Compiler Next step is to select a Cross Compiler Best:Crosstool http://www.kegel.com/crosstool/ Current version 0.42 Supports: gcc-2.95, gcc-3.2.x - gcc-4.0.x Check the current build results: http://www.kegel.com/crosstool/crosstool- 0.42/buildlogs/ If you intend to compile for Motorola devices, use: Crosstool for EZX http://lsb.blogdns.net/ezx-crosstool Current version 0.5

6 6 Copyright 2006 Aplix Corporation. All rights reserved. Compiler the Compiler (2) Extract the downloaded files with: gzip if the file ends with.gz bzip2 if the file ends with.bz2 (Both in fink) Make sure you have ‘wget’ installed –the build process uses it –Check with: $ type wget wget is /sw/bin/wget You MUST be online to do the build! –It will get the sources to compile from websites

7 7 Copyright 2006 Aplix Corporation. All rights reserved. Compiler source download The scripts use wget to download the libraries and linux components defined in: gcc- -glib-.dat If you have a proxy setup, make sure that wget can work with it. If you cannot get wget to work, just run the demo-XYZ.sh It will try to access the sites, use -c to stop it and use a normal browser to download the needed files. Place then into the download directory, usually $HOME/download Start demo-XYZ.sh again

8 8 Copyright 2006 Aplix Corporation. All rights reserved. Setup the target directory At the end you will have to install your cross compiler. Best to setup the directory and rights now. sudo mkdir /opt/crosstool sudo chown $USER /opt/crosstool The following script will build the Motorola cross compiler and install the result into the same directory!

9 9 Copyright 2006 Aplix Corporation. All rights reserved. How to compile the compiler build.sh from ezx-crosstool derived from demo-*.sh #!/bin/sh set -ex CROSSTOOL_DIR=`pwd` TARBALLS_DIR=$CROSSTOOL_DIR/downloads RESULT_TOP=$CROSSTOOL_DIR/gcc-arm-iwmmxt SRC_DIR=$CROSSTOOL_DIR/src export TARBALLS_DIR RESULT_TOP SRC_DIR GCC_LANGUAGES="c,c++" export GCC_LANGUAGES # Really, you should do the mkdir before running this, # and chown /opt/crosstool to yourself so you don't need to run as root. mkdir -p $RESULT_TOP # Build the toolchain. Takes a couple hours and a couple gigabytes. eval `cat arm-ezx.dat gcc-3.3.6-glibc-2.3.2.dat` sh all.sh --notest echo Done.

10 10 Copyright 2006 Aplix Corporation. All rights reserved. What if there is an Error? Mostly errors are not really errors. The Mac uses different versions of GNU Utilities. Look at the error and see what produced it. E.g. Error in an awk-script is not the script: –Use fink and install ‘gawk’ –Run “./build.sh” again –Mostly the error is gone. Unfortunately it does take hours and the “./build.sh” always starts from the beginning.

11 11 Copyright 2006 Aplix Corporation. All rights reserved. Expected Error There is an expected error: At the end it will complain about: –PATH_MAX is undefined This is to be ignored. ALSO (known): Apple make does have a bug/feature:.m files are treated differently! (Objective-C) Get a make from gnu and compile it separately Copy it in /sw/bin do not copy it in /usr/bin!

12 12 Copyright 2006 Aplix Corporation. All rights reserved. Distributed Compile Once you are done, you will have a cross compiler for your embedded device. If you happen to have more than one Mac, you can distribute the cross compiler and compile in your network. Tool to use is‘distcc’ which is part OS X Xcode. (Very advanced, I have not tested it yet.)

13 13 Copyright 2006 Aplix Corporation. All rights reserved. Cross-compile Trick Some developers prefer to use a different shell for the cross compilation. This assures that the builds do not interfere. E.g. ‘tcsh’ uses‘.tcshrc’ Set the PATH and other values to the target compiler. And do not forget:./configure --host=arm-linux This tells configure that you are cross compiling

14 14 Copyright 2006 Aplix Corporation. All rights reserved. Set the environment The PATH must be set to the cross compiler: PATH=/opt/crosstool/gcc-3.4.5-glibc-2.3.3/arm-linux/bin:… Also set the environment variables: AR=arm-linux-ar CC=arm-linux-gcc CXX=arm-linux-g++ LD=arm-linux-ld RANLIB=arm-linux-ranlib STRIP=arm-linux-strip

15 15 Copyright 2006 Aplix Corporation. All rights reserved. Tools for Mac iTerm as xterm substitute, it supports bookmarks: http://iterm.sourceforge.net/

16 16 Copyright 2006 Aplix Corporation. All rights reserved. Tools for Mac (2) Fugu to copy over ssh http://rsug.itd.umich.edu/software/fugu/

17 17 Copyright 2006 Aplix Corporation. All rights reserved. Utilities for Mac Some devices use Ethernet over USB: Get the Mac driver at: http://www.dsitri.de/wiki.php?page=AJZaurusUSB Originally for the Zaurus, but works with most USBLan or USBNet enabled devices. If you want to enable a device this way, look at: http://www.linux-usb.org/usbnet/

18 18 Copyright 2006 Aplix Corporation. All rights reserved. Devices A1200 Rokr E2 A780

19 19 Copyright 2006 Aplix Corporation. All rights reserved.


Download ppt "1 Copyright 2006 Aplix Corporation. All rights reserved. May, 2006 Tokyo Jamboree #8 Cross-Development on Mac André Krützfeldt."

Similar presentations


Ads by Google