Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 413545

Summary: default confgcc for armv7m should include " --with-mode=thumb"
Product: Gentoo Linux Reporter: Christopher Friedt <chrisfriedt>
Component: EclassesAssignee: Gentoo Toolchain Maintainers <toolchain>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: ARM   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: toolchain_eclass-default-to-thumb-mode-for-armv7m.patch
/tmp/toolchain_eclass-default-to-thumb-mode-for-armv7m.patch v2

Description Christopher Friedt 2012-04-25 17:07:02 UTC
When creating a toolchain targeting an armv7-m core, such as cortex-m3 or cortex-m4, toolchain.eclass should configure gcc to default to thumb mode, otherwise any simple compilation unit fails with "error: target CPU does not support ARM mode".

$ echo "int foo() { return 0; }" > conftest.c
$ armv7m-elf-eabi-gcc -c conftest.c
conftest.c:1:0: error: target CPU does not support ARM mode

$ armv7m-elf-eabi-gcc -mthumb -c conftest.c
$ echo $?
0

Please see the attached patch for the fix, which simply adds " --with-mode=thumb" to GCC's configure line.

*Note*: newlib requires a patch for newlib/configure.host (use "arm*)" instead of "arm)") in order to properly compile... how this was overlooked, I have no idea. I'll submit that patch in a separate bug report.

Reproducible: Always

Steps to Reproduce:
1. crossdev --g 4.6.1-r1 --target armv7m-elf-eabi -P -v
2.
3.
Comment 1 Christopher Friedt 2012-04-25 17:07:57 UTC
Created attachment 310093 [details, diff]
toolchain_eclass-default-to-thumb-mode-for-armv7m.patch
Comment 2 Christopher Friedt 2012-04-25 17:12:33 UTC
see #413547 for the newlib patch
Comment 3 Christopher Friedt 2012-04-25 17:13:07 UTC
bug #413547 ... hyperlink?
Comment 4 Christopher Friedt 2012-04-25 19:52:07 UTC
Created attachment 310115 [details, diff]
/tmp/toolchain_eclass-default-to-thumb-mode-for-armv7m.patch v2

This patch has a couple of minor corrections that I noticed after testing

1) eliminate space after +=
2) remove '?'
Comment 5 SpanKY gentoo-dev 2012-04-27 01:15:29 UTC
not an exact dupe, but largely the same issue

*** This bug has been marked as a duplicate of bug 264534 ***