diff mbox

[U-Boot,RFC,1/4] ARM: enable Thumb build

Message ID 1328528248-20872-2-git-send-email-aneesh@ti.com
State RFC
Delegated to: Tom Rini
Headers show

Commit Message

Aneesh V Feb. 6, 2012, 11:37 a.m. UTC
Enable Thumb build and ARM-Thumb interworking based on the new
config flag CONFIG_SYS_THUMB_BUILD

Signed-off-by: Aneesh V <aneesh@ti.com>
---
 README             |    9 +++++++++
 arch/arm/config.mk |   29 +++++++++++++++++------------
 2 files changed, 26 insertions(+), 12 deletions(-)

Comments

Tom Rini Feb. 6, 2012, 6:45 p.m. UTC | #1
On Mon, Feb 6, 2012 at 4:37 AM, Aneesh V <aneesh@ti.com> wrote:
> Enable Thumb build and ARM-Thumb interworking based on the new
> config flag CONFIG_SYS_THUMB_BUILD
>
> Signed-off-by: Aneesh V <aneesh@ti.com>
[snip]
> -# Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb:
> -PF_CPPFLAGS_ARM := $(call cc-option,-marm,)
> +# Choose between ARM/Thumb instruction sets
> +ifeq ($(CONFIG_SYS_THUMB_BUILD),y)
> +PF_CPPFLAGS_ARM += $(call cc-option, -mthumb -mthumb-interwork, \
> +               -marm -mno-thumb-interwork)
> +else
> +PF_CPPFLAGS_ARM += $(call cc-option, -marm -mno-thumb-interwork)
> +endif

We need the ':=' syntax to evaluate this once rather than for every
file we build.  Same with the rest of the changes here.
Aneesh V Feb. 7, 2012, 7:43 a.m. UTC | #2
On Tuesday 07 February 2012 12:15 AM, Tom Rini wrote:
> On Mon, Feb 6, 2012 at 4:37 AM, Aneesh V<aneesh@ti.com>  wrote:
>> Enable Thumb build and ARM-Thumb interworking based on the new
>> config flag CONFIG_SYS_THUMB_BUILD
>>
>> Signed-off-by: Aneesh V<aneesh@ti.com>
> [snip]
>> -# Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb:
>> -PF_CPPFLAGS_ARM := $(call cc-option,-marm,)
>> +# Choose between ARM/Thumb instruction sets
>> +ifeq ($(CONFIG_SYS_THUMB_BUILD),y)
>> +PF_CPPFLAGS_ARM += $(call cc-option, -mthumb -mthumb-interwork, \
>> +               -marm -mno-thumb-interwork)
>> +else
>> +PF_CPPFLAGS_ARM += $(call cc-option, -marm -mno-thumb-interwork)
>> +endif
>
> We need the ':=' syntax to evaluate this once rather than for every
> file we build.  Same with the rest of the changes here.
>

Oops! In my initial patch it was affecting PLATFORM_CPPFLAGS. When I
rebased it I didn't notice that PF_CPPFLAGS_ARM was defined for the
first time here. I will fix it.

Thanks,
Aneesh
diff mbox

Patch

diff --git a/README b/README
index 9d713e8..dfe7fb3 100644
--- a/README
+++ b/README
@@ -420,6 +420,15 @@  The following options need to be configured:
 		XWAY SoCs for booting from NOR flash. The U-Boot image needs to
 		be swapped if a flash programmer is used.
 
+- ARM Options:
+		CONFIG_SYS_THUMB_BUILD
+
+		Use this flag to build U-Boot using the Thumb instruction
+		set for ARM architectures. Thumb instruction set provides
+		better code density. For ARM architectures that support
+		Thumb2 this flag will result in Thumb2 code generated by
+		GCC.
+
 - Linux Kernel Interface:
 		CONFIG_CLOCKS_IN_MHZ
 
diff --git a/arch/arm/config.mk b/arch/arm/config.mk
index 45f9dca..9a450d7 100644
--- a/arch/arm/config.mk
+++ b/arch/arm/config.mk
@@ -33,26 +33,31 @@  endif
 
 PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__
 
-# Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb:
-PF_CPPFLAGS_ARM := $(call cc-option,-marm,)
+# Choose between ARM/Thumb instruction sets
+ifeq ($(CONFIG_SYS_THUMB_BUILD),y)
+PF_CPPFLAGS_ARM += $(call cc-option, -mthumb -mthumb-interwork, \
+		-marm -mno-thumb-interwork)
+else
+PF_CPPFLAGS_ARM += $(call cc-option, -marm -mno-thumb-interwork)
+endif
 
 # Try if EABI is supported, else fall back to old API,
 # i. e. for example:
 # - with ELDK 4.2 (EABI supported), use:
-#	-mabi=aapcs-linux -mno-thumb-interwork
+#	-mabi=aapcs-linux
 # - with ELDK 4.1 (gcc 4.x, no EABI), use:
-#	-mabi=apcs-gnu -mno-thumb-interwork
+#	-mabi=apcs-gnu
 # - with ELDK 3.1 (gcc 3.x), use:
-#	-mapcs-32 -mno-thumb-interwork
-PF_CPPFLAGS_ABI := $(call cc-option,\
-			-mabi=aapcs-linux -mno-thumb-interwork,\
-			$(call cc-option,\
-				-mapcs-32,\
+#	-mapcs-32
+PLATFORM_CPPFLAGS += $(call cc-option,\
+				-mabi=aapcs-linux,\
 				$(call cc-option,\
-					-mabi=apcs-gnu,\
+					-mapcs-32,\
+					$(call cc-option,\
+						-mabi=apcs-gnu,\
+					)\
 				)\
-			) $(call cc-option,-mno-thumb-interwork,)\
-		)
+			)
 PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_ARM) $(PF_CPPFLAGS_ABI)
 
 # For EABI, make sure to provide raise()