[U-Boot] [PATCH 0/4] Use THUMB mode for VCMA9 U-Boot builts

Patch 1 fixes a bug in the calling of board_init_r() in THUMB mode. Patch 2-3 enable THUMB support for the ARM920T architecture. Patch 4 finally activates THUMB mode for VCMA9.

Signed-off-by: David Müller d.mueller@elsoft.ch --- arch/arm/lib/crt0.S | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S index 2f4c14e..8415f77 100644 --- a/arch/arm/lib/crt0.S +++ b/arch/arm/lib/crt0.S @@ -167,8 +167,12 @@ clbss_l:cmp r0, r1 /* while not at end of BSS */ mov r0, r9 /* gd_t */ ldr r1, [r9, #GD_RELOCADDR] /* dest_addr */ /* call board_init_r */ +#if defined(CONFIG_SYS_THUMB_BUILD) + ldr lr, =board_init_r /* this is auto-relocated! */ + bx lr +#else ldr pc, =board_init_r /* this is auto-relocated! */ - +#endif /* we should not return here. */ #endif

On Tue, Feb 09, 2016 at 04:48:28PM +0100, David Müller wrote:
Signed-off-by: David Müller d.mueller@elsoft.ch
arch/arm/lib/crt0.S | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S index 2f4c14e..8415f77 100644 --- a/arch/arm/lib/crt0.S +++ b/arch/arm/lib/crt0.S @@ -167,8 +167,12 @@ clbss_l:cmp r0, r1 /* while not at end of BSS */ mov r0, r9 /* gd_t */ ldr r1, [r9, #GD_RELOCADDR] /* dest_addr */ /* call board_init_r */ +#if defined(CONFIG_SYS_THUMB_BUILD)
- ldr lr, =board_init_r /* this is auto-relocated! */
- bx lr
+#else ldr pc, =board_init_r /* this is auto-relocated! */
+#endif /* we should not return here. */ #endif
In general, my preference is always to use the thumb compatible way, can you rework like that and explain in the commit message? Thanks!

Hello
Tom Rini wrote:
On Tue, Feb 09, 2016 at 04:48:28PM +0100, David Müller wrote:
/* call board_init_r */ +#if defined(CONFIG_SYS_THUMB_BUILD)
- ldr lr, =board_init_r /* this is auto-relocated! */
- bx lr
+#else ldr pc, =board_init_r /* this is auto-relocated! */
+#endif /* we should not return here. */ #endif
In general, my preference is always to use the thumb compatible way, can you rework like that and explain in the commit message? Thanks!
AFAIK, the "bx" instruction is undefined on non-THUMB capable architectures. I therefore don't see a way to avoid some kind of #if/#else/#endif construct.
Dave

On Wed, Feb 10, 2016 at 08:57:38AM +0100, David Müller (ELSOFT AG) wrote:
Hello
Tom Rini wrote:
On Tue, Feb 09, 2016 at 04:48:28PM +0100, David Müller wrote:
/* call board_init_r */ +#if defined(CONFIG_SYS_THUMB_BUILD)
- ldr lr, =board_init_r /* this is auto-relocated! */
- bx lr
+#else ldr pc, =board_init_r /* this is auto-relocated! */
+#endif /* we should not return here. */ #endif
In general, my preference is always to use the thumb compatible way, can you rework like that and explain in the commit message? Thanks!
AFAIK, the "bx" instruction is undefined on non-THUMB capable architectures. I therefore don't see a way to avoid some kind of #if/#else/#endif construct.
Ah, OK, nevermind then, thanks.

On Tue, Feb 09, 2016 at 04:48:28PM +0100, David Müller (ELSOFT AG) wrote:
Signed-off-by: David Müller d.mueller@elsoft.ch
Applied to u-boot/master, thanks!

Signed-off-by: David Müller d.mueller@elsoft.ch --- arch/arm/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/Makefile b/arch/arm/Makefile index cd7d880..6defdfb 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -9,7 +9,7 @@ endif
# This selects which instruction set is used. arch-$(CONFIG_CPU_ARM720T) =-march=armv4 -arch-$(CONFIG_CPU_ARM920T) =-march=armv4 +arch-$(CONFIG_CPU_ARM920T) =-march=armv4t arch-$(CONFIG_CPU_ARM926EJS) =-march=armv5te arch-$(CONFIG_CPU_ARM946ES) =-march=armv4 arch-$(CONFIG_CPU_SA1100) =-march=armv4

On Tue, Feb 09, 2016 at 04:48:29PM +0100, David Müller (ELSOFT AG) wrote:
Signed-off-by: David Müller d.mueller@elsoft.ch
Applied to u-boot/master, thanks!

Signed-off-by: David Müller d.mueller@elsoft.ch --- arch/arm/cpu/arm920t/Makefile | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/arch/arm/cpu/arm920t/Makefile b/arch/arm/cpu/arm920t/Makefile index 6582938..1832b9d 100644 --- a/arch/arm/cpu/arm920t/Makefile +++ b/arch/arm/cpu/arm920t/Makefile @@ -13,3 +13,9 @@ obj-$(CONFIG_USE_IRQ) += interrupts.o obj-$(CONFIG_EP93XX) += ep93xx/ obj-$(CONFIG_IMX) += imx/ obj-$(CONFIG_S3C24X0) += s3c24x0/ + +# some files can only build in ARM mode + +ifdef CONFIG_SYS_THUMB_BUILD +CFLAGS_cpu.o := -marm +endif

On Tue, Feb 09, 2016 at 04:48:30PM +0100, David Müller (ELSOFT AG) wrote:
Signed-off-by: David Müller d.mueller@elsoft.ch
Applied to u-boot/master, thanks!

Signed-off-by: David Müller d.mueller@elsoft.ch --- include/configs/VCMA9.h | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/include/configs/VCMA9.h b/include/configs/VCMA9.h index 42af34f..de7d5c2 100644 --- a/include/configs/VCMA9.h +++ b/include/configs/VCMA9.h @@ -20,6 +20,8 @@ * High Level Configuration Options * (easy to change) */ +#define CONFIG_SYS_THUMB_BUILD + #define CONFIG_S3C24X0 /* This is a SAMSUNG S3C24x0-type SoC */ #define CONFIG_S3C2410 /* specifically a SAMSUNG S3C2410 SoC */ #define CONFIG_VCMA9 /* on a MPL VCMA9 Board */

On Tue, Feb 09, 2016 at 04:48:31PM +0100, David Müller (ELSOFT AG) wrote:
Signed-off-by: David Müller d.mueller@elsoft.ch
Applied to u-boot/master, thanks!
participants (3)
-
David Müller
-
David Müller (ELSOFT AG)
-
Tom Rini