Difference between revisions of "Cross Compile with FPC for ARM"
From Lazarus wiki
Jump to navigationJump to search(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | {{Cross Compile with FPC for ARM}} |
− | == Cross | + | == Overview == |
+ | These instructions cover cross compiling to Linux on ARM. See [[arm-wince]] for instructions on cross-compiling to Windows CE on ARM. | ||
+ | |||
+ | == Cross compile with FPC for ARM (e.g. Zaurus) == | ||
* First, setup a cross compilation environment; you can get more information about this here [http://www.cartel-securite.fr/pbiondi/zaurus/crosscompile.html], here [http://www.nautilus6.org/operation/doc/wide-memo-nautilus6-zaurus-ccenv-setup-00.txt] and here [http://projects.buici.com/arm/cross/]. | * First, setup a cross compilation environment; you can get more information about this here [http://www.cartel-securite.fr/pbiondi/zaurus/crosscompile.html], here [http://www.nautilus6.org/operation/doc/wide-memo-nautilus6-zaurus-ccenv-setup-00.txt] and here [http://projects.buici.com/arm/cross/]. | ||
− | * Install the lastest native | + | * Install the lastest native FPC [http://sourceforge.net/project/showfiles.php?group_id=89339 from sourceforge] |
− | * get an | + | * get an ARM FPC snapshot from the downloads page of [http://users.pandora.be/Jan.Van.hijfte/qtforfpc/qtedemo.html FPC Qt Binding for Zaurus] |
− | * Download it to somedir. The name of the tar file may be different | + | * Download it to somedir. The name of the tar file may be different of course: |
− | < | + | <syntaxhighlight lang="bash"> |
− | cd somedir | + | cd somedir |
tar zxvf arm-linux-fpc.i386-linux-20050217.tar.gz | tar zxvf arm-linux-fpc.i386-linux-20050217.tar.gz | ||
− | </ | + | </syntaxhighlight> |
* you will find a 'lib/fpc/1.9.7/units/arm-linux/...' dir. The version may be '1.9.8' or higher. | * you will find a 'lib/fpc/1.9.7/units/arm-linux/...' dir. The version may be '1.9.8' or higher. | ||
− | * create FPC library directory structure for | + | * create FPC library directory structure for FPC in a lib directory on your system |
* most systems use '/usr/local/lib', some use '/usr' | * most systems use '/usr/local/lib', some use '/usr' | ||
− | < | + | <syntaxhighlight lang="bash"> |
− | mkdir -p /usr/local/lib/fpc/1.9.7/units | + | mkdir -p /usr/local/lib/fpc/1.9.7/units |
cp -fr lib/fpc/1.9.7/units/arm-linux /usr/local/lib/fpc/1.9.7/units/ | cp -fr lib/fpc/1.9.7/units/arm-linux /usr/local/lib/fpc/1.9.7/units/ | ||
− | </ | + | </syntaxhighlight> |
− | * copy the | + | * copy the FPC cross compiler to its default place |
− | < | + | <syntaxhighlight lang="bash"> |
cp lib/fpc/1.9.7/ppcarm /usr/local/lib/fpc/1.9.7 | cp lib/fpc/1.9.7/ppcarm /usr/local/lib/fpc/1.9.7 | ||
− | </ | + | </syntaxhighlight> |
* set a soft link to it in a bin dir in your path | * set a soft link to it in a bin dir in your path | ||
* most distributions use '/usr/local/bin', some '/usr/bin' | * most distributions use '/usr/local/bin', some '/usr/bin' | ||
− | < | + | <syntaxhighlight lang="bash"> |
ln -sf /usr/local/lib/fpc/1.9.7/ppcarm /usr/local/bin/ppcarm | ln -sf /usr/local/lib/fpc/1.9.7/ppcarm /usr/local/bin/ppcarm | ||
− | </ | + | </syntaxhighlight> |
− | * verify you can call ppcarm | + | * verify you can call ppcarm; it should return something like '1.9.7' and not 'command not found' |
− | < | + | <syntaxhighlight lang="bash"> |
ppcarm -iV | ppcarm -iV | ||
− | </ | + | </syntaxhighlight> |
* download [ftp://ftp.freepascal.org/pub/fpc/snapshot/v19/arm-linux/binutils.tar.gz FPC 1.9.x ARM binutils] to somedir | * download [ftp://ftp.freepascal.org/pub/fpc/snapshot/v19/arm-linux/binutils.tar.gz FPC 1.9.x ARM binutils] to somedir | ||
− | < | + | <syntaxhighlight lang="bash"> |
− | cd somedir | + | cd somedir |
− | tar zxvf binutils.tar.gz | + | tar zxvf binutils.tar.gz |
− | </ | + | </syntaxhighlight> |
* copy the 2 programs in the tar to a bin dir in your path | * copy the 2 programs in the tar to a bin dir in your path | ||
− | < | + | <syntaxhighlight lang="bash"> |
− | cp arm-linux-* /usr/local/bin | + | cp arm-linux-* /usr/local/bin |
− | </ | + | </syntaxhighlight> |
* create a 'Hello World' program and compile it | * create a 'Hello World' program and compile it | ||
− | < | + | <syntaxhighlight lang="bash"> |
− | echo "program hello; begin writeln('Hello World'); end." > hello.pas | + | echo "program hello; begin writeln('Hello World'); end." > hello.pas |
− | ppcarm -XParm-linux- hello.pas | + | ppcarm -XParm-linux- hello.pas |
− | </ | + | </syntaxhighlight> |
* output should be something like this: | * output should be something like this: | ||
− | + | <pre> | |
− | + | # ppcarm -XParm-linux- hello.pas | |
− | + | Free Pascal Compiler version 1.9.7 [2005/02/17] for arm | |
− | + | Copyright (c) 1993-2005 by Florian Klaempfl | |
− | + | Target OS: Linux for ARM | |
− | + | Compiling hello.pas | |
− | + | Assembling hello | |
− | + | Linking hello | |
+ | 1 Lines compiled, 0.2 sec | ||
+ | </pre> | ||
* Copy it to the home directory of the user 'zaurus' on your zaurus device. | * Copy it to the home directory of the user 'zaurus' on your zaurus device. | ||
− | * With | + | * With an SSH setup this could be as simple as: |
− | < | + | <syntaxhighlight lang="bash">scp hello zaurus:/home/zaurus</syntaxhighlight> |
* Install terminal program on your Zaurus. For a Zaurus SL6000: see manual on CD. | * Install terminal program on your Zaurus. For a Zaurus SL6000: see manual on CD. | ||
* Run the terminal program. On a SL6000 the console will default to user 'zaurus' in its home dir /home/zaurus | * Run the terminal program. On a SL6000 the console will default to user 'zaurus' in its home dir /home/zaurus | ||
* Run the program | * Run the program | ||
− | < | + | <syntaxhighlight lang="bash">./hello</syntaxhighlight> |
− | ./hello | ||
− | </ | ||
* Output should be something like: | * Output should be something like: | ||
− | + | <pre>Hello World</pre> | |
+ | |||
+ | [[Category:Cross compilation]] | ||
+ | [[Category:ARM]] | ||
+ | [[Category:Linux]] |
Latest revision as of 14:40, 14 July 2015
│
English (en) │
Overview
These instructions cover cross compiling to Linux on ARM. See arm-wince for instructions on cross-compiling to Windows CE on ARM.
Cross compile with FPC for ARM (e.g. Zaurus)
- First, setup a cross compilation environment; you can get more information about this here [1], here [2] and here [3].
- Install the lastest native FPC from sourceforge
- get an ARM FPC snapshot from the downloads page of FPC Qt Binding for Zaurus
- Download it to somedir. The name of the tar file may be different of course:
cd somedir
tar zxvf arm-linux-fpc.i386-linux-20050217.tar.gz
- you will find a 'lib/fpc/1.9.7/units/arm-linux/...' dir. The version may be '1.9.8' or higher.
- create FPC library directory structure for FPC in a lib directory on your system
- most systems use '/usr/local/lib', some use '/usr'
mkdir -p /usr/local/lib/fpc/1.9.7/units
cp -fr lib/fpc/1.9.7/units/arm-linux /usr/local/lib/fpc/1.9.7/units/
- copy the FPC cross compiler to its default place
cp lib/fpc/1.9.7/ppcarm /usr/local/lib/fpc/1.9.7
- set a soft link to it in a bin dir in your path
- most distributions use '/usr/local/bin', some '/usr/bin'
ln -sf /usr/local/lib/fpc/1.9.7/ppcarm /usr/local/bin/ppcarm
- verify you can call ppcarm; it should return something like '1.9.7' and not 'command not found'
ppcarm -iV
- download FPC 1.9.x ARM binutils to somedir
cd somedir
tar zxvf binutils.tar.gz
- copy the 2 programs in the tar to a bin dir in your path
cp arm-linux-* /usr/local/bin
- create a 'Hello World' program and compile it
echo "program hello; begin writeln('Hello World'); end." > hello.pas
ppcarm -XParm-linux- hello.pas
- output should be something like this:
# ppcarm -XParm-linux- hello.pas Free Pascal Compiler version 1.9.7 [2005/02/17] for arm Copyright (c) 1993-2005 by Florian Klaempfl Target OS: Linux for ARM Compiling hello.pas Assembling hello Linking hello 1 Lines compiled, 0.2 sec
- Copy it to the home directory of the user 'zaurus' on your zaurus device.
- With an SSH setup this could be as simple as:
scp hello zaurus:/home/zaurus
- Install terminal program on your Zaurus. For a Zaurus SL6000: see manual on CD.
- Run the terminal program. On a SL6000 the console will default to user 'zaurus' in its home dir /home/zaurus
- Run the program
./hello
- Output should be something like:
Hello World