Generate code for ARM Cortex m0, m3, and m4.

Hi,

I am trying to cross compile code for ARM Cortex m0, m3, and m4.

For m0, I use:

   -target armv6--eabi -mcpu=cortex-m0

That seems to work. For m3 and m4, I use the following which does not work
(fatal error: error in backend: CPU: 'cortex-m3' does not support ARM mode):

  -target armv7m--eabi -mcpu=cortex-m3

and

  -target armv7em--eabi -mcpu=cortex-m4

Who can help me with the right command line arguments for m3 and m4?

Thanks,
Jan

Add -mthumb. It’s also probably a bug in the driver that that’s required. It should be implied by the v7m triple and/or cpu. Mind filing a PR to that effect?

-Jim

Hi Jan,

For Cortex-M0, you should probably use the armv6m string in the target triple. For M3 and M4 you need to use the thumbv7m arch string, -mthumb won’t be necessary.

Amara

Yes, but I agree with Jim that a bug must be filled.

Jan, would you mind filling a bug?

http://llvm.org/bugs/enter_bug.cgi?product=clang

cheers,
--renato

I’ve got a trivial fix for this problem, and another one which manifests when thumb is given without an explicit CPU. I’ll start pushing it through our submissions process.

Thanks Bernie,

Feel free to assign yourself to the bug report, just so we know someone is working on it.

cheers,
-renato

I see you already found it, but for others following along, this is http://llvm.org/bugs/show_bug.cgi?id=17559.

-Jim