public inbox for libffi-discuss@sourceware.org
 help / color / mirror / Atom feed
* libffi on Cortex M4?
@ 2015-09-14 18:43 Tor Krill
  2015-09-14 19:08 ` Richard Henderson
  0 siblings, 1 reply; 3+ messages in thread
From: Tor Krill @ 2015-09-14 18:43 UTC (permalink / raw)
  To: libffi-discuss

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}'
../src/arm/sysv.S:156: Error: attempt to use an ARM instruction on a
Thumb-only processor -- `mov fp,sp'
../src/arm/sysv.S:161: Error: attempt to use an ARM instruction on a
Thumb-only processor -- `sub sp,fp,r2'

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?

sysv.S have indications that it should support thumb instructions but it
seems to be ignored when i compile libffi.

Best!

/Tor

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: libffi on Cortex M4?
  2015-09-14 18:43 libffi on Cortex M4? Tor Krill
@ 2015-09-14 19:08 ` Richard Henderson
  2015-09-15 11:52   ` Tor Krill
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Henderson @ 2015-09-14 19:08 UTC (permalink / raw)
  To: Tor Krill, libffi-discuss

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}'
> ../src/arm/sysv.S:156: Error: attempt to use an ARM instruction on a
> Thumb-only processor -- `mov fp,sp'
> ../src/arm/sysv.S:161: Error: attempt to use an ARM instruction on a
> Thumb-only processor -- `sub sp,fp,r2'
> 
> 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.


r~

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: libffi on Cortex M4?
  2015-09-14 19:08 ` Richard Henderson
@ 2015-09-15 11:52   ` Tor Krill
  0 siblings, 0 replies; 3+ messages in thread
From: Tor Krill @ 2015-09-15 11:52 UTC (permalink / raw)
  To: Richard Henderson, libffi-discuss

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-15 11:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-14 18:43 libffi on Cortex M4? Tor Krill
2015-09-14 19:08 ` Richard Henderson
2015-09-15 11:52   ` Tor Krill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).