cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
rjw_999
Observer
Observer
1,651 Views
Registered: ‎05-04-2016

QSPI Flash flashcp flash_eraseall start not at offset 0

Jump to solution

when i use qspi flash with zynq and linux there is a strange question. i have two SD card systems which have the difference in boot.bin(means that they have the same linux images ,devicetrees, ramdisk images).when i use one of them, the qspi flash works well. the flash_eraseall tools shows:

flash_eraseall /dev/mtd0
Erasing 64 Kibyte @ 0 -  0% complete.random: nonblocking pool is initialized
Erasing 64 Kibyte @ f00000 - 100% complete.
the flashcp tool works well too.

but when i use another, i found that the flash_eraseall tool can not erase the flash mtd partition in right place. it allways start at 10000 not at 0.

flash_eraseall /dev/mtd0
Erasing 64 Kibyte @ 10000 -  0% complete.random: nonblocking pool is initialized
Erasing 64 Kibyte @ f00000 - 100% complete.

this means the first 10000 is not erased. the flashcp tool is not opeating properly too. when i copy a file into flash, i discover that the file is writen beginning at the offset 10000 too. the first 10000 is not updated.

the bootlog and /proc/mtd is the same between these two systems

6 ofpart partitions found on MTD device spi0.0
Creating 6 MTD partitions on "spi0.0":
0x000000000000-0x000000f00000 : "qspi-boot"
0x000000f00000-0x000001300000 : "qspi-linux"
0x000001300000-0x000001310000 : "qspi-device-tree"
0x000001310000-0x000001610000 : "qspi-rootfs"
0x000001610000-0x000001650000 : "qspi-uboot-env"
0x000001650000-0x000002000000 : "qspi-user"

zynq> cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00f00000 00010000 "qspi-boot"
mtd1: 00400000 00010000 "qspi-linux"
mtd2: 00010000 00010000 "qspi-device-tree"
mtd3: 00300000 00010000 "qspi-rootfs"
mtd4: 00040000 00010000 "qspi-uboot-env"
mtd5: 009b0000 00010000 "qspi-user"

i think there is a parameter in fsbl, uboot,or fpga to determine the start position of flash operation.but i don't have the source file of these two boot.bin files.

0 Kudos
Reply
1 Solution

Accepted Solutions
gudishak
Moderator
Moderator
2,141 Views
Registered: ‎06-27-2017

Hi,

 

You didn't mention which version of tools you are using. Please use below commands to program the flash at offset 0x0 in u-boot. Below commands will load file contents to DDR and then DDR to QSPI flash.

fatload mmc 0  100000 Boot.bin

sf probe 0 0 0
sf erase 0 3000000
sf write 100000 0 3000000

Best Regards
Kranthi
--------------------------
Don't forget to reply, kudo, and accept as solution.

View solution in original post

0 Kudos
Reply
2 Replies
gudishak
Moderator
Moderator
2,142 Views
Registered: ‎06-27-2017

Hi,

 

You didn't mention which version of tools you are using. Please use below commands to program the flash at offset 0x0 in u-boot. Below commands will load file contents to DDR and then DDR to QSPI flash.

fatload mmc 0  100000 Boot.bin

sf probe 0 0 0
sf erase 0 3000000
sf write 100000 0 3000000

Best Regards
Kranthi
--------------------------
Don't forget to reply, kudo, and accept as solution.

View solution in original post

0 Kudos
Reply
rjw_999
Observer
Observer
1,577 Views
Registered: ‎05-04-2016
thank you for your answer. i also discover that in U-Boot cmd sf can erase the right place of the flash mem. but in linux cmd flash_eraseall the erased place is wrong. i want to know why? i don't know any parameters which may decide the start writing position of the flash area.
0 Kudos
Reply