|
|
5 месяцев назад | |
|---|---|---|
| .. | ||
| .settings | 6 месяцев назад | |
| board | 6 месяцев назад | |
| figures | 8 месяцев назад | |
| packages | 6 месяцев назад | |
| rzn | 6 месяцев назад | |
| rzn_cfg | 6 месяцев назад | |
| rzn_gen | 6 месяцев назад | |
| script | 6 месяцев назад | |
| src | 8 месяцев назад | |
| .api_xml | 8 месяцев назад | |
| .config | 6 месяцев назад | |
| .cproject | 6 месяцев назад | |
| .gitignore | 8 месяцев назад | |
| .project | 6 месяцев назад | |
| .secure_azone | 8 месяцев назад | |
| .secure_rzone | 6 месяцев назад | |
| .secure_xml | 6 месяцев назад | |
| Kconfig | 6 месяцев назад | |
| README.md | 5 месяцев назад | |
| README_zh.md | 5 месяцев назад | |
| SConscript | 6 месяцев назад | |
| SConstruct | 8 месяцев назад | |
| buildinfo.ipcf | 6 месяцев назад | |
| buildinfo.json | 6 месяцев назад | |
| configuration.xml | 6 месяцев назад | |
| envsetup.sh | 8 месяцев назад | |
| mklinks.bat | 8 месяцев назад | |
| mklinks.sh | 8 месяцев назад | |
| ozone_scons.jdebug | 8 месяцев назад | |
| project.ewd | 6 месяцев назад | |
| project.ewp | 6 месяцев назад | |
| project.ewt | 6 месяцев назад | |
| project.eww | 8 месяцев назад | |
| rtconfig.h | 6 месяцев назад | |
| rtconfig.py | 8 месяцев назад | |
| rzn_cfg.txt | 6 месяцев назад | |
| template.ewd | 6 месяцев назад | |
| template.ewp | 6 месяцев назад | |
| template.eww | 8 месяцев назад | |
English | 中文
FAL (Flash Abstraction Layer) is an abstraction layer for managing and operating Flash devices and Flash-based partitions. It provides a unified API for upper-layer Flash and partition operations (as shown in the framework diagram below), with the following features:
In this example, the EtherKit onboard GD Flash is combined with the RT-Thread FAL component to build a file system using littlefs.
The source code for file system initialization in this example is located at:
../board/ports/filesystem/drv_filesystem.c
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2025-02-07 newflydd@gmail.com the first version
*/
#define DBG_TAG "drv.fs"
#define DBG_LVL DBG_LOG
#include <rtdbg.h>
#include <rtthread.h>
#include <fal.h>
#include <dfs_fs.h>
int initFileSystem()
{
fal_init();
// register onchip flash tail area as littlefs
struct rt_device* flashDev = fal_mtd_nor_device_create("param");
if (RT_NULL == flashDev)
{
LOG_W("create fal device failed");
return RT_ERROR;
}
if (RT_EOK != dfs_mount("param", "/", "lfs", 0, RT_NULL))
{
LOG_W("mount lfs failed once, try to format it");
if (RT_EOK != dfs_mkfs("lfs", "param"))
{
LOG_W("mkfs lfs failed");
return RT_ERROR;
}
LOG_I("mkfs lfs success");
if (RT_EOK != dfs_mount("param", "/", "lfs", 0, RT_NULL))
{
LOG_W("mount lfs failed");
return RT_ERROR;
}
}
LOG_I("mount lfs success");
return RT_EOK;
}
INIT_ENV_EXPORT(initFileSystem);
RT-Thread Studio: Download the EtherKit resource pack from the RT-Thread Studio package manager, then create a new project and compile it.
IAR: First, double-click mklinks.bat to generate links for the rt-thread and libraries folders. Then, use Env to generate the IAR project. Finally, double-click project.eww to open the IAR project and compile it.
Once compiled, connect the development board’s JLink interface to the PC, and download the firmware to the development board.
Press the reset button to restart the development board and observe the terminal logs from the board.
Run the following commands to start the FAL read/write test:
> fal probe param param
> fal bench 4096 yes