LFS, firmware and LUA file mix and match
Posted: Sat Mar 28, 2020 2:33 pm
Is there a webpage that describes how to flash new firmware without disturbing existing LFS and LUA areas?
Example flow
- create a new firmware build with an additional module with cloud builder
https://nodemcu-build.com/index.php
LFS size=128kb
SPIFFS base=1024k
SPIFFS size=all free flash
- flash in such a way that LFS and LUA are not initialized to x'FF'
- it is hoped that the first boot after flash uses the same init.lua as before the firmware upgrade
Having to upload the LFS image and sufficient LUA files one at a time to bootstrap the final configuration is not ideal.
I have tried the following
1. backup/restore (works, device boots as expected through init.lua)
esptool.py -b 115200 --port COM5 read_flash 0x00000 0x400000 NodeMcu_backup.bin
esptool.py -b 115200 --port COM5 write_flash --flash_freq 80m 0x000000 NodeMcu_backup.bin
2. divided the flash address space into 2 pieces for backup/restore (works)
same as above, but in 2 parts, A: 1M and B: 3M
3. flashing with new firmware to 0x0 with esptool fills the space beyond the firmware with xFF
4. flashing with ESP8266Flasher (64 bit).exe (NodeMCU Firmware programmer) behaves similarly
5. attempting to flash part B starting at 0x100000 does not fail with esptool but does not result in working LFS, LUA either
6. I have looked at the 4M binary and it is not obvious to me that LFS starts at 0x100000 nor that LUA files start 128k after that.
In other words, is there a way to flash new firmware, then restore a backup of LFS and LUA through a subsequent flashing operation?
Given the following statement in the LFS documentation, I believe there must be a way using cloudbuilder and the luac web service (https://blog.ellisons.org.uk/article/no ... b-service/)
SPIFFS base: right after firmware or offset up to 1024k. If you have a 4Mb flash module then I suggest you choose the 1024Kb option as this will preserve the SPIFFS even if you reflash with a larger firmware image; otherwise leave this at the default 0
Example flow
- create a new firmware build with an additional module with cloud builder
https://nodemcu-build.com/index.php
LFS size=128kb
SPIFFS base=1024k
SPIFFS size=all free flash
- flash in such a way that LFS and LUA are not initialized to x'FF'
- it is hoped that the first boot after flash uses the same init.lua as before the firmware upgrade
Having to upload the LFS image and sufficient LUA files one at a time to bootstrap the final configuration is not ideal.
I have tried the following
1. backup/restore (works, device boots as expected through init.lua)
esptool.py -b 115200 --port COM5 read_flash 0x00000 0x400000 NodeMcu_backup.bin
esptool.py -b 115200 --port COM5 write_flash --flash_freq 80m 0x000000 NodeMcu_backup.bin
2. divided the flash address space into 2 pieces for backup/restore (works)
same as above, but in 2 parts, A: 1M and B: 3M
3. flashing with new firmware to 0x0 with esptool fills the space beyond the firmware with xFF
4. flashing with ESP8266Flasher (64 bit).exe (NodeMCU Firmware programmer) behaves similarly
5. attempting to flash part B starting at 0x100000 does not fail with esptool but does not result in working LFS, LUA either
6. I have looked at the 4M binary and it is not obvious to me that LFS starts at 0x100000 nor that LUA files start 128k after that.
In other words, is there a way to flash new firmware, then restore a backup of LFS and LUA through a subsequent flashing operation?
Given the following statement in the LFS documentation, I believe there must be a way using cloudbuilder and the luac web service (https://blog.ellisons.org.uk/article/no ... b-service/)
SPIFFS base: right after firmware or offset up to 1024k. If you have a 4Mb flash module then I suggest you choose the 1024Kb option as this will preserve the SPIFFS even if you reflash with a larger firmware image; otherwise leave this at the default 0