参数配置
23 Oct 2024
Read time: 6 minute(s)
SPI NOR 驱动配置
Baremetal 配置
在 Luban-Lite 根目录下执行 scons --menuconfig
,进入 menuconfig
的功能配置界面,按如下选择:
Board options --->
[*] Using Qspi0
[ ] Using Qspi1
[ ] Using Qspi2
[ ] Using Qspi3
Qspi0 Parameter --->
(100000000) Max frequency(Hz)
[*] QSPI0 Devices: SPINOR --->
(100000000) SPINOR bus frequency(Hz)
Drivers options --->
AIC Bare Driver --->
[*] Enable AIC MTD Bare Driver
Peripheral --->
-*- SPINOR Driver SFUD: Serial Flash Universal Driver
注:
为了方便配置, 使能 AIC_QSPI0_DEVICE_SPINOR 后, 会自动选上 AIC_SPINOR_DRV, LPKG_USING_SFUD, AIC_MTD_BARE_DRV
RTOS 配置
在 Luban-Lite 根目录下执行 scons --menuconfig
,进入 menuconfig
的功能配置界面,按如下选择:
Board options --->
[*] Using Qspi0
[ ] Using Qspi1
[ ] Using Qspi2
[ ] Using Qspi3
Qspi0 Parameter --->
(100000000) Max frequency(Hz)
[*] QSPI0 Devices: SPINOR --->
(100000000) SPINOR bus frequency(Hz)
Drivers options --->
Peripheral --->
-*- SPINOR Driver SFUD: Serial Flash Universal Driver
Rt-Thread options --->
RT-Thread Components --->
Device Drivers --->
-*- Using MTD Nor Flash device drivers
-*- Using SPI Bus/Device device drivers
-*- Enable QSPI mode
-*- Using SFUD(Serial Flash Universal Driver)
[*] Using auto probe flash JEDEC SFDP parameter
[*] Using defined supported flash chip information table
[*] Using QSPI mode support
(50000000) Default spi maximum speed(HZ)
注:
为了方便配置, 使能 AIC_QSPI0_DEVICE_SPINOR 后, 会自动选上 AIC_SPINOR_DRV, RT_USING_SFUD, LPKG_USING_SFUD, RT_USING_MTD_NOR
文件系统配置
Baremetal FatFS
配置
Local packages options --->
Third-party packages options --->
[*] DFS: device virtual file system for baremetal mode --->
[*] Using posix-like functions, open/read/write/close
(8) The maximal number of mounted file system
(4) The maximal number of file system type
(16) The maximal number of opened files
[ ] Using mount table for file system
[*] Enable elm-chan fatfs
elm-chan's FatFs, Generic FAT Filesystem Module --->
[*] Enable ReadOnly file system on flash
[ ] Enable RAM file system
RT-Thread FatFS 配置
Rt-Thread options --->
RT-Thread Components --->
[*] DFS: device virtual file system --->
[*] Using posix-like functions, open/read/write/close
[*] Using working directory
(4) The maximal number of mounted file system
(4) The maximal number of file system type
(16) The maximal number of opened files
[*] Using mount table for file system
[*] Enable elm-chan fatfs
elm-chan's FatFs, Generic FAT Filesystem Module --->
(4096) Maximum sector size to be handled.
[ ] Using devfs for device objects
[*] Enable ReadOnly file system on flash
[ ] Enable RAM file system
注意,上面的
Usingmounttableforfilesystem
选项打开后,意味着可以系统启动后会根据一个
Table 配置来自动挂载文件系统。该 Table 定义在 board.c
中:#ifdef RT_USING_DFS_MNTTABLE
#include <dfs_fs.h>
const struct dfs_mount_tbl mount_table[] = {
#if (defined(AIC_USING_FS_IMAGE_TYPE_FATFS_FOR_0) || defined(AIC_USING_FS_IMAGE_TYPE_FATFS_FOR_1))
{"blk_rodata", "/rodata", "elm", 0, 0, 0},
#endif
{0}
};
#endif
FatFS 支持写功能
Baremetal,RT-Thread FatFS 都支持写功能,通过 makem
进行如下配置
make m
Application options --->
[*] FATFS enable write func in spinor
注:
因为 SPINOR 块大小是 4K,sector 是 512,代码兼容后,写速度较慢,不推荐使用 FatFS 写功能
RT-Thread Littlefs 配置
Local packages options --->
Third-party packages options --->
[*] Littlefs: A high-integrity embedded file system --->
(256) disk read size
(256) disk write size
(4096) disk block size
(256) lfs r/w cache size
(128) lfs lookahead size
注意,上面的
Usingmounttableforfilesystem
选项打开后,意味着可以系统启动后会根据一个
Table 配置来自动挂载文件系统。该 Table 定义在 board.c
中:#ifdef RT_USING_DFS_MNTTABLE
#include <dfs_fs.h>
const struct dfs_mount_tbl mount_table[] = {
#ifdef LPKG_USING_LITTLEFS
{"data", "/data", "lfs", 0, 0, 0},
#endif
{0}
};
#endif
文件系统镜像制作和烧录
FatFS
镜像制作和烧录
Application options --->
[*] Using File System Image 0 --->
Select File System Type (FATFS) --->
(packages/artinchip/lvgl-ui/aic_demo/meter_demo/lvgl_src/) Data Directory
(rodata.fatfs) Image Name
[*] auto calcuate image size
(8) size of cluster in fatfs image
Littlefs
镜像制作和烧录
Application options --->
[*] Using File System Image 1 --->
Select File System Type (LittleFS) --->
(packages/artinchip/lvgl-ui/aic_demo/meter_demo/lvgl_src/) Data Directory
(data.lfs) Image Name
(4096) Erase block size
(256) Page size