Skip to contentSkip to conversation

copy to flash ... outside available flash

U-Boot-Users Thomas Ruschival 5 participants 8 messages Nov 13, 2006 – Nov 14, 2006

lore
Share & tools
lore
#0 lore raw

Hi Group,
I am trying to install a Ramdiskimage into the flash of a TQM823L Board. Somehow it seems uboot has problems to copy a image lager than 0x100000 Bytes into flash. Here is my flashinfo:

Bank # 1: AMD AM29LV160B (16 Mbit, bottom boot sect)
Size: 4 MB in 35 Sectors
Sector Start Addresses:

    40000000 (RO) 40008000 (RO) 4000C000 (RO) 40010000 (RO) 40020000 (RO)
    40040000      40060000      40080000      400A0000      400C0000
    400E0000      40100000      40120000      40140000      40160000
    40180000      401A0000      401C0000      401E0000      40200000
    40220000      40240000      40260000      40280000      402A0000
    402C0000      402E0000      40300000      40320000      40340000
    40360000      40380000      403A0000      403C0000      403E0000

Bank # 2: AMD AM29LV160B (16 Mbit, bottom boot sect)
Size: 4 MB in 35 Sectors
Sector Start Addresses:

    40400000      40408000      4040C000      40410000      40420000
    40440000      40460000      40480000      404A0000      404C0000
    404E0000      40500000      40520000      40540000      40560000
    40580000      405A0000      405C0000      405E0000      40600000
    40620000      40640000      40660000      40680000      406A0000
    406C0000      406E0000      40700000      40720000      40740000
    40760000      40780000      407A0000      407C0000      407E0000

This means I have 8 MB o flash. I can copy a Block of 0xFFFFF Bytes from the RAM for example to 0x40100000. and I can copy the same Block to 0x40200000 or to 0x40300000.
But if I copy a block that is larger than 0xFFFFF to any location it claims that I copy outside available Flash. This is stupid and wrong. Ramdisk image size was 0x18CFC9
Baseaddress: 0x40100000
ramdisk size: + 0x0018CFC9
------------------------------
end address 0x4028CFC9

And this adress is surely not outside my flash. What is going on here?

BTW I use U-Boot 1.1.4 (Sep 18 2006 - 13:38:13) on a PPC823 with 16MB RAM and 8 MB Flash.

Thanks for any input!
Thomas

#1 lore raw

Hi Thomas,

u-boot-users-bounces at lists.sourceforge.net wrote on :
[...]

Quoted 12 lines

This means I have 8 MB o flash. I can copy a Block of 0xFFFFF Bytes from
the RAM for example to 0x40100000. and I can copy the same Block to 0x40200000 or to 0x40300000.
But if I copy a block that is larger than 0xFFFFF to any location it claims that I copy outside available Flash. This is stupid and wrong. Ramdisk image size was 0x18CFC9
Baseaddress: 0x40100000
ramdisk size: + 0x0018CFC9
------------------------------
end address 0x4028CFC9

Quoted 1 line

And this adress is surely not outside my flash. What is going on here?

Could you please post the commands you used to load the image and copy it to flash, including the returned error message?

Regards,
Martin

#2 lore raw
In reply to Thomas Ruschival

Hi Thomas,

Quoted 7 lines · Thomas Ruschival

Hi Group,
I am trying to install a Ramdiskimage into the flash of a TQM823L Board. Somehow it seems uboot has problems to copy a image lager than 0x100000 Bytes into flash. Here is my flashinfo:

Bank # 1: AMD AM29LV160B (16 Mbit, bottom boot sect)
Size: 4 MB in 35 Sectors

(snip)

Quoted 3 lines

Bank # 2: AMD AM29LV160B (16 Mbit, bottom boot sect)
Size: 4 MB in 35 Sectors
Sector Start Addresses:

What flash driver are you using? This is not the output from standard cfi_flash.c

Quoted 5 lines

This means I have 8 MB o flash. I can copy a Block of 0xFFFFF Bytes from the RAM for example to 0x40100000. and I can copy the same Block to 0x40200000 or to 0x40300000.
But if I copy a block that is larger than 0xFFFFF to any location it claims that I copy outside available Flash. This is stupid and wrong.

What is your exact cp command. Are you using cp.b or just cp? If you are using just cp your length is in multiples of dwords (4 bytes). Did you scale your size accordingly?

Also, I did not verify this but the cp command as it is implemented now probably requires the start and end address to reside in a single flash bank. Even if your two flashes have contiguous addresses assigned they are still two banks. If you need to copy to flash that spans over two banks you will probably need to split that into two operations.

Quoted 7 lines

Ramdisk image size was 0x18CFC9
Baseaddress: 0x40100000
ramdisk size: + 0x0018CFC9
------------------------------
end address 0x4028CFC9

And this adress is surely not outside my flash. What is going on here?

You are crossing flash banks and your write is not ending in the bank you started with.

Best regards,
Tolunay

#3 lore raw
Quoted 3 lines · In message <[email protected]> you wrote:

What flash driver are you using? This is not the output from standard cfi_flash.c

That's an old custom flash driver. IIRC, the very first one ever in U-Boot resp. PPCBoot.

Quoted 1 line

What is your exact cp command. Are you using cp.b or just cp? If you are

That's muy guess, too.

Quoted 5 lines

Also, I did not verify this but the cp command as it is implemented now probably requires the start and end address to reside in a single flash bank. Even if your two flashes have contiguous addresses assigned they are still two banks. If you need to copy to flash that spans over two banks you will probably need to split that into two operations.

No, this should NOT be necessary.

[And if it was, I'd consider it a bug.]

Best regards,

Wolfgang Denk

Signature · 5 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
When properly administered, vacations do not  diminish  productivity:
for every week you're away and get nothing done, there's another when
your boss is away and you get twice as much done.  -- Daniel B. Luten
#4 lore raw
In reply to Thomas Ruschival
Quoted 4 lines · In message <20061113115625.6c0d99ca@localhost> you wrote:

I am trying to install a Ramdiskimage into the flash of a TQM823L Board. Somehow it seems uboot has problems to copy a image lager than 0x100000 Bytes into flash. Here is my flashinfo:

No, it does not. At least not here.

Quoted 3 lines

This means I have 8 MB o flash. I can copy a Block of 0xFFFFF Bytes from the RAM for example to 0x40100000. and I can copy the same Block to 0x40200000 or to 0x40300000.

Right.

Quoted 9 lines

But if I copy a block that is larger than 0xFFFFF to any location it claims that I copy outside available Flash. This is stupid and wrong. Ramdisk image size was 0x18CFC9
Baseaddress: 0x40100000
ramdisk size: + 0x0018CFC9
------------------------------
end address 0x4028CFC9

And this adress is surely not outside my flash. What is going on here?

You must be doing something awfully wrong, like using "cp" instead of "cp.b". Unfortunately you don't provide the exact command you used, so I can only guess. But I bet a case of beer that it's a PEBKAC.

Best regards,

Wolfgang Denk

Signature · 3 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
panic: can't find /
#5 lore raw
In reply to Thomas Ruschival

Here are the commands I loaded the image with:
now I got a different error. It claim the flash wasn't erased?

1.) load image
loadb 100000
// here I am sending the image

## Total Size = 0x0018cfc9 = 1626057 Bytes
## Start Addr = 0x00100000

2.) Verify The Image
=> imi

## Checking Image at 00100000 ...

   Image Name:   Simple Embedded Linux Framework
   Created:      2005-06-07  12:59:15 UTC
   Image Type:   PowerPC Linux RAMDisk Image (gzip compressed)
   Data Size:    1625993 Bytes =  1.6 MB

Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK

3.) erase the flash
=> erase 40100000 403FFFFF
.............. done
Erased 24 sectors

4.) Copying the image
=> cp 100000 40100000 18cfc9
Copy to Flash... Flash not Erased

What is this?? Now I can't even copy things into flash. After copying for a while it brings this error.

Second attempt: istead of erasing 40100000 to 403FFFFF I erase what is needed :
=> erase 4010000 +18CFC9
...... done
Erased 13 sectors

=> cp 100000 40100000 18CFC9
Copy to Flash... Flash not Erased

I have no clue what is going on here?
Any input for me?

thanks in advance
Thomas

#6 lore raw

Hi,

did you read the answers from Wolfgang and others carefully?

Quoted 2 lines

4.) Copying the image
=> cp 100000 40100000 18cfc9

This will copy 6504228(633f24 = 4*18cfc9) bytes!

Please try:
=> cp.b 100000 40100000 18cfc9

Regards,
Torsten

#7 lore raw
In reply to Thomas Ruschival
Quoted 2 lines · In message <20061114104800.6dfba789@localhost> you wrote:

Here are the commands I loaded the image with:
now I got a different error. It claim the flash wasn't erased?

Correct error message.

Quoted 2 lines

=> cp 100000 40100000 18cfc9
Copy to Flash... Flash not Erased

Please RTFM about the correct use of the cp (resp. the cp.b) command.

Quoted 2 lines

I have no clue what is going on here?
Any input for me?

There were already two postings on this list which pointed out that you are using hte "cp" command with wrong length parameter.

Please RTFM!!!! (ideally *before* posting)

Best regards,

Wolfgang Denk

Signature · 7 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The alternative to genuflecting before the  god  of  code-bumming  is
finding  a  better  algorithm.  It should be clear that none such was
available. If your code is too slow, you must make it faster.  If  no
better algorithm is available, you must trim cycles.
                                 - td at alice.UUCP (Tom Duff) 29 Aug 88