Wiki copymirror

This is a mirror of the wiki at pascal.chat. Editing, history and sign-in are there.

arm-wince

(WinCE only)

This page describes setup of a crosscompiling environment (host is Win32),.

The easy way: download the cross compiler

The easiest way to start development for WinCE is to download the latest release version of FPC for Win32 and arm-wince cross compiler for Win32.

Download them here: http://www.freepascal.org/download.var

First install FPC for Win32, then install arm-wince cross compiler as add-on package.

The hard way: building WinCE cross compiler from sources

This tutorial demonstrates how to build the arm-wince crosscompiler on Windows which allows you to compile Windows CE programs from your Windows desktop.

Note: During the tutorial some paths will be used to demonstrate the build process. Just substitute those paths with the ones on your system.

We will suppose that:

Step 1: Cross binutils

Binutils are the basic tools necessary to create executables, such as: linker (ld), assembler (as), archiver (ar), strip and some others.

You need cross binutils for arm-wince (i.e. they run on your desktop but produce output suitable for arm-wince). Get them from ftp://ftp.freepascal.org/pub/fpc/contrib/cross/arm-wince-binutils.zip.

Extract them to some dir in the path on your machine. We will suppose that you extracted the cross binutils to: C:\cross\arm

Step 2: Building the cross compiler

Now you need to build the FPC cross compiler for the ARM processor. To do that, you need:

You can get the latest FPC source repository from Subversion: http://www.freepascal.org/develop.html#svn

In order to build the cross compiler it is necessary to have a correct PATH environment variable. On Windows it is very easy to get a PATH crowded with information put by installers. To ensure that your path is correct, create a batch file called c:\fpc\compiler\create_cross_arm_wince.cmd with the following code:

dos
PATH=c:\fpc\bin\i386-win32;C:\cross\arm
make cycle CPU_TARGET=arm OS_TARGET=wince

Now open the Windows command line, and run the batch file:

dos
cd /d c:\fpc\compiler
create_cross_arm_wince.cmd

The compile should run without any errors.

You should now have a ppccrossarm.exe in c:\fpc\compiler and some .o and .ppu files in c:\fpc\rtl\units\arm-wince

Now copy those files to your Free Pascal installation.

Step 3: Configuration file

Now you need to edit your FPC configuration file in c:\fpc\bin\i386-win32\fpc.cfg in order to use ppccrossarm.exe easily.

pascal
#IFDEF CPUARM
#IFDEF WINCE
# Settings specific to cross compilation to wince on ARM.
-FuC:\fpc\units\arm-wince
-XParm-wince-
-FDC:\cross\arm
#ENDIF
#ENDIF

Now when you want to compile for WinCE you just have to specify the OS and Arch targets to FPC or Lazarus:

dos
fpc -Twince -Parm yourfile.pas

Note: When using Lazarus, make sure the compiler path/file in Lazarus options is set to "fpc.exe", not "ppc386.exe"

Building FPC libraries

If you want to build libraries available with FPC just go to the library folder and execute:

bash
PATH=c:\fpc\bin\i386-win32;c:\fpc\compiler;C:\cross\arm
make OS_TARGET=wince CPU_TARGET=arm PP=ppcrossarm.exe

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.

Step 1: Installing and Configuring the Emulator

You will need a Windows CE Emulator configured for ActiveSync. The ActiveSync is necessary to install PocketCMD, a command line tool to run our hello world software.

Download the free Pocket PC device emulator from Microsoft. It emulates ARM CPU. http://msdn.microsoft.com/mobility/downloads/Emulator/default.aspx

There is a tutorial on how to set up the Emulator for ActiveSync here.

Step 2: Installing the command line

Download and install PocketCMD by SymbolicTools. Get it here (this site seems to be gone) but try here 1

To enable the console on newer devices (I needed it in my 6.1CE pro), you may to set the following registry value link

text
HKEY_LOCAL_MACHINE\Drivers\Console\OutputTo -> 0

Check WinCE port Hints for more details on programming under Windows CE platform.

Step 3: Compiling

An example file to compile:

pascal
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.

Command line to compile test.pas:

dos
fpc -Twince -Parm test.pas

You will get a test.exe executable file. Copy it to your Windows CE device and run.

Here is a screenshot of a software created this way.


From the Free Pascal wiki, page "arm-wince", as it stood on 2020-08-09 after a change by Trev, 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.

Revision 2, last changed by WikiArchive .