[U-Boot] [PATCH] arm1176: fix relocation

Darius Augulis
2010-10-25T07:47:07Z

Hello Heiko,

thanks for reviewing. ok, I will make patch to fix this bug in all arm*/start.S.

Darius.

On Mon, Oct 25, 2010 at 10:11 AM, Heiko Schocher <hs@denx.de> wrote:
> Hello Darius,
>
> Darius Augulis wrote:
>> On 10/24/2010 11:08 PM, Darius Augulis wrote:
>>> Fix relocation code for arm1176, do it like other ARM
>>> CPU's are doing.
>>> Tested only with CONFIG_SKIP_RELOCATE_UBOOT defined
>>> and using nand_spl (booting from nand). Test done on
>>> s3c6410 based board (not yet supported in main line).
>>>
>>> Signed-off-by: Darius Augulis<augulis.darius@gmail.com>
>>> ---
>>> ? arch/arm/cpu/arm1176/start.S ? ?| ?139 +++++++++++++++++++++++----------------
>>> ? arch/arm/cpu/arm1176/u-boot.lds | ? 15 +++-
>>> ? 2 files changed, 94 insertions(+), 60 deletions(-)
>>>
>>> diff --git a/arch/arm/cpu/arm1176/start.S b/arch/arm/cpu/arm1176/start.S
>>> index 24e5bf4..0d733f7 100644
>>> --- a/arch/arm/cpu/arm1176/start.S
>>> +++ b/arch/arm/cpu/arm1176/start.S
> [...]
>>> @@ -377,10 +402,9 @@ clbss_l:str ? ? r2, [r0] ? ? ? ? ? ? ? ?/* clear loop... ? ? ? ? ? ? ? ? ? ?*/
>>>
>>> ? _nand_boot: .word nand_boot
>>> ? #else
>>> - ? ?ldr ? ? r0, _TEXT_BASE
>>> - ? ?ldr ? ? r2, _board_init_r
>>> - ? ?sub ? ? r2, r2, r0
>>> - ? ?add ? ? r2, r2, r7 ? ? ?/* position from board_init_r in RAM */
>>> + ? ?ldr ? ? r0, _board_init_r_ofs
>>> + ? ?adr ? ? r1, _start
>>> + ? ?add ? ? r2, r0, r1
>>
>> RFC:
>> I've observed that other ARM CPU's are adding r9 to lr here (add ? ? lr,
>> r0, r9). Even though r9 is not pre-loaded with any value in case
>> CONFIG_SKIP_RELOCATE_UBOOT is defined. Is it bug or not?
>> Maybe it's not tested without CONFIG_SKIP_RELOCATE_UBOOT?
>> I've removed this line because uboot stops booting if it's there.
>> Any comments about it?
>
> Yep, thats a Bug, thanks for detecting this.
>
> But your fix seems to me, is not working for the case if
> CONFIG_SKIP_RELOCATE_UBOOT is !defined, because then you need this
> update of the lr register ... so could you please add this line
> with a "#if !defined(CONFIG_SKIP_RELOCATE_UBOOT)" ... "#endif"
> around it? (And maybe fix all other arm start.S files too?)
>
> bye,
> Heiko
> --
> DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
>