On Mon, Dec 19, 2011 at 10:43 PM, Wolfgang Denk <w...@denx.de> wrote:
> Dear Tom Rini,
>
> In message 
> <CA+M6bX=bbfbavm4ad2hvjflxovtgjmko9v40e+nywtmtoao...@mail.gmail.com> you 
> wrote:
>>
>> > 'i2c_base' is correctly located in SRAM but 'current_bus' and 
>> > 'bus_initialized'
>> > are located in CS0 SDRAM which is at the time of call not yet initalized. 
>> > This
>> > fits to the crash behaviour: Accessing 'i2c_base' does not cause trouble.
>> > How can I move 'current_bus' and 'bus_initialized' to SRAM?
>
> I guess you really, really must use i2c before relocation?  If
> possible, this should be avoided in the first place.

Yes, board rev detection to know how to configure SDRAM.

>> Ah-ha!  Good work.  If you initialize them to a non-zero value,
>> statically (and make sure the code doesn't assume they're 0 by
>> default), this will change.
>
> No, this is justy hiding the problem, and the next one who believes
> the value doesn't fit and changes it back to 0 runs into the issue
> again.  Rather use an explicit
>
>        int foo __attribute__ ((section(".data"))) = 0;
>
> so everybody sees the real intention.

And I'll hit up <linux/compiler.h> and see if there's a shortcut and
put it on my TODO list to clean up the existing areas (there's a few,
but commented at least) that have the same need, but set to non-zero
values.  Thanks!

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

Reply via email to