Skip to content
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

Documentation mess #3673

Open
bjne opened this issue Dec 21, 2024 · 0 comments
Open

Documentation mess #3673

bjne opened this issue Dec 21, 2024 · 0 comments

Comments

@bjne
Copy link

bjne commented Dec 21, 2024

For several days I have spent trying to decipher the documentation to understand how to properly flash a LFS image
to the esp8266 using esptool. I understand there are multiple ways, one can place the LFS image in spiffs, one can
place it at a offset, and in a partition? This is badly documented.

in user_config.h the following (LFS related) is defined

LUA_FLASH_STORE 0x10000

Which I understand defines the default size of the LFS image if its not overridden in partition table.

NODEMCU_LFS0_PARTITION 3
NODEMCU_LFS1_PARTITION 4

I am not really able to find any documentation about what this actually does.

Running the code:

do
  local s,p={},node.getpartitiontable()
  for _,k in ipairs{'lfs_addr','lfs_size','spiffs_addr','spiffs_size'} do
    s[#s+1] ='%s = 0x%06x' % {k, p[k]}
  end
  print ('{ %s }' % table.concat(s,', '))
end

outputs the following:

{ lfs_addr = 0x07a000, lfs_size = 0x010000, spiffs_addr = 0x08a000, spiffs_size = 0x373000 }

Given this information, I try to create a lfs image:

first a compact relocatable (https://nodemcu.readthedocs.io/en/dev/compiling/) documentation is hard to understand also here:

./luac.cross -f -m 0x10000  local/fs/init.lua
Image size: 5132

Then I believe I should flash this to the 0x07a000 region:

tools/toolchains/esptool.py --port /dev/ttyUSB0 write_flash -fm dio 0x07a000 luac.out
esptool.py v2.6
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: e8:db:84:eb:a8:e4
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 2068 bytes to 2079...
Wrote 2068 bytes (2079 compressed) at 0x0007a000 in 0.2 seconds (effective 88.5 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

After resetting, serial console outputs:

Flash sig not correct: 0x00088b1e vs 0xfafaa154

Ok, so lets try to create a absolute addressed lfs image (even tho docs say:
_Note that the new NodeMCU loader uses the -f compact relocatable form and does relocation based on the Partition Table, so this option is deprecated and will be removed in future releases.)

./luac.cross -f -a 0x07a000 -s -m 0x10000  local/fs/init.lua
./luac.cross: '-e' absolute address must be valid flash address
usage: ./luac.cross [options] [filenames].

At this point I am really lost. can someone please try to clarify?
How does partition0 and partition1 relate to the lfs_addr?
How should I compile the LFS image?
How should I flash it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant