* [U-Boot] arm writel in v2010.03-rc1 generate wrong code
@ 2011-02-22 8:06 zzs213
2011-02-22 10:10 ` Jens Scharsig
0 siblings, 1 reply; 5+ messages in thread
From: zzs213 @ 2011-02-22 8:06 UTC (permalink / raw)
To: u-boot
My board is very similar to at91rm9200ek. I have a function to init nor flash bus, like this :
void gfd3000cdb_nor_hw_init(void)
{
at91_mc_t *mc = (at91_mc_t *)AT91_MC_BASE;
writel(CONFIG_SYS_EBI_CFGR_VAL, &(mc->ebi.cfgr));
writel(CONFIG_SYS_SMC_CSR0_VAL, &mc->smc.csr[0]);
}
Which render to the fllowing asm code :
20120f0c <gfd3000cdb_nor_hw_init>:
20120f0c: e3a01000 mov r1, #0 ; 0x0
20120f10: e3e0309b mvn r3, #155 ; 0x9b
20120f14: e5831000 str r1, [r3]
20120f18: e283309b add r3, r3, #155 ; 0x9b
20120f1c: e553208f ldrb r2, [r3, #-143]
20120f20: e3e0207b mvn r2, #123 ; 0x7b
20120f24: e543208f strb r2, [r3, #-143]
20120f28: e553208e ldrb r2, [r3, #-142]
20120f2c: e3a02032 mov r2, #50 ; 0x32
20120f30: e543208e strb r2, [r3, #-142]
20120f34: e553208d ldrb r2, [r3, #-141]
20120f38: e543108d strb r1, [r3, #-141]
20120f3c: e553208c ldrb r2, [r3, #-140]
20120f40: e543108c strb r1, [r3, #-140]
20120f44: e1a0f00e mov pc, lr
It can't work very obviously because it use the target address as four byte address, but my idea is write a 4bytes word
to the target address.
And the cpu dead when I download this code to the board.
Then I change the function to the flowwing form:
void gfd3000cdb_nor_hw_init(void)
{
at91_mc_t *mc = (at91_mc_t *)AT91_MC_BASE;
writel(CONFIG_SYS_EBI_CFGR_VAL, &(mc->ebi.cfgr));
writel(CONFIG_SYS_SMC_CSR0_VAL, (unsigned int)(&mc->smc.csr[0]));
}
It's asm code is :
20120f0c <gfd3000cdb_nor_hw_init>:
20120f0c: e3a02000 mov r2, #0 ; 0x0
20120f10: e3e0309b mvn r3, #155 ; 0x9b
20120f14: e5832000 str r2, [r3]
20120f18: e59f2008 ldr r2, [pc, #8] ; 20120f28 <gfd3000cdb_nor_hw_init+0x1c>
20120f1c: e283300c add r3, r3, #12 ; 0xc
20120f20: e5832000 str r2, [r3]
20120f24: e1a0f00e mov pc, lr
20120f28: 00003284 .word 0x00003284
It's ok. And the board say OK too.
My toolchain is eldk4.2
anybody help me!!
^ permalink raw reply [flat|nested] 5+ messages in thread* [U-Boot] arm writel in v2010.03-rc1 generate wrong code
2011-02-22 8:06 [U-Boot] arm writel in v2010.03-rc1 generate wrong code zzs213
@ 2011-02-22 10:10 ` Jens Scharsig
2011-02-22 11:19 ` zzs213
0 siblings, 1 reply; 5+ messages in thread
From: Jens Scharsig @ 2011-02-22 10:10 UTC (permalink / raw)
To: u-boot
Am 2011-02-22 09:06, schrieb zzs213:
> My board is very similar to at91rm9200ek. I have a function to init nor flash bus, like this :
>
> void gfd3000cdb_nor_hw_init(void)
> {
> at91_mc_t *mc = (at91_mc_t *)AT91_MC_BASE;
>
> writel(CONFIG_SYS_EBI_CFGR_VAL, &(mc->ebi.cfgr));
> writel(CONFIG_SYS_SMC_CSR0_VAL, &mc->smc.csr[0]);
> }
>
> Which render to the fllowing asm code :
>
> 20120f0c <gfd3000cdb_nor_hw_init>:
> 20120f0c: e3a01000 mov r1, #0 ; 0x0
> 20120f10: e3e0309b mvn r3, #155 ; 0x9b
> 20120f14: e5831000 str r1, [r3]
> 20120f18: e283309b add r3, r3, #155 ; 0x9b
> 20120f1c: e553208f ldrb r2, [r3, #-143]
> 20120f20: e3e0207b mvn r2, #123 ; 0x7b
> 20120f24: e543208f strb r2, [r3, #-143]
> 20120f28: e553208e ldrb r2, [r3, #-142]
> 20120f2c: e3a02032 mov r2, #50 ; 0x32
> 20120f30: e543208e strb r2, [r3, #-142]
> 20120f34: e553208d ldrb r2, [r3, #-141]
> 20120f38: e543108d strb r1, [r3, #-141]
> 20120f3c: e553208c ldrb r2, [r3, #-140]
> 20120f40: e543108c strb r1, [r3, #-140]
> 20120f44: e1a0f00e mov pc, lr
>
> It can't work very obviously because it use the target address as four byte address, but my idea is write a 4bytes word
> to the target address.
>
> And the cpu dead when I download this code to the board.
>
>
> Then I change the function to the flowwing form:
>
> void gfd3000cdb_nor_hw_init(void)
> {
> at91_mc_t *mc = (at91_mc_t *)AT91_MC_BASE;
>
> writel(CONFIG_SYS_EBI_CFGR_VAL, &(mc->ebi.cfgr));
> writel(CONFIG_SYS_SMC_CSR0_VAL, (unsigned int)(&mc->smc.csr[0]));
> }
>
> It's asm code is :
>
> 20120f0c <gfd3000cdb_nor_hw_init>:
> 20120f0c: e3a02000 mov r2, #0 ; 0x0
> 20120f10: e3e0309b mvn r3, #155 ; 0x9b
> 20120f14: e5832000 str r2, [r3]
> 20120f18: e59f2008 ldr r2, [pc, #8] ; 20120f28 <gfd3000cdb_nor_hw_init+0x1c>
> 20120f1c: e283300c add r3, r3, #12 ; 0xc
> 20120f20: e5832000 str r2, [r3]
> 20120f24: e1a0f00e mov pc, lr
> 20120f28: 00003284 .word 0x00003284
>
> It's ok. And the board say OK too.
>
> My toolchain is eldk4.2
>
> anybody help me!!
I think you need this patch
http://lists.denx.de/pipermail/u-boot/2010-December/084133.html
regards
Jens Scharsig
^ permalink raw reply [flat|nested] 5+ messages in thread* [U-Boot] arm writel in v2010.03-rc1 generate wrong code
2011-02-22 10:10 ` Jens Scharsig
@ 2011-02-22 11:19 ` zzs213
2011-02-22 12:42 ` Wolfgang Denk
0 siblings, 1 reply; 5+ messages in thread
From: zzs213 @ 2011-02-22 11:19 UTC (permalink / raw)
To: u-boot
>> anybody help me!!
>
>I think you need this patch
>
>http://lists.denx.de/pipermail/u-boot/2010-December/084133.html
>
Is there any other smoothly solution?
This patch makes my code differ from the main line,So I think it's not good enough.
regards
zzs213
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] arm writel in v2010.03-rc1 generate wrong code
2011-02-22 11:19 ` zzs213
@ 2011-02-22 12:42 ` Wolfgang Denk
2011-02-22 12:46 ` Albert ARIBAUD
0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Denk @ 2011-02-22 12:42 UTC (permalink / raw)
To: u-boot
Dear zzs213,
In message <747caca3.ef8a.12e4d18b2cb.Coremail.zzs213@126.com> you wrote:
>
> >I think you need this patch
> >
> >http://lists.denx.de/pipermail/u-boot/2010-December/084133.html
>
> Is there any other smoothly solution?
> This patch makes my code differ from the main line,So I think it's not good enough.
You can of course just wait until the patch has been accepted for
mainline, or until another solution has been developed.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
People have one thing in common: they are all different.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] arm writel in v2010.03-rc1 generate wrong code
2011-02-22 12:42 ` Wolfgang Denk
@ 2011-02-22 12:46 ` Albert ARIBAUD
0 siblings, 0 replies; 5+ messages in thread
From: Albert ARIBAUD @ 2011-02-22 12:46 UTC (permalink / raw)
To: u-boot
Le 22/02/2011 13:42, Wolfgang Denk a ?crit :
> Dear zzs213,
>
> In message<747caca3.ef8a.12e4d18b2cb.Coremail.zzs213@126.com> you wrote:
>>
>>> I think you need this patch
>>>
>>> http://lists.denx.de/pipermail/u-boot/2010-December/084133.html
>>
>> Is there any other smoothly solution?
>> This patch makes my code differ from the main line,So I think it's not good enough.
>
> You can of course just wait until the patch has been accepted for
> mainline, or until another solution has been developed.
Meanwhile, one can maintain a local copy of the U-Boot git repository
with a dedicated branch where this patch is added, and keep this branch
rebased on master.
> Best regards,
>
> Wolfgang Denk
Amicalement,
--
Albert.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-02-22 12:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-22 8:06 [U-Boot] arm writel in v2010.03-rc1 generate wrong code zzs213
2011-02-22 10:10 ` Jens Scharsig
2011-02-22 11:19 ` zzs213
2011-02-22 12:42 ` Wolfgang Denk
2011-02-22 12:46 ` Albert ARIBAUD
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox