您尚未登录。

楼主 # 2024-01-10 11:24:33

917346285aa
会员
注册时间: 2022-02-05
已发帖子: 10
积分: 0

{求助帖}全志A13烧录u-boot到NAND Flash不能启动

闲鱼掏了一块板子 主控是用的全志A13 不能插TF卡,只有板载的NandFlash型号是H27UBG8T2BTR查到了规格书是4G的,原来上边的系统跑的是Tina Linux,后来自己提取了设备树,想着自己刷一个u-boot,结果烧录了以后不能启动,串口没有输出.u-boot版本是sunxi哪个论坛下载的 分支是nano-v2018.01,烧录方法就是先用sunxi-tools工具把相应bin加载到内存然后启动

sudo sunxi-fel spl spl/sunxi-spl.bin
sudo sunxi-fel write 0x4a000000 u-boot-dtb.bin
sudo sunxi-fel write 0x43000000 spl/sunxi-spl-with-ecc.bin
sudo sunxi-fel exe 0x4a000000

使用工具可以启动进入uboot打印日志如下:

U-Boot SPL 2018.01-05679-g013ca457fd-dirty (Jan 10 2024 - 11:04:07)
DRAM: 512 MiB
Failed to set core voltage! Can't set CPU frequency
Trying to boot from FEL


U-Boot 2018.01-05679-g013ca457fd-dirty (Jan 10 2024 - 11:04:07 +0800) Allwinner Technology

CPU:   Allwinner A13 (SUN5I)
Model: YCDL Xiaobai
I2C:   ready
DRAM:  512 MiB
NAND:  4096 MiB
In:    serial
Out:   serial
Err:   serial
Allwinner mUSB OTG (Peripheral)
Net:   eth0: usb_ether
Hit any key to stop autoboot:  0
hello boy
=>

使用nand相关命令可以看到NandFlash的相关信息

=> nand info

Device 0: nand0, sector size 2048 KiB
  Page size       8192 b
  OOB size         640 b
  Erase size   2097152 b
  subpagesize     8192 b                                                                                                                              
  options     0x40007200                                                                                                                             
  bbt options 0x00070000 
                                                                                                                                                                                                
=> mtd
device nand0 <sunxi-nand.0>, # parts = 4 
#: name                 size            offset          mask_flags                                                                                     
0: spl                     0x00200000      0x00000000      0   
1: uboot-env           0x00200000      0x00200000      0    
2: uboot                 0x00200000      0x00400000      0    
3: UBI                    0xffa00000        0x00600000      0   

先擦除再写入

=> nand erase.part spl
NAND erase.part: device 0 offset 0x0, size 0x200000  
Erasing at 0x0 -- 100% complete.              
OK 

=> nand write.raw.noverify 0x43000000 0x0 20                      
NAND write:  282624 bytes written: OK    
=>

根据NandFlash的规格书,一页是8K,bin文件大小是132k所以写16页就够了,这里我写了20页
- Page size : (8K+640spare)bytes
- Block size : (2048K+160K)bytes
- Plane size : 1024blocks
- Device size : 2048blocks

按道理讲这不就是已经把spl写入了nand了吗,可是重启以后控制台没有输出,直接进入fel模式了.有没有大佬能指点一下,小白一个很多东西都不懂.....

下面是我修改过的文件
1.添加了一条内容在uboot/drivers/mtd/nand/nand_ids.c

        {"H27UBG8T2BTR-BC 32G 3.3V 8-bit",
                { .id = {0xad, 0xd7, 0x94, 0xda, 0x74, 0xc3} },
                  SZ_8K, SZ_4K, SZ_2M, NAND_NEED_SCRAMBLING, 6, 640, NAND_ECC_INFO(40, SZ_1K), 0 },

2.设备树的nfc节点内容主要是修改了nand-ecc-strength nand-ecc-step-size

&nfc {
        pinctrl-names = "default";
        pinctrl-0 = <&nand_pins_a &nand_cs0_pins_a &nand_rb0_pins_a>;
        status = "okay";

        nand@0 {
                #address-cells = <2>;
                #size-cells = <2>;
                reg = <0>;
                allwinner,rb = <0>;
                nand-ecc-mode = "hw";
                nand-on-flash-bbt;

                onfi,nand-timing-mode = <0x1f>;
                nand-ecc-strength = <40>;
                nand-ecc-step-size = <1024>;

                partitions {
                        compatible = "fixed-partitions";
                        #address-cells = <2>;
                        #size-cells = <2>;
                        partition@0 {
                                label = "spl";
                                reg = <0x0 0x0 0x0 0x200000>;
                        };
                        partition@200000 {
                                label = "uboot-env";
                                reg = <0x0 0x200000 0x0 0x200000>;
                        };
                        partition@400000 {
                                label = "uboot";
                                reg = <0x0 0x400000 0x0 0x200000>;
                        };
                        partition@600000 {
                                label = "UBI";
                                reg = <0x0 0x600000 0x1 0xff000000>;
                        };
                };
        };
};

我查了一下感觉问题可能是出在ecc校验的环节 但是不知道怎么改....

离线

楼主 #1 2024-01-26 15:35:13

917346285aa
会员
注册时间: 2022-02-05
已发帖子: 10
积分: 0

Re: {求助帖}全志A13烧录u-boot到NAND Flash不能启动

问题解决了,原来是Page size设置错了,一不小心多打了一个0导致编译的sunxi-spl-with-ecc.bin体积大了很多.....

最近编辑记录 917346285aa (2024-01-26 15:35:25)

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn