From 6f5c81f8eb1a4b73eff19a8512e9bbac16540950 Mon Sep 17 00:00:00 2001 From: h2zero Date: Sat, 23 Oct 2021 14:24:38 -0600 Subject: [PATCH] Fix SPIFFS location and update LFS loading. --- firmware/nodemcu-firmware-overlay/app/include/user_config.h | 3 ++- firmware/nodemcu-firmware-overlay/app/user/user_main.c | 2 +- src/init.lua | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/firmware/nodemcu-firmware-overlay/app/include/user_config.h b/firmware/nodemcu-firmware-overlay/app/include/user_config.h index 07aed86..a3c0fd9 100644 --- a/firmware/nodemcu-firmware-overlay/app/include/user_config.h +++ b/firmware/nodemcu-firmware-overlay/app/include/user_config.h @@ -98,7 +98,8 @@ #define BUILD_SPIFFS #define SPIFFS_CACHE 1 // Enable if you use you SPIFFS in R/W mode -//#define SPIFFS_MAX_FILESYSTEM_SIZE 128000 +#define SPIFFS_MAX_FILESYSTEM_SIZE 0x100000 +#define SPIFFS_FIXED_LOCATION 0x100000 #define SPIFFS_MAX_OPEN_FILES 4 // maximum number of open files for SPIFFS #define FS_OBJ_NAME_LEN 31 // maximum length of a filename diff --git a/firmware/nodemcu-firmware-overlay/app/user/user_main.c b/firmware/nodemcu-firmware-overlay/app/user/user_main.c index 92c0e8e..c9d4788 100644 --- a/firmware/nodemcu-firmware-overlay/app/user/user_main.c +++ b/firmware/nodemcu-firmware-overlay/app/user/user_main.c @@ -89,7 +89,7 @@ static const struct defaultpt rompt IROM_PTABLE_ATTR USED_ATTR = { { NODEMCU_PARTITION_IROM0TEXT, 0x10000, 0x0000}, { NODEMCU_PARTITION_LFS, 0x0, LUA_FLASH_STORE}, { NODEMCU_PARTITION_SPIFFS, 0x0, SPIFFS_MAX_FILESYSTEM_SIZE}, - { SYSTEM_PARTITION_SYSTEM_PARAMETER, 0x0, SYSTEM_PARAMETER_SIZE}, + { SYSTEM_PARTITION_SYSTEM_PARAMETER, 0x0, SYSTEM_PARAMETER_SIZE}, {0,(uint32_t) &_irom0_text_end,0} } }; diff --git a/src/init.lua b/src/init.lua index 49fda46..005c83a 100644 --- a/src/init.lua +++ b/src/init.lua @@ -1,8 +1,8 @@ print("Heap: ", node.heap(), "Initializing Konnected (" .. string.gsub(wifi.sta.getmac(), ":", "") .. ")") -- load the application in LFS if needed -if node.flashindex() == nil then - node.flashreload("lfs.img") +if node.flashindex("_init") == nil then + node.LFS.reload("lfs.img") end pcall(node.flashindex("_init"))