5.4.2. 参数配置

5.4.2.1. SPI NOR 驱动配置

5.4.2.1.1. Baremetal 配置

在 ZX-RTT 根目录下执行 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

5.4.2.1.2. RTOS 配置

在 ZX-RTT 根目录下执行 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

5.4.2.2. 文件系统配置

5.4.2.2.1. 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

注意,上面的 Using mount table for file system 选项打开后,意味着可以系统启动后会根据一个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

5.4.2.2.2. 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

注意,上面的 Using mount table for file system 选项打开后,意味着可以系统启动后会根据一个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

5.4.2.3. 文件系统镜像制作和烧录

5.4.2.3.1. Littlefs 镜像制作和烧录

Application options  --->
     [*] Using File System Image 0  --->
        Select File System Type (FATFS)  --->
        (application/os/helloworld/lvgl/base_demo/lvgl_src/) Data Directory
        (rodata.fatfs) Image Name
         [*]   auto calcuate image size
    (8) size of cluster in fatfs image

5.4.2.3.2. FatFS 镜像制作和烧录

Application options  --->
     [*] Using File System Image 1  --->
        Select File System Type (LittleFS)  --->
        (application/os/helloworld/lvgl/base_demo/lvgl_src/) Data Directory
        (data.lfs) Image Name
        (4096) Erase block size
        (256) Page size