Lazarus

Installation => PDAs and Smartphones => Topic started by: SambucusELF on February 14, 2007, 08:02:09 pm

Title: fpc and lazarus on (for) symbian
Post by: SambucusELF on February 14, 2007, 08:02:09 pm
a could really use a tiny IDE for Symbian cell phone if there was any...

Is anyone working on it?


 :?:
Title: RE: fpc and lazarus on (for) symbian
Post by: felipemdc on February 14, 2007, 08:27:50 pm
I´m working on it ... because a Bounty was posted: http://wiki.lazarus.freepascal.org/Bounties

My current guesses about how long it will take to get done is: 3 months to get into usable state, and 6 months to be stable.

Take into account that this work only covers creating a Free Pascal port for Symbian OS, so porting LCL isn´t included, and thus using the form designer.

To create forms and such, it will be necessary to call Symbian OS GUI APIs directly. But of course someone can add a LCL port latter.
Title: RE: fpc and lazarus on (for) symbian
Post by: felipemdc on February 14, 2007, 08:54:46 pm
One extra comment, I don´t know what you meant by "tiny IDE", but Lazarus is huge, and thus my idea is using it on a Desktop machine to cross-compile applications to either the emulator or the real devices. I don´t think lazarus would run on Smartphones, specially because it wouldn´t fit the screen.
Title: RE: fpc and lazarus on (for) symbian
Post by: SambucusELF on February 14, 2007, 09:25:43 pm
yes, I was somewhat undefined, I meant, that there should be a tiny ide for FPC on Symbian, something that would resemble Turbo Pascal IDE on DOS, ... Basic stuff like compile, link, run (maybe debug and breakpoint would be too much to ask) ... in one place...

Is there some alpha work I could try?
Title: Re: RE: fpc and lazarus on (for) symbian
Post by: felipemdc on February 15, 2007, 08:12:12 pm
Quote from: "SambucusELF"
Is there some alpha work I could try?


Yes and no. You can download latest Free Pascal from subversion, learn how to compile a cross-compiler to Symbian-i386, cross-compile the Run-time library, and finally compile some software for Symbian - i386 (emulator).

But, the software will give an error on the initialization and not run, because something is wrong with the initialization code I created so far.
Title: fpc and lazarus on (for) symbian
Post by: SambucusELF on February 16, 2007, 07:21:26 pm
I would like to try that. I have some experience in compiling stuff like linux kernel, programs, libraries, etc.

Maybe I could help in making a cross compiler.

P.S. I already have FPC, I just need to intall libraries for Symbian types and procedures I guess...

Can you get me some link for info on how to do that.

If I can mention, I am an amateur programmer since 1991 (when I was 7), so maybe I can be of some assistance - the golden rule of multiple people checking the code for mistakes that are obvious to them, but maybe not for someone else...

 :?:
Title: fpc and lazarus on (for) symbian
Post by: Vincent Snijders on February 16, 2007, 07:39:50 pm
I voted no. Lazarus should not run symbian, but should compile with symbian as target.
Title: fpc and lazarus on (for) symbian
Post by: SambucusELF on February 16, 2007, 07:44:42 pm
Yes, you are right, lazarus is too big, but fpc port with IDE such as Turbo Pascal would be great...
Title: fpc and lazarus on (for) symbian
Post by: felipemdc on February 17, 2007, 10:41:50 pm
Quote from: "SambucusELF"
P.S. I already have FPC, I just need to intall libraries for Symbian types and procedures I guess...


You will need to:

1 - Download latest subversion Free Pascal Source code

2 - Install stable Free Pascal 2.0.4 binaries

3 - Download and install Symbian UIQ 3 SDk. That´s the current target ... others will follow on the future.

4 - Use fpc 2.0.4 to create a cross-compiler with fpc 2.1.1 source code. The command is:

cd fpc21\compiler
make i386

5 - Use the cross-compiler to compile symbian rtl

cd fpc21\rtl\symbian
make PPC=C:\fpc21\compiler\ppci386.exe <not sure about this command>

You need to be in Windows for all of this, because Symbian OS SDK only works on Windows.
Title: fpc and lazarus on (for) symbian
Post by: felipemdc on February 17, 2007, 10:47:26 pm
Quote from: "SambucusELF"
Yes, you are right, lazarus is too big, but fpc port with IDE such as Turbo Pascal would be great...


Free Pascal comes with a IDE which is almost exactly like Turbo Pascal IDE.

However, it´s a complex task to get free pascal running inside symbian os, which dependens on things like the availability of binutils for the platform.

symbian SDK only provides (incomplete) binutils for win32-symbian. They don´t provide binutils for symbian-symbian, althougth it´s obviously possible to roll your own.
Title: fpc and lazarus on (for) symbian
Post by: SambucusELF on March 05, 2007, 03:06:19 pm
ok, thanks, I just downloaded Carbide.C++ Nokia Symbian SDK, I'll try to make something of my own.

I'll inform you if I made some progress.

Thanks for the info.

SambucusELF
Title: fpc and lazarus on (for) symbian
Post by: SambucusELF on March 05, 2007, 03:10:57 pm
Quote from: "sekel"
Quote from: "SambucusELF"
P.S. I already have FPC, I just need to intall libraries for Symbian types and procedures I guess...


You will need to:

1 - Download latest subversion Free Pascal Source code

2 - Install stable Free Pascal 2.0.4 binaries

3 - Download and install Symbian UIQ 3 SDk. That´s the current target ... others will follow on the future.

4 - Use fpc 2.0.4 to create a cross-compiler with fpc 2.1.1 source code. The command is:

cd fpc21\compiler
make i386

5 - Use the cross-compiler to compile symbian rtl

cd fpc21\rtl\symbian
make PPC=C:\fpc21\compiler\ppci386.exe <not sure about this command>

You need to be in Windows for all of this, because Symbian OS SDK only works on Windows.


Obviously, I wasn't reading carefully enough. I will try to get UIQ SDK when I get my broadband back.

c u l8r
Title: fpc and lazarus on (for) symbian
Post by: SambucusELF on April 09, 2007, 01:07:17 pm
sorry for opening an old topic,... but, hence you said there should be some progress on fpc for symbian I wanted to ask is there any change on the procedure of building fpc for UIQ before I start downloading.

Thanks, SambucusELF
Title: fpc and lazarus on (for) symbian
Post by: felipemdc on April 09, 2007, 03:31:44 pm
No, there were no changes.

2 months ago I said it would probably take 3 months before it get's usable, so I'm inside my estimative =)

It doesn't really work currently. I posted a question of fpc mailling list, but noone could answer it, so I have a strange problem that I can't solve. I will rewrite my question here. If you manage to find a solution for this, the development of symbian os port will be greatly accelerated =)

From: Felipe Monteiro de Carvalho    
to: FPC mailling list
   
show details
    Mar 24
Hello,

I am having some trouble with the symbian os port. Basically I am
working with the emulator so far, so consider as if I were writing a
normal (or almost) win32 application.

Basically windows will refuse running the application with a message
saying it´s not a valid win32 application.

To test further, I created a trivial win32 asm app, assembled it with
gas and linked it. Here is the file:

    .file   "prt0.as"
    .text
    /* Entry point for Symbian OS executables */
    .globl E32EXE
E32EXE:
    /* Entry point for MS Windows */
    .globl main
main:
    leave
    ret

And here is how I assemble and link it:

C:\Programas\lazarus20\fpc\2.0.4\bin\i386-win32\as.exe prt0.as -o prt0.o
C:\Programas\lazarus20\fpc\2.0.4\bin\i386-win32\ld.exe --entry=E32EXE
-o prt0.exe prt0.o

This works fine (ok, the app doesn´t do anything, but also I don´t see
any error messages). by the way, prt0 is just a random name ... don´t
think it has anything to do with the prt0 asm files on fpc

Next I tryed to simply compile the same app, but adding the symbian RTL also:

C:\Programas\lazarus20\fpc\2.0.4\bin\i386-win32\ld.exe --entry=E32EXE
-o prt0.exe prt0.o C:\Programas\fpc21\rtl\units\i386-symbian\system.o
qhelloworld.o

This won´t work. The executable is linked fine, but the app won´t run.
I´m puzzled, because there is absolutely no reference from prt0.o to
system.o or qhelloworld.o, so in fact, only prt0 should be used. Just
by linking together the other .o files makes the .exe problematic.

Any ideas why? system.o is assembled with gnu asm too. I added
qhelloworld.o only because linking system.o alone won´t work, as it
complains about missing things.

And there are no main or E32EXE functions on either system.o or qhelloworld.o

This problem is important because it also occurs when I link a
complete symbian app.

thanks,
--
Felipe Monteiro de Carvalho
Title: fpc and lazarus on (for) symbian
Post by: Lord_ZealoN on April 09, 2007, 04:07:59 pm
Quote from: "Vincent"
I voted no. Lazarus should not run symbian, but should compile with symbian as target.


Well, I voted yes, and only would like Symbian as target.
Title: fpc and lazarus on (for) symbian
Post by: SambucusELF on April 11, 2007, 12:12:53 pm
Try looking at this link (you probably already know about it, ...) but you need to run PETRAN on your runtime executable to convert it to symbian executable file format from PE format. this way you'll make and application intended to run on a device, not on the emulator ... but it might just work (odd things happen :P )


http://newlc.com/article.php3?id_article=492

read the article first if you haven't
Title: fpc and lazarus on (for) symbian
Post by: SambucusELF on April 11, 2007, 11:05:34 pm
Quote from: "sekel"
Quote from: "SambucusELF"
P.S. I already have FPC, I just need to intall libraries for Symbian types and procedures I guess...


You will need to:

1 - Download latest subversion Free Pascal Source code

2 - Install stable Free Pascal 2.0.4 binaries

3 - Download and install Symbian UIQ 3 SDk. That´s the current target ... others will follow on the future.

4 - Use fpc 2.0.4 to create a cross-compiler with fpc 2.1.1 source code. The command is:

cd fpc21\compiler
make i386

5 - Use the cross-compiler to compile symbian rtl

cd fpc21\rtl\symbian
make PPC=C:\fpc21\compiler\ppci386.exe <not sure about this command>

You need to be in Windows for all of this, because Symbian OS SDK only works on Windows.


This is how far I got...

I svn-ed the newest source of fpc...
used the stable to create the cross compiler
replaced the ppci386.exe with the newly compiler one (saved the old one) and tried to do the make on it (before I replaced it with new one it complained for not knowing what -Tsymbian is and it doesn't anymore, so I'm guessing it's ok . )

when I enter rtl/symbian and do make it complains for not having i386-symbian-as.exe (the assembler for symbian) ... and I'm stuck there ... what should I do?

P.S. I skipped the step of getting Symbian UIQ 3 SDK before getting this all done...

SambucusELF

my make output is this:
C:\fpc21\rtl\symbian>c:\lazarus\fpc\2.0.4\bin\i386-win32\make.exe
c:/lazarus/fpc/2.0.4/bin/i386-win32/ppc386.exe -Tsymbian -XPi386-symbian- -Xc -X
r -Fi../inc -Fi../i386 -FE. -FU../../rtl/units/i386-symbian -di386  -Us -Sg syst
em.pp
Free Pascal Compiler version 2.3.1 [2007/04/11] for i386
Copyright (c) 1993-2007 by Florian Klaempfl
Target OS: Symbian OS for i386
Compiling system.pp
math.inc(161,23) Warning: Use of -offset(%ebp) is not recommended for local vari
able access
math.inc(163,23) Warning: Use of -offset(%ebp) is not recommended for local vari
able access
math.inc(165,25) Warning: Use of -offset(%ebp) is not recommended for local vari
able access
math.inc(166,22) Warning: Use of -offset(%ebp) is not recommended for local vari
able access
math.inc(172,22) Warning: Use of -offset(%ebp) is not recommended for local vari
able access
math.inc(180,23) Warning: Use of -offset(%ebp) is not recommended for local vari
able access
math.inc(182,23) Warning: Use of -offset(%ebp) is not recommended for local vari
able access
math.inc(184,25) Warning: Use of -offset(%ebp) is not recommended for local vari
able access
math.inc(185,22) Warning: Use of -offset(%ebp) is not recommended for local vari
able access
math.inc(190,22) Warning: Use of -offset(%ebp) is not recommended for local vari
able access
sstrings.inc(409,5) Note: Local variable "e" not used
astrings.inc(253,3) Note: Local variable "destcopy" is assigned but never used
variant.inc(768,25) Warning: Automatic type conversion from floating type to COM
P which is an integer type
setjump.inc(24,16) Warning: Use of +offset(%ebp) for parameters invalid here
setjump.inc(30,2) Warning: Use of +offset(%ebp) for parameters invalid here
sysheap.inc(21,10) Warning: Function result does not seem to be set
sysfile.inc(20,10) Warning: Function result does not seem to be set
sysfile.inc(46,10) Warning: Function result does not seem to be set
sysfile.inc(52,10) Warning: Function result does not seem to be set
sysfile.inc(58,10) Warning: Function result does not seem to be set
sysfile.inc(70,10) Warning: Function result does not seem to be set
sysfile.inc(76,10) Warning: Function result does not seem to be set
text.inc(720,5) Note: Local variable "e" not used
system.pp(123,10) Warning: Function result does not seem to be set
system.pp(171,10) Warning: Function result does not seem to be set
system.pp(173,3) Note: Local variable "ST" not used
system.inc(46,3) Note: Local variable "initialstklen" not used
i386.inc(23,3) Note: Local variable "sse_check" is assigned but never used
genmath.inc(77,7) Note: Local variable "sincof" not used
genmath.inc(84,7) Note: Local variable "coscof" not used
system.pp(121,3) Note: Local variable "ModuleName" not used
system.pp(169,3) Note: Local variable "_SS" not used
system.pp(191,3) Warning: Variable "ProcessID" read but nowhere assigned
Assembling system
system.pp(211) Error: Assembler i386-symbian-as.exe not found, switching to exte
rnal assembling
system.pp(211) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
c:\lazarus\fpc\2.0.4\bin\i386-win32\make.exe: *** [system.ppu] Error 1
C:\fpc21\rtl\symbian>
Title: fpc and lazarus on (for) symbian
Post by: SambucusELF on April 12, 2007, 12:36:31 am
OK, something bothers me here ? why is this one looking for symbian native assembler ?

should arm assembler be enough? if I would use emulator -as you said, ... why isn't it including the native PE assembler ?

to sekel:

one thing about emulators ...

i don't know if you know about MIDlet Pascal...

If you have Sun Java Wireless toolkit that DOES have an emulator and produce .jad and .jar files with midlet pascal - trying to run those .jad files from windows shell by calling automaticaly the emulator will return an error,... if you do it FROM midlet pascal it runs great !

maybe, you need to pass some parameters to emulator in order to run the application...
also,... have you tried wrapping your executable in .sis file (in emulator format) and then running it...

you mentioned on the mailing list that you have some extra stuff in you rtl/symbian dir... is it on the latest svn or you could send it to me...

I'll give you my mail address in a private message.
Title: fpc and lazarus on (for) symbian
Post by: felipemdc on April 12, 2007, 12:18:58 pm
Quote from: "SambucusELF"
OK, something bothers me here ? why is this one looking for symbian native assembler ?


Because you are cross-compiling from i386-win32 to i386-symbian (emulator)

Quote
should arm assembler be enough?


It´s not enougth and it also doesn´t work on the emulator.

Quote
if I would use emulator -as you said, ... why isn't it including the native PE assembler ?


Yes, but that is just a coincidence. The emulator could use something that is not win32-pe. So Just rename the standard as.exe ld.exe and other binutils that come with fpc 2.0.4



i don't know if you know about MIDlet Pascal...



Quote
maybe, you need to pass some parameters to emulator in order to run the application...


No, I am registering the applications directly on the emulator, using the same method I used for c++ apps, and it worked.

Plus, the app should theoriticaly run on windows as well.

I think I hit a bug on the linker. But could be something I don´t know yet, also.

Quote
also,... have you tried wrapping your executable in .sis file (in emulator format) and then running it...


I don´t remember those .sis files ... are you using the uiq 3 sdk? Maybe they are from another sdk

Quote
you mentioned on the mailing list that you have some extra stuff in you rtl/symbian dir... is it on the latest svn or you could send it to me...


No, it´s everything comitted

Quote
I'll give you my mail address in a private message.


It´s better if others latter can see this messages
Title: fpc and lazarus on (for) symbian
Post by: SambucusELF on April 12, 2007, 01:38:33 pm
let's begin from the bottom,... I do want others to see the messages...

the point of giving you my eMail was that you could send me some updates of files...
but I realised there's no need for that...

.sis files are Symbian Installer System files... they are something like .deb or .rpm packages for symbian...
(with no advanced dependency support that I know for, perhaps they are more like .msi files on windows)

Quote

Yes, but that is just a coincidence. The emulator could use something that is not win32-pe. So Just rename the standard as.exe ld.exe and other binutils that come with fpc 2.0.4


what do I get from renaming those bins ? are they the original i386 binaries? if they are, and the emulator is not using native PE how do I assemble and link them correctly? if my assumption of emulator not using the native PE set fully, it's logical that it wouldn't work.

stuff you made in c++ and ran in the emulator,...  are they PE or ARM  or ???
Title: fpc and lazarus on (for) symbian
Post by: SambucusELF on April 12, 2007, 01:42:00 pm
I am currently downloading gnu arm toolkit,... is there any point of adapting the gnu  assembler for symbian executable format with PE instructions and alternatively for arm instruction set ? perhaps this should be done with linker not the assembler...
Title: fpc and lazarus on (for) symbian
Post by: felipemdc on April 12, 2007, 03:26:10 pm
Quote
if they are, and the emulator is not using native PE how do I assemble and link them correctly?


The whole point is that the emulator does use standard win32-pe.
Title: fpc and lazarus on (for) symbian
Post by: felipemdc on April 12, 2007, 03:28:32 pm
Quote from: "SambucusELF"
I am currently downloading gnu arm toolkit,... is there any point of adapting the gnu  assembler for symbian executable format with PE instructions and alternatively for arm instruction set ? perhaps this should be done with linker not the assembler...


o.O Did you just propose porting the gnu assembler?

We already have all the binutils we need, which are:

* For the real device use the gnu binutils that come with the SDK

* For the emulator we have gnu assembler and codewarrior linker
Title: fpc and lazarus on (for) symbian
Post by: SambucusELF on April 12, 2007, 06:53:29 pm
Quote

We already have all the binutils we need, which are:

* For the real device use the gnu binutils that come with the SDK

* For the emulator we have gnu assembler and codewarrior linker


ok,... so that's what we need ...

of course I didn't mean to port the whole gnu assembler, I thought that it is possible to make an assembler compliant with gnu makefile commands and object files in order to make a successful linking... anyway that's not needed,... so I should try linking runtime libraries with some example code...

I compiled the runtime libraries with a 'small' help from standard as.exe ...
I'll continue to work, but I might orient myself to making this compatible with Nokia series 60,... as I saw in the bounty - it is desireable, so if I make a contribution to your work with Series 60 compatibility would you consider me joining you with the bounty ?

I'm still not an expert, but I want to learn and to make use of great things trying to improve them if I can...
Title: fpc and lazarus on (for) symbian
Post by: felipemdc on April 12, 2007, 10:16:50 pm
Quote from: "SambucusELF"
I'll continue to work, but I might orient myself to making this compatible with Nokia series 60,... as I saw in the bounty - it is desireable, so if I make a contribution to your work with Series 60 compatibility would you consider me joining you with the bounty ?


No. What is written on the bounty is that it´s 1000 only for UIQ, but it can be raised if S60/80/90 are supported. So one would have to talk to the person that posted the bounty and see how much would be worth the S60/80/90 addition.

Plus, one needs to consider several aspects of the port. I´ve already done quite a lot of the uiq port. Perhaps not in rtl code, but in other necessary tasks which take quite a lot of time. For you to have a better understanding of the work involved, here are the steps I did:

* Reverse engineering on the UIQ SDK build system. I had to go througth around 10.000 lines of perl code to understand what the sdk does to build uiq apps, and then I extracted that information and built my own building system on pascal capable of, for example, registering a app on the emulator.

* Add symbian target to the compiler

* Build the rtl skeleton and remake the makefiles

* Found out how to all the binutils involved work together (those are gnu binutils, fpc internal assembler and linker and all the codewarrior linker). That was quite hard, because of the bad documentation and incompatibilities between different asm/linker combinations which could only be found by trial and error

* Wrote a simple assembler application for the emulator manually

The next steps are:

* Finish making a trivial fpc app work on the emulator

* Write the rest of the RTL

* Write a c wrapper around the c++ libs of symbian os

* Make sure the app also runs on the real device
Title: fpc and lazarus on (for) symbian
Post by: SambucusELF on April 13, 2007, 09:54:49 am
since I will be busy doing some other work these days, when you finally finish working on it I would like to try the code you made,... in the mean time,... I'll try to make something of it for my personal use...
Title: fpc and lazarus on (for) symbian
Post by: SambucusELF on April 15, 2007, 11:32:09 pm
is there any new progress ?
Title: fpc and lazarus on (for) symbian
Post by: felipemdc on April 16, 2007, 08:38:04 am
I will post an announcement when it´s usable.

In the last 3 days there was progress naturally, but nothing for a user. If you want to know the details, check the fpc-devel mailling list.
Title: fpc and lazarus on (for) symbian
Post by: SambucusELF on April 16, 2007, 06:58:42 pm
I saw on the mailing list that you made some progress with the assembly and linking. Great.
Title: fpc and lazarus on (for) symbian
Post by: felipemdc on April 23, 2007, 09:34:26 am
I reorganized the wiki page about symbian os. Now there is a full guide to make a symbian os application:

http://wiki.lazarus.freepascal.org/SymbianOS

At the moment the only thing you can do is show a message box on the screen, but hey! It´s a start =)

It should also help anyone that want to help with development.
Title: fpc and lazarus on (for) symbian
Post by: SambucusELF on May 10, 2007, 09:42:37 pm
great!

In the meanwhile, I have been working with Nokia Series 60 SDK in C++ and developed some basic examples,... ( I'm still trying to better understand Symbian),... still, I can already say, that there are some great things about it ! :D

Greetings from SambucusELF
Title: fpc and lazarus on (for) symbian
Post by: Shorty on January 26, 2008, 05:38:04 pm
Hello!

I searched the forum for symbian-developing with freepascal and found out, that sekel is working on a port, but the last post was in october 2007. So I wanted to ask, how far this project have got in the last few months? And will I be able to develop for my Nokia 9300 with Symbian OS 7.0, when the port is done?

Shorty
Title: fpc and lazarus on (for) symbian
Post by: felipemdc on January 28, 2008, 07:26:56 am
It's all explained here:

http://wiki.lazarus.freepascal.org/SymbianOS

I got some hello world level applications working for UIQ 3, and now I'm focusing on UIQ 2, althougth I got out of time in the last months.

About developing for Nokia 9300. I took a quick look and it's a Series 80 phone, so the answer is no. Even after I finish this port, you won't be able to develop for it, because I'm targeting UIQ 2 phones. (blame Symbian for developing various incompatible SDKs and libraries for the same operating system)
Title: fpc and lazarus on (for) symbian
Post by: Shorty on January 29, 2008, 07:01:21 pm
Ah, ok, didn't knew what this Series 60/80 meant... So I will have to learn C++ :wink: But thanks for answering the question anyway!