嵌入式技术论坛
直播中

王敏

7年用户 1450经验值
私信 关注
[经验]

RT-Thread spinand程序烧录及Flash分区说明

1 板载25N01G 128MB spi flash

分三个区 8M系统、56M保留、64M用于uffs文件系统(挂载到/mnt/filesystem)

//boad_dev.c
struct rt_mtd_nand_device mtd_partitions[MTD_SPINAND_PARTITION_NUM] =
{
[0] =
{//128k * 64 = 8388608(0x800000=8M) rt-thread,uboot,...
.block_start = 0,
.block_end = 63,
.block_total = 64,
},
[1] =
{//56M, reserved
.block_start = 64,
.block_end = 511,
.block_total = 448,
},
[2] =
{//64M, uffs
.block_start = 512,
.block_end = 1023,
.block_total = 512,
}
};

//fal_cfg.h
/* partition table------------------------------------------------------------ /
#define FAL_PART_TABLE
{
{FAL_PART_MAGIC_WORD, "rtthread", FAL_USING_NOR_FLASH_DEV_NAME, 0, 8
10241024, 0},
{FAL_PART_MAGIC_WORD, "filesystem", FAL_USING_NOR_FLASH_DEV_NAME, 64
10241024, 281024*1024, 0},
}

//mnt.c
const struct dfs_mount_tbl mount_table[] =
{
{ RAMDISK_UDC, "/mnt/ram_usbd", "elm", 0, RT_NULL },
#if defined(RT_USING_DFS_UFFS)
{ "nand2", "/mnt/filesystem", "uffs", 0, RT_NULL },
#endif
{0},
};
#endif

原厂例子是分为4M和12M,可能是考虑有些板载W25Q128(16MB spi nor flash).

2 烧录FLASH

参照官方文档 (NuMaker NUC980 IIoT User Manual.pdf), 除rt-thread.bin文件外,其它位于BSP/uboot目录中。
首先选择USB启动,启动nuwriter。

2.0 擦除整片FLASH

2.1 u-boot-spl.bin

2.jpg

2.2 u-boot.bin

2.jpg

2.3 rt-thread.bin

2.jpg

注意图中的980uimage.bin是linux镜像,改为编译好的rt-thread.bin

2.4 env.txt 启动脚本

baudrate=115200
bootdelay=1
stderr=serial
stdin=serial
stdout=serial
loadrtt=nand read 0x80000000 0x200000 0x600000
bootcmd=run loadrtt;go 0x0

2.jpg

3 SPI nand启动rt-thread

切换到SPI启动模式,reset或重新上电。以后烧录只要把rt-thread占用的空间擦除,见下图

2.jpg

然后重新烧录rt-thread.bin即可,其它不需要重新烧录。

4 SPI Flash 25N01G分区说明

block 0-3(512kB) u-boot-spl

block 4(128kB) env.txt

block 8-15(1MB) u-boot

block 16-63(6MB) rt-thread, 这部分看情况扩展

block 64-511(56MB) reserved

block 512-1024(64MB) uffs文件系统

原作者:lg28870983

更多回帖

发帖
×
20
完善资料,
赚取积分