Difference between revisions of "PalmOS port"
Line 8: | Line 8: | ||
* Base RTL units are not yet ported. | * Base RTL units are not yet ported. | ||
− | == Building Tutorial == | + | ==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. | 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: | These are the basic tools necessary to create executables, such as: | ||
Line 26: | Line 26: | ||
− | + | ===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 '''[http://packages.debian.org/unstable/devel/fp-compiler fp-compiler]''' package ("apt-get install fp-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 '''[http://packages.debian.org/unstable/devel/fp-compiler fp-compiler]''' package ("apt-get install fp-compiler") | ||
Line 32: | Line 32: | ||
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 | 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: <tt>${FPC_SRC}</tt> | We will suppose your Free Pascal 2.1.x source code is located here: <tt>${FPC_SRC}</tt> | ||
Line 38: | Line 38: | ||
<tt>PATH="/bin:/usr/bin:/usr/bin/X11:/usr/local/bin:${FPC_SRC}/compiler"</tt> | <tt>PATH="/bin:/usr/bin:/usr/bin/X11:/usr/local/bin:${FPC_SRC}/compiler"</tt> | ||
− | + | ===The Build process=== | |
In order to build the cross compiler it is necessary to have a correct <tt>PATH</tt> environment variable. Please ensure that your path is correct: | In order to build the cross compiler it is necessary to have a correct <tt>PATH</tt> environment variable. Please ensure that your path is correct: | ||
Line 53: | Line 53: | ||
− | + | ===Configuration file=== | |
Now you need to edit your FPC configuration file <tt>${HOME}/.fpc.cfg</tt> in order to use <tt>ppccrossarm.exe</tt> easy and add the following lines to it: | Now you need to edit your FPC configuration file <tt>${HOME}/.fpc.cfg</tt> in order to use <tt>ppccrossarm.exe</tt> easy and add the following lines to it: | ||
Line 64: | Line 64: | ||
</pre> | </pre> | ||
− | == Compiling a Test Project == | + | ==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. | 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: | A example file to compile: | ||
Line 105: | Line 105: | ||
[http://wiki.lazarus.freepascal.org/index.php/Windows_CE_Interface Here] is a screenshot of a software created this way. | [http://wiki.lazarus.freepascal.org/index.php/Windows_CE_Interface Here] is a screenshot of a software created this way. | ||
− | == Debugging PalmOs applications == | + | ==Debugging PalmOs applications== |
GDB can be used to debug your PalmOs applications remotely via ActiveSync. Download GDB 6.4 for Win32 host and arm-PalmOs target here: ftp://ftp.freepascal.org/pub/fpc/contrib/cross/gdb-6.4-win32-arm-PalmOs.zip | GDB can be used to debug your PalmOs applications remotely via ActiveSync. Download GDB 6.4 for Win32 host and arm-PalmOs target here: ftp://ftp.freepascal.org/pub/fpc/contrib/cross/gdb-6.4-win32-arm-PalmOs.zip | ||
− | + | ===Some hints=== | |
* Pass <tt>--tui</tt> parameter to GDB to enable TUI interface which makes debugging more comfortable. | * Pass <tt>--tui</tt> parameter to GDB to enable TUI interface which makes debugging more comfortable. | ||
* Use unix line endings (LF only) in your pascal source files. Otherwise GDB will show sources incorrctly. | * Use unix line endings (LF only) in your pascal source files. Otherwise GDB will show sources incorrctly. | ||
− | + | ===How to use=== | |
First, make ActiveSync connection to your Pocket PC device. | First, make ActiveSync connection to your Pocket PC device. | ||
Line 137: | Line 137: | ||
To learn more how to use GDB read its documentation here: http://www.gnu.org/software/gdb/documentation | To learn more how to use GDB read its documentation here: http://www.gnu.org/software/gdb/documentation | ||
− | == Building FPC libraries == | + | ==Building FPC libraries== |
If you want to build libraries available with FPC just go to library folder and execute: | If you want to build libraries available with FPC just go to library folder and execute: | ||
Line 147: | Line 147: | ||
For example you want to build FCL. Go to <tt>fpc\fcl</tt> folder and execute the command above. You will get FCL compiled units in <tt>fpc\fcl\units\arm-PalmOs</tt>. | For example you want to build FCL. Go to <tt>fpc\fcl</tt> folder and execute the command above. You will get FCL compiled units in <tt>fpc\fcl\units\arm-PalmOs</tt>. | ||
− | == Documentation == | + | ==Documentation== |
− | === PalmOs port notes === | + | ===PalmOs port notes=== |
* <tt>'''chdir'''</tt> procedure always produces an error (PalmOs does not support setting of current directory). | * <tt>'''chdir'''</tt> procedure always produces an error (PalmOs does not support setting of current directory). | ||
* All file/dir paths must be absolute (started with \). | * All file/dir paths must be absolute (started with \). | ||
Line 156: | Line 156: | ||
* 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 <tt>-WC</tt> compiler switch or put <tt>{$APPTYPE CONSOLE}</tt> directive to source code.<br>To enable console in PalmOs install one of the following programs: | * 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 <tt>-WC</tt> compiler switch or put <tt>{$APPTYPE CONSOLE}</tt> directive to source code.<br>To enable console in PalmOs install one of the following programs: | ||
− | == Links == | + | ==Links== |
* [http://www.stack.nl/~marcov/buildfaq.pdf Buildfaq] is a general FAQ about how to build and configure FPC. | * [http://www.stack.nl/~marcov/buildfaq.pdf Buildfaq] is a general FAQ about how to build and configure FPC. | ||
Line 168: | Line 168: | ||
* [http://web.njit.edu/~baltrush/arm_stuff/ARMInst.ppt The ARM Instruction Set ] Another fine power point file about arm | * [http://web.njit.edu/~baltrush/arm_stuff/ARMInst.ppt The ARM Instruction Set ] Another fine power point file about arm | ||
− | == Contacts == | + | ==Contacts== |
+ | |||
+ | [mailto:mazen@freepascal.org Mazen NEIFER] |
Revision as of 18:10, 31 May 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
GDB can be used to debug your PalmOs applications remotely via ActiveSync. Download GDB 6.4 for Win32 host and arm-PalmOs target here: ftp://ftp.freepascal.org/pub/fpc/contrib/cross/gdb-6.4-win32-arm-PalmOs.zip
Some hints
- Pass --tui parameter to GDB to enable TUI interface which makes debugging more comfortable.
- Use unix line endings (LF only) in your pascal source files. Otherwise GDB will show sources incorrctly.
How to use
First, make ActiveSync connection to your Pocket PC device.
Then launch gdb:
gdb --tui <your_executable_at_local_pc>
On gdb prompt type:
run or just r
GDB will copy your executable to the device in \gdb folder and run it.
Here is a short list of most needed GDB commands:
- s - step into.
- n - step over.
- c - continue execution.
- br <function_name> - set a breakpoint at function_name. Use PASCALMAIN to set a breakpoint at program start.
- br <source_file>:<line_number> - set a breakpoint at specified source line.
To learn more how to use GDB read its documentation here: http://www.gnu.org/software/gdb/documentation
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