Storage Module Limitation

Posted on
  • Hi I'm trying to put a website on ESP8266 4MB Flash, but then when i try to save files into Storage module, I found that I can't write any file size larger than 12k

    require("Storage").write("test","a",0,12­500);
    

    will return

    Uncaught Error: Unable to find or create file
     at line 1 col 44
    

    Isn't there a ~4MB Flash storage for me to store stuffs?

    p.s. here's how I initialize my ESP12

    python3 esptool.py --port /dev/cu.usbserial-1410 --baud 115200 \
    write_flash --flash_freq 80m --flash_mode qio --flash_size 4MB \
    0x0000 "boot_v1.6.bin" 0x1000 espruino_esp8266_user1.bin \
    0x3FC000 esp_init_data_default.bin 0x3FE000 blank.bin

  • The esp32 implements the fs filesystem using flash - that has 1mb of flash set aside - use that to store you files. If you look at the docs you should be able to find out how to initialise the space, or search the forums.

  • Storage is always in the memory mapped segment and is 48 pages in size.

    Use flash to access area between 3-4MB

    Check this page for further details http://www.espruino.com/EspruinoESP8266

  • maybe a limit in storage implementation?

    No limit, works without error on my side

    >process.env
    ={
      VERSION: "2v03.4",
      GIT_COMMIT: "018e5296",
      BOARD: "ESP8266_4MB",
      FLASH: 0, RAM: 81920,
      SERIAL: "84f3eb23-aef8",
      CONSOLE: "Serial1",
      MODULES: "Flash,Storage,hea" ... "r,crypto,neopixel",
      EXPTR: 1073643636 }
    > 
    >require("Storage").write("test","a",0,1­2500);
    =true
    > 
    
  • is it possible to put esp32's fs filesystem on esp12 (4MB)? if yes, how? thanks.

  • thanks, after looking at your process.env, I found that I used BOARD "ESP8266" 's bin instead of BOARD "ESP8266_4MB" 's bin, that's why I failed to utilize the storage.

    many thanks for your help

  • i.e. any Espruino esp8266_4MB firmware build supports SPIFFS Filesystem? how to do so? thanks 🙏

  • No, you can implement it. Main issue is always the limited heap size .

    So try to find a SPIFFS implementation that is using small buffers and than start to implement it.

  • Hmm, why you want to overload the ESP12 with filesystem or spiffs.

    Storage on ESP12 4MB board offers 48 x 4096 byte = 196.128 byte memory mapped.

    So what else do you need?

  • I would like to store make a tool to copy all files of a mini website onto ESP12 and make it to serve the site

    48 pages aren't quite enough to store it.

    I made my own File Structure (without researching the right way to do so) using Storage Module, so that it can map the full folder structure & file content, i.e. mapping "/img/longFileName.js" with its content inside Storage module.


    1 Attachment

  • And here's the py script that copies the website source folder onto ESP12


    1 Attachment

  • Now I'm writing the web server script on ESP12 to read files from my own File Structure.

    Currently 48 pages size is the hard limit for the site total size.

    I'm still new to these stuffs, appreciate if you can let me know if there's smarter way to do so

  • @Unreality, looked at your requireNumberFS.js in post #10... and it looks to me that you write a module out there into the storage. Is there a specific reason for that? ...because there are other options, and if you put a module no matter what, minification helps w/ memory and execution speed.

  • I thought storing a module/script into Storage will utilize flash memory and save ram space?

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Storage Module Limitation

Posted by Avatar for Unreality @Unreality

Actions