-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LFS example not working #3299
Comments
Digging forward so that I can use some LFS this is what I found NodeMCU 3.0.0.0 built with Docker provided by frightanic.com The documentation is outdated, please see the edits on the example:
So this brings us to the correct example: print(LFS) node.flashindex("_init")() print(LFS) print(node.LFS.list()) for k,v in pairs(node.LFS.list()) do print(k,v) end I don't know if it's just for the dev branch but my example now works producing the expected result. First I will start by stating that I really appreciate your work, thank you all. I propose a quick guide, more like a tour if you want for the serios programmer, who wants to know fast what this is all about without digging too much documentation. They'll get to it anyway but beying happy not frustrated, instant satisfaction guaranteed: From my gist guide to be perfect I still have to find quick answers to: Thank you, hope this helps the project |
Hey! Thanks for the quick-start guide prose. It would be great to get something like that integrated into the main documentation. To your questions in reverse order:
All told, then, yes, you can land everything you want on the board in a single |
Hi nwf, Thanks |
I've finally gotten LFS with latest 3.0 release running, but one thing from https://github.com/nodemcu/nodemcu-firmware/blob/dev/lua_examples/lfs/lfs_fragments.lua file that seems to be wrong is this one:
This always returns nil, even if loaded, causing my device to get stuck in LFS reload boot loop until reflashing firmware. Am I missing something, or is it just another thing missing in the docs? |
That sounds like another docs/examples bug after the refactoring of LFS and attendant deprecation of |
The plan was to leave the old interface working as it was. So this should probably get fixed if there is another release before we remove it. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Expected behavior
Obtain output as in docs example: https://nodemcu.readthedocs.io/en/dev/getting-started/#minimal-lfs-example
Actual behavior
node.flashreload("lfs.img")
Warning, deprecated API! node.flashreload. It will be removed soon. Use node.LFS interface instead. See documentation for details.
LFS region updated. Restarting.
Test code
Starting from scratch just now 28-sep-2020 with
git clone --recurse-submodules https://github.com/nodemcu/nodemcu-firmware.git
BUILD NodeMCU
Modify user_config.h
#define LUA_NUMBER_INTEGRAL
#define LUA_FLASH_STORE 0x40000
#define LUA_INIT_STRING "pcall(function() node.flashindex'_init'() end)"
#define BUILD_SPIFFS
#define SPIFFS_CACHE 1 // Enable if you use you SPIFFS in R/W mode
//#define SPIFFS_MAX_FILESYSTEM_SIZE 0x20000
#define SPIFFS_MAX_OPEN_FILES 4 // maximum number of open files for SPIFFS
#define FS_OBJ_NAME_LEN 31 // maximum length of a filename
docker run --rm -ti -v
pwd
/nodemcu-firmware:/opt/nodemcu-firmware marcelstoer/nodemcu-build buildUse NodeMCU PyFlasher to flash the image on ESP-12e
Using ESPlorer v0.2.0
Formatting file system. Please wait...
..................................................
NodeMCU 3.0.0.0 built with Docker provided by frightanic.com
branch: release
commit: 64bbf00
release: 3.0-master_20200910
release DTS: 202009090323
SSL: true
build type: integer
LFS: 0x40000 bytes total capacity
modules: crypto,dht,file,gpio,http,mdns,mqtt,net,node,pwm2,rtctime,sjson,sntp,softuart,tmr,uart,wifi
build 2020-09-28 08:29 powered by Lua 5.1.4 on SDK 3.0.1-dev(fce080e)
Build LFS from lua_examples/lfs/
docker run --rm -ti -v
pwd
/nodemcu-firmware:/opt/nodemcu-firmware -vpwd
/nodemcu-firmware/lua_examples/lfs/:/opt/lua marcelstoer/nodemcu-build lfs-imageAdding files: ./lfs_fragments.lua ./HTTP_OTA.lua ./_init.lua ./dummy_strings.lua
creating LFS_float_20200928-0840.img
creating LFS_integer_20200928-0840.img
Uploading to ESP file LFS_integer_20200928-0840.img...Success
>
----------------------------
LFS_integer_20200928-0840.img : 5670 bytes
----------------------------
Total file(s) : 1
Total size : 5670 bytes
file.rename("LFS_integer_20200928-0840.img","lfs.img")
>
----------------------------
lfs.img : 5670 bytes
----------------------------
Total file(s) : 1
Total size : 5670 bytes
Now using the guide https://nodemcu.readthedocs.io/en/dev/getting-started/#minimal-lfs-example
node.flashreload("lfs.img")
Warning, deprecated API! node.flashreload. It will be removed soon. Use node.LFS interface instead. See documentation for details.
LFS region updated. Restarting.
Create getinfo.lua in SPIFFS with content
print("The LFS addr is " .. node.getpartitiontable().lfs_addr)
print("The LFS size is " .. node.getpartitiontable().lfs_size)
print("The SPIFFS addr is " .. node.getpartitiontable().spiffs_addr)
print("The SPIFFS size is " .. node.getpartitiontable().spiffs_size)
> =node.heap()
43368
>
----------------------------
getinfo.lua : 264 bytes
lfs.img : 5670 bytes
----------------------------
Total file(s) : 2
Total size : 5934 bytes
With command line
>
print("The LFS addr is " .. node.getpartitiontable().lfs_addr)
The LFS addr is 663552
>
print("The LFS size is " .. node.getpartitiontable().lfs_size)
The LFS size is 262144
>
print("The SPIFFS addr is " .. node.getpartitiontable().spiffs_addr)
The SPIFFS addr is 925696
>
print("The SPIFFS size is " .. node.getpartitiontable().spiffs_size)
The SPIFFS size is 3256320
Tried to build also with default init.lua from SPIFFS //#define LUA_INIT_STRING "pcall(function() node.flashindex'_init'() end)" and the same thing happens, print(LFS._list) returns NIL
Tried building LFS with https://blog.ellisons.org.uk/article/nodemcu/a-lua-cross-compile-web-service/ with REMOTE LUAC.CROSS.INT (MASTER) but always get No zip file uploaded in Firefox and Chrome
NodeMCU startup banner
NodeMCU 3.0.0.0 built with Docker provided by frightanic.com
branch: release
commit: 64bbf00
release: 3.0-master_20200910
release DTS: 202009090323
SSL: true
build type: integer
LFS: 0x40000 bytes total capacity
modules: crypto,dht,file,gpio,http,mdns,mqtt,net,node,pwm2,rtctime,sjson,sntp,softuart,tmr,uart,wifi
build 2020-09-28 08:29 powered by Lua 5.1.4 on SDK 3.0.1-dev(fce080e)
Hardware
ESP-12e barebone
Thank you,
The text was updated successfully, but these errors were encountered: