Cross Compile with FPC for ARM: what changed
Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | 1 | ## Overview | |
| 2 | 2 | ||
| 3 | - | ||
| 3 | + | These instructions cover cross compiling to Linux on ARM. See [[arm-wince]] for instructions on cross-compiling to Windows CE on ARM. | |
| 4 | 4 | ||
| 5 | 5 | ## Cross compile with FPC for ARM (e.g. Zaurus) | |
| 6 | 6 | ||
| 7 | - | ||
| 8 | - | ||
| 9 | - | ||
| 10 | - | ||
| 7 | + | - First, setup a cross compilation environment; you can get more information about this here [1](http://www.cartel-securite.fr/pbiondi/zaurus/crosscompile.html), here [2](http://www.nautilus6.org/operation/doc/wide-memo-nautilus6-zaurus-ccenv-setup-00.txt) and here [3](http://projects.buici.com/arm/cross/). | |
| 8 | + | - Install the lastest native FPC [from sourceforge](http://sourceforge.net/project/showfiles.php?group_id=89339) | |
| 9 | + | - get an ARM FPC snapshot from the downloads page of [FPC Qt Binding for Zaurus](http://users.pandora.be/Jan.Van.hijfte/qtforfpc/qtedemo.html) | |
| 10 | + | - Download it to somedir. The name of the tar file may be different of course: | |
| 11 | 11 | ||
| 12 | - | ||
| 12 | + | ``` bash | |
| 13 | 13 | cd somedir | |
| 14 | - | ||
| 14 | + | tar zxvf arm-linux-fpc.i386-linux-20050217.tar.gz | |
| 15 | 15 | ``` | |
| 16 | 16 | ||
| 17 | - | ||
| 18 | - | ||
| 19 | - | ||
| 17 | + | - you will find a 'lib/fpc/1.9.7/units/arm-linux/...' dir. The version may be '1.9.8' or higher. | |
| 18 | + | - create FPC library directory structure for FPC in a lib directory on your system | |
| 19 | + | - most systems use '/usr/local/lib', some use '/usr' | |
| 20 | 20 | ||
| 21 | - | ||
| 21 | + | ``` bash | |
| 22 | 22 | mkdir -p /usr/local/lib/fpc/1.9.7/units | |
| 23 | - | ||
| 23 | + | cp -fr lib/fpc/1.9.7/units/arm-linux /usr/local/lib/fpc/1.9.7/units/ | |
| 24 | 24 | ``` | |
| 25 | 25 | ||
| 26 | - | ||
| 26 | + | - copy the FPC cross compiler to its default place | |
| 27 | 27 | ||
| 28 | - | ||
| 28 | + | ``` bash | |
| 29 | 29 | cp lib/fpc/1.9.7/ppcarm /usr/local/lib/fpc/1.9.7 | |
| 30 | 30 | ``` | |
| 31 | 31 | ||
| 32 | - | ||
| 33 | - | ||
| 32 | + | - set a soft link to it in a bin dir in your path | |
| 33 | + | - most distributions use '/usr/local/bin', some '/usr/bin' | |
| 34 | 34 | ||
| 35 | - | ||
| 35 | + | ``` bash | |
| 36 | 36 | ln -sf /usr/local/lib/fpc/1.9.7/ppcarm /usr/local/bin/ppcarm | |
| 37 | 37 | ``` | |
| 38 | 38 | ||
| 39 | - | ||
| 39 | + | - verify you can call ppcarm; it should return something like '1.9.7' and not 'command not found' | |
| 40 | 40 | ||
| 41 | - | ||
| 41 | + | ``` bash | |
| 42 | 42 | ppcarm -iV | |
| 43 | 43 | ``` | |
| 44 | 44 | ||
| 45 | - | ||
| 45 | + | - download [FPC 1.9.x ARM binutils](ftp://ftp.freepascal.org/pub/fpc/snapshot/v19/arm-linux/binutils.tar.gz) to somedir | |
| 46 | 46 | ||
| 47 | - | ||
| 47 | + | ``` bash | |
| 48 | 48 | cd somedir | |
| 49 | - | ||
| 49 | + | tar zxvf binutils.tar.gz | |
| 50 | 50 | ``` | |
| 51 | 51 | ||
| 52 | - | ||
| 52 | + | - copy the 2 programs in the tar to a bin dir in your path | |
| 53 | 53 | ||
| 54 | - | ||
| 54 | + | ``` bash | |
| 55 | 55 | cp arm-linux-* /usr/local/bin | |
| 56 | 56 | ``` | |
| 57 | 57 | ||
| 58 | - | ||
| 58 | + | - create a 'Hello World' program and compile it | |
| 59 | 59 | ||
| 60 | - | ||
| 60 | + | ``` bash | |
| 61 | 61 | echo "program hello; begin writeln('Hello World'); end." > hello.pas | |
| 62 | - | ||
| 62 | + | ppcarm -XParm-linux- hello.pas | |
| 63 | 63 | ``` | |
| 64 | 64 | ||
| 65 | - | ||
| 65 | + | - output should be something like this: | |
| 66 | 66 | ||
| 67 | - | ||
| 68 | - | ||
| 67 | + | # ppcarm -XParm-linux- hello.pas | |
| 69 | 68 | Free Pascal Compiler version 1.9.7 [2005/02/17] for arm | |
| 70 | 69 | Copyright (c) 1993-2005 by Florian Klaempfl | |
| 71 | 70 | Target OS: Linux for ARM | |
| 72 | 71 | Compiling hello.pas | |
| 73 | 72 | Assembling hello | |
| 74 | 73 | Linking hello | |
| 75 | 74 | 1 Lines compiled, 0.2 sec | |
| 76 | - | ||
| 77 | 75 | ||
| 78 | - | ||
| 79 | - | ||
| 76 | + | - Copy it to the home directory of the user 'zaurus' on your zaurus device. | |
| 77 | + | - With an SSH setup this could be as simple as: | |
| 80 | 78 | ||
| 81 | - | ||
| 79 | + | ``` bash | |
| 82 | 80 | scp hello zaurus:/home/zaurus | |
| 83 | 81 | ``` | |
| 84 | 82 | ||
| 85 | - | ||
| 86 | - | ||
| 87 | - | ||
| 83 | + | - Install terminal program on your Zaurus. For a Zaurus SL6000: see manual on CD. | |
| 84 | + | - Run the terminal program. On a SL6000 the console will default to user 'zaurus' in its home dir /home/zaurus | |
| 85 | + | - Run the program | |
| 88 | 86 | ||
| 89 | - | ||
| 87 | + | ``` bash | |
| 90 | 88 | ./hello | |
| 91 | 89 | ``` | |
| 92 | 90 | ||
| 93 | - | ||
| 91 | + | - Output should be something like: | |
| 94 | 92 | ||
| 95 | - | ||
| 96 | - | ||
| 97 | - | ||
| 93 | + | Hello World | |
| 98 | 94 | ||
| 99 | 95 | --- | |
| 100 | - | ||
| 96 | + | *From the Free Pascal wiki, page "Cross Compile with FPC for ARM", as it stood on 2015-07-14 after a change by FTurtle, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* | |
| 97 | + | Category: ARM | |
| 98 | + | Category: Cross compilation | |
| 99 | + | Category: Linux |
