• uboot1.1.6之NOR FLASH 出现的问题解决方法


    U-BOOT移植,structure has no member named `CAMDIVN

    speed.c: In function `get_HCLK':
    speed.c:114: error: structure has no member named `CAMDIVN'
    speed.c: In function `get_PCLK':
    speed.c:154: error: structure has no member named `CAMDIVN'
    make[1]: *** [speed.o] Error 1
    make[1]: Leaving directory `/usr/wuxuezhi/u-boot-1.1.6/cpu/arm920t/s3c24x0'
    make: *** [cpu/arm920t/s3c24x0/libs3c24x0.a] Error 2

    在include下的s3c24x0.h上的clock&power结构中添加相应名为CAMDIVN的结构变量

    参考《嵌入式linux完全开发流程》P273,

    (1)在include/configs/sbc2410x.h中添加#define CFG_FLASH_CFI_DRIVER  1

    (2)在board/sbc2410x/Makefile中去掉flash.o

      COBJS  :=sbc2410x.o flash.o改为COBJS  :=sbc2410x.o

    (3)make测试,出错如下:编译出现很多警告,好像是编译器的问题,这里先不管它了啦,O(∩_∩)O哈哈~

    [alu@localhost u-boot-1.1.6]$ make sbc2410x_config
    Configuring for sbc2410x board...
    [alu@localhost u-boot-1.1.6]$ make

    .......
    ./bmp_logo logos/denx.bmp >/home/alu/mywork/systems/u-boot-1.1.6/include/bmp_logo.h
    make[1]: Leaving directory `/home/alu/mywork/systems/u-boot-1.1.6/tools'
    make -C examples all
    make[1]: Entering directory `/home/alu/mywork/systems/u-boot-1.1.6/examples'
    /usr/local/arm/usr/bin/arm-ep9312-linux-gnueabi-gcc -g  -Os  -fno-strict-aliasing  -fno-common -ffixed-r8 -msoft-float  -D__KERNEL__ -DTEXT_BASE=0x33F80000  -I/home/alu/mywork/systems/u-boot-1.1.6/include -fno-builtin -ffreestanding -nostdinc -isystem /usr/local/arm/usr/bin/../lib/gcc/arm-ep9312-linux-gnueabi/4.1.1/include -pipe  -DCONFIG_ARM -D__ARM__ -march=armv4 -mabi=apcs-gnu -Wall -Wstrict-prototypes -c -o hello_world.o hello_world.c
    hello_world.c:1: warning: target CPU does not support interworking
    In file included from /home/alu/mywork/systems/u-boot-1.1.6/include/common.h:105,
                    from hello_world.c:24:
    /home/alu/mywork/systems/u-boot-1.1.6/include/flash.h:36: error: 'CFG_MAX_FLASH_SECT' undeclared here (not in a function)
    make[1]: *** [hello_world.o] Error 1
    make[1]: Leaving directory `/home/alu/mywork/systems/u-boot-1.1.6/examples'
    make: *** [examples] Error 2

    [alu@localhost u-boot-1.1.6]$

    上边有很多编译警告,先不管,看下边的错误可知,此错误是由未定义'CFG_MAX_FLASH_SECT' 而引起。呵呵是问了好多大侠才知道的。在include/configs/sbc2410x.h中添加'CFG_MAX_FLASH_SECT'的定义,暂时定义为#define  CFG_MAX_FLASH_SECT  1  好像说这里应该根据flash 的data sheet来定义,但是我还不知道怎么定义,先不管了。定义后编译:

    添加了'CFG_MAX_FLASH_SECT'的定义后编译,出现了好一堆的错误:
    cfi_flash.c:1224: error: 'flash_info_t' has no member named 'cmd_reset'
    cfi_flash.c: In function 'flash_write_cfiword':
    cfi_flash.c:1257: error: 'flash_info_t' has no member named 'portwidth'
    cfi_flash.c:1279: error: 'flash_info_t' has no member named 'vendor'
    cfi_flash.c:1288: error: 'flash_info_t' has no member named 'portwidth'
    cfi_flash.c:1292: error: 'flash_info_t' has no member named 'portwidth'
    cfi_flash.c:1312: error: 'flash_info_t' has no member named 'write_tout'
    cfi_flash.c: In function 'flash_make_addr':
    cfi_flash.c:221: warning: control reaches end of non-void function
    make[1]: *** [cfi_flash.o] Error 1
    make[1]: Leaving directory `/home/alu/mywork/systems/u-boot-1.1.6/drivers'
    make: *** [drivers/libdrivers.a] Error 2
    [alu@localhost u-boot-1.1.6]$

    分析:在include/flash.h中:
    typedef struct {
        ulong    size;           
        ushort    sector_count;       
        ulong    flash_id;       
        ulong    start[CFG_MAX_FLASH_SECT]; 
        uchar    protect[CFG_MAX_FLASH_SECT];
    #ifdef CFG_FLASH_CFI           
        uchar    portwidth;       
        uchar    chipwidth;    
    ……
    “cfi_flash.c:220: error: structure has no member named `portwidth'”这个错误的意思是:
    结构中没有portwidth,从flash_info_t结构的定义就可以知道,是CFG_FLASH_CFI没有定义。

    所以,在include/configs/100ask24x0.h 中加一个#define CFG_FLASH_CFI 1

    (4)添加#define CFG_FLASH_CFI 1再编译,又出现错误:
    cfi_flash.c: In function `flash_init':
    cfi_flash.c:411: error: `CFG_MONITOR_BASE' undeclared (first use in this function)
    cfi_flash.c:411: error: (Each undeclared identifier is reported only once
    cfi_flash.c:411: error: for each function it appears in.)
    make[1]: *** [cfi_flash.o] 错误 1
    make[1]:正在离开目录 `/home/boy/document/system/ub/u-boot-1.1.6/drivers'
    make: *** [drivers/libdrivers.a] 错误 2
    查找问题 在flash.h  和 100ask24x0.h中都没有定义CFG_MONITOR_BASE,又看了cfi_flash.c中的207:ulong flash_get_size (ulong base, int banknum);
        208:#if defined(CFG_ENV_IS_IN_FLASH) || defined(CFG_ENV_ADDR_REDUND) || (CFG_MONITOR_BASE >= CFG_FLASH_BASE)
    在100ask24x0.h定义:#define
     CFG_MONITOR_BASE  0x00000000 在编译:

    (5)编译时,应该还会出现一个错误,我的是这样的,但是别人的没有出现。会要求定义#define CFG_ENV_ADDR  (CFG_FLASH_BASE + 0X0F0000)这个地址我也不知道怎么定义,是对着LV800的定义的,还不知道是对是错呢!

    (6)终于编译通过了!一共在sbc2410x.h中添加了

    #define CFG_FLASH_CFI_DRIVER    1
    #define CFG_MAX_FLASH_SECT      1
    #define CFG_FLASH_CFI           1
    #define CFG_MONITOR_BASE     0x00000000
    #define CFG_ENV_ADDR         (CFG_FLASH_BASE + 0X0F0000) 这几个定义。

    (7)终于可以下到板子上边去跑了,虽然显示还是有问题

    U-Boot 1.1.6 (Oct 29 2008 - 14:15:28)
    DRAM:  64 MB
    Flash:  0 kB       ???????flash显示有问题
    *** Warning - bad CRC, using default environment

    In:    serial
    Out:   serial

    小知识:

    1)用fl可以显示内存

    SMDK2410 # fl
     Bank # 1: AMD: 1x Amd29LV400BB (4Mbit) (此为未修改nor flash之前的设置)
     Size: 0 MB in 11 Sectors
     Sector Start Addresses:
     00000000 (RO) 00004000 (RO) 00006000 (RO) 00008000 (RO) 00010000 (RO)
      00020000      00030000      00040000      00050000      00060000     
       00070000 (RO)
     SMDK2410 # 

    2) pro off all 解除所有内存的保护状态
        erase all   擦除所有内存
        md 0        显示内存信息


    SMDK2410 # md 0
    00000000: ffffffff ffffffff ffffffff ffffffff    ................ 
    00000010: ffffffff ffffffff ffffffff ffffffff    ................
    00000020: ffffffff ffffffff ffffffff ffffffff    ................ 
    00000030: ffffffff ffffffff ffffffff ffffffff    ................
    00000040: ffffffff ffffffff ffffffff ffffffff    ................ 
    00000050: ffffffff ffffffff ffffffff ffffffff    ................
    00000060: ffffffff ffffffff ffffffff ffffffff    ................
    00000070: ffffffff ffffffff ffffffff ffffffff    ................
    00000080: ffffffff ffffffff ffffffff ffffffff    ................
    00000090: ffffffff ffffffff ffffffff ffffffff    ................ 
    000000a0: ffffffff ffffffff ffffffff ffffffff    ................
    000000b0: ffffffff ffffffff ffffffff ffffffff    ................
    000000c0: ffffffff ffffffff ffffffff ffffffff    ................
    000000d0: ffffffff ffffffff ffffffff ffffffff    ................
    000000e0: ffffffff ffffffff ffffffff ffffffff    ................ 
    000000f0: ffffffff ffffffff ffffffff ffffffff    ................
    SMDK2410 # 

    3)内存拷贝  cp.b 目标地址  要存放的地址  $(filesize) 后边的$(filesize)是下载的文件大小,直接用$(filesize),不改变。

    4)定义DEBUG ,可以使用CFI的调试.至于是什么,不知道!没试过,只是听说了……


     

  • 相关阅读:
    菜根谭#250
    菜根谭#249
    菜根谭#248
    [转载]将网卡(设备中断)绑定到特定CPU
    request_mem_region,ioremap 和phys_to_virt()
    [转载]python的range()函数用法
    [转载]Python print函数用法,print 格式化输出
    [转载]python datetime处理时间
    Linux驱动
    Linux驱动
  • 原文地址:https://www.cnblogs.com/yihujiu/p/5451347.html
Copyright © 2020-2023  润新知