问题题背景描述:
335平台在 更换1gflash 型号后 ,有29F8G08ABABA 更换为29F8G08ABACA 后。部分flash 存在坏块。
用烧录器烧写后部分核心板不能能启动。但是用sd卡重新烧写系统后,核心板能正常启动。
基于此问题。领导交代任务,查出烧录器烧写不能启动原因所在,
此问题需要 生产协助
1,受限验证烧录器是否 可以检测检测坏块,和我们的uboot检测的坏块位置是否一致
通过在生产看 烧录器 检测和擦除flash 时 报的坏块和我能uboot 检测的坏块是一致的。
烧录器检测到nand坏块
此核心板sd卡启动检测坏块也是九个
Device 0 bad blocks:
00400000 /40000=0x10
0c280000 /40000=0x30a
32300000 ... c8c
37a80000 ... dea
39580000 ... e56
3bc80000 ... ef2
3de00000 ... f78
3ed00000 ... fb4
3ef80000 ... fbe
据此得出结论,烧录器检测坏块和我们的uboot检测坏块一致。第一个怀疑因素不成立。
坏块0x10 影响我们的uboot
2.从生产拿了两个烧录器烧写后不能启动和核心板。和烧录器烧写后能启动的核心板一块。
不能启动的核心板打印信息如下:
U-Boot SPL 2011.09 (Jul 02 2019 - 14:25:52)
Texas Instruments Revision detection unimplemented
Booting from NAND...
MT29F8G08
mkimage signature not found - ih_magic = ffffffff
Assuming u-boot.bin ..
MLO using backup u-boot.img
mkimage signature not found - ih_magic = 8081222c
Assuming u-boot.bin ..
通过上述问题,发现uboot 分区 和uboot备份分区读出的ih_magic 都是错误的,导致uboot镜像的校验失败,根本不能加载nand中的uboot镜像到内核。是什么问题提导致如此严重的问题? 我们可以看一下相应的分区的内用
根据上述能容 我们发现了烧录器的问题:
烧录器在制作母片时 ,将我们整个的nand 内容做为镜像文件内容。在往烧录器写镜像时 ,将我们镜像从flash 0 地址开始烧写。 当写到16块时地址0x400000 ,检测到是坏块,跳过,下一个块(0x440000)继续烧写,这就相当于后续的镜像内容的地址都会后移0x40000个地址。那么我们的主分区镜像就会在0x840000烧写。与我们看到的flash内容一致。
那我们uboot 读 nand的uboot的代码如下:
分析镜像头文件
经过分析,在主分区由于烧录器的原因导致我们不能 从主分区加载uboot 。那为什么备份分区的加载呢。
刚开始怀疑 是不是检测坏块功能失误到时
编译后 ,烧写看启动信息如下。U-Boot 2011.09 (Apr 13 2020 - 14:49:52)
I2C: ready
DRAM: 512 MiB
WARNING: Caches not enabled
Did not find a recognized configuration, assuming General purpose EVM in Profile 0 with Daughter board
NAND: HW ECC BCH16 Selected
U-Boot SPL 2011.09 (Apr 13 2020 - 14:49:52)
Texas Instruments Revision detection unimplemented
Booting from NAND...
MT29F8G08
*****off is 800000 block is 10,lastblock is10
block 10 is a good block
*****off is 800000 block is 10,lastblock is11
block 10 is a good block
*****off is 800000 block is 11,lastblock is11
block 11 is a good block
发现地址对,但是坏块地址不对坏块地址不对。 块大小256k 在0x800000 对应的地址应该32 ,而非16.
查看phys_erase_shift 地址设置。
移动19位,块大小位512k。
重新编译,烧写启动
U-Boot SPL 2011.09 (Apr 13 2020 - 14:49:52)
Texas Instruments Revision detection unimplemented
Booting from NAND...
MT29F8G08
*****off is 800000 block is 20,lastblock is20
block 20 is a good block
*****off is 800000 block is 20,lastblock is21
block 20 is a good block
*****off is 800000 block is 21,lastblock is21
block 21 is a good block
将800000 内容删除 ,备份分区可以启动
U-Boot 2011.09 (Apr 13 2020 - 14:49:52)
OK335X# nand erase 800000 200000
NAND erase: device 0 offset 0x800000, size 0x200000
OK
OK335X#
U-Boot SPL 2011.09 (Apr 13 2020 - 14:49:52)
Texas Instruments Revision detection unimplemented
Booting from NAND...
MT29F8G08
*****off is 800000 block is 20,lastblock is20
block 20 is a good block
mkimage signature not found - ih_magic = ffffffff
Assuming u-boot.bin ..
MLO using backup u-boot.img
*****off is 400000 block is 10,lastblock is10
block 10 is a bad block
*****off is 400000 block is 11,lastblock is11
block 11 is a good block
*****off is 400000 block is 10,lastblock is11
block 10 is a bad block
*****off is 400000 block is 11,lastblock is12
block 11 is a good block
*****off is 400000 block is 12,lastblock is12
block 12 is a good block
U-Boot 2011.09 (Apr 13 2020 - 14:49:52)
I2C: ready