Sign in Join
Wiki copytemporary

arm-wince: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11*(WinCE only)*
22
33This page describes setup of a crosscompiling environment (host is Win32),.
44
55## The easy way: download the cross compiler
66
77The 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.
88
99Download them here: <http://www.freepascal.org/download.var>
1010
1111First install FPC for Win32, then install arm-wince cross compiler as add-on package.
1212
1313## The hard way: building WinCE cross compiler from sources
1414
1515This tutorial demonstrates how to build the **arm-wince** crosscompiler on Windows which allows you to compile Windows CE programs from your Windows desktop.
1616
1717> **Note:** During the tutorial some paths will be used to demonstrate the build process. Just substitute those paths with the ones on your system.
1818
1919We will suppose that:
2020
2121- your FPC compiler is located here: `c:\fpc\bin\i386-win32\fpc.exe`
2222- your Free Pascal source code is located here: `c:\fpc`
2323
2424### Step 1: Cross binutils
2525
2626Binutils are the basic tools necessary to create executables, such as: linker (ld), assembler (as), archiver (ar), strip and some others.
2727
2828You 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>.
2929
3030Extract them to some dir in the path on your machine. We will suppose that you extracted the cross binutils to: `C:\cross\arm`
3131
3232### Step 2: Building the cross compiler
3333
3434Now you need to build the FPC cross compiler for the ARM processor. To do that, you need:
3535
3636- FPC sources
3737- a working installation of FPC
3838- the cross binutils mentioned above
3939
4040You can get the latest FPC source repository from Subversion: <http://www.freepascal.org/develop.html#svn>
4141
4242In 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:
4343
4444```dos
4545PATH=c:\fpc\bin\i386-win32;C:\cross\arm
4646make cycle CPU_TARGET=arm OS_TARGET=wince
4747```
4848
4949Now open the Windows command line, and run the batch file:
5050
5151```dos
5252cd /d c:\fpc\compiler
5353create_cross_arm_wince.cmd
5454```
5555
5656The compile should run without any errors.
5757
5858You should now have a `ppccrossarm.exe` in `c:\fpc\compiler` and some `.o` and `.ppu` files in `c:\fpc\rtl\units\arm-wince`
5959
6060Now copy those files to your Free Pascal installation.
6161
6262- Copy the cross compiler `ppccrossarm.exe` to `c:\fpc\bin\i386-win32\`
6363- Copy the units in `c:\fpc\rtl\units\arm-wince` to `c:\fpc\units\arm-wince`
6464
6565### Step 3: Configuration file
6666
6767Now you need to edit your FPC configuration file in `c:\fpc\bin\i386-win32\fpc.cfg` in order to use `ppccrossarm.exe` easily.
6868
6969 #IFDEF CPUARM
7070 #IFDEF WINCE
7171 # Settings specific to cross compilation to wince on ARM.
7272 -FuC:\fpc\units\arm-wince
7373 -XParm-wince-
7474 -FDC:\cross\arm
7575 #ENDIF
7676 #ENDIF
7777
7878Now when you want to compile for WinCE you just have to specify the OS and Arch targets to FPC or Lazarus:
7979
8080```DOS
8181fpc -Twince -Parm yourfile.pas
8282```
8383
8484> **Note:** When using Lazarus, make sure the compiler path/file in Lazarus options is set to "fpc.exe", not "ppc386.exe"
8585
8686## Building FPC libraries
8787
8888If you want to build libraries available with FPC just go to the library folder and execute:
8989
9090``` bash
9191PATH=c:\fpc\bin\i386-win32;c:\fpc\compiler;C:\cross\arm
9292make OS_TARGET=wince CPU_TARGET=arm PP=ppcrossarm.exe
9393```
9494
9595## Compiling a Test Project
9696
9797You 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.
9898
9999### Step 1: Installing and Configuring the Emulator
100100
101101You 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.
102102
103103Download the free Pocket PC device emulator from Microsoft. It emulates ARM CPU. <http://msdn.microsoft.com/mobility/downloads/Emulator/default.aspx>
104104
105105There is a tutorial on how to set up the Emulator for ActiveSync [here](http://www.pocketpcfaq.com/faqs/5.0/emulator.htm).
106106
107107### Step 2: Installing the command line
108108
109109Download and install **PocketCMD** by SymbolicTools. Get it [here](http://www.symbolictools.de/public/pocketconsole/applications/PocketCMD) (this site seems to be gone) but try here [1](http://www.mobile2day.de/platform_wince/device/CASIO/Cassiopeia+E-115/download.html?file=c112516.exe&prod=14571)
110110
111111To enable the console on newer devices (I needed it in my 6.1CE pro), you may to set the following registry value [link](http://forum.xda-developers.com/showthread.php?t=275019&highlight=console)
112112
113-`HKEY_LOCAL_MACHINE\Drivers\Console\OutputTo -> 0`
113+```text
114+HKEY_LOCAL_MACHINE\Drivers\Console\OutputTo -> 0
115+```
114116
115117Check [[WinCE port Hints]] for more details on programming under Windows CE platform.
116118
117119### Step 3: Compiling
118120
119121An example file to compile:
120122
121123``` pascal
122124program test;
123125
124126{$apptype console}
125127
126128var
127129 Str: string;
128130begin
129131 WriteLn('Software Developed with:');
130132 WriteLn('The Free Pascal Compiler');
131133 WriteLn('');
132134 WriteLn('Please, enter your name:');
133135 ReadLn(Str);
134136 WriteLn('Your name is: ' + Str);
135137end.
136138```
137139
138140Command line to compile `test.pas`:
139141
140142```DOS
141143fpc -Twince -Parm test.pas
142144```
143145
144146You will get a `test.exe` executable file. Copy it to your Windows CE device and run.
145147
146148[Here](http://wiki.lazarus.freepascal.org/index.php/Windows_CE_Interface#Screenshots) is a screenshot of a software created this way.
147149
148150---
149151*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](/wiki-contact).*
150152Category: ARM
151153Category: Cross compilation
152154Category: WinCE

Back to history