Difference between revisions of "Smartphone Development"

From Lazarus wiki
Jump to navigationJump to search
Line 129: Line 129:
  
 
Maemo runs "pure" arm-linux applications, so you need to enable FPC to cross compile for arm-linux. It is reccomended to use latest FPC trunk (2.5.x at now).
 
Maemo runs "pure" arm-linux applications, so you need to enable FPC to cross compile for arm-linux. It is reccomended to use latest FPC trunk (2.5.x at now).
Change "/home/user/" with your user path.
 
  
1) Install & Configure Binutils
+
See [http://wiki.lazarus.freepascal.org/Setup_Cross_Compile_For_ARM HERE] for the tutorial.
  
  ./configure --target=arm-linux --disable-werror
+
Notes:
 +
*Nokia N900 accept eabi v5 code, so make sure to use option
 +
  -meabi=5
 +
in assembler section of the [http://wiki.lazarus.freepascal.org/Setup_Cross_Compile_For_ARM#Compile_binutils_for_arm-linux tutorial]
  
2) Replace arm-assebler with a "fake one", you need to do this because Maemo runs on EABI v5 hardware
+
*Target llibs.
 
+
For Nokia N900 you need to copy /lib/* and /usr/lib/* (no subdirs) and merged to ~/lazarus/fpc/libcross/ then you had to rename each library ''not found'' by linker (ld) to the file name searched by linker itself.
sudo mv /usr/local/bin/arm-linux-as /usr/local/bin/arm-linux-as_org
+
I mean, if you got this error
sudo gedit /usr/local/bin/arm-linux-as
 
 
 
Paste this:
 
 
 
#!/bin/sh
 
/usr/local/bin/arm-linux-as_org -meabi=5 $@
 
 
 
3) Make FPC for arm-linux
 
 
 
sudo make crossinstall CPU_TARGET=arm OS_TARGET=linux CROSSBINDIR=/home/user/lazarus/fpc/binutils/ OPT=-dFPC_ARMEL INSTALL_PREFIX=/usr
 
 
 
4) Customize fpc.cfg
 
 
 
gedit ~/.fpc.cfg
 
 
 
and paste this (customize with your paths):
 
 
 
#INCLUDE /etc/fpc.cfg
 
#DEFINE DEMOTEST
 
#DEFINE DEMOTEST1
 
#DEFINE LAZARUS
 
 
-Fu/usr/lib/fpc/2.5.1/units/$fpctarget/*
 
-Fl/usr/lib/fpc/2.5.1/units/$fpctarget/rtl/
 
 
-a
 
-Sd
 
-Xd
 
-Xs
 
 
-O-
 
 
#IFDEF CPUARM
 
-XP/home/user/lazarus/fpc/binutils/
 
-Xr/usr/lib/fpc/2.5.1/units/arm-linux/rtl/
 
-Xr/home/user/lazarus/fpc/libcross
 
-XR/home/user/lazarus/fpc/
 
-darm
 
-Tlinux
 
#ENDIF
 
 
 
save and close gedit
 
 
 
sudo ln -sf /usr/lib/fpc/2.5.1/ppcrossarm /usr/local/bin/ppcarm
 
 
 
5) Cross compile the LCL ( http://wiki.lazarus.freepascal.org/Cross_compiling#Cross_compiling_the_LCL ).
 
 
 
6) Set Targets:
 
 
 
From the IDE:
 
  * Set in Project / Compiler Options / Code / Target OS (-T): Linux
 
  * Set in Project / Compiler Options / Code / Target CPU family (-P): arm
 
 
 
7) Add terget libs to your project:
 
 
 
From the IDE:
 
  * Set in Project / Compiler Options / Linking / Options (-k): -L/home/kjow/lazarus/fpc/libcross
 
 
 
8) Target llibs.
 
 
 
You need target libs to assemble and link binary file. You can find them into the SDK of your device or into the device itself.
 
E.g. for Nokia N900 I copied /lib/* and /usr/lib/* (no subdirs) and merged to ubuntu's ~/lazarus/fpc/libcross/ then I had to rename each library not found by linker (ld) to the file name searched by linker.
 
I mean, if you got this error:
 
  
 
  libX11.so not found (or incompatible)
 
  libX11.so not found (or incompatible)
  
and you have in /usr/lib/ a file called libX11.so.6.2.0 you need to rename it into libX11.so
+
and you have in /usr/lib/ a file called ''libX11.so.6.2.0'' you need to rename it into ''libX11.so''
  
  
A fully tutorial is available [http://forum.lazarus.freepascal.org/index.php/topic,8084.0.html HERE]. It starts from latest sources of Binutils, FPC and Lazarus.
 
  
By [[User:Kjow|Kjow]] 11:36, 16 December 2009 (CET)
+
[[User:Kjow|Kjow]] 18:50, 16 December 2009 (CET)
  
 
==iPhone==
 
==iPhone==

Revision as of 19:50, 16 December 2009

There is a multitude of Smartphone platforms available today, and in many of them it is possible to write Free Pascal and Lazarus software.

Smartphone Marketshares

Precise reports about Smartphone marketshares can be bought from Gartnet, but this information also comes up in scattered news. This section attempts to put some organization in those news to reconstruct a precise picture of the marketshare for those which cannot aford the full report from Gartnet. This information can be relevant when choosing for which operating system to develop and the potential market that they offer. The market can be very different in different parts of the world, but mostly information about US and Worldwide markets come in the news, but occasionally there is also information about regional markets.

Worldwide

Year Marketshares Sales Total Sales
2007 Symbian 64%, BlackBerry 10%, Windows 12%, Linux 10%, Mac 3% Symbian 78m, BlackBerry 12m, Windows 15m, Linux 12m, Mac 3m 122m
2008 Symbian 52%, BlackBerry 17%, Windows 12%, Linux 8%, Mac 8% Symbian 73m, BlackBerry 23m, Windows 17m, Linux 11m, Mac 11m 139m

Sources:

Year Marketshares Sales Total Sales
2007 Q2 Symbian 66%, BlackBerry 9%, Windows 12%, Linux 10%, Mac 1% Symbian 18m, BlackBerry 3m, Windows 3m, Linux 3m, Mac - 28m
2007 Q4 Symbian 62%, BlackBerry 11%, Windows 12%, Linux 7%, Mac 5% Symbian 23m, BlackBerry 4m, Windows 4m, Linux 3m, Mac 2m 37m
2008 Q1 Symbian 57%, BlackBerry 13%, Windows 12%, Linux 8%, Mac 5% Symbian 18m, BlackBerry 4m, Windows 4m, Linux 3m, Mac 2m 32m
2008 Q2 Symbian 57%, BlackBerry 17%, Windows 12%, Linux 7%, Mac 3% Symbian 18m, BlackBerry 6m, Windows 4m, Linux 2m, Mac 1m 32m
2008 Q3 Symbian 50%, BlackBerry 15%, Windows 11%, Linux ?, Mac 13% Symbian 19m, BlackBerry 6m, Windows 4m, Linux ?, Mac 5m 36m
2008 Q4 Symbian 47%, BlackBerry 20%, Windows 12%, Linux 6%, Mac 11% Symbian 18m, BlackBerry 7m, Windows 5m, Linux 3m, Mac 4m 38m
2009 Q1 Symbian 49%, BlackBerry 20%, Windows 12%, Linux 8%, Mac 11% Symbian 18m, BlackBerry 7m, Windows 5m, Linux 3m, Mac 4m 36m
2009 Q2 Symbian 50%, BlackBerry 20%, Windows 9%, Linux 3%, Mac 14%, Android 3% Symbian 20m, BlackBerry 8m, Windows 4m, Linux ?, Mac 5m 41m
2009 Q3 Symbian 45%, BlackBerry 19%, Windows 8%, Linux 5%, Mac 17%, Android 4% Symbian 19m, BlackBerry 8m, Windows 3m, Linux 2m, Mac 7m, Android 2m 43m

Sources:

By Region

Region Year Marketshares
Europe, Middle East, Africa 2007 Q3 Symbian 85%, BlackBerry 5%, Windows 5%, Linux 5%
Latin America 2007 Q3 Symbian 80%, BlackBerry 2%, Windows 8%, Linux 10%

Sources:


Windows CE

Windows CE is the name of an operating system which is used in Smartphones, PDAs, GPS devices, bar code scanners and other embedded devices. When run in a Smartphone the latest versions of the operating system have been branded as Windows Mobile, but it's the same operating system.

You can see information about writing Lazarus software for Windows CE devices in the following pages:

For information about using Free Pascal without Lazarus to developed WinCE applications read:

Maemo Linux

Tutorial

Maemo runs "pure" arm-linux applications, so you need to enable FPC to cross compile for arm-linux. It is reccomended to use latest FPC trunk (2.5.x at now).

See HERE for the tutorial.

Notes:

  • Nokia N900 accept eabi v5 code, so make sure to use option
-meabi=5

in assembler section of the tutorial

  • Target llibs.

For Nokia N900 you need to copy /lib/* and /usr/lib/* (no subdirs) and merged to ~/lazarus/fpc/libcross/ then you had to rename each library not found by linker (ld) to the file name searched by linker itself. I mean, if you got this error

libX11.so not found (or incompatible)

and you have in /usr/lib/ a file called libX11.so.6.2.0 you need to rename it into libX11.so


Kjow 18:50, 16 December 2009 (CET)

iPhone

For information about writing Free Pascal applications for the iPhone read:

Linux-based phones

For ARM-based phones you can read here: Linux for ARM

Palm OS

A initial FPC por has been started, more information here: PalmOS port

Symbian OS

A port based on Symbian UIQ 2 was started, but not finished: SymbianOS

Blackberry, Java-based phones

There are many phones which can run only Java software, including Blackberry and most of the cheap phones without a native interface. Also some other phones can also run Java applications out of the box, for example Symbian OS.

It's not possible to develop for java-based phones with Free Pascal at the moment, but you can use another compiler, MIDlet Pascal do to it. It has been recently made open source, and can be downloaded here:

http://sourceforge.net/projects/midletpascal/