Difference between revisions of "SymbianOS"

From Lazarus wiki
Jump to navigationJump to search
Line 42: Line 42:
 
4 - Building the RTL only is not enougth to compile a Symbian OS application. We also need the c++ bindings which connect our RTL to the Symbian libraries.
 
4 - Building the RTL only is not enougth to compile a Symbian OS application. We also need the c++ bindings which connect our RTL to the Symbian libraries.
  
4.1 - To build the bindings you will need the helper application called mksymbian. Please download it with subversion using this command:
+
4.1 - To build the bindings you will need the helper application called mksymbian. This application is included with the Free Pascal sources on the directory utils/mksymbian
  
svn co https://p-tools.svn.sourceforge.net/svnroot/p-tools/mksymbian mksymbian
+
4.2 - Next compile mksymbian. There is a lazarus project to help building it, but directly calling the compiler from command line works just as well, like this:
  
4.2 - Next compile mksymbian. There is a lazarus project to help building it, but directly calling the compiler from command line should work just as well.
+
fpc mksymbian.pas
  
 
4.3 - Copy the mksymbian executable to the fpc/rtl/symbian/bindings directory, open a console, go to the fpc/rtl/symbian/bindings directory and type this command:
 
4.3 - Copy the mksymbian executable to the fpc/rtl/symbian/bindings directory, open a console, go to the fpc/rtl/symbian/bindings directory and type this command:

Revision as of 10:12, 6 July 2007

The SymbianOS port of Free Pascal is under construction.

Roadmap to port FPC to SymbianOS

  1. Develop a Hello World application on c++ for SymbianOS UIQ 3 - Felipe
  2. Convert the Build software from perl to our own building system, and make it build the c++ software - Felipe
  3. Effectively start to port the Free Pascal Runtime Library - Felipe
  4. Convert some c++ symbian applications to check for errors on the port - Felipe - 1 trivial done, more to go
  5. Complete the port of Free Pascal Runtime Library
  6. Start developing with UIQ 2 SDK, and make adjustments for everything to work with it
  7. Make sure everything works on the real Phone with UIQ 2 too

Versions Roadmap

The first target will be UIQ 3.0 for the Symbian OS on x86 architecture (the emulator).

Next will be the UIQ 2 for x86 emulator, and last the UIQ 2 real device.

Compiling Free Pascal for the Emulator

1 - Download the latest FPC from Subversion. Make sure you also have the latest stable FPC installed.

2 - Next you will need a assembler compatible with the Code Warrior linker. Currently this is the GNU Assembler. It´s a good coincidence that the emulator uses normal win32 PE executables, but of course it could use any other format, so FPC will expect a cross-assembler with the correct name. Because of this we can simply copy the as.exe file that comes with FPC releases and rename it.

Suppose your win32 gnu assembler is located at: C:\Programas\lazarus20\fpc\2.0.4\bin\i386-win32\as.exe

You should make a copy of it with this name: C:\Programas\lazarus20\fpc\2.0.4\bin\i386-win32\i386-symbian-as.exe

3 - Now, open a Windows Command Line session. The following batch script will execute a full compilation of FPC for the emulator. In this particular case lazarus was installed on C:\Programas\lazarus20 and the fpc 2.1 source code is on C:\Programas\fpc21

PATH=C:\Programas\lazarus20\fpc\2.0.4\bin\i386-win32
cd c:\Programas\fpc21
cd compiler
make i386
cd ..
cd rtl
cd symbian
make FPC=C:\Programas\fpc21\compiler\ppc386.exe

4 - Building the RTL only is not enougth to compile a Symbian OS application. We also need the c++ bindings which connect our RTL to the Symbian libraries.

4.1 - To build the bindings you will need the helper application called mksymbian. This application is included with the Free Pascal sources on the directory utils/mksymbian

4.2 - Next compile mksymbian. There is a lazarus project to help building it, but directly calling the compiler from command line works just as well, like this:

fpc mksymbian.pas

4.3 - Copy the mksymbian executable to the fpc/rtl/symbian/bindings directory, open a console, go to the fpc/rtl/symbian/bindings directory and type this command:

mksymbian bindings

4.4 - Copy the resulting .o file(s) to where your symbian os RTL is located. On our example it´s on: C:\Programas\fpc21\rtl\units\i386-symbian

5 - Next you can go to the session "Building Symbian OS Applications" bellow, to learn how to use your compiler to generate a Object Pascal software for Symbian.

The Symbian OS RTL will be located at: C:\Programas\fpc21\rtl\units\i386-symbian

Compiling Free Pascal for the real device

Not yet implemented.


Building Symbian OS Applications

Overview

Building a Symbian OS Application is much more complex tast then on other operating systems, because there are several unique things about Symbian, like the UIDs, the need to register a application on the Emulator and other things.

The UIQ SDK solves this problem using a very complex build system composed of several ten thousends lines of Perl code, batch files and Makefiles. It forces the software to have a specific directory structure, which is very bad to port existing software, as well as to writting cross-platform software. Because cross-platform is a strong point on Free Pascal we decided to eliminate this limitations when writing our build system for Symbian. We created a external build utility, called mksymbian, written in Pascal that auxiliates the build process.

Guide for building applications for the Emulator

You need first to write a .ini file that will contain Symbian OS specific information. Here is a example file called QPasHello.ini

[Main]
EXENAME=QPasHello.exe
Language=Pascal
ProjectType=EXE
SDK=UIQ
SDKVersion=3
Emulator=1

[FPC]
CompilerPath=C:\Programas\fpc21\compiler\ppc386.exe
RTLUnitsDir=C:\Programas\fpc21\rtl\units\i386-symbian\

[UIDs]
UID2=0x100039CE
UID3=0xE1000002

[Files]
mainsource=QPasHello.pas
mainresource=QPasHello_reg.rss

[Objects]
file0=qpashello.o

Next use mksymbian to build your application, like this:

mksymbian build QPasHello.ini

If something goes wrong, check if mksymbian located your directories correctly:

mksymbian showpath

Using mksymbian

The sintax of this tool is:

mksymbian [action] [project file]

Action can be one of the following:

  • build - Compiles a project
  • bindings - Compiles the pascal bindings for Symbian OS. It supposes that the necessary files are on the location where the command is executed.
  • showpath - Shows the paths found for the Symbian SDKs and Free Pascal. Utilized to check if the tool was able to find the tools.

The project file is a .ini file with many symbian os specific informations about a project, like the UIDs

Target can be one of the following:

  • WinEmulator - Builds for the x86 emulator
  • ArmDevice - Builds a binary for use on PDAs and Smartphones

Note: The tool parameters are not case-sensitive

Screenshots

First pascal symbian os UIQ 3 application:

First pascal symbian app.PNG

See Also

External Links