diff mbox

[U-Boot,v2] armv7m: Fix larger builds

Message ID 1496215625-25664-1-git-send-email-phil.edworthy@renesas.com
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

Phil Edworthy May 31, 2017, 7:27 a.m. UTC
The branch instruction only has an 11-bit relative target address, which
is sometimes not enough.

Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
---
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(-)

Comments

Vikas MANOCHA May 31, 2017, 1:08 p.m. UTC | #1
> On May 31, 2017, at 12:27 AM, Phil Edworthy <phil.edworthy@renesas.com> wrote:
> 
> The branch instruction only has an 11-bit relative target address, which
> is sometimes not enough.
> 
> Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>

Reviewed-by: Vikas Manocha <vikas.manocha@st.com>

Cheers,
Vikas

> ---
> 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(-)
> 
> diff --git a/arch/arm/cpu/armv7m/Makefile b/arch/arm/cpu/armv7m/Makefile
> index 257fc7f..df1fc95 100644
> --- a/arch/arm/cpu/armv7m/Makefile
> +++ b/arch/arm/cpu/armv7m/Makefile
> @@ -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
> diff --git a/arch/arm/cpu/armv7m/start.S b/arch/arm/cpu/armv7m/start.S
> index 49f2720..890c773 100644
> --- a/arch/arm/cpu/armv7m/start.S
> +++ b/arch/arm/cpu/armv7m/start.S
> @@ -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:
> -- 
> 2.7.4
>
Tom Rini May 31, 2017, 1:10 p.m. UTC | #2
On Wed, May 31, 2017 at 08:27:05AM +0100, Phil Edworthy wrote:

> The branch instruction only has an 11-bit relative target address, which
> is sometimes not enough.
> 
> Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
> ---
> 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(-)
> 
> diff --git a/arch/arm/cpu/armv7m/Makefile b/arch/arm/cpu/armv7m/Makefile
> index 257fc7f..df1fc95 100644
> --- a/arch/arm/cpu/armv7m/Makefile
> +++ b/arch/arm/cpu/armv7m/Makefile
> @@ -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!
Phil Edworthy May 31, 2017, 2:24 p.m. UTC | #3
Hi Tom,

On 31 May 2017 14:10 Tom Rini wrote:
> On Wed, May 31, 2017 at 08:27:05AM +0100, Phil Edworthy wrote:
> 
> > The branch instruction only has an 11-bit relative target address,
> > which is sometimes not enough.
> >
> > Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
> > ---
> > 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(-)
> >
> > diff --git a/arch/arm/cpu/armv7m/Makefile
> > b/arch/arm/cpu/armv7m/Makefile index 257fc7f..df1fc95 100644
> > --- a/arch/arm/cpu/armv7m/Makefile
> > +++ b/arch/arm/cpu/armv7m/Makefile
> > @@ -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

> --
> Tom
Tom Rini May 31, 2017, 2:27 p.m. UTC | #4
On Wed, May 31, 2017 at 02:24:13PM +0000, Phil Edworthy wrote:
> Hi Tom,
> 
> On 31 May 2017 14:10 Tom Rini wrote:
> > On Wed, May 31, 2017 at 08:27:05AM +0100, Phil Edworthy wrote:
> > 
> > > The branch instruction only has an 11-bit relative target address,
> > > which is sometimes not enough.
> > >
> > > Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
> > > ---
> > > 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(-)
> > >
> > > diff --git a/arch/arm/cpu/armv7m/Makefile
> > > b/arch/arm/cpu/armv7m/Makefile index 257fc7f..df1fc95 100644
> > > --- a/arch/arm/cpu/armv7m/Makefile
> > > +++ b/arch/arm/cpu/armv7m/Makefile
> > > @@ -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?

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.
diff mbox

Patch

diff --git a/arch/arm/cpu/armv7m/Makefile b/arch/arm/cpu/armv7m/Makefile
index 257fc7f..df1fc95 100644
--- a/arch/arm/cpu/armv7m/Makefile
+++ b/arch/arm/cpu/armv7m/Makefile
@@ -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
diff --git a/arch/arm/cpu/armv7m/start.S b/arch/arm/cpu/armv7m/start.S
index 49f2720..890c773 100644
--- a/arch/arm/cpu/armv7m/start.S
+++ b/arch/arm/cpu/armv7m/start.S
@@ -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: