Cross Compile with FPC for ARM: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Cross Compile with FPC for ARM
| Old | New | Line | |
|---|---|---|---|
| 1 | + | ## Overview | |
| 2 | + | ||
| 3 | + | These instructions cover cross compiling to Linux on ARM. See [[arm-wince]] for instructions on cross-compiling to Windows CE on ARM. | |
| 4 | + | ||
| 5 | + | ## Cross compile with FPC for ARM (e.g. Zaurus) | |
| 6 | + | ||
| 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 | + | ||
| 12 | + | ``` bash | |
| 13 | + | cd somedir | |
| 14 | + | tar zxvf arm-linux-fpc.i386-linux-20050217.tar.gz | |
| 15 | + | ``` | |
| 16 | + | ||
| 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 | + | ||
| 21 | + | ``` bash | |
| 22 | + | mkdir -p /usr/local/lib/fpc/1.9.7/units | |
| 23 | + | cp -fr lib/fpc/1.9.7/units/arm-linux /usr/local/lib/fpc/1.9.7/units/ | |
| 24 | + | ``` | |
| 25 | + | ||
| 26 | + | - copy the FPC cross compiler to its default place | |
| 27 | + | ||
| 28 | + | ``` bash | |
| 29 | + | cp lib/fpc/1.9.7/ppcarm /usr/local/lib/fpc/1.9.7 | |
| 30 | + | ``` | |
| 31 | + | ||
| 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 | + | ||
| 35 | + | ``` bash | |
| 36 | + | ln -sf /usr/local/lib/fpc/1.9.7/ppcarm /usr/local/bin/ppcarm | |
| 37 | + | ``` | |
| 38 | + | ||
| 39 | + | - verify you can call ppcarm; it should return something like '1.9.7' and not 'command not found' | |
| 40 | + | ||
| 41 | + | ``` bash | |
| 42 | + | ppcarm -iV | |
| 43 | + | ``` | |
| 44 | + | ||
| 45 | + | - download [FPC 1.9.x ARM binutils](ftp://ftp.freepascal.org/pub/fpc/snapshot/v19/arm-linux/binutils.tar.gz) to somedir | |
| 46 | + | ||
| 47 | + | ``` bash | |
| 48 | + | cd somedir | |
| 49 | + | tar zxvf binutils.tar.gz | |
| 50 | + | ``` | |
| 51 | + | ||
| 52 | + | - copy the 2 programs in the tar to a bin dir in your path | |
| 53 | + | ||
| 54 | + | ``` bash | |
| 55 | + | cp arm-linux-* /usr/local/bin | |
| 56 | + | ``` | |
| 57 | + | ||
| 58 | + | - create a 'Hello World' program and compile it | |
| 59 | + | ||
| 60 | + | ``` bash | |
| 61 | + | echo "program hello; begin writeln('Hello World'); end." > hello.pas | |
| 62 | + | ppcarm -XParm-linux- hello.pas | |
| 63 | + | ``` | |
| 64 | + | ||
| 65 | + | - output should be something like this: | |
| 66 | + | ||
| 67 | + | # ppcarm -XParm-linux- hello.pas | |
| 68 | + | Free Pascal Compiler version 1.9.7 [2005/02/17] for arm | |
| 69 | + | Copyright (c) 1993-2005 by Florian Klaempfl | |
| 70 | + | Target OS: Linux for ARM | |
| 71 | + | Compiling hello.pas | |
| 72 | + | Assembling hello | |
| 73 | + | Linking hello | |
| 74 | + | 1 Lines compiled, 0.2 sec | |
| 75 | + | ||
| 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: | |
| 78 | + | ||
| 79 | + | ``` bash | |
| 80 | + | scp hello zaurus:/home/zaurus | |
| 81 | + | ``` | |
| 82 | + | ||
| 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 | |
| 86 | + | ||
| 87 | + | ``` bash | |
| 88 | + | ./hello | |
| 89 | + | ``` | |
| 90 | + | ||
| 91 | + | - Output should be something like: | |
| 92 | + | ||
| 93 | + | Hello World | |
| 94 | + | ||
| 95 | + | --- | |
| 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 |
