Cross compiling for Cortex A9

Karel Gardas karel.gardas at centrum.cz
Mon Jul 14 16:12:13 UTC 2014


On 07/14/14 04:58 PM, Michael Jones wrote:
> Karel,
>
> Thanks. This helps.
>
> If I understand, you have Linux running on a Panda, and on that Panda
> system you have gcc, and you compile GHC on the Panda itself, rather
> than build a cross compiler. I can see the advantage of building this
> way.

Correct!

> As far as cross compilers, I have a reason for trying to build a
> cross compiler, other than the ability to keep the image of the
> target small. That is, eventually, I want to be able to compile for
> an RTOS and/or bare iron system. I decided that learning to cross
> compile for Linux first would be a good approach. Learn the build
> system on something known to work. So I probably will not give up on
> that.

That is right, in future I'd also like to give a try to port GHC to some 
free RTOS and for this I'd need to use cross-compiling anyway, so I'll 
be on the same boat...

> I got a book on Autoconfig. I’ll just have to dig a level deeper into
> the whole build system. Mainly it means learning the M4 system. I
> have never used it.
>
> Below are the defines from the command you suggested. Thanks for
> that, got me over an ignorance hump. At least this define,
> __ARM_ARCH_5T__, is in the aclocal.m4 file. So I will have to study
> the macros until I figure out what controls the gcc options passed to
> the gcc cross compiler. I guess my question is what actually controls
> this result ("target arch", "ArchARM {armISA = ARMv7, armISAExt =
> [VFPv3,NEON], armABI = HARD}”)?
>
> Are these controlled by the defines below, or are they controlled by
> passing gcc arguments to the gcc compiler when the Haskell compiler
> calls gcc?

Basically speaking all those are controlled by platform gcc. That means 
if you pass the right option to your cross-compiling gcc you should also 
get the same result, so for example if you use:

gcc -mfloat-abi=hard -march=armv7-a -mfpu=vfpv3-d16

you should get the same settings like me.

But anyway, please note that ABI you set to your cross-compiler *have 
to* match the ABI provided by the target RTOS/OS! I hope that's clear. :-)

Cheers,
Karel


More information about the Glasgow-haskell-users mailing list