From 1c13877a10e75fa3cce8bee37ed91aaa22d9988a Mon Sep 17 00:00:00 2001 From: sc <2401809606@qq.com> Date: Fri, 21 Nov 2025 02:31:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0tmpfs=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E4=B8=BA=E6=A0=B9=E7=9B=AE=E5=BD=95=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8C=82=E8=BD=BD=E8=B7=AF=E5=BE=84=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=95=B0=E6=8D=AE=E5=A4=84=E7=90=86=E8=B5=84?= =?UTF-8?q?=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .config | 2 +- .cproject | 4 +--- .settings/828F.DAPLink.Debug.rttlaunch | 2 +- .settings/language.settings.xml | 2 +- applications/DB_SQLite.c | 18 +++--------------- applications/SDIO_elmfatfs.c | 8 ++++---- applications/main.c | 6 +++++- rtconfig.h | 1 - 8 files changed, 16 insertions(+), 27 deletions(-) diff --git a/.config b/.config index f38b1fa..8003bc4 100644 --- a/.config +++ b/.config @@ -161,7 +161,7 @@ CONFIG_RT_USING_DFS_DEVFS=y # CONFIG_RT_USING_DFS_CROMFS is not set # CONFIG_RT_USING_DFS_RAMFS is not set CONFIG_RT_USING_DFS_TMPFS=y -CONFIG_RT_USING_DFS_MQUEUE=y +# CONFIG_RT_USING_DFS_MQUEUE is not set # end of DFS: device virtual file system # CONFIG_RT_USING_FAL is not set diff --git a/.cproject b/.cproject index 2f86a95..e234b49 100644 --- a/.cproject +++ b/.cproject @@ -79,7 +79,6 @@ - @@ -195,7 +194,6 @@ - @@ -219,7 +217,7 @@ - + diff --git a/.settings/828F.DAPLink.Debug.rttlaunch b/.settings/828F.DAPLink.Debug.rttlaunch index 7fe54dc..82fd19b 100644 --- a/.settings/828F.DAPLink.Debug.rttlaunch +++ b/.settings/828F.DAPLink.Debug.rttlaunch @@ -13,7 +13,7 @@ - + diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index 485cf0e..fa957bb 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + diff --git a/applications/DB_SQLite.c b/applications/DB_SQLite.c index 12d43d2..32d8c01 100644 --- a/applications/DB_SQLite.c +++ b/applications/DB_SQLite.c @@ -14,11 +14,11 @@ #include "DB_SQLite.h" #include "sqlite3.h" -#define DB_NAME "/SC828.db" +#define DB_NAME "/sddisk/SC828.db" int db_HelperInit; rt_mq_t db_mq = RT_NULL; // -#define DBG_TAG "db_sql" +#define DBG_TAG "dat_sql" #define DBG_LVL DBG_LOG #include @@ -190,18 +190,6 @@ void db_sqlite_init_full(void) if (access(DB_NAME, F_OK) != 0) { - // 先测试文件系统是否可写 - LOG_E("[SD] Test File System..."); - int test_fd = open("/db_test.tmp", O_CREAT | O_WRONLY, 0); - if (test_fd < 0) { - LOG_E("[DB] ERROR: Root filesystem not writable! errno=%d", errno); - return; - } - write(test_fd, "test", 4); - close(test_fd); - unlink("/db_test.tmp"); - LOG_D("[SD] File system available."); - // 创建新数据库 if (sqlite3_open(DB_NAME, &g_db) != SQLITE_OK) { @@ -458,6 +446,6 @@ void thread_DB_SQLite(void) } else { - LOG_D("Failed to create led thread!\n"); + LOG_D("Failed to create SQLite thread!\n"); } } diff --git a/applications/SDIO_elmfatfs.c b/applications/SDIO_elmfatfs.c index 194183a..e81012d 100644 --- a/applications/SDIO_elmfatfs.c +++ b/applications/SDIO_elmfatfs.c @@ -10,7 +10,6 @@ #include #include "dfs_fs.h" - #define DBG_TAG "mount_fs" #define DBG_LVL DBG_LOG #include @@ -25,9 +24,10 @@ void sd_mount(void *parameter) { if (rt_device_find("sd") != RT_NULL) { - if (dfs_mount("sd", "/", "elm", 0, NULL) == RT_EOK) + mkdir("/sddisk", 0777); + if (dfs_mount("sd", "/sddisk", "elm", 0, NULL) == RT_EOK) { - LOG_I("SD card mounted to '/' successfully"); + LOG_I("SD card mounted to '/sddisk' successfully"); // 挂载成功,释放信号量 if (mount_sem != RT_NULL) { @@ -46,7 +46,7 @@ void sd_mount(void *parameter) } // 避免空转,延时 100ms 再试 - rt_thread_mdelay(500); + rt_thread_mdelay(100); retry++; } } diff --git a/applications/main.c b/applications/main.c index 75e9c8b..2fa54c3 100644 --- a/applications/main.c +++ b/applications/main.c @@ -9,8 +9,11 @@ */ #include +#include #include "RUN_LED.h" #include "DB_SQLite.h" +#include "DATA_comm.h" +#include "DATA_uart.h" #define DBG_TAG "main" #define DBG_LVL DBG_LOG @@ -22,7 +25,8 @@ int main(void) { rt_sem_take(mount_sem, rt_tick_from_millisecond(5000)); // 等待挂载完成,最多等待 5 秒 thread_DB_SQLite(); - + data_comm_init(); + //start_uart_thread(); thread_RUN_LED();//运行指示灯线程 return RT_EOK; } diff --git a/rtconfig.h b/rtconfig.h index ec8715f..d12218a 100644 --- a/rtconfig.h +++ b/rtconfig.h @@ -110,7 +110,6 @@ /* end of elm-chan's FatFs, Generic FAT Filesystem Module */ #define RT_USING_DFS_DEVFS #define RT_USING_DFS_TMPFS -#define RT_USING_DFS_MQUEUE /* end of DFS: device virtual file system */ /* Device Drivers */