Difference between revisions of "User:CCRDude"

From Free Pascal wiki
Jump to navigationJump to search
(No difference)

Revision as of 18:38, 10 June 2006

Lazarus and WinCE using Win64, from the start

Introduction

Existing tutorials

This is not to say that the existing tutorials are bad, just that they did not help in my special case. I gave up following them because of a bunch of things I couldn't follow, including PocketCMD, which doesn't run on my iPAQ H3870, the Microsoft Emulator which doesn't network on 64-bit Windows XP, unit paths in the tutorial that were not correct, and some other troubles. So I thought I'ld better understand what's done and write down my steps that way (because the next FPC + Lazarus version is surely to come...).

Prerequisites

I want to build simple GUI applications for a HP iPAQ H3870 running Pocket PC 2002 Version 3.0.11171 on an ARM SA1110 processor.

This tutorial is intended to show an installation of Lazarus to compile WinCE applications on a clean system running Windows (in this special case Windows XP 64-bit edition, but since all tools are 32-bit tools, it should run on standard Windows XP as well). Instructions are based on these Lazarus wiki pages:

Installation

Cleanup

Completely remove old FPC and Lazarus installations. This includes opening the System Properties, Advanced tab, button Environment Variables, and removing all previous references to FPC and Arm in the PATH environment.

ARM-Utilities

  • Download arm-wince-binutils and extract into C:\Apps\arm\. Then add C:\Apps\arm to the PATH environment.
  • Test the path by opening a new terminal (Start -> Run -> 'cmd') and typing arm-wince-ar. If you see a compiler message, everything is fine.

Lazarus

  • Download newest Lazarus daily snapshot and install into C:\Apps\Lazarus\. I used the snapshot from June 8th 2006, named Lazarus-0.9.17-20060608-win32.exe.
  • Add C:\Apps\Lazarus\pp\bin\i386-win32 and C:\apps\Lazarus\pp\bin\arm-wince to the PATH environment.
  • Test the path by opening a new terminal (Start -> Run -> 'cmd') and typing 'fpc'. If you see a compiler message, everything is fine.
  • The installation should be tested by compiling a simple existing Lazarus project.

FreePascal

By using a daily snapshot, we already have a 2.1.x version of FreePascal that is needed. But we still need some more FreePascal stuff. The other tutorials mentions Subversion; it's a bit simpler to get a daily snapshot of the development tree though, or directly via ftp. Open this archive and extract the folders from the fpc subfolder into C:\Apps\Lazarus\pp\. Make sure you don't have an additional fpc subfolder, but the compiler, fcl, etc. folder directly in pp.

Compiling for ARM

Create cross compiler

  • Open a new command prompt and switch to C:\Apps\Lazarus\pp\compiler.
  • Type make --help and check if you've got the right version (Delphi users will probably see the Borland version, in which case you should type set path=C:\Apps\arm;C:\Apps\Lazarus\pp\bin\i386-win32;C:\Apps\Lazarus\pp\bin\arm-wince).
  • Then just type make cycle CPU_TARGET=arm OS_TARGET=wince and let it compile. There'll be a bunch of warnings, hints and notes, but it should finish.
 C:
 cd \Apps\Lazarus\pp\compiler
 set path=C:\Apps\arm;C:\Apps\Lazarus\pp\bin\i386-win32;C:\Apps\Lazarus\pp\bin\arm-wince
 make cycle CPU_TARGET=arm OS_TARGET=wince

Files

  • Create the folder C:\Apps\Lazarus\pp\bin\arm-wince, and copy C:\Apps\Lazarus\pp\compiler\ppcrossarm.exe into it.
  • Create C:\Apps\Lazarus\pp\units\arm-wince\rtl, and copy C:\Apps\Lazarus\pp\rtl\units\arm-wince\*.* into it.

Configuration

Go back to C:\Apps\Lazarus\pp\bin\arm-wince and create a fpc.cfg in there:

 -Twince
 -FuC:\Apps\Lazarus\pp\units\arm-wince
 -FuC:\Apps\Lazarus\pp\units\arm-wince\*
 -FuC:\Apps\Lazarus\pp\units\arm-wince\rtl
 -XParm-wince-
 -FDC:\Apps\arm
 -FDC:\Apps\Lazarus\pp\bin\arm-wince

FCL

  • Go to C:\Apps\Lazarus\pp\fcl and compile there.
 C:
 cd \Apps\Lazarus\pp\fcl
 make CPU_TARGET=arm OS_TARGET=wince PP=ppcrossarm.exe
  • Create C:\Apps\Lazarus\pp\units\arm-wince\fcl, and copy C:\Apps\Lazarus\pp\fcl\units\arm-wince\*.* into it.

LCL

Go to C:\Apps\Lazarus and rebuild the lcl.

 C:
 cd \Apps\Lazarus
 make lcl LCL_PLATFORM=wince PP=ppcrossarm.exe CPU_TARGET=arm OS_TARGET=wince

Test compile

Compile the test program from the wiki by saving it on your disk and compiling it using

 ppcrossarm test.pas

Test shell

There are two ways of getting a command shell on WinCE; one is Microsofts PPC Command Shell, the other one PocketCmd, which also needs PocketConsole installed.

Using Lazarus

  • Create a new application
  • Open the compile options,
    • change widgetset to wince,
    • target OS to WinCE,
    • and target processor to arm.
  • Change the compiler path in environment settings to C:\Apps\Lazarus\pp\bin\arm-wince\ppcrossarm.exe.