summaryrefslogtreecommitdiffstats
path: root/arch/arm/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-12-10 16:41:07 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2012-03-06 09:37:59 +0100
commit104a6a7ccfb7928ca5dc28c8cbe0ea231ffc45ee (patch)
tree9775e9211293396220d225d7a4746c3d06a837ec /arch/arm/include
parentcb1bd905dcacd8abd2703f6ce61fc09db8e475a4 (diff)
downloadbarebox-104a6a7ccfb7928ca5dc28c8cbe0ea231ffc45ee.tar.gz
barebox-104a6a7ccfb7928ca5dc28c8cbe0ea231ffc45ee.tar.xz
ARM: Allow to compile in thumb-2 mode
This shrinks the resulting binary size by ~25%. Exceptions are still handled in arm mode, so we have to explicitely put .arm directives into the exception code. Thumb-2 mode has been tested on i.MX51 Babbage board. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/include')
-rw-r--r--arch/arm/include/asm/barebox-arm-head.h12
-rw-r--r--arch/arm/include/asm/unified.h8
2 files changed, 16 insertions, 4 deletions
diff --git a/arch/arm/include/asm/barebox-arm-head.h b/arch/arm/include/asm/barebox-arm-head.h
index fdbee8cdda..0dc3074a27 100644
--- a/arch/arm/include/asm/barebox-arm-head.h
+++ b/arch/arm/include/asm/barebox-arm-head.h
@@ -4,6 +4,17 @@
static inline void barebox_arm_head(void)
{
__asm__ __volatile__ (
+#ifdef CONFIG_THUMB2_BAREBOX
+ ".arm\n"
+ "adr r9, 1f + 1\n"
+ "bx r9\n"
+ ".thumb\n"
+ "1:\n"
+ "bl reset\n"
+ ".rept 10\n"
+ "1: b 1b\n"
+ ".endr\n"
+#else
"b reset\n"
"1: b 1b\n"
"1: b 1b\n"
@@ -12,6 +23,7 @@ static inline void barebox_arm_head(void)
"1: b 1b\n"
"1: b 1b\n"
"1: b 1b\n"
+#endif
".word 0x65726162\n" /* 'bare' */
".word 0x00786f62\n" /* 'box' */
".word _text\n" /* text base. If copied there,
diff --git a/arch/arm/include/asm/unified.h b/arch/arm/include/asm/unified.h
index bc631161e9..4d855c8352 100644
--- a/arch/arm/include/asm/unified.h
+++ b/arch/arm/include/asm/unified.h
@@ -24,10 +24,10 @@
.syntax unified
#endif
-#ifdef CONFIG_THUMB2_KERNEL
+#ifdef CONFIG_THUMB2_BAREBOX
#if __GNUC__ < 4
-#error Thumb-2 kernel requires gcc >= 4
+#error Thumb-2 barebox requires gcc >= 4
#endif
/* The CPSR bit describing the instruction set (Thumb) */
@@ -40,7 +40,7 @@
#endif
#define BSYM(sym) sym + 1
-#else /* !CONFIG_THUMB2_KERNEL */
+#else /* !CONFIG_THUMB2_BAREBOX */
/* The CPSR bit describing the instruction set (ARM) */
#define PSR_ISETSTATE 0
@@ -52,7 +52,7 @@
#endif
#define BSYM(sym) sym
-#endif /* CONFIG_THUMB2_KERNEL */
+#endif /* CONFIG_THUMB2_BAREBOX */
#ifndef CONFIG_ARM_ASM_UNIFIED