cmcu为stm32h743IIt6
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.0 KiB

/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2025-11-21 Administrator the first version
*/
#include <rtthread.h>
#include <dfs_fs.h>
#include <dfs_posix.h>
#define DBG_TAG "tmpfs_init"
#define DBG_LVL DBG_LOG
#include <rtdbg.h>
int init_tmpfs_root(void)
{
// 挂载 TMPFS 到根目录(注意类型是 "tmp")
if (dfs_mount(RT_NULL, "/", "tmp", 0, RT_NULL) != RT_EOK) {
LOG_E("Failed to mount TMPFS!");
return -1;
}
LOG_I("TMPFS mounted as root.");
/* 3. 测试创建目录 */
if (mkdir("/run", 0777) == 0) {
LOG_I("Created /run directory");
} else {
LOG_E("mkdir failed, errno = %d", errno);
}
2 weeks ago
/* if (mkdir("/usb", 0777) == 0) {
LOG_I("Created /usb directory");
} else {
LOG_E("mkdir failed, errno = %d", errno);
}*/
return 0;
}
/* 在应用初始化阶段运行(确保系统已就绪) */
INIT_DEVICE_EXPORT(init_tmpfs_root);