• mini2440移植uboot 2014.04(五)


    代码上传到github上:https://github.com/qiaoyuguo/u-boot-2014.04-mini2440

    前几篇博文: 《mini2440移植uboot 2014.04(一)

                          《mini2440移植uboot 2014.04(二)

                          《mini2440移植uboot 2014.04(三)

                          《mini2440移植uboot 2014.04(四)

    (九)修改nand flash代码错误(代码中一些错误修正):

    用tftp将uboot加载到mini2440,然后nand erase擦除nand flash,然后再用nand write写入到nand flash后,重新加载uboot,结果又出现了下面的错误(前面已经出现过一次):

    Flash: fwc addr 00000000 cmd f0 00f0 16bit x 16 bit
    fwc addr 0000aaaa cmd aa 00aa 16bit x 16 bit
    fwc addr 00005554 cmd 55 0055 16bit x 16 bit
    fwc addr 0000aaaa cmd 90 0090 16bit x 16 bit
    fwc addr 00000000 cmd f0 00f0 16bit x 16 bit
    JEDEC PROBE: ID f0 ffff 0
    fwc addr 00000000 cmd ff 00ff 16bit x 16 bit
    fwc addr 00000000 cmd 90 0090 16bit x 16 bit
    fwc addr 00000000 cmd ff 00ff 16bit x 16 bit
    JEDEC PROBE: ID 90 ffff 0
    *** failed ***
    ### ERROR ### Please RESET the board ###

    如果将include/configs/mini2440.h中的#define DEBUG注释掉,显示信息如下:

    U-Boot 2014.04-gb749c10-dirty (Jun 06 2014 - 09:20:31)
    
    CPUID: 32440001
    FCLK:      405 MHz
    HCLK:  101.250 MHz
    PCLK:   50.625 MHz
    DRAM:  64 MiB
    WARNING: Caches not enabled
    Flash: *** failed ***
    ### ERROR ### Please RESET the board ###

    再次出现了无法检测nor flash的情况.

    暂时先将官方uboot烧写到开发板(先擦除整个nand flash,然后烧写官方uboot)。

    然后打开三个控制台,一个执行"sudo minicom",另一个执行"openocd -f interface/jlink.cfg -f board/mini2440.cfg",最后一个控制台执行下面内容:

    telnet localhost 4444
    reset
    init_2440
    nand probe 0
    nand erase 0
    nand write 0  /home/host/soft/mini2440/u-boot/u-boot.bin 0   reset

    在minicom所在控制台上可以正常显示和进入uboot。

    执行nand write命令需要很长时间,下面是执行该命令的输出信息:

    wrote file /home/host/soft/mini2440/u-boot/u-boot.bin to NAND flash 0 up to offset 0x00038800 in 706.817383s (0.320 Ki/s)

    231KB的文件足足花了十多分钟,我差点以为telnet命令挂掉了。


    修改下面代码(drivers/mtd/nand/s3c2410_nand.c):

    #if defined(CONFIG_S3C2440)
                    if (ctrl & NAND_NCE)
    -                       writel(readl(&nand->nfconf) & ~S3C2410_NFCONT_nFCE,
    -                              &nand->nfconf);
    +                       
    +                              &nand->nfcont);
                    else
    -                       writel(readl(&nand->nfconf) | S3C2410_NFCONT_nFCE,
    -                              &nand->nfconf);
    +                       writel(readl(&nand->nfcont) | S3C2410_NFCONT_nFCE,
    +                              &nand->nfcont);
            }

     #if defined(CONFIG_S3C2440)
    -       writel(readl(&nand->nfconf) | S3C2410_NFCONT_INITECC, &nand->nfconf);
    +       writel(readl(&nand->nfcont) | S3C2410_NFCONT_INITECC, &nand->nfcont);
     #endif

    '-'号表示需要删除的代码行,'+'号表示需要添加的代码行。

    修改代码后重新编译:

    make CROSS_COMPILE=arm-linux-

    执行下面命令加载uboot文件:

    reset
    init_2440
    load_image /home/host/soft/mini2440/u-boot-2014.04/u-boot.bin 0x33e80000 bin 
    resume 0x33e80000   

    在minicom中得到下面输出信息后就重启系统了:

    U-Boot 2014.04-gb749c10-dirty (Jun 30 2014 - 09:51:24)
    
    U-Boot code: 33E80000 -> 33EFA3D8  BSS: -> 33F48ED0
    CPUID: 32440001
    FCLK:      405 MHz
    HCLK:  101.250 MHz
    PCLK:   50.625 MHz
    monitor len: 000C8ED0
    ramsize: 04000000
    TLB table from 33ff0000 to 33ff4000
    Top of RAM usable for U-Boot at: 33ff0000
    Reserving 803k for U-Boot at: 33f27000
    Reserving 4160k for malloc() at: 33b17000
    Reserving 32 Bytes for Board Info at: 33b16fe0
    Reserving 160 Bytes for Global Data at: 33b16f40
    New Stack Pointer is: 33b16f30
    RAM Configuration:
    Bank #0: 30000000 64 MiB
    addr=33f27000,_start=33e80000
    relocation Offset is: 000a7000
    WARNING: Caches not enabled
    monitor flash len: 00084CF8
    dram_bank_mmu_setup: bank: 0
    Now running in RAM - U-Boot at: 33f27000

    将include/configs/mini2440.h中CONFIG_SYS_TEXT_BASE修改为0x33E00000:

    #define CONFIG_SYS_TEXT_BASE   0x33E00000

     重新编译后,加载到系统中:

    reset
    init_2440
    load_image /home/host/soft/mini2440/u-boot-2014.04/u-boot.bin 0x33e00000 bin 
    resume 0x33e00000   

    可以正常进入uboot(输出信息太长了,不再列出)。

    在uboot下执行下面命令(需要查看md和nand dump输出内容是否一致):

    nand read 0 0 0x100
    nand dump 0 0x100
    md 0

    查看二者输出可以看到,二者输出信息是一致的(只是md的输出信息使用小端法表示,会有点难以比对)

    再执行下面命令:

    nand erase 0x100000 0x100000
    nand dump 0x100000 0x100
    nand write 0 0x100000 0x100
    nand dump 0x100000 0x100

    两次dump的信息一致,但是都是ff,这说明nand write并没有真正把数据写入到nand flash中。

    参考《u-boot移植到mini2440,u-boot版本2008.10 》默认不会对写入进行校验,需要添加CONFIG_MTD_NAND_VERIFY_WRITE才能进行校验

    在include/configs/mini2440中添加一行代码:

    #define CONFIG_MTD_NAND_VERIFY_WRITE

    重新编译uboot,并按照上面步骤载入并进入uboot.

    然后执行nand write命令:

    MINI2440 # nand write 0 0x100000 0x100
    
    NAND write: device 0 offset 0x100000, size 0x100
    hwcontrol(): 0x70 0x83
    hwcontrol(): 0xffffffff 0x81
    hwcontrol(): 0x80 0x83
    hwcontrol(): 0x00 0x85
    hwcontrol(): 0x00 0x05
    hwcontrol(): 0x200 0x05
    hwcontrol(): 0x02 0x05
    hwcontrol(): 0xffffffff 0x81
    hwcontrol(): 0x10 0x83
    hwcontrol(): 0xffffffff 0x81
    hwcontrol(): 0x70 0x83
    hwcontrol(): 0xffffffff 0x81
    dev_ready
    hwcontrol(): 0x00 0x83
    hwcontrol(): 0x00 0x85
    hwcontrol(): 0x00 0x05
    hwcontrol(): 0x200 0x05
    hwcontrol(): 0x02 0x05
    hwcontrol(): 0xffffffff 0x81
    hwcontrol(): 0x30 0x83
    hwcontrol(): 0xffffffff 0x81
    dev_ready
    hwcontrol(): 0xffffffff 0x80
    NAND write to offset 100000 failed -5
     0 bytes written: ERROR

    nand write执行失败。

    修改drivers/mtd/nand/s3c2410_nand.c:

    添加一行代码:
    ulong IO_ADDR_W = CONFIG_SYS_NAND_BASE;   
    删除两行代码:
    //  struct nand_chip *chip = mtd->priv;
    //      chip->IO_ADDR_W = (void *)IO_ADDR_W;

    修改下面一行代码(chip->替换成(void *):
    writeb(cmd, chip->IO_ADDR_W);
    还有一行代码中ulong需要删除掉:
    ulong IO_ADDR_W = (ulong)nand;

    然后再次编译、加载、运行uboot,

    在uboot下执行下面命令:

    md 0  
    nand erase 0x100000 0x100   
    nand write 0  0x100000 0x100
    nand dump 0x100000 0x100   

    最后一条命令显示信息如下:

    hwcontrol(): 0x00 0x83
    hwcontrol(): 0x00 0x85
    hwcontrol(): 0x00 0x05
    hwcontrol(): 0x200 0x05
    hwcontrol(): 0x02 0x05
    hwcontrol(): 0xffffffff 0x81
    hwcontrol(): 0x30 0x83
    hwcontrol(): 0xffffffff 0x81
    dev_ready
    hwcontrol(): 0xffffffff 0x80
    Page 00100000 dump:
            f0 00 00 ea 14 f0 9f e5  14 f0 9f e5 14 f0 9f e5
            04 f0 9f e5 14 f0 9f e5  14 f0 9f e5 14 f0 9f e5
            60 02 f8 33 c0 02 f8 33  20 03 f8 33 80 03 f8 33
            e0 03 f8 33 40 04 f8 33  60 04 f8 33 ef be ad de
            00 00 f8 33 00 00 f8 33  cc 87 fb 33 9c b5 ff 33
            de c0 ad 0b de c0 ad 0b  00 00 0f e1 1f 00 c0 e3
            d3 00 80 e3 00 f0 29 e1  53 04 a0 e3 00 10 a0 e3
            00 10 80 e5 00 10 e0 e3  20 04 9f e5 00 10 80 e5
            1c 14 9f e5 1c 04 9f e5  00 10 80 e5 18 04 9f e5
            05 10 a0 e3 00 10 80 e5  10 1f 11 ee 03 11 81 e3
            10 1f 01 ee 13 13 a0 e3  7f 2a a0 e3 21 20 82 e2
            04 20 81 e5 5b 00 00 eb  c0 00 4f e2 84 10 1f e5
            01 00 50 e1 40 00 00 0a  f1 11 a0 e3 00 00 a0 e3
            00 00 81 e5 3c 10 a0 e3  00 00 91 e5 00 00 50 e3
            2c 00 00 1a c4 03 9f e5  f1 11 a0 e3 00 00 81 e5
            4e 14 a0 e3 b8 23 9f e5  00 20 81 e5 00 20 91 e5
            ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
            ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
            ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
            ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
            ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
            ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
    .......................

    后面还有一些输出信息,都是ff,此处我都将其省略了。

  • 相关阅读:
    web.config配置错误的后果
    重装VS.NET碰到:IDE 未能加载 Dte.olb
    初次使用Wix
    typedef
    [WTL] Accelerator
    在浏览器中粘贴时替换剪贴板数据
    自定义浏览器
    关于MSHTML
    [WTL] STLport安装指南
    [WTL] WTL7.5中CFileDialog用'\0'过滤
  • 原文地址:https://www.cnblogs.com/qiaoqiao2003/p/3771876.html
Copyright © 2020-2023  润新知