Hi Phil,

> -----Original Message-----
> From: Phil Edworthy [mailto:phil.edwor...@renesas.com]
> Sent: Friday, May 26, 2017 1:27 AM
> To: Vikas MANOCHA <vikas.mano...@st.com>
> Cc: Tom Rini <tr...@konsulko.com>; Kamil Lulko <kamil.lu...@gmail.com>; 
> u-boot@lists.denx.de; Albert Aribaud
> <albert.u.b...@aribaud.net>
> Subject: RE: [PATCH] armv7m: Fix larger builds
> 
> Hi Vikas,
> 
> On 26 May 2017 00:58 Vikas MANOCHA wrote:
> > On Thursday, May 25, 2017 6:58 AM Phil Edworthy wrote:
> > > On 25 May 2017 10:16 Phil Edworthy wrote:
> > > > > On 24 May 2017 18:32 Vikas MANOCHA wrote:
> > > > > Hi Phil,
> > > > >
> > > > > > On Wednesday, May 24, 2017 7:34 AM 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.edwor...@renesas.com>
> > > > > > ---
> > > > > >  arch/arm/cpu/armv7m/start.S | 3 ++-
> > > > > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > > > >
> > > > > > diff --git a/arch/arm/cpu/armv7m/start.S
> > > > b/arch/arm/cpu/armv7m/start.S
> > > > > > index 49f2720..d79adb5 100644
> > > > > > --- a/arch/arm/cpu/armv7m/start.S
> > > > > > +++ b/arch/arm/cpu/armv7m/start.S
> > > > > > @@ -8,7 +8,8 @@
> > > > > >  .globl     reset
> > > > > >  .type reset, %function
> > > > > >  reset:
> > > > > > -   b       _main
> > > > > > +   ldr     r0, =_main
> > > > > > +   mov     pc, r0
> > > > >
> > > > > How about using W(b) for wider range ?
> > > > Yes, that makes better sense!
> > > Hmm, if I use W(b) it complains with:
> > > arch/arm/cpu/armv7m/start.S:14:(.text+0x0): relocation truncated to
> > > fit: R_ARM_THM_JUMP11 against symbol `_main' defined in .text
> > > section in arch/arm/lib/built-in.o
> >
> > Seems like the generated branch instruction is still 16 bit, you can
> > check the disassembly.  Which compiler & version you are using ?
> > Are you getting the same issue with "b      _main" also. If no, compare the
> > disassembly.
> I'm using Linaro GCC 6.3-2017.02
> 
>       b       _main
> or
>       W(b)    _main
> Disassembly is the same:
>    0: e7fe            b.n     0 <_main>
> 
> The problem appears to be that __ASSEMBLY__ is defined and so in 
> arch/arm/include/asm/unified.h, W(x) does nothing.

__ASSEMBLY__ is fine, flag CONFIG_THUMB2_KERNEL is required.

> Having said
> that, if I simply change the code to
>       b.w     _main
> then I get a build error "Error: bad instruction `b.w _main'"

Here also flag CONFIG_ARM_ASM_UNIFIED is required for unified assembly.

Cheers,
Vikas

> 
> Sorry, I'm not very familiar with ARM asm :)
> 
> Thanks
> Phil
> 
> > Cheers,
> > Vikas
> >
> > >
> > > Any ideas why?
> > > Phil
> > >
> > > > Thanks
> > > > Phil
> > > >
> > > > > Cheers,
> > > > > Vikas
> > > > >
> > > > > >
> > > > > >  .globl     c_runtime_cpu_setup
> > > > > >  c_runtime_cpu_setup:
> > > > > > --
> > > > > > 2.7.4

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to