diff mbox

[2/4] arm: update processor types

Message ID 1421951608-31233-3-git-send-email-ezequiel@vanguardiasur.com.ar
State Changes Requested
Headers show

Commit Message

Ezequiel Garcia Jan. 22, 2015, 6:33 p.m. UTC
From: Guido Martínez <guido@vanguardiasur.com.ar>

Add the Cortex M3 variant. These microcontrollers don't support regular
ARM instructions and don't have an MMU.

Signed-off-by: Guido Martínez <guido@vanguardiasur.com.ar>
---
 arch/Config.in                | 8 ++++----
 arch/Config.in.arm            | 5 +++++
 toolchain/toolchain-common.in | 6 ++++--
 3 files changed, 13 insertions(+), 6 deletions(-)

Comments

Romain Naour Feb. 2, 2015, 4:18 p.m. UTC | #1
Hi Ezequiel,

Le 22/01/2015 19:33, Ezequiel Garcia a écrit :
> From: Guido Martínez <guido@vanguardiasur.com.ar>
> 
> Add the Cortex M3 variant. These microcontrollers don't support regular
> ARM instructions and don't have an MMU.
> 
> Signed-off-by: Guido Martínez <guido@vanguardiasur.com.ar>
> ---
>  arch/Config.in                | 8 ++++----
>  arch/Config.in.arm            | 5 +++++
>  toolchain/toolchain-common.in | 6 ++++--
>  3 files changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/Config.in b/arch/Config.in
> index 890e7e2..6f7d608 100644
> --- a/arch/Config.in
> +++ b/arch/Config.in
> @@ -258,13 +258,13 @@ config BR2_BINFMT_SUPPORTS_SHARED
>  # Set up target binary format
>  choice
>  	prompt "Target Binary Format"
> -	default BR2_BINFMT_ELF if !(BR2_bfin || BR2_m68k)
> +	default BR2_BINFMT_ELF if !(BR2_bfin || BR2_m68k || BR2_cortex_m3)
>  	default BR2_BINFMT_FDPIC if BR2_bfin
> -	default BR2_BINFMT_FLAT if BR2_m68k
> +	default BR2_BINFMT_FLAT if BR2_m68k || BR2_cortex_m3

What do you think about adding BR2_ARCH_HAS_EFL_SUPPORT in each architecture
Config.in.x instead of black-listing them here ?

>  
>  config BR2_BINFMT_ELF
>  	bool "ELF"
> -	depends on !BR2_bfin && !BR2_m68k
> +	depends on !BR2_bfin && !BR2_m68k && !BR2_cortex_m3
>  	select BR2_BINFMT_SUPPORTS_SHARED
>  	help
>  	  ELF (Executable and Linkable Format) is a format for libraries and
> @@ -283,7 +283,7 @@ config BR2_BINFMT_FDPIC
>  
>  config BR2_BINFMT_FLAT
>  	bool "FLAT"
> -	depends on BR2_bfin || BR2_m68k
> +	depends on BR2_bfin || BR2_m68k || BR2_cortex_m3

Same here with BR2_ARCH_HAS_FLAT_SUPPORT.

>  	help
>  	  FLAT binary is a relatively simple and lightweight executable format
>  	  based on the original a.out format. It is widely used in environment
> diff --git a/arch/Config.in.arm b/arch/Config.in.arm
> index a2d113a..1e22ab8 100644
> --- a/arch/Config.in.arm
> +++ b/arch/Config.in.arm
> @@ -134,6 +134,10 @@ config BR2_cortex_a15
>  	select BR2_ARM_CPU_HAS_VFPV4
>  	select BR2_ARM_CPU_HAS_THUMB2
>  	select BR2_ARM_CPU_ARMV7A
> +config BR2_cortex_m3
> +	bool "cortex-M3"
> +	select BR2_ARM_CPU_HAS_THUMB
> +	select BR2_ARM_CPU_HAS_THUMB2
>  config BR2_fa526
>  	bool "fa526/626"
>  	select BR2_ARM_CPU_HAS_ARM
> @@ -396,6 +400,7 @@ config BR2_GCC_TARGET_CPU
>  	default "cortex-a9"	if BR2_cortex_a9
>  	default "cortex-a12"	if BR2_cortex_a12
>  	default "cortex-a15"	if BR2_cortex_a15
> +	default "cortex-m3"	if BR2_cortex_m3
>  	default "fa526"		if BR2_fa526
>  	default "marvell-pj4"	if BR2_pj4
>  	default "strongarm"	if BR2_strongarm
> diff --git a/toolchain/toolchain-common.in b/toolchain/toolchain-common.in
> index 2ee2019..fd6ef53 100644
> --- a/toolchain/toolchain-common.in
> +++ b/toolchain/toolchain-common.in
> @@ -114,8 +114,10 @@ config BR2_NEEDS_GETTEXT_IF_LOCALE
>  	default y if (BR2_NEEDS_GETTEXT && BR2_ENABLE_LOCALE)
>  
>  config BR2_USE_MMU
> -	bool "Enable MMU support" if BR2_arm || BR2_armeb || BR2_sh || BR2_xtensa
> -	default y if !BR2_bfin
> +	bool "Enable MMU support"
> +	depends on BR2_arm || BR2_armeb || BR2_sh || BR2_xtensa
> +	depends on !BR2_cortex_m3 && !BR2_bfin
> +	default y

And here with BR2_ARCH_HAS_MMU_SUPPORT ?

>  	help
>  	  If your target has a MMU, you should say Y here.  If you
>  	  are unsure, just say Y.
> 

Best regards,
Romain Naour
Ezequiel Garcia Feb. 7, 2015, 6:05 p.m. UTC | #2
On 02/02/2015 01:18 PM, Romain Naour wrote:
> Hi Ezequiel,
> 
> Le 22/01/2015 19:33, Ezequiel Garcia a écrit :
>> From: Guido Martínez <guido@vanguardiasur.com.ar>
>>
>> Add the Cortex M3 variant. These microcontrollers don't support regular
>> ARM instructions and don't have an MMU.
>>
>> Signed-off-by: Guido Martínez <guido@vanguardiasur.com.ar>
>> ---
>>  arch/Config.in                | 8 ++++----
>>  arch/Config.in.arm            | 5 +++++
>>  toolchain/toolchain-common.in | 6 ++++--
>>  3 files changed, 13 insertions(+), 6 deletions(-)
>>
>> diff --git a/arch/Config.in b/arch/Config.in
>> index 890e7e2..6f7d608 100644
>> --- a/arch/Config.in
>> +++ b/arch/Config.in
>> @@ -258,13 +258,13 @@ config BR2_BINFMT_SUPPORTS_SHARED
>>  # Set up target binary format
>>  choice
>>  	prompt "Target Binary Format"
>> -	default BR2_BINFMT_ELF if !(BR2_bfin || BR2_m68k)
>> +	default BR2_BINFMT_ELF if !(BR2_bfin || BR2_m68k || BR2_cortex_m3)
>>  	default BR2_BINFMT_FDPIC if BR2_bfin
>> -	default BR2_BINFMT_FLAT if BR2_m68k
>> +	default BR2_BINFMT_FLAT if BR2_m68k || BR2_cortex_m3
> 
> What do you think about adding BR2_ARCH_HAS_EFL_SUPPORT in each architecture
> Config.in.x instead of black-listing them here ?
> 
>>  
>>  config BR2_BINFMT_ELF
>>  	bool "ELF"
>> -	depends on !BR2_bfin && !BR2_m68k
>> +	depends on !BR2_bfin && !BR2_m68k && !BR2_cortex_m3
>>  	select BR2_BINFMT_SUPPORTS_SHARED
>>  	help
>>  	  ELF (Executable and Linkable Format) is a format for libraries and
>> @@ -283,7 +283,7 @@ config BR2_BINFMT_FDPIC
>>  
>>  config BR2_BINFMT_FLAT
>>  	bool "FLAT"
>> -	depends on BR2_bfin || BR2_m68k
>> +	depends on BR2_bfin || BR2_m68k || BR2_cortex_m3
> 
> Same here with BR2_ARCH_HAS_FLAT_SUPPORT.
> 
>>  	help
>>  	  FLAT binary is a relatively simple and lightweight executable format
>>  	  based on the original a.out format. It is widely used in environment
>> diff --git a/arch/Config.in.arm b/arch/Config.in.arm
>> index a2d113a..1e22ab8 100644
>> --- a/arch/Config.in.arm
>> +++ b/arch/Config.in.arm
>> @@ -134,6 +134,10 @@ config BR2_cortex_a15
>>  	select BR2_ARM_CPU_HAS_VFPV4
>>  	select BR2_ARM_CPU_HAS_THUMB2
>>  	select BR2_ARM_CPU_ARMV7A
>> +config BR2_cortex_m3
>> +	bool "cortex-M3"
>> +	select BR2_ARM_CPU_HAS_THUMB
>> +	select BR2_ARM_CPU_HAS_THUMB2
>>  config BR2_fa526
>>  	bool "fa526/626"
>>  	select BR2_ARM_CPU_HAS_ARM
>> @@ -396,6 +400,7 @@ config BR2_GCC_TARGET_CPU
>>  	default "cortex-a9"	if BR2_cortex_a9
>>  	default "cortex-a12"	if BR2_cortex_a12
>>  	default "cortex-a15"	if BR2_cortex_a15
>> +	default "cortex-m3"	if BR2_cortex_m3
>>  	default "fa526"		if BR2_fa526
>>  	default "marvell-pj4"	if BR2_pj4
>>  	default "strongarm"	if BR2_strongarm
>> diff --git a/toolchain/toolchain-common.in b/toolchain/toolchain-common.in
>> index 2ee2019..fd6ef53 100644
>> --- a/toolchain/toolchain-common.in
>> +++ b/toolchain/toolchain-common.in
>> @@ -114,8 +114,10 @@ config BR2_NEEDS_GETTEXT_IF_LOCALE
>>  	default y if (BR2_NEEDS_GETTEXT && BR2_ENABLE_LOCALE)
>>  
>>  config BR2_USE_MMU
>> -	bool "Enable MMU support" if BR2_arm || BR2_armeb || BR2_sh || BR2_xtensa
>> -	default y if !BR2_bfin
>> +	bool "Enable MMU support"
>> +	depends on BR2_arm || BR2_armeb || BR2_sh || BR2_xtensa
>> +	depends on !BR2_cortex_m3 && !BR2_bfin
>> +	default y
> 
> And here with BR2_ARCH_HAS_MMU_SUPPORT ?
> 

Hm.. shouldn't that be, BR2_ARCH_HAS_OPTIONAL_MMU or something ?

At least that's what it seems: only some architectures expose the build
time config to disable MMU.
Ezequiel Garcia Feb. 7, 2015, 7:47 p.m. UTC | #3
Hi Romain,

First of all, thanks for the great feedback.

On 02/02/2015 01:18 PM, Romain Naour wrote:
[..]
>> -	default BR2_BINFMT_FLAT if BR2_m68k
>> +	default BR2_BINFMT_FLAT if BR2_m68k || BR2_cortex_m3
> 
> What do you think about adding BR2_ARCH_HAS_EFL_SUPPORT in each architecture
> Config.in.x instead of black-listing them here ?
> 

I've been thinking about this. At first it seemed like a good idea, but
then I realised that Cortex-M3 is not really an architecture, but 
a variant.

Introducing BR2_ARCH_HAS_ELF_SUPPORT would mean selecting it on almost each
architecture and almost each of the ARM variants, except Cortex-M3.

So, it seems like it would be an elegant way of doing this, but I'm not sure
it's worth such an invasive change.
Romain Naour Feb. 14, 2015, 1:51 p.m. UTC | #4
Hi Ezequiel,

[snip]
>>> diff --git a/toolchain/toolchain-common.in b/toolchain/toolchain-common.in
>>> index 2ee2019..fd6ef53 100644
>>> --- a/toolchain/toolchain-common.in
>>> +++ b/toolchain/toolchain-common.in
>>> @@ -114,8 +114,10 @@ config BR2_NEEDS_GETTEXT_IF_LOCALE
>>>  	default y if (BR2_NEEDS_GETTEXT && BR2_ENABLE_LOCALE)
>>>  
>>>  config BR2_USE_MMU
>>> -	bool "Enable MMU support" if BR2_arm || BR2_armeb || BR2_sh || BR2_xtensa
>>> -	default y if !BR2_bfin
>>> +	bool "Enable MMU support"
>>> +	depends on BR2_arm || BR2_armeb || BR2_sh || BR2_xtensa
>>> +	depends on !BR2_cortex_m3 && !BR2_bfin
>>> +	default y
>>
>> And here with BR2_ARCH_HAS_MMU_SUPPORT ?
>>

Sorry for the delay...

> 
> Hm.. shouldn't that be, BR2_ARCH_HAS_OPTIONAL_MMU or something ?
> 
> At least that's what it seems: only some architectures expose the build
> time config to disable MMU.
> 

I think we need BR2_ARCH_HAS_MMU_SUPPORT if there is an MMU in the CPU and
BR2_ARCH_HAS_OPTIONAL_MMU if the MMU can be disabled.

The BR2_ARCH_HAS_OPTIONAL_MMU should automatically select
BR2_ARCH_HAS_MMU_SUPPORT when set to y.

Then BR2_arm, BR2_armeb, BR2_sh and BR2_xtensa should select
BR2_ARCH_HAS_OPTIONAL_MMU.

And all other architecture should select BR2_ARCH_HAS_MMU_SUPPORT except
BR2_bfin and BR2_cortex_m3.

So BR2_USE_MMU look like this:

config BR2_USE_MMU
	boot "Enable MMU support" if BR2_ARCH_HAS_OPTIONAL_MMU
	default y if BR2_ARCH_HAS_MMU_SUPPORT

When looking again at your patch, there is an error when another architecture
like i386 is selected.
BR2_USE_MMU must be set to y in that case.

What do you think ?

Best regards,
Romain
Romain Naour Feb. 14, 2015, 2:43 p.m. UTC | #5
Hi Ezequiel,

Le 07/02/2015 20:47, Ezequiel Garcia a écrit :
> Hi Romain,
> 
> First of all, thanks for the great feedback.

You're welcome :)

> 
> On 02/02/2015 01:18 PM, Romain Naour wrote:
> [..]
>>> -	default BR2_BINFMT_FLAT if BR2_m68k
>>> +	default BR2_BINFMT_FLAT if BR2_m68k || BR2_cortex_m3
>>
>> What do you think about adding BR2_ARCH_HAS_EFL_SUPPORT in each architecture
>> Config.in.x instead of black-listing them here ?
>>
> 
> I've been thinking about this. At first it seemed like a good idea, but
> then I realised that Cortex-M3 is not really an architecture, but 
> a variant.
> 
> Introducing BR2_ARCH_HAS_ELF_SUPPORT would mean selecting it on almost each
> architecture and almost each of the ARM variants, except Cortex-M3.
> 
> So, it seems like it would be an elegant way of doing this, but I'm not sure
> it's worth such an invasive change.
> 

We may introduce BR2_ARCH_HAS_ELF_SUPPORT as an hidden option which is set to y
by default except for BR2_bfin, BR2_m68k and BR2_cortex_m3. (like for BR2_USE_MMU)

config BR2_ARCH_HAS_ELF_SUPPORT
	bool
	default y if !(BR2_bfin || BR2_m68k || BR2_cortex_m3)

What other developer think ?

Best regards,
Romain
diff mbox

Patch

diff --git a/arch/Config.in b/arch/Config.in
index 890e7e2..6f7d608 100644
--- a/arch/Config.in
+++ b/arch/Config.in
@@ -258,13 +258,13 @@  config BR2_BINFMT_SUPPORTS_SHARED
 # Set up target binary format
 choice
 	prompt "Target Binary Format"
-	default BR2_BINFMT_ELF if !(BR2_bfin || BR2_m68k)
+	default BR2_BINFMT_ELF if !(BR2_bfin || BR2_m68k || BR2_cortex_m3)
 	default BR2_BINFMT_FDPIC if BR2_bfin
-	default BR2_BINFMT_FLAT if BR2_m68k
+	default BR2_BINFMT_FLAT if BR2_m68k || BR2_cortex_m3
 
 config BR2_BINFMT_ELF
 	bool "ELF"
-	depends on !BR2_bfin && !BR2_m68k
+	depends on !BR2_bfin && !BR2_m68k && !BR2_cortex_m3
 	select BR2_BINFMT_SUPPORTS_SHARED
 	help
 	  ELF (Executable and Linkable Format) is a format for libraries and
@@ -283,7 +283,7 @@  config BR2_BINFMT_FDPIC
 
 config BR2_BINFMT_FLAT
 	bool "FLAT"
-	depends on BR2_bfin || BR2_m68k
+	depends on BR2_bfin || BR2_m68k || BR2_cortex_m3
 	help
 	  FLAT binary is a relatively simple and lightweight executable format
 	  based on the original a.out format. It is widely used in environment
diff --git a/arch/Config.in.arm b/arch/Config.in.arm
index a2d113a..1e22ab8 100644
--- a/arch/Config.in.arm
+++ b/arch/Config.in.arm
@@ -134,6 +134,10 @@  config BR2_cortex_a15
 	select BR2_ARM_CPU_HAS_VFPV4
 	select BR2_ARM_CPU_HAS_THUMB2
 	select BR2_ARM_CPU_ARMV7A
+config BR2_cortex_m3
+	bool "cortex-M3"
+	select BR2_ARM_CPU_HAS_THUMB
+	select BR2_ARM_CPU_HAS_THUMB2
 config BR2_fa526
 	bool "fa526/626"
 	select BR2_ARM_CPU_HAS_ARM
@@ -396,6 +400,7 @@  config BR2_GCC_TARGET_CPU
 	default "cortex-a9"	if BR2_cortex_a9
 	default "cortex-a12"	if BR2_cortex_a12
 	default "cortex-a15"	if BR2_cortex_a15
+	default "cortex-m3"	if BR2_cortex_m3
 	default "fa526"		if BR2_fa526
 	default "marvell-pj4"	if BR2_pj4
 	default "strongarm"	if BR2_strongarm
diff --git a/toolchain/toolchain-common.in b/toolchain/toolchain-common.in
index 2ee2019..fd6ef53 100644
--- a/toolchain/toolchain-common.in
+++ b/toolchain/toolchain-common.in
@@ -114,8 +114,10 @@  config BR2_NEEDS_GETTEXT_IF_LOCALE
 	default y if (BR2_NEEDS_GETTEXT && BR2_ENABLE_LOCALE)
 
 config BR2_USE_MMU
-	bool "Enable MMU support" if BR2_arm || BR2_armeb || BR2_sh || BR2_xtensa
-	default y if !BR2_bfin
+	bool "Enable MMU support"
+	depends on BR2_arm || BR2_armeb || BR2_sh || BR2_xtensa
+	depends on !BR2_cortex_m3 && !BR2_bfin
+	default y
 	help
 	  If your target has a MMU, you should say Y here.  If you
 	  are unsure, just say Y.