diff mbox

[v2,1/6] arm: update processor types

Message ID 1431959088-15257-2-git-send-email-guido@vanguardiasur.com.ar
State Superseded
Headers show

Commit Message

Guido Martínez May 18, 2015, 2:24 p.m. UTC
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

Thomas Petazzoni May 18, 2015, 8:05 p.m. UTC | #1
Dear Guido Martínez,

On Mon, 18 May 2015 11:24:43 -0300, Guido Martínez wrote:

>  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

This breaks things, because now BR2_USE_MMU is empty on architectures
others than arm, armeb, sh and xtensa.

What we probably need is something like this:

config BR2_ARCH_MMU_OPTIONAL
	bool

config BR2_ARCH_MMU_MANDATORY
	bool

and have all ARM cores select BR2_ARCH_MMU_OPTIONAL except Cortex M3,
SuperH and Xtensa select BR2_ARCH_MMU_OPTIONAL, all other architectures
except Blackfin selecting BR2_ARCH_MMU_MANDATORY.

And then:

	bool "Enable MMU support" if BR2_ARCH_MMU_OPTIONAL
	default y if BR2_ARCH_MMU_MANDATORY || BR2_ARCH_MMU_OPTIONAL

or something like that.

Thomas
Guido Martínez May 19, 2015, 3:53 p.m. UTC | #2
On Mon, May 18, 2015 at 10:05:12PM +0200, Thomas Petazzoni wrote:
> >  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
> 
> This breaks things, because now BR2_USE_MMU is empty on architectures
> others than arm, armeb, sh and xtensa.
Ugh, stupid me.

> What we probably need is something like this:
> 
> config BR2_ARCH_MMU_OPTIONAL
> 	bool
> 
> config BR2_ARCH_MMU_MANDATORY
> 	bool
> 
> and have all ARM cores select BR2_ARCH_MMU_OPTIONAL except Cortex M3,
> SuperH and Xtensa select BR2_ARCH_MMU_OPTIONAL, all other architectures
> except Blackfin selecting BR2_ARCH_MMU_MANDATORY.
> 
> And then:
> 
> 	bool "Enable MMU support" if BR2_ARCH_MMU_OPTIONAL
> 	default y if BR2_ARCH_MMU_MANDATORY || BR2_ARCH_MMU_OPTIONAL
> 
> or something like that.
Yes, I'll work on something like that.

Sorry for the noise :(
Guido Martínez May 21, 2015, 4:51 p.m. UTC | #3
On Tue, May 19, 2015 at 12:53:42PM -0300, Guido Martínez wrote:
> Yes, I'll work on something like that.

I'm sending two patches tidying up the MMU and BINFMT configs. After
that I'll respin the m3 series with the changes discussed.

Thanks for the comments!
diff mbox

Patch

diff --git a/arch/Config.in b/arch/Config.in
index 06aff2c..8ff4a05 100644
--- a/arch/Config.in
+++ b/arch/Config.in
@@ -244,13 +244,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
@@ -269,7 +269,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 f5d317b..44dd47c 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
@@ -391,6 +395,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 d50c908..d71b850 100644
--- a/toolchain/toolchain-common.in
+++ b/toolchain/toolchain-common.in
@@ -108,8 +108,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.