Recent

Poll

Should there be an Pascal/Lazarus IDE for Symbian?

Yes
10 (90.9%)
No
1 (9.1%)

Total Members Voted: 10

Voting closed: February 14, 2007, 08:02:09 pm

Author Topic: fpc and lazarus on (for) symbian  (Read 34325 times)

SambucusELF

  • New Member
  • *
  • Posts: 25
fpc and lazarus on (for) symbian
« Reply #15 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

SambucusELF

  • New Member
  • *
  • Posts: 25
fpc and lazarus on (for) symbian
« Reply #16 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>

SambucusELF

  • New Member
  • *
  • Posts: 25
fpc and lazarus on (for) symbian
« Reply #17 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.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
fpc and lazarus on (for) symbian
« Reply #18 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

SambucusELF

  • New Member
  • *
  • Posts: 25
fpc and lazarus on (for) symbian
« Reply #19 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 ???

SambucusELF

  • New Member
  • *
  • Posts: 25
fpc and lazarus on (for) symbian
« Reply #20 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...

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
fpc and lazarus on (for) symbian
« Reply #21 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.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
fpc and lazarus on (for) symbian
« Reply #22 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

SambucusELF

  • New Member
  • *
  • Posts: 25
fpc and lazarus on (for) symbian
« Reply #23 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...

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
fpc and lazarus on (for) symbian
« Reply #24 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

SambucusELF

  • New Member
  • *
  • Posts: 25
fpc and lazarus on (for) symbian
« Reply #25 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...

SambucusELF

  • New Member
  • *
  • Posts: 25
fpc and lazarus on (for) symbian
« Reply #26 on: April 15, 2007, 11:32:09 pm »
is there any new progress ?

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
fpc and lazarus on (for) symbian
« Reply #27 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.

SambucusELF

  • New Member
  • *
  • Posts: 25
fpc and lazarus on (for) symbian
« Reply #28 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.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
fpc and lazarus on (for) symbian
« Reply #29 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.

 

TinyPortal © 2005-2018