From: Reinhard Meyer Date: Sat, 22 Jan 2011 08:21:01 +0100 Subject: [U-Boot] arm: timer_init() and bss (relocation) In-Reply-To: <4D3A839E.6030109@ahsoftware.de> References: <4D3A743E.8010009@ahsoftware.de> <4D3A839E.6030109@ahsoftware.de> Message-ID: <4D3A855D.1060503@emk-elektronik.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Alexander Holler, > Am 22.01.2011 07:38, schrieb John Rigby: >> On Fri, Jan 21, 2011 at 11:07 PM, Alexander Holler 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