Difference between revisions of "Windows CE Interface"
Line 69: | Line 69: | ||
If you encountered an error make sure the \gdb folder is created,arm-wince-pe-stub.exe and you exe file is there.Also most of the times becouse of big size of exe file you can not copy that into your \gdb file.So you have to call Microsoft Device Emulator Preview with 128mg of ram instead of defaulkt 64mg ram. | If you encountered an error make sure the \gdb folder is created,arm-wince-pe-stub.exe and you exe file is there.Also most of the times becouse of big size of exe file you can not copy that into your \gdb file.So you have to call Microsoft Device Emulator Preview with 128mg of ram instead of defaulkt 64mg ram. | ||
+ | ==Windows CE Interface Decelopment notes== | ||
+ | [[Windows_CE_Development_Notes]] | ||
==Road map for the Windows CE interface== | ==Road map for the Windows CE interface== |
Revision as of 11:02, 23 April 2006
Windows CE interface is in early development.
Setting Up the Windows CE interface
The Compiler and Run-time library for Windows CE are only available on the development branch of Free Pascal, the 2.1.x version. Lazarus snapshot comes with this Free Pascal version.
Step 1 - To start with you will need to recompile the compiler on Windows to create a Windows CE - ARM Crosscompiler. There are instructions here: WinCE_port.
Step 2 - You also need to compile FCL (Free Component Library) with the newly built compile. Instructions here.
Step 3 - Put the batch file bellow on the root of your subversion lazarus directory and run it
PATH=C:\Programas\lazarus\pp\bin\i386-win32;c:\Programas\arm make lcl LCL_PLATFORM=wince PP=ppcrossarm.exe CPU_TARGET=arm OS_TARGET=wince
This should compile LCL for Windows CE.
Step 4 - Now you can compile simple LCL software using scripts similar to this:
PATH=C:\Programas\lazarus\pp\bin\i386-win32;c:\Programas\arm ppcrossarm.exe -Twince -FuC:\Programas\fpc\rtl\units\arm-wince -FDC:\Programas\arm -XParm-wince- test.pas ppcrossarm.exe -Twince -FuC:\programas\lazarus\lcl\units\arm-wince -FuC:\programas\lazarus\lcl\units\arm-wince\wince -FuC:\Programas\fpc\rtl\units\arm-wince -FDC:\Programas\arm -XParm-wince- windowtest.pas
Debbuging Windows CE software on the Lazarus IDE
You can also debug applications created whithin Lazarus IDE.
Step 1 - In Lazarus IDE go to the menu Environment->Debugger Options. Change the debugger path to the directory with gdb for wince.you can get it from here ftp://ftp.freepascal.org/pub/fpc/contrib/cross/gdb-6.4-win32-arm-wince.zip
Step 2 - Create a .bat file to compile your application for wince.Here is my .bat file.
path=e:\fpc\lazarus\pp\bin\i386-win32;e:\fpc\fpc\bin\i386-win32;e:\fpc\fpc\bin\arm-wince;e:\fpc\gdb del project1.exe ppcrossarm.exe -Twince -g -O- -gl -gc -Fue:\fpc\lazarus\lcl\units\arm-wince -Fue:\fpc\lazarus\lcl\units\arm-wince\wince -FuE:\fpc\source\rtl\units\arm-wince\ -FDe:\fpc\fpc\bin\arm-wince -XParm-wince- project1.lpr echo change all path to yours echo arm-wince-strip --only-keep-debug project1.exe echo it doesnt that much reduce the size,so for now i removed it copy project1.exe "E:\eMbedded Projects\storage card\fpc" /Y echo "E:\eMbedded Projects\storage card" is my shared folder path
Step 3 - Go to the menu Project->Compiler options. In the "Compilation" tab put your .bat file or command which you use to build your application in 'Execute after' section in Command editbar.Also check the Call on : Compile and build checkboxes.Clear all other checkboxes.
Step 4 - If you are using Microsoft Device Emulator Preview, launch(or restore)it.Make sure you've started emulator with 128mg of ram.Select a path for shared folders in emulator, add copy command to your .bat file used for building your application to copy the compiled exe file to your shared path.(as you can see in my .bat file).Here is a .bat file you can use to launch emulator with 128 of ram.
start deviceemulator.exe ".\ppc_2003_se\PPC_2003_SE_WWE_ARMv4.bin" /memsize 128 /skin ".\ppc_2003_se\PocketPC_2003_Skin.xml"
After that just do 'save and exit' whenever you want to quit emulator,and launch it again from shortcuts created in your start menu.(the shortcuts with '(restore)').
Step 5 - Run Device Emulator Manager and in available emulators right click on the name of emulator and do cradle.Now Microsoft ActiveSync will be launched.If not in Micrososft ActiveSync Go to the menu File->Get connected.If still ActiveSync doesnt recognize the emulator.Uncradle and Cradle the emulator again.
Step 6 - Copy that file with File Explorer program in your emulator to \gdb directory.If it is your first time running emulator you have to create a gdb directory in 'My Pocket PC' folder which is your root(\) folder.(To make things even faster for your each build,with file explorer go to your shared folder,press ctrl+c in your exe file,go to \gdb folder and each time before you try to debug your application just press ctrl+v)
Step 7 - Now you can safely debug your application.gdb for wince will be launched.it will copy arm-wince-pe-stub.exe to \gdb folder and check if your application.exe file is there and will launch the program. If you encountered an error make sure the \gdb folder is created,arm-wince-pe-stub.exe and you exe file is there.Also most of the times becouse of big size of exe file you can not copy that into your \gdb file.So you have to call Microsoft Device Emulator Preview with 128mg of ram instead of defaulkt 64mg ram.
Windows CE Interface Decelopment notes
Road map for the Windows CE interface
currently implemented components with their status
Moved here: Road_To_1.0#Widgetset_dependent_components
components scheduled to be implemented
- TCanvas
- TBitmap - Needs a description of the internal format used by Windows CE
- TPixmap
- TIcon
Screenshots
A minimal example of Lazarus+WinCE and the Free Pascal software used to test the cross compiler:
How to add a new control
For example TButton.
TButton is defined in lcl/buttons.pp. This is the platform independent part of the LCL, which is used by the normal LCL programmer.
Its widgetset class is in lcl/widgetset/wsbuttons.pp. This is the platform independent base for all widgetsets (qt, carbon, gtk, win32, ...).
It's wince interface class is in lcl/interfaces/wince/wincewsbuttons.pp:
TWinCEWSButton = class(TWSButton) private protected public class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override; end;
Every WS class, that actually implements something must be registered. See the initialization section at the end of the wincewsXXX.pp unit:
RegisterWSComponent(TButton, TWinCEWSButton);
Also notice that DestroyHandle should be implemented to clean up memory utilized by the control.