美菱項目(AU1200):NorFlash相關的設定

來源:互聯網
上載者:User

涉及源碼檔案:drivers/mtd/maps/alchemy-flash.c

 

10:   #include <linux/config.h>

註解: 在 include/linux/config.h中,只有一句 #include <linux/autoconf.h>, 而在 include/linux/autoconf.h 中則有如下

59:  #undef CONFIG_MIPS_PB1000
60:  #undef CONFIG_MIPS_PB1100
61:  #undef CONFIG_MIPS_PB1500
62:  #undef CONFIG_MIPS_PB1550
63:  #undef CONFIG_MIPS_PB1200
64:  #undef CONFIG_MIPS_DB1000
65:  #undef CONFIG_MIPS_DB1100
66:  #undef CONFIG_MIPS_DB1500
67:  #undef CONFIG_MIPS_DB1550
68: 

#define CONFIG_MIPS_DB1200 1


 

因此對應於alchemy-flash.c 的82行定義成立

#ifdef CONFIG_MIPS_DB1200
#define BOARD_MAP_NAME "Db1200 Flash"
#define BOARD_FLASH_SIZE 0x00800000 /* 8MB */
#define BOARD_FLASH_WIDTH 2 /* 16-bits */
#endif

 

其中
BOARD_FLASH_SIZE
表示嵌入式系統中使用的NorFlash的容量大小,
BOARD_FLASH_WIDTH
表示NorFlash資料匯流排寬度(以byte為單位)。

 

 

在 include/linux/mtd/partitions.h中定義結構體

struct mtd_partition {
    char *name;            /* identifier string */
    u_int32_t size;            /* partition size */
    u_int32_t offset;        /* offset within the master MTD space */
    u_int32_t mask_flags;        /* master MTD flags to mask out for this partition */
    struct nand_oobinfo *oobsel;    /* out of band layout for this partition (NAND only)*/
    struct mtd_info **mtdp;        /* pointer to store the MTD object */
};

 

 

alchemy-flash.c

113行開始的定義則對應於NorFlash中的資料分割配置:

 

static struct mtd_partition alchemy_partitions[] = {
        {
                .name = "User FS",
                .size = BOARD_FLASH_SIZE - 0x00400000,  ——此處即使用宏


BOARD_FLASH_SIZE


                .offset = 0x0000000
        },

        {
                .name = "YAMON",
                .size = 0x0100000,
                .offset = MTDPART_OFS_APPEND,
            //    .mask_flags = MTD_WRITEABLE

               


——此處使用的宏






MTD_WRITEABLE

表示 本mtd分區起始位移量緊跟上一分區結束位置


        },
        {
                .name = "raw kernel",
                .size = (0x300000 - 0x40000), /* last 256KB is yamon env */
                .offset = MTDPART_OFS_APPEND,
        }
};


在這個NorFlash分區的方案中,YAMON 開始於 NorFlash的最後 4MB 起始處,整個kernel 和 Yamon佔據




NorFlash最後 4MB 空間,這可從"User FS" .size=




BOARD_FLASH_SIZE - 0x00400000 看出








因此,當NorFlash類型更換之後,需要根據新NorFlash的容量、資料寬度相應的修改




alchemy-flash.c  82行開始的宏定義




BOARD_FLASH_SIZE
  和
BOARD_FLASH_WIDTH

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.