[LLVMdev] Generate code for ARM Cortex m0, m3, and m4.

1,012 views
Skip to first unread message

Jan Hoogerbrugge

unread,
Oct 11, 2013, 2:23:27 PM10/11/13
to llv...@cs.uiuc.edu
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


_______________________________________________
LLVM Developers mailing list
LLV...@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

Jim Grosbach

unread,
Oct 11, 2013, 5:17:18 PM10/11/13
to Jan Hoogerbrugge, LLVM Developers Mailing List
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

Amara Emerson

unread,
Oct 12, 2013, 6:00:29 PM10/12/13
to Jan Hoogerbrugge, llv...@cs.uiuc.edu
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

Renato Golin

unread,
Oct 12, 2013, 6:28:40 PM10/12/13
to Amara Emerson, llv...@cs.uiuc.edu, Jan Hoogerbrugge
On 12 October 2013 23:00, Amara Emerson <amara....@gmail.com> wrote:
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.

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

Jan, would you mind filling a bug?


cheers,
--renato

Bernard Ogden

unread,
Oct 14, 2013, 12:38:49 PM10/14/13
to Renato Golin, Jan Hoogerbrugge, llv...@cs.uiuc.edu
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.

Renato Golin

unread,
Oct 14, 2013, 12:47:26 PM10/14/13
to Bernard Ogden, Jan Hoogerbrugge, llv...@cs.uiuc.edu
Thanks Bernie,

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

cheers,
-renato

Jim Grosbach

unread,
Oct 14, 2013, 4:20:42 PM10/14/13
to Renato Golin, llv...@cs.uiuc.edu, Jan Hoogerbrugge
I see you already found it, but for others following along, this is http://llvm.org/bugs/show_bug.cgi?id=17559.

-Jim

Reply all
Reply to author
Forward
0 new messages