Haskell on ARM (was Re: [Haskell-cafe] ANN: Topkata)
jeremy at n-heptane.com
Tue Jun 24 14:27:03 EDT 2008
I have, on two occasions made an *unregisterised* of GHC for the ARM
(specifically the Maemo on Nokia 770). Mostly I just followed the
unregisterised porting directions in the GHC user manual.
I documented one attempt here:
Note: This procedure is for building a version of GHC that runs on ARM
and generates ARM code. So, it is not build a cross-compiler, just a
native ARM compiler.
The unregisterised build is not that useful because:
1. no FFI
2. uses trampolining for tail calls
3. no threads I think
4. some other stuff I have forgotten
So, the next step is to registerise the build. This is online a few
lines a code. Basically stuff like:
1. add ARM support to the evil mangler (basically, a few regexps to
strip prolog and epilogue stuff from the ASM)
2. #define which registers exist and what they should be used for
3. implement the tail call ASM
4. define some aspects of the C calling convention
5. (Optional), implement native assembly generation
This is not a lot of code. However, it is very low-level code.
I think that doing a registerised build is pretty easy, the *second*
time you do it. The big problem is that there is pretty much no
documentation on how to do it. (The porting guide does tell you, very
generally, what needs to be done).
Also, running GHC on an emulated ARM processor is slow. I think it
took GHC 6.4 8+ hours to build.
Now that many of the extra libs have been split out into the extra
libs package, that should help significantly with the build time.
If any does attempt to build for the ARM, please, please, please,
document what you do in the wiki. And, if you do, edit the wiki as you
go, you definitely won't be able to remember what you did after the
fact. (Or, at the very least, use some program to capture everything
you do so that you can refer to it later).
And, finally, I heard vague rumors a while ago that made me think that
GHC 6.10 might have a pure ANSI-C backend? Is there any truth to this?
That would make porting much easier if it meant you did not have to do
ps. I would be happy to try to answer any questions if someone tries a
port. I would still like to run GHC on my 770, and I hope to own an
iPhone if they fix a few ommisions (bluetooth keyboard support, and
At Tue, 17 Jun 2008 13:12:33 -0700,
Don Stewart wrote:
> > "Ariel J. Birnbaum" <valgarv at gmx.net> writes:
> > >> In the mean time -- who knows enough to make ghc target
> > >> ARM, and get this to link against the iPhone libraries?
> > >> This would be quite a coup if it could be made to run
> > >> there!
> > > For that matter, there's another ARM-based target in which
> > > I'm interested: Nintendo DS. Has anyone got any Haskell
> > > code to run on one of these? PS: Maybe this discussion
> > > should be moved to a new "Haskell on ARM" thread?
> > I would be interested to see ghc running on Nokia n8xx or
> > iRex iliad. Both of them are quite open linux based
> > systems.
> Jeremy Shaw had ghc targeting the nokia last year, iirc.
> Perhaps he'll have more info.
> -- Don
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe