Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2001-09

Building the PalmOS cross compiler...

15 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Julia A. Case

I'd like to build the PalmOS cross compiler under linux, but I'll be if I can figure out how to do it. I tried setting the enviornment variables CPU_TARGET and OS_TARGET but that didn't help...

The cygwin compiler runs under wine but the assembler seems to hang for ever... So, I would like a native linux version of these tools.

Thanks,
Julia

[ Julia Anne Case ] [ Ships are safe inside the harbor, ] [Programmer at large] [ but is that what ships are really for. ] [ Admining Linux ] [ To thine own self be true. ] [ Windows/WindowsNT ] [ Fair is where you take your cows to be judged. ]

Reply by email

Florian Klaempfl
to Julia A. Case
you wrote
I'd like to build the PalmOS cross compiler under linux, but I'll be if I can figure out how to do it. I tried setting the enviornment variables CPU_TARGET and OS_TARGET but that didn't help...

Did you try a
make CPU_TARGET=m68k
in the compiler directory?
What errors did you get?

Reply by email

Jonas Maebe
to Julia A. Case: I'd like to build the PalmOS cross compiler under linux, but I'll be if I can figure out…
Julia A. Case wrote
I'd like to build the PalmOS cross compiler under linux, but I'll be if I can figure out how to do it. I tried setting the enviornment variables CPU_TARGET and OS_TARGET but that didn't help...

You have to make sure you have a cross-assembler and cross-linker. Once you've compiled (or downloaded) those, put them in some directory and pass that directory to the compiler using the -FD option. I think it's also the easiest to pass te CPU_TARGET and OS_TARGET environment vars directly to make. So supppose you created a cross-assembler and cross-linker which you put in ~/palmutils, first use

make CPU_TARGET=m68k OS_TARGET=palmos

in the compiler dir. This will create a cross-compiler for palmos.

Next, move the resulting compiler (ppc68k) somewhere else (e.g. to ~/palmutils) and compile the RTL by going to the RTL dir and typing

make OPT="-FD~/palmutils" FPC="~/palmutils/ppc68k"

Finally, when you want to cross-compile something use

ppc68k -FD~/palmutils file.pas

You can also put a

#ifdef m68k
-FD~/palmutils
#endif

in your ~/.ppc386.cfg so that you don't have to add the -FD parameter every time by hand.

Jonas

Reply by email

Julia A. Case
to Jonas Maebe

Quoting Jonas Maebe ():

make CPU_TARGET=m68k OS_TARGET=palmos in the compiler dir. This will create a cross-compiler for palmos.

I get this when I try that...

ppc386 -dGDB -dBROWSERLOG -Tpalmos -Fum68k -Futargets -Fim68k -FE. -dm68k pp.pas
Error: Illegal parameter: -Tpalmos

Julia

[ Julia Anne Case ] [ Ships are safe inside the harbor, ] [Programmer at large] [ but is that what ships are really for. ] [ Admining Linux ] [ To thine own self be true. ] [ Windows/WindowsNT ] [ Fair is where you take your cows to be judged. ]

Reply by email

Jonas Maebe
to Julia A. Case
Julia A. Case wrote 10 lines
> make CPU_TARGET=m68k OS_TARGET=palmos > > in the compiler dir. This will create a cross-compiler for palmos. > I get this when I try that... ppc386 -dGDB -dBROWSERLOG -Tpalmos -Fum68k -Futargets -Fim68k -FE. -dm68k pp.pas Error: Illegal parameter: -Tpalmos

Ok, leave out the "OS_TARGET=palmos" then while compiling the compiler (you'll still have to use it when compiling the rtl). The reason that this doesn't work is that 1.0.4 didn't have palmos support yet.

Jonas

Reply by email

Julia A. Case
to Jonas Maebe

Quoting Jonas Maebe ():

Ok, leave out the "OS_TARGET=palmos" then while compiling the compiler (you'll still have to use it when compiling the rtl). The reason that this doesn't work is that 1.0.4 didn't have palmos support yet.

Ok, not to sound naieve (I've built many cross compilers with gcc) but now it fails when it tries to compile the rtl (which it seems want to do immediately when I start the compiler compile) and it fails to find the includes (both in rtl/unix and rtl/inc) how to do I add these directories to the include path?

Julia

[ Julia Anne Case ] [ Ships are safe inside the harbor, ] [Programmer at large] [ but is that what ships are really for. ] [ Admining Linux ] [ To thine own self be true. ] [ Windows/WindowsNT ] [ Fair is where you take your cows to be judged. ]

Reply by email

Jonas Maebe
to Julia A. Case
Julia A. Case wrote 5 lines
Ok, not to sound naieve (I've built many cross compilers with gcc) but now it fails when it tries to compile the rtl (which it seems want to do immediately when I start the compiler compile) and it fails to find the includes (both in rtl/unix and rtl/inc) how to do I add these directories to the include path?

The reason it wants to recompile the rtl is that the 1.0.5 rtl directory is automatically added to the source search path if you type "make" in the compiler dir and the data/time of those source files is different from the dates/times stored in the ppu files of your 1.0.4 rtl. C compilers don't use ppu files (a binary file in which the interface of a unit is stored), except if you tell them to use "precompiled headers" and the C library often isn't tied to the compiler, which is why you never encounter that there.

So, you first hae to "cycle" the 1.0.5 compiler by typing "make cycle" in the 1.0.5 compiler dir. This will compile the new rtl, then the compiler, then the new rtl again with the compiler created in the previous pass etc until two successively generated compilers are exact binary matches. You'll end up with a ppc386 file in your compiler dir. Move this one somewhere else and give it another name (such as ppc105).

After you've done that, you can start the procedure I outlined before, but you'll have to add FPC=ppc105 (or FPC=path_to_ppc105/ppc105 if it isn't in the path) in the first step (the one where you create the ppc68k binary). You may want to clean the compiler dir first, though, so use

make FPC=ppc105 CPU_TARGET=m68k clean all

(and with the resulting compiler, compile the palm os rtl)

Jonas

Reply by email

Peter Vreman
Show quoted text 14 lines
>> make CPU_TARGET=m68k OS_TARGET=palmos >> >> in the compiler dir. This will create a cross-compiler for palmos. >> > > I get this when I try that... > > ppc386 -dGDB -dBROWSERLOG -Tpalmos -Fum68k -Futargets -Fim68k -FE. > -dm68k pp.pas > Error: Illegal parameter: -Tpalmos Ok, leave out the "OS_TARGET=palmos" then while compiling the compiler (you'll still have to use it when compiling the rtl). The reason that this doesn't work is that 1.0.4 didn't have palmos support yet.

The makefiles are not yet good to build a cross compiler easily. For example in the compiler/Makefile.fpc the usage of CPU_TARGET is used for selecting the supported cpu of the target compiler instead of the processor type that the executable needs to run on.

To create a cross compiler you now need to run "make CPU_TARGET=m68k" in the compiler directory. This will give you a ppc68k.exe that can create m68k code and supports the m68k targets. You can then use this ppc68k.exe to compile the palmos rtl using "make FPC=<path to>/ppc68k.exe" in the rtl/palmos directory

Reply by email

Julia A. Case
to Jonas Maebe: The reason it wants to recompile the rtl is that the 1.0.5 rtl directory is automatically…

Quoting Jonas Maebe ():

(and with the resulting compiler, compile the palm os rtl)

Ok, now I'm making progress, I got the new compiler built... and I started to build the m68k cross compiler... but it can't find the CPUINFO unit, I looked in the m68k directory but there is no cpuinfo.pas file like the other arch's... Was this file left out of the distribution? Should I get a newer copy of the CVS source?

Thanks much for your help,
Julia

[ Julia Anne Case ] [ Ships are safe inside the harbor, ] [Programmer at large] [ but is that what ships are really for. ] [ Admining Linux ] [ To thine own self be true. ] [ Windows/WindowsNT ] [ Fair is where you take your cows to be judged. ]

Reply by email

Jonas Maebe
to Julia A. Case
Julia A. Case wrote 8 lines
> (and with the resulting compiler, compile the palm os rtl) > Ok, now I'm making progress, I got the new compiler built... and I started to build the m68k cross compiler... but it can't find the CPUINFO unit, I looked in the m68k directory but there is no cpuinfo.pas file like the other arch's... Was this file left out of the distribution? Should I get a newer copy of the CVS source?

Yes, because I have that file here.

Jonas

Reply by email

Julia A. Case
to Jonas Maebe

Quoting Jonas Maebe ():

Yes, because I have that file here.

Can you send me the file, I just checkout the source again (and even did a full cvs update just to make sure) and that file is not included...

compiler/m68k/cpuinfo.pas

Thanks,
Julia

[ Julia Anne Case ] [ Ships are safe inside the harbor, ] [Programmer at large] [ but is that what ships are really for. ] [ Admining Linux ] [ To thine own self be true. ] [ Windows/WindowsNT ] [ Fair is where you take your cows to be judged. ]

Reply by email

Jonas Maebe
to Julia A. Case
Julia A. Case wrote 7 lines
> Yes, because I have that file here. > Can you send me the file, I just checkout the source again (and even did a full cvs update just to make sure) and that file is not included... compiler/m68k/cpuinfo.pas

Hmm, that means you checked out the main branch (version 1.1) instead of the fixes branch (version 1.0.5) :/ Do a

cvs -z3 co -rFIXES_1_0_0 compiler rtl

that will get you the branch with the working m68k compiler (the 1.1 version doesn't work with m68k currently)

Jonas

Reply by email

Julia A. Case
to Jonas Maebe

Quoting Jonas Maebe ():

Show quoted text 8 lines
Hmm, that means you checked out the main branch (version 1.1) instead of the fixes branch (version 1.0.5) :/ Do a cvs -z3 co -rFIXES_1_0_0 compiler rtl that will get you the branch with the working m68k compiler (the 1.1 version doesn't work with m68k currently)

Ok, almost there. I got the compiler built, and during the build of the rtl I found a typo in the palm.pp file, on line 682 there is an extra ; near the end of the line after the Integer declaration. Ok, the rtl is built and I am trying to build the demo app from the 1.1 demo files... the file compiles fine, but during link it tries to create a link.res file, but this referenced as @link.res in the script. Fixed that, but the format of the link.res seems wrong...

file format not recognized; treating as
linker parse error

I'm not really sure what the format of this file should be. Anywhere I can get some documentation on it?

After I get this working I will type up a howto for you folks so someone else doesn't have to go through all this :-) If I'm adventerous I may even put together a rpm for the linux people.

Julia

[ Julia Anne Case ] [ Ships are safe inside the harbor, ] [Programmer at large] [ but is that what ships are really for. ] [ Admining Linux ] [ To thine own self be true. ] [ Windows/WindowsNT ] [ Fair is where you take your cows to be judged. ]

Reply by email

Julia A. Case
to Julia A. Case

Quoting Julia A. Case ():

file format not recognized; treating as linker parse error

The fix for this problem is simple, just remove the @ on line 213 of the file t_palmos.pas

Julie

[ Julia Anne Case ] [ Ships are safe inside the harbor, ] [Programmer at large] [ but is that what ships are really for. ] [ Admining Linux ] [ To thine own self be true. ] [ Windows/WindowsNT ] [ Fair is where you take your cows to be judged. ]

Reply by email

Julia A. Case
to Julia A. Case

An update, I've gotten the compiler to compile and then link and even build a .prc file (the resulting .prc file crashes the emulator, but it's a start)... There are some errors about a NULL pointer being passed to the MemoryMgr... I'm going to investigate those. Writing compilers isn't my specialty, but I think I may be able to help. I'll keep you all informed.

Julia

[ Julia Anne Case ] [ Ships are safe inside the harbor, ] [Programmer at large] [ but is that what ships are really for. ] [ Admining Linux ] [ To thine own self be true. ] [ Windows/WindowsNT ] [ Fair is where you take your cows to be judged. ]

Reply by email