Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Caml-list] PowerPC 405

8 views
Skip to first unread message

Gregory Bellier

unread,
Mar 27, 2009, 11:05:05 AM3/27/09
to caml...@yquem.inria.fr
Hi everybody.

Do you know if it is possible to compile caml code on a PowerPC 405 from the
Vertex 4 family ?
We'd like to put this processor in a FPGA.
On the Caml's website, it is written "PowerPC" but is it only for Macintosch
?

Thank you for your time.
Gregory BELLIER.

Basile STARYNKEVITCH

unread,
Mar 27, 2009, 11:10:25 AM3/27/09
to Gregory Bellier, caml...@yquem.inria.fr
Gregory Bellier wrote:
> Hi everybody.
>
> Do you know if it is possible to compile caml code on a PowerPC 405
> from the Vertex 4 family ?
> We'd like to put this processor in a FPGA.
> On the Caml's website, it is written "PowerPC" but is it only for
> Macintosch ?

That is probably not so hard if your processor runs some Linux kernel,
or if you want to run only ocaml bytecode (not native).

The point is in what kind of runtime environment will your Ocaml run?

Also, what is your development toolchain? Are executables in ELF format? ...

What is your knowledge of Ocaml internals (notably the stdlib, the
runtime C API)?

Do you have a usual C lib?

Regards.

--
Basile STARYNKEVITCH http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Gregory Bellier

unread,
Mar 27, 2009, 11:56:55 AM3/27/09
to Basile STARYNKEVITCH, caml...@yquem.inria.fr
Hello Basile, thank you for your reply.

Yes, it will run Linux. It will have the uclibC or even the lib C.
The best case is to run native code for better performance. We'd like to
cross-compile for the PowerPC.

I'm not a FPGA expert, I'm asking questions for a colleague who works on it.

>From what you're saying, it should work properly because of the non-exotic
environment thanks to Linux. Am I correct ?

Regards.


2009/3/27 Basile STARYNKEVITCH <bas...@starynkevitch.net>

Basile STARYNKEVITCH

unread,
Mar 27, 2009, 12:05:09 PM3/27/09
to Gregory Bellier, Caml Mailing List
Gregory Bellier wrote:
> Hello Basile, thank you for your reply.
>
> Yes, it will run Linux. It will have the uclibC or even the lib C.
> The best case is to run native code for better performance. We'd like
> to cross-compile for the PowerPC.
>
> I'm not a FPGA expert, I'm asking questions for a colleague who works
> on it.
>
> From what you're saying, it should work properly because of the
> non-exotic environment thanks to Linux. Am I correct ?


Probably yes. A few years ago, I had a Powerbook G4 with a 32 bits
PowerPC running Linux, and Ocaml did compile and run fine, even in
native mode. Of course, I understand that your ocaml code runs inside an
application in linux user mode (not inside the kernel!).

I would expect you might have minor issues in configuration or
whatsover. I suppose you have enough RAM (and I have no idea what that
means exactly on your system).

Please publish the patches you'll need to implement your solution.

But I never tried all that, so take all my saying with a big grain of salt.

BTW, I'm curious: what kind of embedded application do you want to code
in Ocaml for what sort of device or system?


Regards

--
Basile STARYNKEVITCH http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***

_______________________________________________

Xavier Leroy

unread,
Mar 27, 2009, 1:20:11 PM3/27/09
to Gregory Bellier, caml...@yquem.inria.fr
Just to complement Basile's excellent answers:

> Do you know if it is possible to compile caml code on a PowerPC 405
> from the Vertex 4 family ?
> We'd like to put this processor in a FPGA. On the Caml's website,
> it is written "PowerPC" but is it only for Macintosch ?

Not just Macintosh: PowerPC/Linux is also supported and works very
well.

> Yes, it will run Linux. It will have the uclibC or even the lib C.

Then you're in good shape. I would expect a basic OCaml system to
work with uclibC, although a number of external libraries might not.
With GNU libC, everything will work but watch out for code size:
glibc is big!

> The best case is to run native code for better performance. We'd
> like to cross-compile for the PowerPC.

Setting up OCaml as a cross-compiler is a bit of a challenge at the
moment. As a prerequisite, you'll need a complete cross-compilation
environment for C: cross-compiler, cross-binutils, libraries and
header files for your target. It sounds obvious but in my experience
that's quite hard to get right. Then, there is a bit of configuration
magic to be done on the OCaml side. Write back for help if you're
going to follow this way.

A perhaps simpler alternative would be to compile on a bigger
PowerPC/Linux platform. An old Mac would be handy for this, but you
can also use a Sony Playstation 3 (if you happen to have one around
for, ahem, R&D purposes) after installing YellowDog Linux on it.

- Xavier "doing lots of R&D with my PS3" Leroy

Gregory Bellier

unread,
Mar 30, 2009, 3:30:40 AM3/30/09
to Xavier Leroy, caml...@yquem.inria.fr
Thank you Basile and Xavier, you were very helpful. That's nice of you.
Basile, I'm sorry but I'm not sure I can talk freely about what we're about
to do. Sorry, company policy :(

Anyway, thanks again and I'll write back when I'll have other questions.

Gregory BELLIER.


2009/3/27 Xavier Leroy <Xavier...@inria.fr>

xclerc

unread,
Mar 30, 2009, 9:45:52 AM3/30/09
to caml...@yquem.inria.fr

Le 27 mars 09 à 18:19, Xavier Leroy a écrit :

> Just to complement Basile's excellent answers:
>
>> Do you know if it is possible to compile caml code on a PowerPC 405
>> from the Vertex 4 family ?
>> We'd like to put this processor in a FPGA. On the Caml's website,
>> it is written "PowerPC" but is it only for Macintosch ?
>
> Not just Macintosh: PowerPC/Linux is also supported and works very
> well.
>
>> Yes, it will run Linux. It will have the uclibC or even the lib C.
>
> Then you're in good shape. I would expect a basic OCaml system to
> work with uclibC, although a number of external libraries might not.
> With GNU libC, everything will work but watch out for code size:
> glibc is big!
>
>> The best case is to run native code for better performance. We'd
>> like to cross-compile for the PowerPC.
>
> Setting up OCaml as a cross-compiler is a bit of a challenge at the
> moment. As a prerequisite, you'll need a complete cross-compilation
> environment for C: cross-compiler, cross-binutils, libraries and
> header files for your target. It sounds obvious but in my experience
> that's quite hard to get right. Then, there is a bit of configuration
> magic to be done on the OCaml side. Write back for help if you're
> going to follow this way.

I have built a MacOS-to-Linux cross-compiler last week.
I do confirm that the hard part is getting a cross-[g]cc up and running.
In fact, this is so tedious that I strongly encourage to resort to
either
a prepackaged cross-[g]cc (from binaries, from a Linux packaging
system, whatever), or to the excellent "crosstool" available at :
http://www.kegel.com/crosstool/

On the OCaml side, there are very few things to do and they are
quite straightforward. First, you have to emulate the behaviour of
"./configure" by producing "config/m.h", "config/s.h", and "config/
Makefile"
by hand. This is easier than it may sound, just start from "config/m-
templ.h",
"config/s-temp.h", and "config/Makefile-templ" (these are
comprehensively
commented).
Then, you will have to slightly patch some Makefiles, and you are done.

I will setup a webpage with all the necessary steps and patches as soon
as I get my notes organized. This will allow us to share knowledge on
the subject.

Xavier Clerc

xclerc

unread,
Apr 1, 2009, 10:12:34 AM4/1/09
to caml...@yquem.inria.fr

Le 30 mars 09 à 15:45, xclerc a écrit :

(...)

> I have built a MacOS-to-Linux cross-compiler last week.
> I do confirm that the hard part is getting a cross-[g]cc up and
> running.
> In fact, this is so tedious that I strongly encourage to resort to
> either
> a prepackaged cross-[g]cc (from binaries, from a Linux packaging
> system, whatever), or to the excellent "crosstool" available at :
> http://www.kegel.com/crosstool/
>
> On the OCaml side, there are very few things to do and they are
> quite straightforward. First, you have to emulate the behaviour of
> "./configure" by producing "config/m.h", "config/s.h", and "config/
> Makefile"
> by hand. This is easier than it may sound, just start from "config/m-
> templ.h",
> "config/s-temp.h", and "config/Makefile-templ" (these are
> comprehensively
> commented).
> Then, you will have to slightly patch some Makefiles, and you are
> done.
>
> I will setup a webpage with all the necessary steps and patches as
> soon
> as I get my notes organized. This will allow us to share knowledge
> on the subject.

The build process I followed along with its accompagnying patch are
available on the Gallium wiki at the following URL:
http://brion.inria.fr/gallium/index.php/CrossCompiler

This is clearly a very experimental draft that is still a bit hackish.
All reports, both positive and negative are hence very welcome,
in order to polish it up.


Hope this helps,

0 new messages