当前位置:网站首页>STM32 RT thread virtual file system mount operation
STM32 RT thread virtual file system mount operation
2022-07-28 03:34:00 【Number and form】
of RT-Thread Introduction to virtual file system , I won't go into details here , Self check what you need to know RT-Thread Document center --> Components –> Virtual file system RT-Thread Document center I will only talk about the configuration, mounting and final operation , Specific documents related API View documents by yourself .
Specific steps
Step one
- First you need to have a bsp file , If there is no need to look downStep two
- open stm32cubemx To enable configuration

- 2.
At this time, only relevant settings are configured , Not yet sd Add to device
Step three , To write Kconfig To add sd equipment , reference rtthread Source code bsp in stm32 Any one of board Medium kconfig, Add these two pieces of code Kconfig(board --> Kconfig)
Step four : open menuconfig, Turn on sd Device drivers

3.
4 . Open the virtual file system dfs
6. Recompile project , And download to the development board 
Step five :
Here you can see that there are already sd Device registered 
Step six : Mount the file system to sd equipment , Pay attention to adding relevant paths and header files
#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>
/* defined the LED0 pin: PB1 */
#define LED0_PIN GET_PIN(B, 0)
static rt_device_t sd_card = RT_NULL;
int main(void)
{
int count = 1;
/* set LED0 pin mode to output */
rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT);
// while (count++)
// {
// rt_pin_write(LED0_PIN, PIN_HIGH);
// rt_thread_mdelay(100);
// rt_pin_write(LED0_PIN, PIN_LOW);
// rt_thread_mdelay(100);
// }
// Virtual file system test
rt_thread_mdelay(5000); // This delay is guaranteed sd The card has an initial time
sd_card = rt_device_find("sd0");
if(sd_card != RT_NULL)
{
rt_kprintf("sd card find ok\n");
#if 0
if(0 == dfs_mkfs("elm","sd0")) // Format file system
{
rt_kprintf(" Format file system successfully \n");
}
else
{
rt_kprintf(" Failed to format file system \n");
}
#endif
if (0 == dfs_mount("sd0","/","elm",0,0)) // Mount file system
{
rt_kprintf(" File system mounted successfully \n");
}
else
{
rt_kprintf(" File system mount failed \n");
}
}
else
{
rt_kprintf("sd card find err\n");
}
rt_thread_mdelay(100);
return RT_EOK;
}
Step seven : Download the program to the development board , Check whether the device is successfully mounted 
It shows that the file is successfully mounted , And the relevant operations of the file appear finsh Instructions , At this time, you can call the virtual file related API To realize the operation of virtual file system .
- Be careful , If sd The card was not successfully attached , Multiple reset , Download the program again , Sometimes it is .
边栏推荐
- Response to questions about the balanced beacon group of Hubei University of Arts and Sciences
- 最新版宝塔安装zip扩展,php -m 不显示的处理方法
- 过亿资产地址被拉入黑名单?Tether地址冻结功能该怎么用?
- The wonderful use of asemi rectifier bridge GBPC3510 in DC brush motor
- How to arrange PCB screen printing? Please check this manual!
- xctf攻防世界 Web高手进阶区 unserialize3
- Malloc, free, calloc, realloc dynamic memory development functions in dynamic memory management
- 2022最新Android Handler相关面试题总结
- Leaf recognition, color feature extraction, defect detection, etc
- How to reinstall win11 system with one click
猜你喜欢

Redis基本操作

Redis implements distributed locks

Log analysis tool (Splunk)

How does win11 display fixed applications?

bp svm的缺陷检测 树叶缺陷 叶片缺陷检测的系统设计

53. Maximum subarray maximum subarray sum

鼠标操作和响应

ES6 从入门到精通 # 08:扩展的对象的功能

Practice of online problem feedback module (16): realize the function of checking details

光年(Light Year Admin)后台管理系统模板
随机推荐
如何让外网访问内网IP(esp8266网页使用)
Robot development -- lead screw and guide rail
12月份PMP考试首次采用新考纲,该怎么学?
IO analog serial port of stm32
Unity简单实现对话功能
最新版宝塔安装zip扩展,php -m 不显示的处理方法
A treasure simulates login and reduces the method of secondary verification
xctf攻防世界 Web高手进阶区 unserialize3
关于湖北文理学院平衡信标组的疑问回应
STM32 RT-Thread虚拟文件系统挂载操作
版本兼容的问题
Redis source code analysis (who says C language can't analyze it?)
某宝模拟登录,减少二次验证的方法
Redis基本操作
Softek Barcode Reader 9.1.5
When a dialog box pops up, the following form is not available
xctf攻防世界 Web高手进阶区 PHP2
8000字讲透OBSA原理与应用实践
Practice of online problem feedback module (16): realize the function of checking details
Redis communication protocol -- resp protocol
