Difference between revisions of "SymbianOS"

From Lazarus wiki
Jump to navigationJump to search
Line 220: Line 220:
  
 
Wiley, Symbian OS Internals Real time Kernel Programming Dec 2005
 
Wiley, Symbian OS Internals Real time Kernel Programming Dec 2005
 +
 +
==See Also==
 +
 +
*[[Symbian OS Internals]]
  
 
==External Links==
 
==External Links==

Revision as of 21:14, 22 April 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 - 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

Comments

there is also an replacement for the Symbian build system which uses Makefiles: http://www.koeniglich.de/sdk2unix/symbian_sdk_on_unix.html

That build system only targets the ARM device, not the Emulator, and isn´t available for UIQ 3. So it doesn´t help much --Sekelsenmat 16:11, 26 October 2006 (CEST)

A simpler way would be to concentrate on the POSIX compatible API that Symbian OS has... that would be much faster to do.... And it would not be fixed to UIQ only ...

We could probably reuse existing bindings (for example the Unix rtl or something like that...)

Versions Roadmap

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

Comments

The emulator does not use the E32 fileformat used by the real devices but makes an normal PE exe that bind against the emulator libraries so thath should be much easier to do than to really build ARM binaries... (I don't have Windows right now so I can't test anything yet...)

Yes, and that´s why the first target will be the emulator =) --Sekelsenmat 16:11, 26 October 2006 (CEST)


Compiling Free Pascal for the Emulator

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

2 - 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

3 - Now 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

This section is a documentation on the attempt to re-engineer the UIQ 3 build system to a format more friendly to Free Pascal and cross-platform development in general.

Default SDK Build Process

Two commands are executed when building UIQ 3 software for the emulator. Suppose your UIQ SDK is installed on c:\Symbian\UIQ3SDK and your software C++ source code is on C:\QHelloWorld\src.

On C++ you should enter the directory C:\QHelloWorld\group where the build file is located (bld.inf), and type:

bldmake bldfiles
abld build winscw udeb

The first command will:

  • Generate the directory: C:\Symbian\UIQ3SDK\epoc32\BUILD\Programas\SymbianOS\QHelloWorld\group
  • Fill it with many Makefiles
  • Create a ABLD.BAT script
  • Perl files involved: bldmake.pl

The second command will:

  • Generate the directory: C:\Symbian\UIQ3SDK\epoc32\BUILD\Programas\SymbianOS\QHelloWorld\group\QHELLOWORLD\WINSCW
  • There it will put the source code, a QHELLOWORLD.WINSCW file and a UDEB directory with compiled .o files for the software
  • It will also create a executable (QHelloWorld.exe) for the software on the directory: C:\Symbian\UIQ3SDK\epoc32\release\winscw\udeb
  • Perl files involved: abld.pl makmake.pl

Modifyed Build Process

To aid on this complex build process, a command line tool called "mksymbian" will be created.

Default UIQ build process expects that the source be on a rather peculiar directory format. This is unsuitable for cross-platform development. Just imagine if each OS required a different directory tree, cross-platform would be impossible. Instead we will change this to simply require that the project be the only project on it´s directory. This is already required by many tools, like make, so it should be a flexible enougth restriction for cross-platform.

On the folder of the project you should have source code and also a project information file. This file is in INI format, and specifies many information for our tool to use to build the project. The file must be called "mksymbian.ini"

To compile a C++ project with it you can do:

mksymbian cpp

This is just utilized to show that the tool produces correct output, as our objetive here is to build Object Pascal software.

One important task of this build tool is identifying correctly where Symbian SDKs and Free Pascal are installed.

Using mksymbian

The sintax of this tool is:

mksymbian [action] [target] [options]

Action can be one of the following:

  • cpp - Compiles a C++ project
  • pascal - Compiles a Object Pascal project
  • showpath - Shows the paths found for the Symbian SDKs and Free Pascal. Utilized to check if the tool was able to find the tools.

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

Registering a application on the UIQ Emulator

Each application should provide a non-localizable resource file with information necessary to register it on the emulator (or later on a real phone). This file ends with the .rss extension and should look similar to this example one:

// QHelloWorld_reg.rss
#include <AppInfo.rh>

UID2 KUidAppRegistrationResourceFile
UID3 0x01000001

RESOURCE APP_REGISTRATION_INFO
{
	// filename of application binary (minus extension)
	app_file = "QHelloWorld";
}

During the build process this file will be compiled into a .RCS resource file. On the emulator, all registration files should be located on the directory \private\10003a3f\apps

Mksymbian tool will take care of compiling the resource and placing it on the correct position. There next paragraphs on this sections are technical details of how this is done.

Looking at the UIQ 3 SDK directory structure you will find 3 directories that match \private\10003a3f:

  • C:\Programas\UIQ3SDK\epoc32\data\Z\private\10003a3f\apps

Here a copy of your RCS resource file will be put

  • C:\Programas\UIQ3SDK\epoc32\winscw\c\Private\10003a3f

This directory contains only some binary files.

  • C:\Programas\UIQ3SDK\epoc32\release\winscw\udeb\Z\private\10003a3f\apps

Here a copy of your RCS resource file will be put, and you can also see RCS files for all other software installed on the emulator.

Screenshots

First pascal symbian os application:

First pascal symbian app.PNG

Misc info from old SymbianOS Port page

1. Compiler seems to be complete for arm, but THUMB and interworking is something good for symbian.

2. It seems there are some ABI incompatibilities, at least people from symbian irc insist only symbian 9 and greater is ok with arm abi, find out what they are and how to implement them.

3. Everything on symbian is in C++, and fpc cannot connect to C++ object files. The only solution is to create bindings in c and then link fpc to c instead.

These tools seems to be helpful in some way:

  smoke, swig, doxygen

And some links to look at in this field:

rvelthuis.de/articles/articles-cppobjs.html

qtcsharp.sourceforge.net/background.php

dot.kde.org

wiki.kde.org/tiki-index.php?page=Language+Bindings+Talk

wiki.dotgnu.info/Smoke/Refract

4. Symbian has a very complicated build/make process. How to do that?

5. Symbian has different kinds of applications, some new application modes have to be introduced.

6. Investigate how other languages, not C++, deal with these problems.

7. Neither Symbain OS nor its C++ have exceptions, static data and some strange other things. why? Does it mean we cannot have them on fpc, too? How to deal with this?

8. Someone with good knowledge and background of symbian is defenitely needed here. I just know how to code simple programs on symbian.

9. The source code of gcc might be useful too.

Some usefull links:

Symbian programming tutorial, recommended!

Tutorial

Pythong for series60

SDKS

Symbian OS design faults, interesting

Good books:

Wiley, Programming for the Series 60 Platform and Symbian OS (2003)

Wiley, Symbian OS Internals Real time Kernel Programming Dec 2005

See Also

External Links