* [Buildroot] [PATCH] arch/arm: add support for thumb(1) mode
@ 2013-07-17 15:39 Gustavo Zacarias
2013-07-17 15:58 ` Thomas Petazzoni
2013-07-17 22:22 ` Peter Korsgaard
0 siblings, 2 replies; 15+ messages in thread
From: Gustavo Zacarias @ 2013-07-17 15:39 UTC (permalink / raw)
To: buildroot
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
arch/Config.in.arm | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/arch/Config.in.arm b/arch/Config.in.arm
index b2fe257..7fef04c 100644
--- a/arch/Config.in.arm
+++ b/arch/Config.in.arm
@@ -31,6 +31,9 @@ config BR2_ARM_CPU_HAS_VFPV4
bool
select BR2_ARM_CPU_HAS_VFPV3
+config BR2_ARM_CPU_HAS_THUMB
+ bool
+
config BR2_ARM_CPU_HAS_THUMB2
bool
@@ -43,28 +46,38 @@ choice
config BR2_arm7tdmi
bool "arm7tdmi"
+ select BR2_ARM_CPU_HAS_THUMB
config BR2_arm720t
bool "arm720t"
+ select BR2_ARM_CPU_HAS_THUMB
config BR2_arm920t
bool "arm920t"
+ select BR2_ARM_CPU_HAS_THUMB
config BR2_arm922t
bool "arm922t"
+ select BR2_ARM_CPU_HAS_THUMB
config BR2_arm926t
bool "arm926t"
select BR2_ARM_CPU_MAYBE_HAS_VFPV2
+ select BR2_ARM_CPU_HAS_THUMB
config BR2_arm10t
bool "arm10t"
+ select BR2_ARM_CPU_HAS_THUMB
config BR2_arm1136jf_s_r0
bool "arm1136jf_s rev0"
select BR2_ARM_CPU_HAS_VFPV2
+ select BR2_ARM_CPU_HAS_THUMB
config BR2_arm1136jf_s_r1
bool "arm1136jf_s rev1"
select BR2_ARM_CPU_HAS_VFPV2
+ select BR2_ARM_CPU_HAS_THUMB
config BR2_arm1176jz_s
bool "arm1176jz-s"
+ select BR2_ARM_CPU_HAS_THUMB
config BR2_arm1176jzf_s
bool "arm1176jzf-s"
select BR2_ARM_CPU_HAS_VFPV2
+ select BR2_ARM_CPU_HAS_THUMB
config BR2_cortex_a5
bool "cortex-A5"
select BR2_ARM_CPU_MAYBE_HAS_NEON
@@ -99,6 +112,7 @@ config BR2_strongarm
bool "strongarm sa110/sa1100"
config BR2_xscale
bool "xscale"
+ select BR2_ARM_CPU_HAS_THUMB
config BR2_iwmmxt
bool "iwmmxt"
endchoice
@@ -286,7 +300,7 @@ endchoice
choice
prompt "ARM instruction set"
- depends on BR2_ARM_CPU_HAS_THUMB2
+ depends on BR2_ARM_CPU_HAS_THUMB || BR2_ARM_CPU_HAS_THUMB2
config BR2_ARM_INSTRUCTIONS_ARM_CHOICE
bool "ARM"
@@ -294,8 +308,18 @@ config BR2_ARM_INSTRUCTIONS_ARM_CHOICE
This option instructs the compiler to generate regular ARM
instructions, that are all 32 bits wide.
+config BR2_ARM_INSTRUCTIONS_THUMB
+ bool "Thumb"
+ depends on BR2_ARM_CPU_HAS_THUMB
+ help
+ This option instructions the compiler to generate Thumb
+ instructions, which allows to mix 16 bits instructions and
+ 32 bits instructions. This generally provides a much smaller
+ compiled binary size.
+
config BR2_ARM_INSTRUCTIONS_THUMB2
bool "Thumb2"
+ depends on BR2_ARM_CPU_HAS_THUMB2
help
This option instructions the compiler to generate Thumb2
instructions, which allows to mix 16 bits instructions and
@@ -306,7 +330,7 @@ endchoice
config BR2_ARM_INSTRUCTIONS_ARM
def_bool y
- depends on !BR2_ARM_INSTRUCTIONS_THUMB2
+ depends on !(BR2_ARM_INSTRUCTIONS_THUMB || BR2_ARM_INSTRUCTIONS_THUMB2)
config BR2_ARCH
default "arm" if BR2_arm
--
1.8.1.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH] arch/arm: add support for thumb(1) mode
2013-07-17 15:39 [Buildroot] [PATCH] arch/arm: add support for thumb(1) mode Gustavo Zacarias
@ 2013-07-17 15:58 ` Thomas Petazzoni
2013-07-17 16:03 ` Gustavo Zacarias
2013-07-17 22:22 ` Peter Korsgaard
1 sibling, 1 reply; 15+ messages in thread
From: Thomas Petazzoni @ 2013-07-17 15:58 UTC (permalink / raw)
To: buildroot
Dear Gustavo Zacarias,
On Wed, 17 Jul 2013 12:39:15 -0300, Gustavo Zacarias wrote:
> +config BR2_ARM_INSTRUCTIONS_THUMB
> + bool "Thumb"
> + depends on BR2_ARM_CPU_HAS_THUMB
> + help
> + This option instructions the compiler to generate Thumb
> + instructions, which allows to mix 16 bits instructions and
> + 32 bits instructions. This generally provides a much smaller
> + compiled binary size.
I think this is misleading: Thumb doesn't allow to mix 16 bits and 32
bits instructions like Thumb2 does. IIRC, with Thumb, a particular
function needs to be either completely Thumb (16 bits) or completely
ARM (32 bits), and there is the thumb-interworking mechanism between
the two.
Which leads me to this question: is adding Thumb support as simple as
what you're adding? Aren't there some additional thumb-interworking
complexities to handle?
Thanks!
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH] arch/arm: add support for thumb(1) mode
2013-07-17 15:58 ` Thomas Petazzoni
@ 2013-07-17 16:03 ` Gustavo Zacarias
2013-07-17 19:58 ` Thomas Petazzoni
0 siblings, 1 reply; 15+ messages in thread
From: Gustavo Zacarias @ 2013-07-17 16:03 UTC (permalink / raw)
To: buildroot
On 07/17/2013 12:58 PM, Thomas Petazzoni wrote:
> I think this is misleading: Thumb doesn't allow to mix 16 bits and 32
> bits instructions like Thumb2 does. IIRC, with Thumb, a particular
> function needs to be either completely Thumb (16 bits) or completely
> ARM (32 bits), and there is the thumb-interworking mechanism between
> the two.
>
> Which leads me to this question: is adding Thumb support as simple as
> what you're adding? Aren't there some additional thumb-interworking
> complexities to handle?
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042e/IHI0042E_aapcs.pdf
Section 5.6 is of interest, once OABI (APCS) was dropped interworking
isn't that hard since it's mandatory for AAPCS.
Regards.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH] arch/arm: add support for thumb(1) mode
2013-07-17 16:03 ` Gustavo Zacarias
@ 2013-07-17 19:58 ` Thomas Petazzoni
2013-07-17 22:25 ` Gustavo Zacarias
0 siblings, 1 reply; 15+ messages in thread
From: Thomas Petazzoni @ 2013-07-17 19:58 UTC (permalink / raw)
To: buildroot
Dear Gustavo Zacarias,
On Wed, 17 Jul 2013 13:03:56 -0300, Gustavo Zacarias wrote:
> > Which leads me to this question: is adding Thumb support as simple as
> > what you're adding? Aren't there some additional thumb-interworking
> > complexities to handle?
>
> http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042e/IHI0042E_aapcs.pdf
> Section 5.6 is of interest, once OABI (APCS) was dropped interworking
> isn't that hard since it's mandatory for AAPCS.
Ok, so if I select "Thumb" for ARMv5T, but use a normal ARMv5
external toolchain (compiled ARM, not Thumb), it should work. Am I
correct?
Thanks!
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH] arch/arm: add support for thumb(1) mode
2013-07-17 15:39 [Buildroot] [PATCH] arch/arm: add support for thumb(1) mode Gustavo Zacarias
2013-07-17 15:58 ` Thomas Petazzoni
@ 2013-07-17 22:22 ` Peter Korsgaard
1 sibling, 0 replies; 15+ messages in thread
From: Peter Korsgaard @ 2013-07-17 22:22 UTC (permalink / raw)
To: buildroot
>>>>> "Gustavo" == Gustavo Zacarias <gustavo@zacarias.com.ar> writes:
Gustavo> Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Gustavo> ---
Gustavo> arch/Config.in.arm | 28 ++++++++++++++++++++++++++--
Gustavo> 1 file changed, 26 insertions(+), 2 deletions(-)
Gustavo> config BR2_ARM_INSTRUCTIONS_ARM
Gustavo> def_bool y
Gustavo> - depends on !BR2_ARM_INSTRUCTIONS_THUMB2
Gustavo> + depends on !(BR2_ARM_INSTRUCTIONS_THUMB || BR2_ARM_INSTRUCTIONS_THUMB2)
You seem to have missed setting BR2_TARGET_CPU_MODE to "thumb", so it
doesn't actually do anything.
Committed with that fixed, thanks.
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH] arch/arm: add support for thumb(1) mode
2013-07-17 19:58 ` Thomas Petazzoni
@ 2013-07-17 22:25 ` Gustavo Zacarias
2013-07-18 7:19 ` Thomas Petazzoni
2013-07-18 8:10 ` Peter Korsgaard
0 siblings, 2 replies; 15+ messages in thread
From: Gustavo Zacarias @ 2013-07-17 22:25 UTC (permalink / raw)
To: buildroot
On 07/17/2013 04:58 PM, Thomas Petazzoni wrote:
> Ok, so if I select "Thumb" for ARMv5T, but use a normal ARMv5
> external toolchain (compiled ARM, not Thumb), it should work. Am I
> correct?
Yes, because at the moment it's a NOP, we don't do anything regarding
thumb and external toolchains :)
However if we did it must work, it's part of the spec and the gcc
default as long as we are talking about a thumb-supporting cpu of course.
Regards.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH] arch/arm: add support for thumb(1) mode
2013-07-17 22:25 ` Gustavo Zacarias
@ 2013-07-18 7:19 ` Thomas Petazzoni
2013-07-18 11:08 ` Gustavo Zacarias
2013-07-18 8:10 ` Peter Korsgaard
1 sibling, 1 reply; 15+ messages in thread
From: Thomas Petazzoni @ 2013-07-18 7:19 UTC (permalink / raw)
To: buildroot
Dear Gustavo Zacarias,
On Wed, 17 Jul 2013 19:25:24 -0300, Gustavo Zacarias wrote:
> On 07/17/2013 04:58 PM, Thomas Petazzoni wrote:
>
> > Ok, so if I select "Thumb" for ARMv5T, but use a normal ARMv5
> > external toolchain (compiled ARM, not Thumb), it should work. Am I
> > correct?
>
> Yes, because at the moment it's a NOP, we don't do anything regarding
> thumb and external toolchains :)
We definitely do something. If you enable Thumb in the configuration,
then -mthumb gets hard-coded into the external toolchain wrapper. If you
enable ARM in the configuration, then -marm gets hard-coded into the
external toolchain wrapper.
See:
http://git.buildroot.net/buildroot/tree/toolchain/toolchain-external/ext-tool.mk#n183
and:
http://git.buildroot.net/buildroot/tree/toolchain/toolchain-external/ext-toolchain-wrapper.c#n50.
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH] arch/arm: add support for thumb(1) mode
2013-07-17 22:25 ` Gustavo Zacarias
2013-07-18 7:19 ` Thomas Petazzoni
@ 2013-07-18 8:10 ` Peter Korsgaard
2013-07-18 16:07 ` Gustavo Zacarias
1 sibling, 1 reply; 15+ messages in thread
From: Peter Korsgaard @ 2013-07-18 8:10 UTC (permalink / raw)
To: buildroot
>>>>> "Gustavo" == Gustavo Zacarias <gustavo@zacarias.com.ar> writes:
Gustavo> On 07/17/2013 04:58 PM, Thomas Petazzoni wrote:
>> Ok, so if I select "Thumb" for ARMv5T, but use a normal ARMv5
>> external toolchain (compiled ARM, not Thumb), it should work. Am I
>> correct?
Gustavo> Yes, because at the moment it's a NOP, we don't do anything
Gustavo> regarding thumb and external toolchains :) However if we did
Gustavo> it must work, it's part of the spec and the gcc default as
Gustavo> long as we are talking about a thumb-supporting cpu of course.
FYI, I just did a test build (arm926/thumb1/internal uclibc), and the
build dies in NPTL when it runs out of registers. Without threads it
builds and seems to work.
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH] arch/arm: add support for thumb(1) mode
2013-07-18 7:19 ` Thomas Petazzoni
@ 2013-07-18 11:08 ` Gustavo Zacarias
2013-07-18 11:24 ` Thomas Petazzoni
0 siblings, 1 reply; 15+ messages in thread
From: Gustavo Zacarias @ 2013-07-18 11:08 UTC (permalink / raw)
To: buildroot
On 07/18/2013 04:19 AM, Thomas Petazzoni wrote:
> We definitely do something. If you enable Thumb in the configuration,
> then -mthumb gets hard-coded into the external toolchain wrapper. If you
> enable ARM in the configuration, then -marm gets hard-coded into the
> external toolchain wrapper.
>
> See:
> http://git.buildroot.net/buildroot/tree/toolchain/toolchain-external/ext-tool.mk#n183
> and:
> http://git.buildroot.net/buildroot/tree/toolchain/toolchain-external/ext-toolchain-wrapper.c#n50.
Missed that!
It's working though, tested on real hardware (arm920t) with CS 2013.05
Regards.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH] arch/arm: add support for thumb(1) mode
2013-07-18 11:08 ` Gustavo Zacarias
@ 2013-07-18 11:24 ` Thomas Petazzoni
0 siblings, 0 replies; 15+ messages in thread
From: Thomas Petazzoni @ 2013-07-18 11:24 UTC (permalink / raw)
To: buildroot
Dear Gustavo Zacarias,
On Thu, 18 Jul 2013 08:08:11 -0300, Gustavo Zacarias wrote:
> > We definitely do something. If you enable Thumb in the
> > configuration, then -mthumb gets hard-coded into the external
> > toolchain wrapper. If you enable ARM in the configuration, then
> > -marm gets hard-coded into the external toolchain wrapper.
> >
> > See:
> > http://git.buildroot.net/buildroot/tree/toolchain/toolchain-external/ext-tool.mk#n183
> > and:
> > http://git.buildroot.net/buildroot/tree/toolchain/toolchain-external/ext-toolchain-wrapper.c#n50.
>
> Missed that!
> It's working though, tested on real hardware (arm920t) with CS 2013.05
Excellent, thanks for the testing!
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH] arch/arm: add support for thumb(1) mode
2013-07-18 8:10 ` Peter Korsgaard
@ 2013-07-18 16:07 ` Gustavo Zacarias
2013-07-18 22:32 ` Peter Korsgaard
0 siblings, 1 reply; 15+ messages in thread
From: Gustavo Zacarias @ 2013-07-18 16:07 UTC (permalink / raw)
To: buildroot
On 07/18/2013 05:10 AM, Peter Korsgaard wrote:
> FYI, I just did a test build (arm926/thumb1/internal uclibc), and the
> build dies in NPTL when it runs out of registers. Without threads it
> builds and seems to work.
I regularly build -mthumb (via CFLAGS) projects without issues for an
arm920t, but that doesn't force those flags for uclibc, just catched the
breakage after you fixed my patch (mine was a no-op, d'oh!)
Seems uclibc is broken for thumb builds, even with
COMPILE_IN_THUMB_MODE=y in its config (which the only thing it does is
add -mthumb to the compile flags).
Patches follow to make uclibc build on ARM mode regardless to avoid the
breakage (eglibc seems broken too, though none of them for thumb2 since
the register set isn't restricted).
I've also disabled libmudflap for thumb1 since it doesn't build either -
i know Thomas has a patchset coming adding the option for libmudflap,
just that i don't want to leave it broken/undocumented in the mean time.
Regards.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH] arch/arm: add support for thumb(1) mode
2013-07-18 16:07 ` Gustavo Zacarias
@ 2013-07-18 22:32 ` Peter Korsgaard
2013-07-18 22:46 ` Gustavo Zacarias
0 siblings, 1 reply; 15+ messages in thread
From: Peter Korsgaard @ 2013-07-18 22:32 UTC (permalink / raw)
To: buildroot
>>>>> "Gustavo" == Gustavo Zacarias <gustavo@zacarias.com.ar> writes:
Gustavo> On 07/18/2013 05:10 AM, Peter Korsgaard wrote:
>> FYI, I just did a test build (arm926/thumb1/internal uclibc), and the
>> build dies in NPTL when it runs out of registers. Without threads it
>> builds and seems to work.
Gustavo> I regularly build -mthumb (via CFLAGS) projects without issues for an
Gustavo> arm920t, but that doesn't force those flags for uclibc, just catched the
Gustavo> breakage after you fixed my patch (mine was a no-op, d'oh!)
Gustavo> Seems uclibc is broken for thumb builds, even with
Gustavo> COMPILE_IN_THUMB_MODE=y in its config (which the only thing it does is
Gustavo> add -mthumb to the compile flags).
Actually the uClibc breakage seems to only be in the NPTL stuff. A test
build without threads worked OK.
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH] arch/arm: add support for thumb(1) mode
2013-07-18 22:32 ` Peter Korsgaard
@ 2013-07-18 22:46 ` Gustavo Zacarias
2013-07-19 8:19 ` Peter Korsgaard
0 siblings, 1 reply; 15+ messages in thread
From: Gustavo Zacarias @ 2013-07-18 22:46 UTC (permalink / raw)
To: buildroot
On 07/18/2013 07:32 PM, Peter Korsgaard wrote:
> Actually the uClibc breakage seems to only be in the NPTL stuff. A test
> build without threads worked OK.
Question is did (does) it really work or just built?
Regards.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH] arch/arm: add support for thumb(1) mode
2013-07-18 22:46 ` Gustavo Zacarias
@ 2013-07-19 8:19 ` Peter Korsgaard
2013-07-19 13:06 ` Gustavo Zacarias
0 siblings, 1 reply; 15+ messages in thread
From: Peter Korsgaard @ 2013-07-19 8:19 UTC (permalink / raw)
To: buildroot
>>>>> "Gustavo" == Gustavo Zacarias <gustavo@zacarias.com.ar> writes:
Gustavo> On 07/18/2013 07:32 PM, Peter Korsgaard wrote:
>> Actually the uClibc breakage seems to only be in the NPTL stuff. A test
>> build without threads worked OK.
Gustavo> Question is did (does) it really work or just built?
A statically built busybox with it atleast ran here. I didn't really
give it a lot of testing though.
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH] arch/arm: add support for thumb(1) mode
2013-07-19 8:19 ` Peter Korsgaard
@ 2013-07-19 13:06 ` Gustavo Zacarias
0 siblings, 0 replies; 15+ messages in thread
From: Gustavo Zacarias @ 2013-07-19 13:06 UTC (permalink / raw)
To: buildroot
On 07/19/2013 05:19 AM, Peter Korsgaard wrote:
> Gustavo> Question is did (does) it really work or just built?
>
> A statically built busybox with it atleast ran here. I didn't really
> give it a lot of testing though.
Fair enough then, i'll send a v2.
Regards.
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2013-07-19 13:06 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-17 15:39 [Buildroot] [PATCH] arch/arm: add support for thumb(1) mode Gustavo Zacarias
2013-07-17 15:58 ` Thomas Petazzoni
2013-07-17 16:03 ` Gustavo Zacarias
2013-07-17 19:58 ` Thomas Petazzoni
2013-07-17 22:25 ` Gustavo Zacarias
2013-07-18 7:19 ` Thomas Petazzoni
2013-07-18 11:08 ` Gustavo Zacarias
2013-07-18 11:24 ` Thomas Petazzoni
2013-07-18 8:10 ` Peter Korsgaard
2013-07-18 16:07 ` Gustavo Zacarias
2013-07-18 22:32 ` Peter Korsgaard
2013-07-18 22:46 ` Gustavo Zacarias
2013-07-19 8:19 ` Peter Korsgaard
2013-07-19 13:06 ` Gustavo Zacarias
2013-07-17 22:22 ` Peter Korsgaard
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.