Open Miq1 opened 2 years ago
Block numbers and pagesize arguments look good, as well as the length. Address looks fine too, it reads from the same address that stuff was written to. Can you upload the C:\Users\Micha\Documents\PlatformIO\Projects\Dewair\downloaded_fs_0x300000_0xfa000.bin
file for inspection?
downloaded_fs_0x300000_0xfa000.zip Here we go.
Well that's weird, given that file, I can immediately list its contents..
"C:\Users\Max\.platformio\packages\tool-mklittlefs\mklittlefs.exe" -b 8192 -p 256 -l downloaded_fs_0x300000_0xfa000.bin
19270 /config.html Thu Oct 13 08:44:23 2022
965 /set.js Thu Jan 01 00:00:00 1970
256 /settings.bin Thu Jan 01 00:00:00 1970
Creation time: Fri Oct 14 15:39:26 2022
But unpacking indeed fails with the same error message as yours. I'll try and understand why..
If that is a hint: I looked into the downloaded .bin file with a hex editor and found a file that supposedly should have been altered in the meantime being still at the state of the first write to it, despite the fact I did a fresh download after deleting the previous.
That may be natural for LittleFS, not doing an erase unless absolutely necessary to overwrite data. I'll keep it in mind though.
Wow, I just downloaded the latest source code for mklittlefs from https://github.com/earlephilhower/mklittlefs, compiled in debug mode, ready to step-by-step debug the point where it fails, and what do you know, that latest version can unpack the binary just fine?!
Directory ./unpack_dir/ does not exists. Try to create it.
config.html > ./unpack_dir/config.html size: 19270 Bytes
set.js > ./unpack_dir/set.js size: 965 Bytes
settings.bin > ./unpack_dir/settings.bin size: 256 Bytes
I need to check what the difference between this and the PIO packaged version is..
My compiled version now is mklittlefs.zip
I seem to have stirred up something?
If that matters, the settings.bin
file is written binary, so it may contain any byte value - could that cause problems?
No that shouldn't matter at all. If you save binary files, then those must be preseverd exactly as is. Same for the html and js files. As referenced in the issue, although I can "extract" the files now, they don't match what I see in the littlefs .bin image.
>type unpack_dir\*
unpack_dir\config.html
��3������3���3������h�3�Yd����3���3���3�e�����3�
!��3�60305�c�"r��3������
�3�60305ML����3�x�3�$������{;��������3�p�3�{;��3��3�P1;����3��3�PA����������3�3��2��0�3�0���3�@\Registry\Machine\System\CurrentControlSet\Control\Nls\Sorting\Versions��T�0�3�Q�3������Q�3�0�3�l�3�h�3����T� �Wh���2���3�P�3���3������p�3��3������0�3�H�3���3��������3�B����3�@F�T�000603xx�2�;����,�3�Q������3���T��y���0F�T�1d�"r��3���2���3���T��Wh���T�Ad�"r��3���T���3��3�������3���3�,�3�A�����3�������3���T� �h�3���3�������3�*���Z�"r��3���2�@�3�(
unpack_dir\set.js
��T���$�T��$�T�3P�T��f�T�
��$�T�� � �T��P�T���)�T�P�T�H�T��0�����T�#��B�T��B�T������T�'�T�k������T��b���������T�@Y����T���T������0�
}C���3��`p�C�%C�����T����3�0��������@� �@яC�p<��|C��b������Zt�C�
unpack_dir\settings.bin
@@яC�p<�3�
�|C��b������Zt�C�
�3�@����
}C���3�0�C�
The first two cannot be correct when I clearly see human-readable HTML code in the .bin file.
At least I am able to re-read the binary file obviously. I will try to open and read the set.js file as well to make sure it is nothing caused by my application.
Use newer mklittlefs (not in pio Registry). The issue was that the needed setting -s
was not given in the script. Newer mklittlefs does not need -s
option anymore for extracting files.
Uploaded a updated mklittlefs for esp32x MCUs. Extracting files does now work for me. Before never got this going. https://registry.platformio.org/tools/tasmota/tool-mklittlefs
Thanks for the hints, I will retest this. I think we also talked about this in https://github.com/earlephilhower/mklittlefs/pull/31. If it's just -s
that's missing, that's a small change to make it work properly.
@maxgerhardt in my tests -s
was not enough. Esp32 littlefs is build in IDF with LFS_NAME_MAX 64
and the earlephilower mklittlefs is built for esp8266 with LFS_NAME_MAX 32
.
Thats why i built a extra mklittlefs for ESP32x with LFS_NAME_MAX 64
-> https://github.com/Jason2866/mklittlefs_esp32
Due to the ancient version of "tool-mklittlefs"/mklittlefs in platformio (dating back to Feb 11, 2021, auto FS size retrieval not included yet), I ran into the same issue (_littlefs/lfs.c:84: lfs_bd_read: Assertion `block < lfs->cfg->blockcount' failed).
For me (currently working on esp8266) it was enough to pimp download_fs.py#L61 with an additional "-s", str(self.length),
argument to hand over the size known to the download script to mklittlefs for unpacking images different from the default length correctly.
For esp8266 it is enough to add "-s" as mentioned from @Henning-Lenz I have refactored the script for Tasmota (only using LittleFS) and with the changed mklittlefs for esp32 it is working now for esp8266 and esp32 (core2 and core3 alpha). https://github.com/arendst/Tasmota/blob/development/pio-tools/custom_target.py
What I did:
data
folderThat resulted in
My
platformio.ini
looks like:The upload looked good to me: