Browse Source

change: 默认关闭fatfs的长文件名支持,并在luat_conf_bsp中添加选项

Wendal Chen 4 years ago
parent
commit
07f9101eb2
3 changed files with 31 additions and 18 deletions
  1. 22 15
      app/port/luat_conf_bsp.h
  2. 2 0
      lib/xmake.lua
  3. 7 3
      src/app/fatfs/ffconf.h

+ 22 - 15
app/port/luat_conf_bsp.h

@@ -24,20 +24,20 @@
 // 外设,按需启用, 最起码启用uart和wdt库
 #define LUAT_USE_UART 1
 #define LUAT_USE_GPIO 1
-// #define LUAT_USE_I2C  1
+#define LUAT_USE_I2C  1
 #define LUAT_USE_SPI  1
-// #define LUAT_USE_ADC  1
+#define LUAT_USE_ADC  1
 #define LUAT_USE_PWM  1
 #define LUAT_USE_WDT  1
 #define LUAT_USE_PM  1
 #define LUAT_USE_MCU  1
 // hwtimer库对lua代码没多少用处,通常禁用
 // #define LUAT_USE_HWTIMER  1
-// #define LUAT_USE_RTC 1
+#define LUAT_USE_RTC 1
 // SDIO 仅支持TF/SD卡的挂载
-// #define LUAT_USE_SDIO 1
+#define LUAT_USE_SDIO 1
 // 段码屏/段式屏, 按需启用
-// #define LUAT_USE_LCDSEG 1
+#define LUAT_USE_LCDSEG 1
 
 //----------------------------
 // 常用工具库, 按需启用, cjson和pack是强烈推荐启用的
@@ -46,13 +46,20 @@
 #define LUAT_USE_ZBUFF  1
 #define LUAT_USE_PACK  1
 // #define LUAT_USE_GNSS  1
-// #define LUAT_USE_FS  1
-// #define LUAT_USE_SENSOR  1
-// #define LUAT_USE_SFUD  1
+#define LUAT_USE_FS  1
+#define LUAT_USE_SENSOR  1
+#define LUAT_USE_SFUD  1
 // #define LUAT_USE_STATEM 1
 // 性能测试,跑完就是玩,不要与lvgl一起启用,生产环境的固件别加这个库
 // #define LUAT_USE_COREMARK 1
 
+//---------------SDIO-FATFS特别配置
+// sdio库对接的是fatfs
+// fatfs的长文件名和非英文文件名支持需要180k的ROM, 非常奢侈
+// 从v0006开始默认关闭之, 需要用到就打开吧
+// #define FF_USE_LFN 0
+// #define FF_LFN_UNICODE 0
+
 //----------------------------
 // 高通字体, 需配合芯片使用
 // #define LUAT_USE_GTFONT 1
@@ -60,28 +67,28 @@
 
 //----------------------------
 // 高级功能, 其中shell是推荐启用, 除非你打算uart0也读数据
-// #define LUAT_USE_SHELL 1
+#define LUAT_USE_SHELL 1
 // NIMBLE 是蓝牙功能, 名为BLE, 但绝非低功耗.
-// #define LUAT_USE_NIMBLE 1
+#define LUAT_USE_NIMBLE 1
 // FDB 提供kv数据库, 与nvm库类似
-// #define LUAT_USE_FDB 1
+#define LUAT_USE_FDB 1
 // 多虚拟机支持,实验性,一般不启用
 // #define LUAT_USE_VMX 1
 
-// #define LUAT_USE_DBG
+#define LUAT_USE_DBG
 
 //---------------------
 // UI
 // LCD  是彩屏, 若使用LVGL就必须启用LCD
 #define LUAT_USE_LCD
 // EINK 是墨水屏
-// #define LUAT_USE_EINK
+#define LUAT_USE_EINK
 
 //---------------------
 // U8G2
 // 单色屏, 支持i2c/spi
-// #define LUAT_USE_DISP
-// #define LUAT_USE_U8G2
+#define LUAT_USE_DISP
+#define LUAT_USE_U8G2
 // #define U8G2_USE_SH1106
 // #define U8G2_USE_ST7567
 

+ 2 - 0
lib/xmake.lua

@@ -7,6 +7,8 @@ target("app")
     set_kind("static")
     set_plat("cross")
     set_arch("c-sky")
+
+    add_includedirs(sdkdir .. "app/port")
     
     add_files(sdkdir.."src/app/**.c")
     del_files(sdkdir.."src/app/btapp/**.c")

+ 7 - 3
src/app/fatfs/ffconf.h

@@ -1,3 +1,5 @@
+#include "luat_conf_bsp.h"
+
 /*---------------------------------------------------------------------------/
 /  FatFs Functional Configurations
 /---------------------------------------------------------------------------*/
@@ -96,8 +98,9 @@
 /     0 - Include all code pages above and configured by f_setcp()
 */
 
-
-#define FF_USE_LFN		3
+#ifndef FF_USE_LFN
+#define FF_USE_LFN		0
+#endif
 #define FF_MAX_LFN		255
 /* The FF_USE_LFN switches the support for LFN (long file name).
 /
@@ -116,8 +119,9 @@
 /  memory for the working buffer, memory management functions, ff_memalloc() and
 /  ff_memfree() exemplified in ffsystem.c, need to be added to the project. */
 
-
+#ifndef FF_LFN_UNICODE
 #define FF_LFN_UNICODE	0
+#endif
 /* This option switches the character encoding on the API when LFN is enabled.
 /
 /   0: ANSI/OEM in current CP (TCHAR = char)