[U-Boot-Users] Some puzzles on dram_size()

Hi,
Sorry for sending the same topic mail again.Pls delet the former mail with the same topic for my mistaken operation.
When porting u-boot on LITE_DW,I found that the following code in RPXlite.c couldn't get through.I traced the code by BDI2000 and DDD and knew that the problem perhaps was save[32].In the "for" cycle,the dimension of save[] must beyond 32 limit by [maxsize/sizeof(long)]/2.I changed save[] dimension to big enough but still in vain.I don't know why.Finally,I masked the following code and booted successfully.How does the following code work normally?If I masked the code,is there any potential danger?
ulong save[32];
for (cnt = maxsize/sizeof(long); cnt > 0; cnt >>= 1) { addr = base + cnt; /* pointer arith! */ save[i++] = *addr; *addr = ~cnt; } /* write 0 to base address */ addr = base; save[i] = *addr; *addr = 0;
/* check at base address */ if ((val = *addr) != 0) { *addr = save[i]; return (0); }
for (cnt = 1; cnt <= maxsize/sizeof(long); cnt <<= 1) { addr = base + cnt; /* pointer arith! */
val = *addr; *addr = save[--i];
if (val != (~cnt)) { return (cnt * sizeof(long)); } }
Best regards,
Sam Song
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

In message 20040104064134.64840.qmail@web15209.mail.bjs.yahoo.com you wrote:
When porting u-boot on LITE_DW,I found that the following code in RPXlite.c couldn't get through.I
Can you please be a bit more specific? What does "couldn't get through" mean? Bad results? Crash? Which error / crash dump messages?
traced the code by BDI2000 and DDD and knew that the problem perhaps was save[32].In the "for" cycle,the dimension of save[] must beyond 32 limit by
THis is impossible on a 32 bit system. You definitely don't have that much RAM on your box.
[maxsize/sizeof(long)]/2.I changed save[] dimension to big enough but still in vain.I don't know why.Finally,I masked the following code and booted
How big is your SDRAM_MAX_SIZE #defined? And how big is your actual RAM?
successfully.How does the following code work normally?If I masked the code,is there any potential danger?
The code works fine on all systems I know. If you remove it, you lose the feature that U-0Boot automatically adjusts itself to different RAM sizes.
Best regards,
Wolfgang Denk

--- Wolfgang Denk wd@denx.de 的正文:> In message
When porting u-boot on LITE_DW,I found that the following code in RPXlite.c couldn't get through.I
Can you please be a bit more specific? What does "couldn't get through" mean? Bad results? Crash? Which error / crash dump messages?
I did a test again and get the following result:
(gdb) b dram_size Breakpoint 6 at 0xff012f38: file RPXlite.c, line 199. (gdb) c
Breakpoint 6, dram_size (mamr_value=546328576, base=0x0, maxsize=67108864) at RPXlite.c:199 (gdb) d b (gdb) step (gdb) step (gdb) step (gdb) step (gdb) step (gdb) step (gdb) step
Program received signal SIGSTOP, Stopped (signal). 0x00001000 in ?? () (gdb)
By DDD,I could see the code executed to the following cycle and hanged after one cycle.At the same time,cnt and maxsize equal to 16777216 and 67108864 respectively.
for (cnt = maxsize/sizeof(long); cnt > 0; cnt >>= 1) { addr = base + cnt; /* pointer arith! */ save[i++] = *addr; *addr = ~cnt; }
[maxsize/sizeof(long)]/2.I changed save[]
dimension to
big enough but still in vain.I don't know why.Finally,I masked the following code and booted
How big is your SDRAM_MAX_SIZE #defined? And how big is your actual RAM?
I set SDRAM_MAX_SIZE as 0x04000000 according to two MT48LC16M16A2TG-75 on LITE_DW.
successfully.How does the following code work normally?If I masked the code,is there any potential danger?
The code works fine on all systems I know. If you remove it, you lose the feature that U-Boot itself to different RAM sizes.
Thank you for your notes.Actually,I cannot help suspect that address multiplexing on LITE_DW makes the problems.I notice that A6mpc is connected to A12sd but A8mpc and A7mpc linking BA0sd and BA1sd on LITE_DW.Some documents from Micron Technical Notes,howerever, say the MSB for the SDRAM are the bank address lines BA1 and BA0.I am a little confused by these authoritative reference.Which one is better for practice?Is it related with above phenomenon?
Best regards,
Sam Song
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

In message 20040105064054.54073.qmail@web15201.mail.bjs.yahoo.com you wrote:
Breakpoint 6, dram_size (mamr_value=546328576, base=0x0, maxsize=67108864) at RPXlite.c:199 (gdb) d b (gdb) step (gdb) step (gdb) step (gdb) step (gdb) step (gdb) step (gdb) step
Instead of using DDD where nobody can see what's going on it would have been much more useful to use plain GDB so we could see at which line this happened. Also, setting "d/i $pc" is usually very useful.
Program received signal SIGSTOP, Stopped (signal). 0x00001000 in ?? () (gdb)
By DDD,I could see the code executed to the following cycle and hanged after one cycle.At the same time,cnt and maxsize equal to 16777216 and 67108864 respectively.
for (cnt = maxsize/sizeof(long); cnt > 0; cnt >>= 1) { addr = base + cnt; /* pointer arith! */ save[i++] = *addr; *addr = ~cnt; }
Really? With just 8 steps I would think you should not be able to perform the init part of the function plus two full loops through the loop.
How big is your SDRAM_MAX_SIZE #defined? And how big is your actual RAM?
I set SDRAM_MAX_SIZE as 0x04000000 according to two MT48LC16M16A2TG£75 on LITE_DW.
So it seems the problem hapens when you actually access the RAM for the first time. The previous cycles through the test loop were still outside the available RAM area (testing at 64 MB and 32 MB);
Thank you for your notes.Actually,I cannot help suspect that address multiplexing on LITE_DW makes the problems.I notice that A6mpc is connected to A12sd but A8mpc and A7mpc linking BA0sd and BA1sd on LITE_DW.Some documents from Micron Technical Notes,howerever, say the MSB for the SDRAM are the bank address lines BA1 and BA0.I am a little confused by these authoritative reference.Which one is better for practice?Is it related with above phenomenon?
Sorry, but I don't know anything about the RPXlite hardware.
Best regards,
Wolfgang Denk

Evening (o;
Tested the latest mcf5272 code.... (with own loader code so I need to compile only one package ;o)
(32MB SDRAM, 8MB flash, LSI L80227 PHY)
Get many "RARP invalid header" messages for tftp downloads.... Thought shouldn't be much difference in net code between ppcboot and u-boot...
Someone else experiencing this?
riku

Hi Rick,
I experienced the problems, too. They are probably caused by the timer functions. You get wrong timeouts and therefore errors.
I spent some time in the last weeks in porting u-boot 1.0.0 to the mcf5272. This port contains also new interrupt driven timer functions.
Unfortunately my port differs from Bernhards coldfire patches which are already added to the u-boot CVS tree. Yesterday, I sent a patch to Wolfgang and Bernhard to look at it. If you are interested in, I can send you the code, too.
Regards,
Josef
On Monday 05 January 2004 17:35, Richard Klingler wrote:
Evening (o;
Tested the latest mcf5272 code.... (with own loader code so I need to compile only one package ;o)
(32MB SDRAM, 8MB flash, LSI L80227 PHY)
Get many "RARP invalid header" messages for tftp downloads.... Thought shouldn't be much difference in net code between ppcboot and u-boot...
Someone else experiencing this?
riku
This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click _______________________________________________ U-Boot-Users mailing list U-Boot-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/u-boot-users
participants (4)
-
Josef Baumgartner
-
Richard Klingler
-
SAM SONG
-
Wolfgang Denk