logo elektroda
logo elektroda
X
logo elektroda
Dostępna jest polska wersja

Czy wolisz polską wersję strony elektroda?

Nie, dziękuję Przekieruj mnie tam

Why is BL602 LFS (LittleFS) missing in the current build and can it be implemented?

DeDaMrAz 1641 28
Best answers

Why is BL602 LittleFS missing in the current build, and can it be enabled?

BL602 LittleFS is not fundamentally missing; it was part of an unmerged PR, and it works once the build uses a compatible partition layout/TOML [#21583299] LFS will work on any TOML that has a media partition, and the recommended TOML for future use is `partition_cfg_2M.toml` [#21583616] The BL602 update was pushed and tested, with LFS present, preserved after OTA, and working [#21583674] The PR was later considered ready to merge [#21584443] If you still have trouble importing an LFS backup, that appears to be a separate web-app issue rather than an LFS problem [#21583674]
ADVERTISEMENT
  • #1 21583294
    DeDaMrAz
    Level 22  
    Hey @divadiow and @insmod

    I am back testing something for 5 minutes and I already ran into a problem 😊 there is no BL602 LFS present in the current build, any particular reason for that or can we implement it?

    Saw this from @divadiow

    #define LFS_BLOCKS_START 0x190000
    #define LFS_BLOCKS_START_MIN 0x190000


    But wanted to ask first if there was any problems with it??
  • ADVERTISEMENT
  • #3 21583316
    p.kaczmarek2
    Moderator Smart Home
    This is the PR that is waiting for "BL602 bricked when OTA file after decompression is too large"? @insmod
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #5 21583480
    p.kaczmarek2
    Moderator Smart Home
    Maybe it could be done in Javascript in Web App?

    Regarding OTA header - are those bytes checked anywhere?
    Code: Python
    Log in, to see the code

    Maybe use them to keep uncompressed len and in firmware check for default value (older OTA files) - then pass, otherwise check the lenght.
    Helpful post? Buy me a coffee.
  • Helpful post
    #6 21583488
    insmod
    Level 31  
    >>21583480
    I don't see if they are used, but i think it's better to insert file size after sha256. That way compatibility is guaranteed.

    Added after 1 [hours] 45 [minutes]:

    Pushed an update for BL602, needs testing.
    Additionally added heap_5 for W600. + enabled LTO + fixed building with newer gcc versions (gcc 8 +3kb size, gcc 11 +6kb).
    Replaced tls_get_netif in WiFI_GetMacAddress with tls_get_mac_addr. Now MAC address is not zeroed at first boot, leading to normal full name.
    Last release W600 is 545212 bytes, pull with LFS is 548712 bytes. With LFS without LTO is 564952 bytes.
  • #9 21583604
    DeDaMrAz
    Level 22  
    Next question would be to use the toml @max4elektroda provided or stick with the original?


    Why is BL602 LFS (LittleFS) missing in the current build and can it be implemented?

    LFS present and working, tested with both toml files. Mind you I have no idea what chip is inside WB2-12F module 🙂

    Parsing of LFS backup import looks a bit strange thou 😁


    Why is BL602 LFS (LittleFS) missing in the current build and can it be implemented?
  • #11 21583619
    DeDaMrAz
    Level 22  
    >>21583616

    Info:MAIN:Time 288, idle 0/s, free 112400, MQTT 0(18), bWifi 1, secondsWithNoPing 218, socks 2/21
    Info:MAIN:Time 292, idle 0/s, free 112400, MQTT 0(18), bWifi 1, secondsWithNoPing 222, socks 2/21
    Info:MAIN:Time 293, idle 0/s, free 112408, MQTT 0(18), bWifi 1, secondsWithNoPing 223, socks 2/21
    Error:OTA:Unpacked OTA image size (922368) is bigger than running partition size (884736)
    Info:MAIN:Time 299, idle 0/s, free 111552, MQTT 0(18), bWifi 1, secondsWithNoPing 229, socks 3/21
  • #12 21583624
    insmod
    Level 31  
    Looks like it works.
    Just to be sure flash with new toml and try to ota to berry again.
    Finally merge-ready?
  • #13 21583658
    DeDaMrAz
    Level 22  
    Let me attach DS18B20 to it first as I think I saw somewhere it can break that sensor (still catching up to all your guys work).
  • #14 21583671
    insmod
    Level 31  
    Pushed an update for delay_us on BL602. Now uses bl_timer_delay_us instead of nops. Untested.
  • ADVERTISEMENT
  • #15 21583674
    DeDaMrAz
    Level 22  
    >>21583671

    oh c'mon! 😁 hold up let me test something first

    Why is BL602 LFS (LittleFS) missing in the current build and can it be implemented?

    DS18B20 works...

    Added after 13 [minutes]:

    >>21583624

    OTA to berry passes with the latest build


    Why is BL602 LFS (LittleFS) missing in the current build and can it be implemented?

    LSF present/preserved and working


    Why is BL602 LFS (LittleFS) missing in the current build and can it be implemented?

    Final version of the DevCube with corect 2M toml file can be found here - https://www.dropbox.com/scl/fi/e4351scw2oj5yk...59t5okpqw7h4cvr6a5tz&st=92r6mulg&dl=0

    P.S. I know there is a newer version of devcube but haven'g got to it to test it.

    Added after 9 [minutes]:

    Will try to find W800 module and test that as well and we can call it a day on this PR, correct? @insmod there is still an issue on importing LFS from backup thought!

    @divadiow do you have W800 devboard and know where it is maybe? 🙂
  • #16 21583704
    insmod
    Level 31  
    There is no real difference in devcube versions, the most important thing is correct toml.
    W800 is already tested and confirmed working.

    Added after 2 [minutes]:

    I suppose W600 can be tested, but when i flashed it and did ota everything was ok.
  • ADVERTISEMENT
  • #18 21583713
    insmod
    Level 31  
    I don't know, but LFS itself works fine.
  • #19 21583718
    DeDaMrAz
    Level 22  
    LFS does work fine and is preserved after OTA, but backup import is broken, at least on BL602.

    Same file just downloaded and reimported as if tar parsing is now being done.


    Why is BL602 LFS (LittleFS) missing in the current build and can it be implemented?

    Ok, that seems to be the problem in the webapp it self, I'll give it a check soon and report back.
  • #20 21584032
    divadiow
    Level 38  
    Heyyy. Will reread what's going on shortly. Not sure what needs testing still, if anything.
  • #21 21584288
    p.kaczmarek2
    Moderator Smart Home
    It seems very good to merge now. Variants improvement is also acceptable. I just need a final confirmation. I saw DS18B20 was tested, but was DHT11 tested as well?
    Helpful post? Buy me a coffee.
  • #22 21584294
    DeDaMrAz
    Level 22  
    Why is BL602 LFS (LittleFS) missing in the current build and can it be implemented?

    DHT11 is working on BL602.

    Added after 35 [minutes]:

    @insmod

    Is internal temperature on BL602 now refreshed every second or maybe tied to CH1 somehow??

    I got these reading within seconds if DS was set on CH1


    Why is BL602 LFS (LittleFS) missing in the current build and can it be implemented?

    Why is BL602 LFS (LittleFS) missing in the current build and can it be implemented?

    If I move DS to ch2 it normalizes.
  • #23 21584408
    insmod
    Level 31  
    >>21584294
    I did nothing to temperature sensor, and even then, there should be no correlation between channels and sensor.
    It's likely the same in release version.
  • #24 21584422
    divadiow
    Level 38  
    I've definitely seen the behaviour @DeDaMrAz describes. I'd made the connection with the new SDK rather than any PR, but may be misremembering. I can check unless @DeDaMrAz does first.
  • #25 21584443
    p.kaczmarek2
    Moderator Smart Home
    I've decided to merge it now. Good job, guys! Now, the next thing I would like to have merged ASAP (so I can also start testing on my side) are BK7251 builds, as long as they just boot into OBK, that's ok. Can you open PRs @insmod ?

    I would also like go through @max4elektroda PRs, some of them seem interesting, but they need testing really before merge... especially multiple DS18B20s
    Helpful post? Buy me a coffee.
  • #26 21584448
    insmod
    Level 31  
    >>21584443
    Don't forget to merge XR and W600/W800 pulls.
  • #27 21584464
    p.kaczmarek2
    Moderator Smart Home
    I see you also ported our old MQTT.c lwip fixes for xr872, nice...
    Helpful post? Buy me a coffee.
  • #28 21598479
    divadiow
    Level 38  
    I was about to say maybe the BL602 zip should include the revised toml, but I guess most users would get the individual files from the releases page. How can it be made clear which toml should be used now?

    Added after 8 [minutes]:

    Ooh. Could OpenBL602 list partition addresses/sizes so when a user has x issue that info may help with knowing which toml was used for original flash? Might also be useful for mhflasher OTA situations.
  • #29 21598502
    p.kaczmarek2
    Moderator Smart Home
    maybe add invididual zips to release page instead of just bins? Zip with bin, toml and... a readme.
    Helpful post? Buy me a coffee.

Topic summary

✨ The BL602 LittleFS (LFS) filesystem was initially missing in the current build due to pending issues related to OTA update handling, specifically when decompressed OTA files exceed partition sizes. A pull request (#1629) introduced improved LFS support compatible with various partition layouts, including the older 1.4.8 type. The implementation requires a proper partition configuration TOML file with a media partition; the recommended TOML for 2MB flash devices was shared and tested successfully. LFS functionality was confirmed working and preserved after OTA updates on BL602, W600, and W800 modules. However, LFS backup import currently has issues on BL602, likely due to web app parsing errors. Additional fixes included updating delay functions and ensuring MAC address initialization correctness. Sensor compatibility was verified with DS18B20 and DHT11 on BL602. The PR was deemed ready for merging, with further testing encouraged on BK7251 and other platforms. The discussion also covered potential OTA header modifications to include uncompressed file size for better OTA validation and compatibility.

FAQ

TL;DR: BL602 LittleFS was missing in some builds because support depended on partition layout and an unmerged patch path; PR #1629 restored it for newer layouts. "LFS will work on any toml that has media partition," and the tested size impact was 3.5 KB with LTO enabled. This FAQ helps OpenBL602/OpenBK users choose the right TOML, avoid OTA brick risks, and verify LFS survives updates. [#21583616]

Why it matters: On BL602, the right partition TOML decides whether LittleFS works, whether OTA safely rejects oversized images, and whether your storage survives updates.

Opcja Status LFS OTA Uwagi
Stary układ 1.4.8 Działa Starszy układ Użytkownik powinien dostać LFS już tutaj
Nowszy poprawny TOML 2M Działa Potwierdzone testami Najlepszy wybór na przyszłość
TOML bez partycji media Nie działa Nie dotyczy LFS wymaga partycji media

Key insight: BL602 nie potrzebował „wycięcia” LittleFS na stałe; potrzebował poprawnego układu partycji i zabezpieczenia OTA przed zbyt dużym obrazem po dekompresji.

Quick Facts

  • LFS_BLOCKS_START i LFS_BLOCKS_START_MIN były pokazane jako 0x190000, co wskazuje stały obszar startowy LFS w jednym z układów pamięci. [#21583294]
  • Test błędu OTA wykazał konkretny limit: rozpakowany obraz miał 922368 bajtów, a aktywna partycja tylko 884736 bajtów, więc aktualizacja została poprawnie zablokowana. [#21583619]
  • Na W600 ostatni release miał 545212 bajtów, build z LFS i LTO 548712 bajtów, a z LFS bez LTO 564952 bajtów. [#21583488]
  • Nowsze kompilatory zwiększały rozmiar firmware: GCC 8 o około +3 KB, a GCC 11 o około +6 KB, więc optymalizacja rozmiaru miała realny wpływ. [#21583488]
  • Po poprawkach BL602 przeszedł testy z DS18B20, DHT11 i OTA do Berry, a LFS pozostał zachowany po aktualizacji. [#21583674]

Why is BL602 LittleFS missing in some current builds, and what changed in PR #1629 to bring LFS support back?

BL602 LittleFS was missing in some builds because support was tied to partition layout handling, and the broader LFS support lived in an unmerged path until PR #1629. The change added better LFS support for different partition layouts and restored working LFS in the tested BL602 flow. After that update, BL602 builds with the right TOML showed LFS present and working. [#21583299]

How do I enable LittleFS on BL602 using the old 1.4.8-style partition layout TOML?

Use the old 1.4.8-style partition TOML and flash a build that includes the PR #1629 changes. The maintainer explicitly said you should get LFS with the old 1.4.8-type partition layout. 1. Flash BL602 with the old 1.4.8-style TOML. 2. Boot firmware and verify the media/LFS area appears. 3. Confirm LFS survives a reboot or OTA test. [#21583299]

What is LittleFS (LFS), and why would I use it on OpenBL602 or OpenBK firmware?

"LittleFS" is a small flash file system that stores files in onboard flash, survives reboots, and works well on constrained embedded devices. You would use it on OpenBL602 or OpenBK to keep files and backups persistent across updates. In this thread, LFS was confirmed present, working, and preserved after OTA on BL602. [#21583674]

What is a partition layout TOML file in BouffaloLab DevCube, and how does it affect BL602 flashing and OTA updates?

"Partition layout TOML" is a configuration file that defines flash partition addresses and sizes, including where firmware and media storage live, which directly controls flashing behavior and OTA safety. On BL602, the correct TOML determines whether LFS works and whether OTA image-size checks compare against the right running partition. [#21583616]

Which partition TOML is best for BL602 going forward: the original layout or the newer correct 2M TOML?

The newer correct 2M TOML is the best choice going forward. The maintainer said, "The best toml for the future" is the updated partition_cfg_2M.toml.txt, and later clarified that correct TOML matters more than DevCube version. Use the original layout only for compatibility testing. [#21583616]

How can I tell whether my BL602 TOML has the required media partition so LFS will work?

Check whether the TOML defines a media partition. The maintainer stated a simple rule: LFS works on any TOML that has a media partition. If LFS is missing after flashing, the first thing to verify is whether the TOML includes that partition and allocates space for it. [#21583616]

Why does BL602 OTA fail with an error like 'Unpacked OTA image size is bigger than running partition size,' and how was that fixed?

OTA fails because the decompressed image is larger than the active firmware partition, so flashing it would overflow the allowed space. The thread showed a real failure case: 922368 bytes unpacked versus 884736 bytes available. The fix added a size-aware OTA path so the firmware blocks the update instead of risking a brick. [#21583619]

What changed in the BL602 OTA header to prevent devices from bricking when the decompressed OTA image is too large?

The OTA header was changed to carry the OTA file size, so firmware can validate the decompressed image before applying it. The proposed implementation added *_OTA.bin size to ota_header, first in flash_build.py under bl_mfg_ota_header, then in the rest_interface ota_header struct. That moved the protection into a predictable header field. [#21583442]

How do I test whether the new BL602 firmware size check really blocks an oversized OTA image before flashing?

Try an OTA to Berry while using the default TOML, then watch the log for a size-rejection message. 1. Flash BL602 with the target TOML. 2. Start an OTA to Berry. 3. Confirm the log reports the unpacked image exceeds the running partition, instead of flashing it. The thread showed exactly that rejection on BL602. [#21583619]

Why is LFS preserved after OTA on BL602, but backup import appears broken or parses the file strangely?

LFS itself survives OTA, but backup import looked broken because the issue appeared during file parsing rather than LFS storage. The tester confirmed LFS was present, preserved, and working after OTA, then reported that reimporting the same downloaded file parsed strangely. That points to an import-path problem, not loss of the filesystem. [#21583718]

Could the BL602 LFS backup import problem be in the Web App rather than the firmware, and how would I troubleshoot that?

Yes, the thread strongly points to the Web App. The tester said the same file, once downloaded and reimported, behaved as if TAR parsing was being applied incorrectly, then concluded the problem seemed to be in the Web App itself. To troubleshoot, compare export and reimport behavior with the same file and inspect the parser path before blaming firmware. [#21583718]

How does the updated delay_us implementation on BL602 using bl_timer_delay_us affect 1-wire sensors like DS18B20 and DHT11?

The update changed delay_us on BL602 to use bl_timer_delay_us instead of NOP loops, which matters because 1-wire timing is sensitive. After that change, DS18B20 was tested and reported working, and DHT11 was also later confirmed working on BL602. That makes the timing change promising, though it was initially marked untested. [#21584294]

Why does the BL602 internal temperature reading seem to change when a DS18B20 is placed on CH1, and what should I check?

The behavior was observed, but the thread did not identify a firmware-side cause. One tester saw internal temperature readings change within seconds when DS18B20 used CH1, while moving the sensor to CH2 normalized the readings. The maintainer said no temperature-sensor code had changed, so you should first compare CH1 versus CH2 and verify whether the same behavior appears in the release build. [#21584408]

What is LTO in these OpenBK/OpenBL602 builds, and how much firmware size does it save compared with building without LFS or without LTO?

"LTO" is Link Time Optimization that reduces firmware size by optimizing across compiled units, which is especially useful on flash-limited embedded targets. In this thread, W600 measured 548712 bytes with LFS and LTO, versus 564952 bytes with LFS but without LTO. That is a savings of 16240 bytes, or about 15.9 KB. [#21583488]

What's the best way to package BL602 releases so users know which BIN, TOML, and README to use for flashing and OTA?

Package individual ZIP files that include the BIN, the correct TOML, and a short README. That proposal came directly from the thread after users noted most people download release assets individually and may miss which TOML they need. The same discussion also suggested making partition addresses and sizes visible to help diagnose flashing and OTA issues later. [#21598502]
ADVERTISEMENT