Skip to contentSkip to conversation

Use THUMB mode for VCMA9 U-Boot builts

PATCH New David Müller 2 participants 12 messages Feb 9, 2016 – Feb 15, 2016 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

cover 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.

#1 lore raw

PATCH 1/4 arm: make sure board_init_r() is being called using the right mode (ARM / THUMB)

---
 arch/arm/lib/crt0.S | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/lib/crt0.S +5 -1
index 2f4c14e..8415f77 100644
@@ -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
 
Signature · 1 line
1.8.4
#2 lore raw

PATCH 1/4 arm: make sure board_init_r() is being called using the right mode (ARM / THUMB)

Quoted 12 lines · David M?ller
---
 arch/arm/lib/crt0.S | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/lib/crt0.S +0 -0
index 2f4c14e..8415f77 100644
@@ -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 */

arch/arm/lib/crt0.S clbss_l:cmp r0, r1 /* while not at end of BSS */ · line 177

Quoted 10 lines
arch/arm/lib/crt0.S +5 -1
 	/* 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!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160209/4d1d0d1d/attachment.sig>
#3 lore raw

PATCH 1/4 arm: make sure board_init_r() is being called using the right mode (ARM / THUMB)

Hello

Quoted 14 lines · Tom Rini

arch/arm/lib/crt0.S clbss_l:cmp r0, r1 /* while not at end of BSS */ · line 177

Quoted 10 lines · David M?ller
arch/arm/lib/crt0.S +5 -1
 	/* 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

#4 lore raw

PATCH 1/4 arm: make sure board_init_r() is being called using the right mode (ARM / THUMB)

Quoted 18 lines · David M?ller (ELSOFT AG)

Hello

Quoted 14 lines · Tom Rini

arch/arm/lib/crt0.S clbss_l:cmp r0, r1 /* while not at end of BSS */ · line 177

Quoted 10 lines · David M?ller
arch/arm/lib/crt0.S +5 -1
 	/* 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!

Quoted 3 lines

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.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160210/4f511f5e/attachment.sig>
#5 lore raw

PATCH 1/4 arm: make sure board_init_r() is being called using the right mode (ARM / THUMB)

In reply to David Müller
Quoted 1 line · David M?ller (ELSOFT AG)

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160215/6d4eb124/attachment.sig>
#6 lore raw

PATCH 2/4 arm: the ARM920T is THUMB capable, so select the appropriate ISA

In reply to David Müller
---
 arch/arm/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/Makefile +1 -1
index cd7d880..6defdfb 100644
@@ -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
Signature · 1 line
1.8.4
#7 lore raw

PATCH 2/4 arm: the ARM920T is THUMB capable, so select the appropriate ISA

Quoted 1 line · David M?ller (ELSOFT AG)

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160215/ed2b24e1/attachment.sig>
#8 lore raw

PATCH 3/4 arm: build some file(s) as ARM mode only

In reply to David Müller
---
 arch/arm/cpu/arm920t/Makefile | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/cpu/arm920t/Makefile +6 -0
index 6582938..1832b9d 100644
@@ -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
Signature · 1 line
1.8.4
#9 lore raw

PATCH 3/4 arm: build some file(s) as ARM mode only

Quoted 1 line · David M?ller (ELSOFT AG)

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160215/ad75d66f/attachment.sig>
#10 lore raw

PATCH 4/4 arm: VCMA9: because of NOR flash space constrains, activate THUMB build mode

In reply to David Müller
---
 include/configs/VCMA9.h | 2 ++
 1 file changed, 2 insertions(+)
include/configs/VCMA9.h +2 -0
index 42af34f..de7d5c2 100644
@@ -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  */
Signature · 1 line
1.8.4
#11 lore raw

PATCH 4/4 arm: VCMA9: because of NOR flash space constrains, activate THUMB build mode

Quoted 1 line · David M?ller (ELSOFT AG)

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160215/96b3d86a/attachment.sig>