Difference between revisions of "PalmOS port"
Line 142: | Line 142: | ||
==Contacts== | ==Contacts== | ||
− | [mazen@freepascal.org Mazen NEIFER] | + | [mailto:mazen@freepascal.org Mazen NEIFER] |
Revision as of 14:24, 1 June 2006
PalmOs port is in its early beginning stage. The port is started and will be maintained by Mazen Neifer. Peter Vreman ported PalmOs API headers.
Status
- The 2.1.x compiler has compiler support (very experimental) for PalmOs.
- ARM CPU is supported.
- The following platforms will be supported:
- Zire72 – PalmOs version: 3.0
- Base RTL units are not yet ported.
Building Tutorial
During the tutorial some paths will be supposed to demonstrate the build process. Just substitute those paths with the ones on your system.
Cross binutils
These are the basic tools necessary to create executables, such as:
- arm-palmos-ld : Linker
- arm-palmos-as : Assembler
- arm-palmos-ar : Archiver (Creates smartlinking .a files)
- arm-palmos-strip and some others.
You need cross binutils for arm-palmos, debian linux (sid) provides a ready to use package prc-tools-utils. Just "apt-get install prc-tools-utils" will do the job. Otherwise, you need to get them from http://www.palmos.com/dev/dl/dl_tools/.
Extract them to some dir in the path on your machine. In a debian machine these are installed to /usr/bin/arm-palmos-*
Cross compiler
We will suppose that your are using debian linux installation (sid) and fpc compiler is already installed and correctly configured. Under debian linux (sid) you may install the fp-compiler package ("apt-get install fp-compiler")
Now you need to build fpc cross compiler for ARM processor. To do that you need latest fpc 2.1.x sources in addition to your working installation of fpc 2.0.2 or 2.0 already mentioned. Get the latest 2.1.x source repository from Subversion: http://www.freepascal.org/develop.html#svn
Environment
We will suppose your Free Pascal 2.1.x source code is located here: ${FPC_SRC}
PATH="/bin:/usr/bin:/usr/bin/X11:/usr/local/bin:${FPC_SRC}/compiler"
The Build process
In order to build the cross compiler it is necessary to have a correct PATH environment variable. Please ensure that your path is correct:
make cycle CPU_TARGET=arm OS_TARGET=palmos
On the end of the compile you should not see any errors.
You should have a ppccrossarm in ${FPC_SRC}/compiler and some .o and .ppu files in ${FPC_SRC}/rtl/units/arm-palmos
Now copy those files to your Free Pascal installation. The cross compiler ppccrossarm should go to /usr/local/bin/arm-palmos and the units to /usr/local/lib/fpc/units/arm-palmos
Configuration file
Now you need to edit your FPC configuration file ${HOME}/.fpc.cfg in order to use ppccrossarm.exe easy and add the following lines to it:
#IFDEF FPC_CROSSCOMPILING -Tpalmos -Fu${FPC_SRC}/rtl/units/arm-palmos -XParm-palmos- #ENDIF
Compiling a Test Project
You compiled the compiler! Now, what can I do with it? This is a tutorial to create a hello world like software with your new compiler.
Installing and Configuring the Emulator
??
Installing the command line
??
Compiling
A example file to compile:
program test; {$apptype console} var Str: string; begin WriteLn('Software Developed with:'); WriteLn('The Free Pascal Compiler'); WriteLn(''); WriteLn('Please, enter your name:'); ReadLn(Str); WriteLn('Your name is: ' + Str); end.
Sample command line to compile test.pas:
ppcrossarm test.pas
You will get test.exe executable file. Copy it to your Windows CE device and run.
Here is a screenshot of a software created this way.
Debugging PalmOs applications
This section is not yet available
Building FPC libraries
If you want to build libraries available with FPC just go to library folder and execute:
PATH=C:\Programas\fpc\bin\i386-win32;C:\Programas\fpc\compiler;C:\Programas\arm make OS_TARGET=PalmOs CPU_TARGET=arm PP=ppcrossarm.exe
For example you want to build FCL. Go to fpc\fcl folder and execute the command above. You will get FCL compiled units in fpc\fcl\units\arm-PalmOs.
Documentation
PalmOs port notes
- chdir procedure always produces an error (PalmOs does not support setting of current directory).
- All file/dir paths must be absolute (started with \).
- PalmOs is unicode OS. All string parameters to API calls must be PWideChar.
- PalmOs does not have support for environment strings.
- PalmOs does not have support for console applications by default. But you can install console support by yourself. Please note that FPC creates GUI applications for PalmOs target by default. To create console application you should use -WC compiler switch or put {$APPTYPE CONSOLE} directive to source code.
To enable console in PalmOs install one of the following programs:
Links
- Buildfaq is a general FAQ about how to build and configure FPC.
Here are some links related to ARM CPU Architecture
- ARM Core Developers Forum Not that much active though.
- GCC ARM Improvement Project
- ARM ASSEMBLER Good information and codes related to arm assembly language.
- GNU ARM toolchain for Cygwin, Linux and MacOS
- ARM Instruction Sets & Programs Very good and consice information about arm architecture
- The ARM Instruction Set Another fine power point file about arm