[U-Boot] Most ARM CPU's have buggy clear_bss?

Darius Augulis augulis.darius at gmail.com
Wed Oct 27 10:22:17 CEST 2010


Hi,

On Wed, Oct 27, 2010 at 11:01 AM, Sughosh Ganu <urwithsughosh at gmail.com> wrote:
> hi,
>
> On Wed Oct 27, 2010 at 10:26:06AM +0300, Darius Augulis wrote:
>
>> IMO, if relocation is skipped, r4 should be loaded with value of
>> _TEXT_BASE, not reloc address?
>> It seems like r3 is prepared for this but, it's somehow missing? It's
>> not used at all.
>> Maybe it could be reason why I'm facing strange problem, when after
>> relocating uboot with nand_spl no one command is not working.
>> I debugged that command table is empty. I think this ASM code clears
>> not bss area but something else.
>
>
> <snip>
>
>>
>> Also relocation code looks a bit strange:
>
>  <snip>
>
>> r0 is compared to r6, which contains reloc address. All instructions
>> between loading r0 and comparison are confusing, because they do not
>> impact comparison result.
>> Also they do not matter in clear_bss so I think would be great to
>> change code like this:
>>
>>         mov     sp, r4
>>
>>         adr     r0, _start
>>         cmp     r0, r6
>>         beq     clear_bss
>>         ldr     r2, _TEXT_BASE
>>         ldr     r3, _bss_start_ofs
>>         add     r2, r0, r3              /* r2 <- source end address         */
>>
>> Any comments are welcome!
>
>  Not sure which core are you referring to. I checked for arm926ejs,
>  and we have conditional code inclusion based on the definition of
>  CONFIG_SYS_ARM_WITHOUT_RELOC. So the start address in both the cases
>  is determined based on whether relocation is enabled or not.

The same is at least for arm926ejs, arm1136, arm1176.
As you probably know  CONFIG_SYS_ARM_WITHOUT_RELOC support will be
removed soon and I'm talking about code which is under
#ifndef  CONFIG_SYS_ARM_WITHOUT_RELOC.

Darius.

>
> -sughosh
>


More information about the U-Boot mailing list