[U-Boot-Users] Problem in writing downloaded image to NAND device
Stefan Roese
sr at denx.de
Tue Nov 27 10:23:58 CET 2007
On Tuesday 27 November 2007, Dharmosoth Seetharam wrote:
> I have a problem in writing to NAND device.
>
> U-Boot 1.2.0 (Nov 27 2007 - 13:18:12)
Please try to upgrade to a recent version of U-Boot. 1.3.0 was released just a
few days ago. Generally it is always recommended to use the most recent
U-Boot version.
> Board - atmel
> cpu - arm926ejs
> fs - cramfs
> Os - Linux, ARM based OS
>
> 64MB SDRAM and 256 MB NAND device.
>
> What i am trying to achieve is:
> To copy the downloaded kernel image and fs image
> to NAND device.
>
> What I have done is:
> 1) Downloaded the kernel image and fs image
> using tftp download command at U-Boot.
>
> *) tftp 0x22200000 kernel.img
>
> ## Checking Image at 22200000 ...
> Image Name: Linux 2.6.22
> Image Type: ARM Linux Kernel Image (uncompressed)
> Data Size: 1872572 Bytes = 1.8 MB
> Load Address: 20008000
> Entry Point: 20008000
> Verifying Checksum ... OK
> U-Boot>
>
> kernel image is downloaded to SDRAM.
>
> Now want to write this kernel image to NAND device.
> U-Boot> nand device
> Device 0: NAND 256MiB 3,3V 8-bit
>
> U-Boot> nand write 0x22200000 0x0 0x200000
> NAND write: device 0 offset 0x0, size 0x200000
> 2097152 bytes written: OK
Just try to read the image back into SDRAM and compare it to the original
version:
=> nand read 22400000 0 200000
=> cmp.b 22200000 22400000 200000
Does this match? But again it is not worth the effort to debug such a problem
in this older U-Boot version. Please upgrade. A lot changes in the NAND
driver too.
> U-Boot> nboot 0x22200000 0
> Loading from NAND 256MiB 3,3V 8-bit, offset 0x0
> Magic Number : 0x0 , required : 0x27051956
> Image Name:
> Image Type: Invalid CPU Invalid OS Invalid Image
> (uncompressed)
> Data Size: 0 Bytes = 0 kB
> Load Address: 00000000
> Entry Point: 00000000
> U-Boot>
>
>
> I have looked @ the code for NAND write
>
> nand_write() --> nand_write_ecc() -->
> nand_write_page() --> nand_write_buf() --> writeb()
>
> in nand_write_buf() :
>
> for (i=0; i<len; i++) {
> writeb(buf[i], this->IO_ADDR_W);
>
> << writeb is defined as
> (*(volatile unsigned char *)(a) = (v)) >>
>
> As per the above for loop every character (ie.
> buf[i])
> going to written @ the address this->IO_ADDR_W (??).
>
> But, What we need is, start address and len to
> write into the NAND device.
>
>
> Can you please look at this and help me in this
> regard.
>
> My main goal here is to write to NAND device.
>
> I wrote my own function to write to NAND device, but
> somehow they are getting modified once the command
> finishes the execution.
Don't write "own functions". Use the existing ones and fix them if necessary.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
More information about the U-Boot
mailing list