Skip to main content

Nor

一 打开nor参数相关宏

文件位于bootloader/uboot-x2000/include/configs/ad100_base_common.h

1

二 添加nor相关参数及分区信息

文件位于bootloader/uboot-x2000/tools/ingenic-tools/sfc_builtin_params/nor_device.c

以开发板flash GD25B512ME为例添加,打开烧录工具查看对应flash信息

2

将nor相关参数写入nor_device.c

3

4

5

struct spi_nor_info builtin_spi_nor_info = {

.name = "GD25B512ME",
.id = 0xC8471A,

.read_standard = CMD_INFO(0x13, 0, 4, 0), //对应单线读
.read_quad = CMD_INFO(0x6c, 8, 4, 5), //对应四线读
.write_standard = CMD_INFO(0x12, 0, 4, 0), //对应单线写
.write_quad = CMD_INFO(0x34, 0, 4, 5), //对应四线写
.sector_erase = CMD_INFO(0x5c, 0, 4, 0), //对应扇区擦除
.wr_en = CMD_INFO(0x06, 0, 0, 0), //对应写使能
.en4byte = CMD_INFO(0xb7, 0, 0, 0), //对应4字节地址模式
.quad_set = ST_INFO(-1, -1, -1, -1, -1, -1), //对应设置四线
.quad_get = ST_INFO(-1, -1, -1, -1, -1, -1), //对应获取四线
.busy = ST_INFO(0x05, 0, 1, 0, 1, 0),//对应获取WIP状态

.tCHSH = 5,
.tSLCH = 5,
.tSHSL_RD = 20,
.tSHSL_WR = 40,

.chip_size = 67108864,
.page_size = 256,
.erase_size = 32768,

.quad_ops_mode = 0,
.addr_ops_mode = 0,
.chip_erase_cmd = 0x60,


#ifdef CONFIG_INGENIC_XXXXX
//add your flash
#endif
};

将分区信息写入nor_device.c

struct norflash_partitions builtin_norflash_partitions = {

/* max 10 partitions*/
.num_partition_info = 4, //根据分区个数来修改

.nor_partition = {

[0].name = "uboot",
[0].offset = 0x0,
[0].size = 0x40000,
[0].mask_flags = NORFLASH_PART_RW,
[0].manager_mode = MTD_MODE,

[1].name = "kernel",
[1].offset = 0x40000,
[1].size = 0x600000,
[1].mask_flags = NORFLASH_PART_RW,
[1].manager_mode = MTD_MODE,

[2].name = "rootfs",
[2].offset = 0x640000,
[2].size = 0x1000000,
[2].mask_flags = NORFLASH_PART_RW,
[2].manager_mode = MTD_MODE,

[3].name = "userdata",
[3].offset = 0x1640000,
[3].size = 0x1000000,
[3].mask_flags = NORFLASH_PART_RW,
[3].manager_mode = MTD_MODE,
},
};


/*
* params: private params
*/
private_params_t builtin_private_params = {
.fs_erase_size = 32768, //文件系统擦除块大小
.uk_quad = 1,
};

#define NORFLASH_PART_RW    0
#define NORFLASH_PART_WO 1
#define NORFLASH_PART_RO 2

#define MTD_MODE 0x0 //use mtd mode, erase partition when write
#define MTD_D_MODE 0x2 //use mtd dynamic mode, erase block_size when write
#define UBI_MANAGER 0x1

分区个数不能超过十个, 如需要大于十则要修改代码

使用到rtos, 修改文件位置freertos/xburst2/soc-ad100/sfc_nor_params.h

6

linux 修改uboot 及kernel :

uboot文件位于bootloader/uboot-x2000/arch/mips/include/asm/arch-ad100/spinor.h

kernel文件位于kernel/kernel/module_drivers/drivers/mtd/devices/ingenic_sfc_v2/spinor.h

7

8

三 编译

修改后重新编译uboot

bhu@bhu-PC:~/ad101/build$ make uboot

生成的uboot, 可以对比下, 与屏蔽掉第一章节打开的宏后, 烧录工具合并镜像功能打包出来的uboot进行对比