libffi on Cortex M4?

Tor Krill tor@openproducts.com
Tue Sep 15 11:52:00 GMT 2015


Hi Richard and others,

Thank you for a prompt and good answer!

On mån, 2015-09-14 at 12:07 -0700, Richard Henderson wrote:
> On 09/14/2015 11:43 AM, Tor Krill wrote:
> > Dear list,
> > 
> > I'm trying to crosscompile libffi for a Cortex-M4 platform running
> > uClinux but this fails miserably during compilation with a:
> > 
> > ../src/arm/sysv.S: Assembler messages:
> > ../src/arm/sysv.S:152: Error: selected processor does not support ARM
> > opcodes
> > ../src/arm/sysv.S:154: Error: attempt to use an ARM instruction on a
> > Thumb-only processor -- `stmfd sp!,{r0-r3,fp,lr}'
----8<----------------------
> > 
> > My question is simply, is thumb2 on a cortex m4 supported by libffi?
> > I.e. is it my build setup that is faulty and this should work or is this
> > unsupported?
> 
> Thumb2 is supported, but I think you'll find that the M4 is thumb1, which isn't.
>
> We normally expect to have the assembly bits for libffi compiled for arm32 and
> use interworking to let the C bits be built for thumb1.  In order to support a
> thumb1 only core would require significant work.

Now i actually get a bit confused. Excuse me for my lack of low level
arm core knowledge. But Arm says that the Cortex M4 should be Thumb2,
albeit Thumb2 only if i understand correctly.

http://www.arm.com/products/processors/cortex-m/cortex-m4-processor.php

Further more, when i read up on the Cortex M4 users manual it seems like
the assembler instructions i get an error on during build is actually
supported by the cpu. I.e. the stmfd.

Could it be that i have a toolchain problem? (I use a somewhat old gcc
from "Sourcery", Sourcery G++ Lite 2010q1-189 4.4.1)

Best!

/Tor




More information about the Libffi-discuss mailing list