Skip to contentSkip to conversation

Some puzzles on dram_size()

U-Boot-Users SAM SONG 4 participants 6 messages Jan 4, 2004 – Jan 5, 2004

lore
Share & tools
lore

SAM SONG

author
#0 lore raw

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

#1 lore raw
Quoted 3 lines · In message <[email protected]> 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?

Quoted 3 lines

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.

Quoted 3 lines

[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?

Quoted 3 lines

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

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
"It is better for civilization to be going down the drain than to  be
coming up it."                                          - Henry Allen
author
#2 lore raw

--- Wolfgang Denk <[email protected]> ????> In message

Quoted 8 lines
Quoted 3 lines

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;
    }
Quoted 8 lines
Quoted 1 line

[maxsize/sizeof(long)]/2.I changed save[]

dimension to

Quoted 2 lines

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.

Quoted 9 lines
Quoted 4 lines

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

#3 lore raw
Quoted 11 lines · In message <[email protected]> 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.

Quoted 9 lines

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.

Quoted 6 lines
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.

Quoted 5 lines
Quoted 2 lines

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);

Quoted 9 lines

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

Signature · 3 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
Machines take me by surprise with great frequency.      - Alan Turing
#4 lore raw

[U-Boot-Users] invalid rarp header on Coldfire..

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

#5 lore raw

[U-Boot-Users] invalid rarp header on Coldfire..

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

Quoted 28 lines · Richard Klingler

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 at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users