Skip to contentSkip to conversation

armv7m: Fix larger builds

PATCH Superseded Phil Edworthy 3 participants 5 messages May 31, 2017 Arm (32-bit)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 armv7m: Fix larger builds

The branch instruction only has an 11-bit relative target address, which is sometimes not enough.

---
v2:
- Use W(b) instead of ldr+mov. Using this macro requires CONFIG_ARM_ASM_UNIFIED and CONFIG_THUMB2_KERNEL to be defined.

---
 arch/arm/cpu/armv7m/Makefile | 3 +++
 arch/arm/cpu/armv7m/start.S  | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)
arch/arm/cpu/armv7m/Makefile +3 -0
index 257fc7f..df1fc95 100644
@@ -8,3 +8,6 @@
 extra-y := start.o
 obj-y += cpu.o cache.o mpu.o
 obj-$(CONFIG_SYS_ARCH_TIMER) += systick-timer.o
+
+asflags-y += -DCONFIG_ARM_ASM_UNIFIED
+asflags-y += -DCONFIG_THUMB2_KERNEL
arch/arm/cpu/armv7m/start.S +3 -1
index 49f2720..890c773 100644
@@ -5,10 +5,12 @@
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
+#include <asm/assembler.h>
+
 .globl	reset
 .type reset, %function
 reset:
-	b	_main
+	W(b)	_main
 
 .globl	c_runtime_cpu_setup
 c_runtime_cpu_setup:
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/1 armv7m: Fix larger builds

Quoted 8 lines · Phil Edworthy

The branch instruction only has an 11-bit relative target address, which is sometimes not enough.

Cheers,
Vikas

Quoted 41 lines

---
v2:
- Use W(b) instead of ldr+mov. Using this macro requires CONFIG_ARM_ASM_UNIFIED and CONFIG_THUMB2_KERNEL to be defined.
---
arch/arm/cpu/armv7m/Makefile | 3 +++ arch/arm/cpu/armv7m/start.S | 4 +++-

2 files changed, 6 insertions(+), 1 deletion(-)
arch/arm/cpu/armv7m/Makefile +0 -0
index 257fc7f..df1fc95 100644
@@ -8,3 +8,6 @@

extra-y := start.o
obj-y += cpu.o cache.o mpu.o
obj-$(CONFIG_SYS_ARCH_TIMER) += systick-timer.o

arch/arm/cpu/armv7m/Makefile +3 -0
+
+asflags-y += -DCONFIG_ARM_ASM_UNIFIED
+asflags-y += -DCONFIG_THUMB2_KERNEL
arch/arm/cpu/armv7m/start.S +2 -0
index 49f2720..890c773 100644
@@ -5,10 +5,12 @@
 * SPDX-License-Identifier:    GPL-2.0+
 */
 
+#include <asm/assembler.h>
+

.globl reset
.type reset, %function
reset:

arch/arm/cpu/armv7m/start.S +1 -1
-    b    _main
+    W(b)    _main

.globl c_runtime_cpu_setup
c_runtime_cpu_setup:

Signature · 1 line
2.7.4
#2 lore raw

PATCH v2 1/1 armv7m: Fix larger builds

In reply to Phil Edworthy
Quoted 18 lines · Phil Edworthy

The branch instruction only has an 11-bit relative target address, which is sometimes not enough.

---
v2:
- Use W(b) instead of ldr+mov. Using this macro requires CONFIG_ARM_ASM_UNIFIED and CONFIG_THUMB2_KERNEL to be defined.

---
 arch/arm/cpu/armv7m/Makefile | 3 +++
 arch/arm/cpu/armv7m/start.S  | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)
arch/arm/cpu/armv7m/Makefile +0 -0
index 257fc7f..df1fc95 100644

arch/arm/cpu/armv7m/Makefile line 13

Quoted 6 lines
arch/arm/cpu/armv7m/Makefile +3 -0
@@ -8,3 +8,6 @@
 extra-y := start.o
 obj-y += cpu.o cache.o mpu.o
 obj-$(CONFIG_SYS_ARCH_TIMER) += systick-timer.o
+
+asflags-y += -DCONFIG_ARM_ASM_UNIFIED
+asflags-y += -DCONFIG_THUMB2_KERNEL

Lets move these two symbols to Kconfig and select them on CPU_V7M, thanks!

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

PATCH v2 1/1 armv7m: Fix larger builds

Hi Tom,

Quoted 16 lines · On 31 May 2017 14:10 Tom Rini wrote:
Quoted 8 lines · Phil Edworthy

The branch instruction only has an 11-bit relative target address, which is sometimes not enough.

---
v2:
- Use W(b) instead of ldr+mov. Using this macro requires CONFIG_ARM_ASM_UNIFIED and CONFIG_THUMB2_KERNEL to be

defined.

Quoted 5 lines
---
 arch/arm/cpu/armv7m/Makefile | 3 +++
 arch/arm/cpu/armv7m/start.S  | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)
Quoted 14 lines

arch/arm/cpu/armv7m/Makefile line 13

Quoted 11 lines
(quoted diff) +0 -0

b/arch/arm/cpu/armv7m/Makefile index 257fc7f..df1fc95 100644

arch/arm/cpu/armv7m/Makefile +3 -0
@@ -8,3 +8,6 @@
 extra-y := start.o
 obj-y += cpu.o cache.o mpu.o
 obj-$(CONFIG_SYS_ARCH_TIMER) += systick-timer.o
+
+asflags-y += -DCONFIG_ARM_ASM_UNIFIED asflags-y +=
+-DCONFIG_THUMB2_KERNEL

Lets move these two symbols to Kconfig and select them on CPU_V7M, thanks!

These two symbols come from Linux asm files that have been simply copied over to U-Boot, they are not configuration options in U-Boot. They are used by both CPU_V7M and others.

Perhaps I have misunderstood, but for non-CPU_V7M, since CONFIG_THUMB2_KERNEL depends on CONFIG_SYS_THUMB_BUILD, are you asking me to add Kconfig for CONFIG_SYS_THUMB_BUILD?

Thanks
Phil

Quoted 2 lines

--
Tom

#4 lore raw

PATCH v2 1/1 armv7m: Fix larger builds

Quoted 34 lines · Phil Edworthy

Hi Tom,

Quoted 16 lines · On 31 May 2017 14:10 Tom Rini wrote:
Quoted 8 lines · Phil Edworthy

The branch instruction only has an 11-bit relative target address, which is sometimes not enough.

---
v2:
- Use W(b) instead of ldr+mov. Using this macro requires CONFIG_ARM_ASM_UNIFIED and CONFIG_THUMB2_KERNEL to be

defined.

Quoted 5 lines
---
 arch/arm/cpu/armv7m/Makefile | 3 +++
 arch/arm/cpu/armv7m/start.S  | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)
Quoted 14 lines

arch/arm/cpu/armv7m/Makefile line 13

Quoted 11 lines
(quoted diff) +0 -0

b/arch/arm/cpu/armv7m/Makefile index 257fc7f..df1fc95 100644

arch/arm/cpu/armv7m/Makefile +3 -0
@@ -8,3 +8,6 @@
 extra-y := start.o
 obj-y += cpu.o cache.o mpu.o
 obj-$(CONFIG_SYS_ARCH_TIMER) += systick-timer.o
+
+asflags-y += -DCONFIG_ARM_ASM_UNIFIED asflags-y +=
+-DCONFIG_THUMB2_KERNEL

Lets move these two symbols to Kconfig and select them on CPU_V7M, thanks!

Quoted 7 lines

These two symbols come from Linux asm files that have been simply copied over to U-Boot, they are not configuration options in U-Boot. They are used by both CPU_V7M and others.

Perhaps I have misunderstood, but for non-CPU_V7M, since CONFIG_THUMB2_KERNEL depends on CONFIG_SYS_THUMB_BUILD, are you asking me to add Kconfig for CONFIG_SYS_THUMB_BUILD?

No, I'm saying that CONFIG_ARM_ASM_UNIFIED and CONFIG_THUMB2_KERNEL need to get moved to arch/arm/Kconfig and select'd by CPU_V7M, with a comment about how we need these for compatibility with files we copy from the Linux kernel. Then they will be defined automatically.

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