* [U-Boot] Instructions in TEXT section can not load data from other section
@ 2010-03-16 8:37 jrjr
2010-03-16 8:50 ` Joakim Tjernlund
0 siblings, 1 reply; 9+ messages in thread
From: jrjr @ 2010-03-16 8:37 UTC (permalink / raw)
To: u-boot
Hi, everyone.
I have got a problem when I porting U-BOOT to my board
with MPC8247. My configuration file is based on the MPC8260ADS_config.
The problem is : The instruction in TEXT section can not load data in
other (DATA) sections. It seems there is a relocation to the data section .
For example: If I use
for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
if ((*init_fnc_ptr) () != 0) {
hang ();
}
}
I can't jump to functions in init_sequence[] ;
If I called functions such as get_clocks() in board_init_f , it works fine.
So the code in board_init_f can not load address in init_sequence[] , because
init_sequence[] is out of TEXT section.
The same thing happens with iop_conf_tab[][], and strings used by "puts".
Anyone there has the same problem? Or know the point? Pls help!
Great Great Thanks !
-----------------------------------------------------------
-JRJR
_________________________________________________________________
SkyDrive????????????????????????!
http://www.windowslive.cn/campaigns/e-magazine/ngmchina/?a=c
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] Instructions in TEXT section can not load data from other section
2010-03-16 8:37 [U-Boot] Instructions in TEXT section can not load data from other section jrjr
@ 2010-03-16 8:50 ` Joakim Tjernlund
2010-03-17 6:28 ` jrjr
0 siblings, 1 reply; 9+ messages in thread
From: Joakim Tjernlund @ 2010-03-16 8:50 UTC (permalink / raw)
To: u-boot
>
> Hi, everyone.
>
> I have got a problem when I porting U-BOOT to my board
>
> with MPC8247. My configuration file is based on the MPC8260ADS_config.
>
> The problem is : The instruction in TEXT section can not load data in
>
> other (DATA) sections. It seems there is a relocation to the data section .
>
> For example: If I use
>
> for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
> if ((*init_fnc_ptr) () != 0) {
> hang ();
> }
> }
>
> I can't jump to functions in init_sequence[] ;
>
> If I called functions such as get_clocks() in board_init_f , it works fine.
>
> So the code in board_init_f can not load address in init_sequence[] , because
>
> init_sequence[] is out of TEXT section.
>
> The same thing happens with iop_conf_tab[][], and strings used by "puts".
>
> Anyone there has the same problem? Or know the point? Pls help!
Yes, that is a relocation problem. Do you compile with -mrelocatable?
If so, you might have a broken toolchain that don't produce .fixups
jocke
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] Instructions in TEXT section can not load data from other section
2010-03-16 8:50 ` Joakim Tjernlund
@ 2010-03-17 6:28 ` jrjr
[not found] ` <OFDDD6C953.292271B8-ONC12576E9.0026AC5F-C12576E9.0026F24C@transmode.se>
0 siblings, 1 reply; 9+ messages in thread
From: jrjr @ 2010-03-17 6:28 UTC (permalink / raw)
To: u-boot
Thanks for your advise, I compile with -mrelocatable. If I remove this flag, Error is shown:
ERROR: Your compiler doesn't generate .fixup sections!
My host gcc is gcc 4.1.2 20080704 (Red Hat 4.1.2-44),
I try different toolchain:
powerpc-unknown-linux-gnu-gcc gcc version 4.4.3 (crosstool-NG-1.6.0)
ppc_82xx-gcc gcc version 4.2.2 from ELDK
powerpc-603-linux-gnu-gcc gcc version 4.1.0 from crosstool 0.43
The problem is still there : (
----------------------------------------------------
--JRJR
> Subject: Re: [U-Boot] Instructions in TEXT section can not load data from other section
> To: jason622 at hotmail.com
> CC: u-boot at lists.denx.de
> From: joakim.tjernlund at transmode.se
> Date: Tue, 16 Mar 2010 09:50:42 +0100
>
> >
> > Hi, everyone.
> >
> > I have got a problem when I porting U-BOOT to my board
> >
> > with MPC8247. My configuration file is based on the MPC8260ADS_config.
> >
> > The problem is : The instruction in TEXT section can not load data in
> >
> > other (DATA) sections. It seems there is a relocation to the data section .
> >
> > For example: If I use
> >
> > for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
> > if ((*init_fnc_ptr) () != 0) {
> > hang ();
> > }
> > }
> >
> > I can't jump to functions in init_sequence[] ;
> >
> > If I called functions such as get_clocks() in board_init_f , it works fine.
> >
> > So the code in board_init_f can not load address in init_sequence[] , because
> >
> > init_sequence[] is out of TEXT section.
> >
> > The same thing happens with iop_conf_tab[][], and strings used by "puts".
> >
> > Anyone there has the same problem? Or know the point? Pls help!
>
> Yes, that is a relocation problem. Do you compile with -mrelocatable?
> If so, you might have a broken toolchain that don't produce .fixups
>
> jocke
>
_________________________________________________________________
SkyDrive????????????????????????!
http://www.windowslive.cn/campaigns/e-magazine/ngmchina/?a=c
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] Instructions in TEXT section can not load data from other section
[not found] ` <OFDDD6C953.292271B8-ONC12576E9.0026AC5F-C12576E9.0026F24C@transmode.se>
@ 2010-03-17 8:18 ` jrjr
2010-03-17 8:45 ` jrjr
1 sibling, 0 replies; 9+ messages in thread
From: jrjr @ 2010-03-17 8:18 UTC (permalink / raw)
To: u-boot
jocke,
Thanks for your advise, my lds file is from cpu/mpc8260/u-boot.lds ; I don't change it.
Here is the fixup part:
------------------------------
.reloc :
{
*(.got)
_GOT2_TABLE_ = .;
*(.got2)
_FIXUP_TABLE_ = .;
*(.fixup)
}
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2;
__fixup_entries = (. - _FIXUP_TABLE_) >> 2;
--------------------------------------------
And my TEXT_BASE is 0xFFF80000 , because my boot flash is 0.5MB .
I can execute instructions in text section after power on reset.
Is there anything wrong with this configure?
Thanks for your help.
--JRJR
> Subject: RE: [U-Boot] Instructions in TEXT section can not load data from other section
> To: jason622 at hotmail.com
> CC: u-boot at lists.denx.de
> From: joakim.tjernlund at transmode.se
> Date: Wed, 17 Mar 2010 08:05:23 +0100
>
> jrjr <jason622@hotmail.com> wrote on 2010/03/17 07:28:04:
> >
> > Thanks for your advise, I compile with -mrelocatable. If I remove this flag,
> > Error is shown:
> >
> > ERROR: Your compiler doesn't generate .fixup sections!
> >
> > My host gcc is gcc 4.1.2 20080704 (Red Hat 4.1.2-44),
> > I try different toolchain:
> > powerpc-unknown-linux-gnu-gcc gcc version 4.4.3 (crosstool-NG-1.6.0)
> > ppc_82xx-gcc gcc version 4.2.2 from ELDK
> > powerpc-603-linux-gnu-gcc gcc version 4.1.0 from crosstool 0.43
> >
> > The problem is still there : (
> > ----------------------------------------------------
> > --JRJR
>
> Check your linker script(*.lds) for .fixup sections and compare
> that to a working working board.
> OR
> Your TEXT_BASE is wrong
>
> >
> >
> > > Subject: Re: [U-Boot] Instructions in TEXT section can not load data from
> > other section
> > > To: jason622 at hotmail.com
> > > CC: u-boot at lists.denx.de
> > > From: joakim.tjernlund at transmode.se
> > > Date: Tue, 16 Mar 2010 09:50:42 +0100
> > >
> > > >
> > > > Hi, everyone.
> > > >
> > > > I have got a problem when I porting U-BOOT to my board
> > > >
> > > > with MPC8247. My configuration file is based on the MPC8260ADS_config.
> > > >
> > > > The problem is : The instruction in TEXT section can not load data in
> > > >
> > > > other (DATA) sections. It seems there is a relocation to the data section .
> > > >
> > > > For example: If I use
> > > >
> > > > for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
> > > > if ((*init_fnc_ptr) () != 0) {
> > > > hang ();
> > > > }
> > > > }
> > > >
> > > > I can't jump to functions in init_sequence[] ;
> > > >
> > > > If I called functions such as get_clocks() in board_init_f , it works fine.
> > > >
> > > > So the code in board_init_f can not load address in init_sequence[] , because
> > > >
> > > > init_sequence[] is out of TEXT section.
> > > >
> > > > The same thing happens wit h iop_conf_tab[][], and strings used by "puts".
> > > >
> > > > Anyone there has the same problem? Or know the point? Pls help!
> > >
> > > Yes, that is a relocation problem. Do you compile with -mrelocatable?
> > > If so, you might have a broken toolchain that don't produce .fixups
> > >
> > > jocke
> > >
> >
> > ??+??+?? ??????,??MSN????! ?????
_________________________________________________________________
?????????????????msn?????
http://ditu.live.com/?form=TL&swm=1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] Instructions in TEXT section can not load data from other section
[not found] ` <OFDDD6C953.292271B8-ONC12576E9.0026AC5F-C12576E9.0026F24C@transmode.se>
2010-03-17 8:18 ` jrjr
@ 2010-03-17 8:45 ` jrjr
2010-03-17 8:48 ` Joakim Tjernlund
1 sibling, 1 reply; 9+ messages in thread
From: jrjr @ 2010-03-17 8:45 UTC (permalink / raw)
To: u-boot
And I have made some change in cpu/mpc8260/start.S, I removed following lines:
#ifndef CONFIG_SYS_RAMBOOT
/* When booting from ROM (Flash or EPROM), clear the */
/* Address Mask in OR0 so ROM appears everywhere */
/*--------------------------------------------------------------*/
lis r3, (CONFIG_SYS_IMMR+IM_REGBASE)@h
lwz r4, IM_OR0 at l(r3)
li r5, 0x7fff
and r4, r4, r5
stw r4, IM_OR0 at l(r3)
/* Calculate absolute address in FLASH and jump there */
/*--------------------------------------------------------------*/
lis r3, CONFIG_SYS_MONITOR_BASE at h
ori r3, r3, CONFIG_SYS_MONITOR_BASE at l
addi r3, r3, in_flash - _start + EXC_OFF_SYS_RESET
mtlr r3
blr
in_flash:
#endif /* CONFIG_SYS_RAMBOOT */
Becasue I don't think I need to clear the Address Mask in OR0, Is there anything wrong?
--JRJR
> Subject: RE: [U-Boot] Instructions in TEXT section can not load data from other section
> To: jason622 at hotmail.com
> CC: u-boot at lists.denx.de
> From: joakim.tjernlund at transmode.se
> Date: Wed, 17 Mar 2010 08:05:23 +0100
>
> jrjr <jason622@hotmail.com> wrote on 2010/03/17 07:28:04:
> >
> > Thanks for your advise, I compile with -mrelocatable. If I remove this flag,
> > Error is shown:
> >
> > ERROR: Your compiler doesn't generate .fixup sections!
> >
> > My host gcc is gcc 4.1.2 20080704 (Red Hat 4.1.2-44),
> > I try different toolchain:
> > powerpc-unknown-linux-gnu-gcc gcc version 4.4.3 (crosstool-NG-1.6.0)
> > ppc_82xx-gcc gcc version 4.2.2 from ELDK
> > powerpc-603-linux-gnu-gcc gcc version 4.1.0 from crosstool 0.43
> >
> > The problem is still there : (
> > ----------------------------------------------------
> > --JRJR
>
> Check your linker script(*.lds) for .fixup sections and compare
> that to a working working board.
> OR
> Your TEXT_BASE is wrong
>
> >
> >
> > > Subject: Re: [U-Boot] Instructions in TEXT section can not load data from
> > other section
> > > To: jason622 at hotmail.com
> > > CC: u-boot at lists.denx.de
> > > From: joakim.tjernlund at transmode.se
> > > Date: Tue, 16 Mar 2010 09:50:42 +0100
> > >
> > > >
> > > > Hi, everyone.
> > > >
> > > > I have got a problem when I porting U-BOOT to my board
> > > >
> > > > with MPC8247. My configuration file is based on the MPC8260ADS_config.
> > > >
> > > > The problem is : The instruction in TEXT section can not load data in
> > > >
> > > > other (DATA) sections. It seems there is a relocation to the data section .
> > > >
> > > > For example: If I use
> > > >
> > > > for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
> > > > if ((*init_fnc_ptr) () != 0) {
> > > > hang ();
> > > > }
> > > > }
> > > >
> > > > I can't jump to functions in init_sequence[] ;
> > > >
> > > > If I called functions such as get_clocks() in board_init_f , it works fine.
> > > >
> > > > So the code in board_init_f can not load address in init_sequence[] , because
> > > >
> > > > init_sequence[] is out of TEXT section.
> > > >
> > > > The same thing happens wit h iop_conf_tab[][], and strings used by "puts".
> > > >
> > > > Anyone there has the same problem? Or know the point? Pls help!
> > >
> > > Yes, that is a relocation problem. Do you compile with -mrelocatable?
> > > If so, you might have a broken toolchain that don't produce .fixups
> > >
> > > jocke
> > >
> >
> > ??+??+?? ??????,??MSN????! ?????
_________________________________________________________________
SkyDrive????????????????????????!
http://www.windowslive.cn/campaigns/e-magazine/ngmchina/?a=c
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] Instructions in TEXT section can not load data from other section
2010-03-17 8:45 ` jrjr
@ 2010-03-17 8:48 ` Joakim Tjernlund
2010-03-17 9:49 ` jrjr
0 siblings, 1 reply; 9+ messages in thread
From: Joakim Tjernlund @ 2010-03-17 8:48 UTC (permalink / raw)
To: u-boot
jrjr <jason622@hotmail.com> wrote on 2010/03/17 09:45:08:
>
> And I have made some change in cpu/mpc8260/start.S, I removed following lines:
>
> #ifndef CONFIG_SYS_RAMBOOT
> /* When booting from ROM (Flash or EPROM), clear the */
> /* Address Mask in OR0 so ROM appears everywhere */
> /*--------------------------------------------------------------*/
>
> lis r3, (CONFIG_SYS_IMMR+IM_REGBASE)@h
> lwz r4, IM_OR0 at l(r3)
> li r5, 0x7fff
> and r4, r4, r5
> stw r4, IM_OR0 at l(r3)
>
> /* Calculate absolute address in FLASH and jump there */
> /*--------------------------------------------------------------*/
>
> lis &nbs p; r3, CONFIG_SYS_MONITOR_BASE at h
> ori r3, r3, CONFIG_SYS_MONITOR_BASE at l
> addi r3, r3, in_flash - _start + EXC_OFF_SYS_RESET
> mtlr r3
> blr
>
> in_flash:
> #endif /* CONFIG_SYS_RAMBOOT */
>
> Becasue I don't think I need to clear the Address Mask in OR0, Is there anything wrong?
uhh, Why did you remove that? It is vital code, especially the
/* Calculate absolute address in FLASH and jump there */ part.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] Instructions in TEXT section can not load data from other section
2010-03-17 8:48 ` Joakim Tjernlund
@ 2010-03-17 9:49 ` jrjr
2010-03-17 9:56 ` Joakim Tjernlund
2010-03-17 17:47 ` Scott Wood
0 siblings, 2 replies; 9+ messages in thread
From: jrjr @ 2010-03-17 9:49 UTC (permalink / raw)
To: u-boot
Because I want to use LED controlled by OR3 to debug the code,so I don't want to clear OR0.
You remind me, so I enable the "Calculate absolute address in FLASH and jump there " part,
It seems that I get close to the point: jump to "in_flash:" failed.
Here is the start.S part:
/* Calculate absolute address in FLASH and jump there */
/*--------------------------------------------------------------*/
lis r3, CONFIG_SYS_MONITOR_BASE at h
ori r3, r3, CONFIG_SYS_MONITOR_BASE at l
addi r3, r3, in_flash - _start + EXC_OFF_SYS_RESET
mtlr r3
blr
in_flash:
...
...
The disassemble part :
fff80158: 3c 60 ff f8 lis r3,-8
fff8015c: 60 63 00 00 ori r3,r3,0 /*r3 is 0xfff80000 */
fff80160: 38 63 01 6c addi r3,r3,364 /* 0xfff8016c */
fff80164: 7c 68 03 a6 mtlr r3
fff80168: 4e 80 00 20 blr
fff8016c <in_flash>:
And my text_base is 0xfff80000.
Something is wrong with the "absolute address" and "relative address", I am not sure about
that. Expect for your advise.
--JRJR
> Subject: RE: [U-Boot] Instructions in TEXT section can not load data from other section
> To: jason622 at hotmail.com
> CC: u-boot at lists.denx.de
> From: joakim.tjernlund at transmode.se
> Date: Wed, 17 Mar 2010 09:48:42 +0100
>
> jrjr <jason622@hotmail.com> wrote on 2010/03/17 09:45:08:
> >
> > And I have made some change in cpu/mpc8260/start.S, I removed following lines:
> >
> > #ifndef CONFIG_SYS_RAMBOOT
> > /* When booting from ROM (Flash or EPROM), clear the */
> > /* Address Mask in OR0 so ROM appears everywhere */
> > /*--------------------------------------------------------------*/
> >
> > lis r3, (CONFIG_SYS_IMMR+IM_REGBASE)@h
> > lwz r4, IM_OR0 at l(r3)
> > li r5, 0x7fff
> > and r4, r4, r5
> > stw r4, IM_OR0 at l(r3)
> >
> > /* Calculate absolute address in FLASH and jump there */
> > /*--------------------------------------------------------------*/
> >
> > lis &nbs p; r3, CONFIG_SYS_MONITOR_BASE at h
> > ori r3, r3, CONFIG_SYS_MONITOR_BASE at l
> > addi r3, r3, in_flash - _start + EXC_OFF_SYS_RESET
> > mtlr r3
> > blr
> >
> > in_flash:
> > #endif /* CONFIG_SYS_RAMBOOT */
> >
> > Becasue I don't think I need to clear the Address Mask in OR0, Is there anything wrong?
>
> uhh, Why did you remove that? It is vital code, especially the
> /* Calculate absolute address in FLASH and jump there */ part.
>
_________________________________________________________________
MSN????????????????25???????????2010?????????
http://kaba.msn.com.cn/?k=1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] Instructions in TEXT section can not load data from other section
2010-03-17 9:49 ` jrjr
@ 2010-03-17 9:56 ` Joakim Tjernlund
2010-03-17 17:47 ` Scott Wood
1 sibling, 0 replies; 9+ messages in thread
From: Joakim Tjernlund @ 2010-03-17 9:56 UTC (permalink / raw)
To: u-boot
jrjr <jason622@hotmail.com> wrote on 2010/03/17 10:49:15:
>
> Because I want to use LED controlled by OR3 to debug the code,so I don't want
> to clear OR0.
>
> You remind me, so I enable the "Calculate absolute address in FLASH and jump
> there " part,
>
> It seems that I get close to the point: jump to "in_flash:" failed.
Did you read the comment?
/* When booting from ROM (Flash or EPROM), clear the */
/* Address Mask in OR0 so ROM appears everywhere */
Try with pristine source first.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] Instructions in TEXT section can not load data from other section
2010-03-17 9:49 ` jrjr
2010-03-17 9:56 ` Joakim Tjernlund
@ 2010-03-17 17:47 ` Scott Wood
1 sibling, 0 replies; 9+ messages in thread
From: Scott Wood @ 2010-03-17 17:47 UTC (permalink / raw)
To: u-boot
On Wed, Mar 17, 2010 at 09:49:15AM +0000, jrjr wrote:
>
> Because I want to use LED controlled by OR3 to debug the code,so I don't want to clear OR0.
It's temporary; you can use bank 3 after BRn/ORn are set to their final
values (confusingly named PRELIM) in cpu_init_f().
-Scott
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-03-17 17:47 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-16 8:37 [U-Boot] Instructions in TEXT section can not load data from other section jrjr
2010-03-16 8:50 ` Joakim Tjernlund
2010-03-17 6:28 ` jrjr
[not found] ` <OFDDD6C953.292271B8-ONC12576E9.0026AC5F-C12576E9.0026F24C@transmode.se>
2010-03-17 8:18 ` jrjr
2010-03-17 8:45 ` jrjr
2010-03-17 8:48 ` Joakim Tjernlund
2010-03-17 9:49 ` jrjr
2010-03-17 9:56 ` Joakim Tjernlund
2010-03-17 17:47 ` Scott Wood
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.