加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

RT5350配置uboot 支持8M的Flash

发布时间:2020-12-15 20:03:12 所属栏目:百科 来源:网络整理
导读:?RT5350配置uboot 支持8M的Flash Uboot 采用 U-Boot 1.1.3 ? 一、在 uboot 目录下配置支持 8M flash cd ?/home/RT5350/Uboot/ make menuconfig 二、 重新编译 1 、 make 2 、生成 uboot.img 三、烧录镜像板子出现如下信息 四、定位打印信息 ? 可以看到uboot

?RT5350配置uboot 支持8M的Flash

Uboot 采用U-Boot 1.1.3

?

一、在uboot 目录下配置支持8M flash

cd ?/home/RT5350/Uboot/

make menuconfig


二、重新编译

1make

2、生成uboot.img

三、烧录镜像板子出现如下信息


四、定位打印信息

?

可以看到uboot启动之后,通过spi 方式读取到的 flash 信息在配置表当中查询不到

uboot搜索这条打印信息可以查询到如下位置

“Warning: un-recognized chip ID,please update bootloader!”

?

grep -r -n “Warning: un-recognized chip ID,please update bootloader!”

?

./drivers/spi_flash.c 838 位置出现

?

struct chip_info *chip_prob(void)

{

????????struct chip_info *info,*match;

????????u8 buf[5];

????????u32 jedec,weight;

????????int i;

?

????????raspi_read_devid(buf,5);

????????jedec = (u32)((u32)(buf[1] << 24) | ((u32)buf[2] << 16) | ((u32)buf[3] <<8) | (u32)buf[4]);

?

????????printf("spi device id: %x %x %x %x %x (%x)n",buf[0],buf[1],buf[2],buf[3],buf[4],jedec);

?

????????// FIXME,assign default as AT25D

????????weight = 0xffffffff;

????????match = &chips_data[0];

????????for (i = 0; i < sizeof(chips_data)/sizeof(chips_data[0]); i++) {

????????????????info = &chips_data[i];

????????????????if (info->id == buf[0]) {

????????????????????????if (info->jedec_id == jedec) {

????????????????????????????????printf("find flash: %sn",info->name);

????????????????????????????????return info;

????????????????????????}

?

????????????????????????if (weight > (info->jedec_id ^ jedec)) {

????????????????????????????????weight = info->jedec_id ^ jedec;

????????????????????????????????match = info;

????????????????????????}

????????????????}

????????}

????????printf("Warning: un-recognized chip ID,please update bootloader!n");

?

????????return match;

}

?

unsigned long raspi_init(void)

{

????????spic_init();

????????spi_chip_info = chip_prob();

????????

????????return spi_chip_info->sector_size * spi_chip_info->n_sectors;

}

?

?

以上函数功能主要是:

raspi_init 初始化spi,读取spi信息,返回spi flash的大小。

chip_prob() 函数是探测flash ID信息,从flash 当中raspi_read_devid函数读取到的ID信息和chips_data表当中的数据进行匹配,得出flash 大小。

从打印信息可以看到info->id= 0xc8,flash序列号jedec ?= 0x4017c840

?

在配置表chips_data 当中没有这个id,所以才才打印出如下信息

找不到flash,在raspi_init 打印flash 大小,还是默认用4M

printf("raspi_init ?=%dn",spi_chip_info->sector_size * spi_chip_info->n_sectors);

?

五、配置表如下



六、添加自己的flash?

我们需要添加自己的flash信息进去,uboot才能正确识别大小

在最后添加一行

{ "W25Q64_1",??????????0xc8,0x4017c840,64 * 1024,128,0 },

?

添加的参数描述:


W25Q64_1 :表示名字 ,可以自定义。

id:0xc8?是当前取出来的ID值(上面的打印函数可以看出raspi_read_devid

jedec_id: 序列号,读取出来的值0x4017c840

sector_size flash 片区大小 (64 * 1024

n_sectors: 总共有多少片(128

64*1024*128/1024/1024 =8M 计算出8M

addr4b :读写保护 0表示可以读写 ?1:表示只能读取flash

?

七、重新编译下载

出现如下打印信息


?

就可以正确读取flash,下载超过4M的内核就可以正常通过

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读