diff mbox

[v2,02/17] arch/arm: Cortex-M3 provides only Thumb-2

Message ID 1458335299-27409-3-git-send-email-thomas.petazzoni@free-electrons.com
State Accepted
Headers show

Commit Message

Thomas Petazzoni March 18, 2016, 9:08 p.m. UTC
The Cortex-M cores only support Thumb-2, not Thumb. In fact, Thumb-2
is a superset of Thumb, and we could have a single option for both in
Buildroot, since -mthumb on ARMv4/v5 means original Thumb, while
-mthumb on ARMv7 means Thumb 2. However, for clarity, it makes sense
to have two separate options. But in this case, Cortex-M3 should not
advertise that it supports Thumb, as in fact selecting Thumb would
generate Thumb-2 code.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/Config.in.arm | 1 -
 1 file changed, 1 deletion(-)

Comments

Yann E. MORIN March 18, 2016, 10:34 p.m. UTC | #1
Thomas, All,

On 2016-03-18 22:08 +0100, Thomas Petazzoni spake thusly:
> The Cortex-M cores only support Thumb-2, not Thumb. In fact, Thumb-2
> is a superset of Thumb, and we could have a single option for both in
> Buildroot, since -mthumb on ARMv4/v5 means original Thumb, while
> -mthumb on ARMv7 means Thumb 2. However, for clarity, it makes sense
> to have two separate options. But in this case, Cortex-M3 should not
> advertise that it supports Thumb, as in fact selecting Thumb would
> generate Thumb-2 code.

So, if a package has some assembly code written in Thumb not Thimb2, it
should do sometinh like:

    ifeq ($(BR2_ARM_CPU_HAS_THUMB)$(BR2_ARM_CPU_HAS_THUMB2),y)
    FOO_OPTS += --enable-thumb
    endif

whereas now it would only need to do:

    ifeq ($(BR2_ARM_CPU_HAS_THUMB)$(BR2_ARM_CPU_HAS_THUMB2),y)
    FOO_OPTS += --enable-thumb
    endif

Right?

> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  arch/Config.in.arm | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/arch/Config.in.arm b/arch/Config.in.arm
> index 33f763a..cd1ec33 100644
> --- a/arch/Config.in.arm
> +++ b/arch/Config.in.arm
> @@ -172,7 +172,6 @@ config BR2_cortex_a17
>  	select BR2_ARCH_HAS_MMU_OPTIONAL
>  config BR2_cortex_m3
>  	bool "cortex-M3"
> -	select BR2_ARM_CPU_HAS_THUMB
>  	select BR2_ARM_CPU_HAS_THUMB2
>  	select BR2_ARM_CPU_ARMV7M
>  config BR2_fa526
> -- 
> 2.6.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Arnout Vandecappelle March 19, 2016, 3:33 p.m. UTC | #2
On 03/18/16 23:34, Yann E. MORIN wrote:
> Thomas, All,
>
> On 2016-03-18 22:08 +0100, Thomas Petazzoni spake thusly:
>> The Cortex-M cores only support Thumb-2, not Thumb. In fact, Thumb-2
>> is a superset of Thumb, and we could have a single option for both in
>> Buildroot, since -mthumb on ARMv4/v5 means original Thumb, while
>> -mthumb on ARMv7 means Thumb 2. However, for clarity, it makes sense
>> to have two separate options. But in this case, Cortex-M3 should not
>> advertise that it supports Thumb, as in fact selecting Thumb would
>> generate Thumb-2 code.
>
> So, if a package has some assembly code written in Thumb not Thimb2, it
> should do sometinh like:
>
>      ifeq ($(BR2_ARM_CPU_HAS_THUMB)$(BR2_ARM_CPU_HAS_THUMB2),y)
>      FOO_OPTS += --enable-thumb
>      endif
>
> whereas now it would only need to do:
>
>      ifeq ($(BR2_ARM_CPU_HAS_THUMB)$(BR2_ARM_CPU_HAS_THUMB2),y)

  I guess you meant to say

	ifeq ($(BR2_ARM_CPU_HAS_THUMB),y)

>      FOO_OPTS += --enable-thumb
>      endif
>
> Right?

  Indeed. This was discussed in v1 of the series, and Thomas updated the commit 
message to clarify that a bit. It turns out that we have no case you need a 
condition like that, but we do have a few cases where we need 
thumb-but-not-thumb2 (e.g. the uClibc threads stuff).

>
>> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
>
> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

  Regards,
  Arnout

>
> Regards,
> Yann E. MORIN.
>
>> ---
>>   arch/Config.in.arm | 1 -
>>   1 file changed, 1 deletion(-)
>>
>> diff --git a/arch/Config.in.arm b/arch/Config.in.arm
>> index 33f763a..cd1ec33 100644
>> --- a/arch/Config.in.arm
>> +++ b/arch/Config.in.arm
>> @@ -172,7 +172,6 @@ config BR2_cortex_a17
>>   	select BR2_ARCH_HAS_MMU_OPTIONAL
>>   config BR2_cortex_m3
>>   	bool "cortex-M3"
>> -	select BR2_ARM_CPU_HAS_THUMB
>>   	select BR2_ARM_CPU_HAS_THUMB2
>>   	select BR2_ARM_CPU_ARMV7M
>>   config BR2_fa526
>> --
>> 2.6.4
>>
>> _______________________________________________
>> buildroot mailing list
>> buildroot@busybox.net
>> http://lists.busybox.net/mailman/listinfo/buildroot
>
diff mbox

Patch

diff --git a/arch/Config.in.arm b/arch/Config.in.arm
index 33f763a..cd1ec33 100644
--- a/arch/Config.in.arm
+++ b/arch/Config.in.arm
@@ -172,7 +172,6 @@  config BR2_cortex_a17
 	select BR2_ARCH_HAS_MMU_OPTIONAL
 config BR2_cortex_m3
 	bool "cortex-M3"
-	select BR2_ARM_CPU_HAS_THUMB
 	select BR2_ARM_CPU_HAS_THUMB2
 	select BR2_ARM_CPU_ARMV7M
 config BR2_fa526