public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] arm: timer_init() and bss (relocation)
@ 2011-01-22  6:07 Alexander Holler
  2011-01-22  6:38 ` John Rigby
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Holler @ 2011-01-22  6:07 UTC (permalink / raw)
  To: u-boot

Hello,

because I still have problems where I think the problem is the 
relocation, I've had a look at some timer code.

E.g. in arch/arm/cpu/arm926ejs/kirkwood/timer.c  on top there is

struct kwtmr_registers *kwtmr_regs = (struct kwtmr_registers 
*)KW_TIMER_BASE;

which is used in timer_init().

In arch/arm/cpu/armv7/omap-common/timer.c we have

static struct gptimer *timer_base = (struct gptimer *)CONFIG_SYS_TIMERBASE;

which is used in timer_init() too.

(I assume similiar code is used in more files, I've just had a look at 
those two.)

timer_init() is called in board_init_f() through init_sequence, that 
means before relocation.

Did I miss something, or I'm right that this is a problem because those 
two variables are stored in bss but are accessed before relocation?

Regards,

Alexander

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] arm: timer_init() and bss (relocation)
  2011-01-22  6:07 [U-Boot] arm: timer_init() and bss (relocation) Alexander Holler
@ 2011-01-22  6:38 ` John Rigby
  2011-01-22  7:13   ` Alexander Holler
  0 siblings, 1 reply; 5+ messages in thread
From: John Rigby @ 2011-01-22  6:38 UTC (permalink / raw)
  To: u-boot

On Fri, Jan 21, 2011 at 11:07 PM, Alexander Holler <holler@ahsoftware.de> wrote:
> Hello,
>
> because I still have problems where I think the problem is the
> relocation, I've had a look at some timer code.
>
> E.g. in arch/arm/cpu/arm926ejs/kirkwood/timer.c ?on top there is
>
> struct kwtmr_registers *kwtmr_regs = (struct kwtmr_registers
> *)KW_TIMER_BASE;
>
> which is used in timer_init().
>
> In arch/arm/cpu/armv7/omap-common/timer.c we have
>
> static struct gptimer *timer_base = (struct gptimer *)CONFIG_SYS_TIMERBASE;
>
> which is used in timer_init() too.
>
> (I assume similiar code is used in more files, I've just had a look at
> those two.)
>
> timer_init() is called in board_init_f() through init_sequence, that
> means before relocation.
>
> Did I miss something, or I'm right that this is a problem because those
> two variables are stored in bss but are accessed before relocation?
>
These are both initialized data so they do not go in bss.
> Regards,
>
> Alexander
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] arm: timer_init() and bss (relocation)
  2011-01-22  6:38 ` John Rigby
@ 2011-01-22  7:13   ` Alexander Holler
  2011-01-22  7:21     ` Reinhard Meyer
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Holler @ 2011-01-22  7:13 UTC (permalink / raw)
  To: u-boot

Am 22.01.2011 07:38, schrieb John Rigby:
> On Fri, Jan 21, 2011 at 11:07 PM, Alexander Holler<holler@ahsoftware.de>  wrote:
>> Hello,
>>
>> because I still have problems where I think the problem is the
>> relocation, I've had a look at some timer code.
>>
>> E.g. in arch/arm/cpu/arm926ejs/kirkwood/timer.c  on top there is
>>
>> struct kwtmr_registers *kwtmr_regs = (struct kwtmr_registers
>> *)KW_TIMER_BASE;
>>
>> which is used in timer_init().
>>
>> In arch/arm/cpu/armv7/omap-common/timer.c we have
>>
>> static struct gptimer *timer_base = (struct gptimer *)CONFIG_SYS_TIMERBASE;
>>
>> which is used in timer_init() too.
>>
>> (I assume similiar code is used in more files, I've just had a look at
>> those two.)
>>
>> timer_init() is called in board_init_f() through init_sequence, that
>> means before relocation.
>>
>> Did I miss something, or I'm right that this is a problem because those
>> two variables are stored in bss but are accessed before relocation?
>>
> These are both initialized data so they do not go in bss.

Correct, I should have a look into u-boot.map before writing this mail. 
Thanks for the pointer.

But this leads me to the question what happens with the stuff in the 
data section. Seems I should have again a look at the lowlevel stuff to 
understand that.

Thanks,

Alexander

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] arm: timer_init() and bss (relocation)
  2011-01-22  7:13   ` Alexander Holler
@ 2011-01-22  7:21     ` Reinhard Meyer
  2011-01-22  7:40       ` Albert ARIBAUD
  0 siblings, 1 reply; 5+ messages in thread
From: Reinhard Meyer @ 2011-01-22  7:21 UTC (permalink / raw)
  To: u-boot

Dear Alexander Holler,

> Am 22.01.2011 07:38, schrieb John Rigby:
>> On Fri, Jan 21, 2011 at 11:07 PM, Alexander Holler<holler@ahsoftware.de>   wrote:
>>> Hello,
>>>
>>> because I still have problems where I think the problem is the
>>> relocation, I've had a look at some timer code.
>>>
>>> E.g. in arch/arm/cpu/arm926ejs/kirkwood/timer.c  on top there is
>>>
>>> struct kwtmr_registers *kwtmr_regs = (struct kwtmr_registers
>>> *)KW_TIMER_BASE;
>>>
>>> which is used in timer_init().
>>>
>>> In arch/arm/cpu/armv7/omap-common/timer.c we have
>>>
>>> static struct gptimer *timer_base = (struct gptimer *)CONFIG_SYS_TIMERBASE;
>>>
>>> which is used in timer_init() too.
>>>
>>> (I assume similiar code is used in more files, I've just had a look at
>>> those two.)
>>>
>>> timer_init() is called in board_init_f() through init_sequence, that
>>> means before relocation.
>>>
>>> Did I miss something, or I'm right that this is a problem because those
>>> two variables are stored in bss but are accessed before relocation?
>>>
>> These are both initialized data so they do not go in bss.
>
> Correct, I should have a look into u-boot.map before writing this mail.
> Thanks for the pointer.
>
> But this leads me to the question what happens with the stuff in the
> data section. Seems I should have again a look at the lowlevel stuff to
> understand that.

Intuitively (without looking at the code) I would think that
CONST DATA is ok,
but non const, initialized data cannot work because it is not
initialized before relocation...

Best Regards,
Reinhard

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] arm: timer_init() and bss (relocation)
  2011-01-22  7:21     ` Reinhard Meyer
@ 2011-01-22  7:40       ` Albert ARIBAUD
  0 siblings, 0 replies; 5+ messages in thread
From: Albert ARIBAUD @ 2011-01-22  7:40 UTC (permalink / raw)
  To: u-boot

Le 22/01/2011 08:21, Reinhard Meyer a ?crit :

>> But this leads me to the question what happens with the stuff in the
>> data section. Seems I should have again a look at the lowlevel stuff to
>> understand that.
>
> Intuitively (without looking at the code) I would think that
> CONST DATA is ok,
> but non const, initialized data cannot work because it is not
> initialized before relocation...

To be precise:

1. const data are readable before and after relocation.

2. non-const initialized data are readable only until relocated, and 
then writable as well.

3. BSS data cannot and must not be used at all until relocated, and are 
then zeroed out before board_init_r() starts.

> Best Regards,
> Reinhard

Amicalement,
-- 
Albert.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-01-22  7:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-22  6:07 [U-Boot] arm: timer_init() and bss (relocation) Alexander Holler
2011-01-22  6:38 ` John Rigby
2011-01-22  7:13   ` Alexander Holler
2011-01-22  7:21     ` Reinhard Meyer
2011-01-22  7:40       ` Albert ARIBAUD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox