These are chat archives for esp8266/Arduino

13th
Nov 2016
Clemens Kirchgatterer
@everslick
Nov 13 2016 10:10
there is a makefile for arduino esp8266 sketches
there is also my own modified version of that in my genesys repo
Mehrdad K
@mkeyno
Nov 13 2016 10:23
@everslick is there a way or function to find last sector of written files in SPIFF
I'm trying to use free sectors is SPIFF
Clemens Kirchgatterer
@everslick
Nov 13 2016 10:26
i don't think SPIFFS fills the flash from beginning to end. most likly blocks are written scattered over the whole flash.
Mehrdad K
@mkeyno
Nov 13 2016 10:28
for example I've upload my files in SPIFF which is took about 256 sectors and my ESP flash setting set to 4(3m SPIFF), so I should have 256 sector for sketch and 256 sector for uploaded files and must have room after sector 500 , for more safety start writing the flash after sector 600, but surprisingly it corrupts all my files in SPIFF
is there a way to manage SPIFF to upload files as per requested
Clemens Kirchgatterer
@everslick
Nov 13 2016 10:29
you can put SPIFFS wherever you want on the flash. but you have to create the FS() object 'by hand'
Mehrdad K
@mkeyno
Nov 13 2016 10:32
I remember that yo give me function for such purpose, but I need it change dynamically because may need to add or remove files when sketch running
Clemens Kirchgatterer
@everslick
Nov 13 2016 10:32
  FS *fs = NULL;

  size   = (uint32_t)(&_SPIFFS_end) - (uint32_t)(&_SPIFFS_start);
  start  = (uint32_t) &_SPIFFS_start - 0x40200000;
  page   = (uint32_t) &_SPIFFS_page;
  block  = (uint32_t) &_SPIFFS_block;

  fs = new FS(
    fs::FSImplPtr(
      new SPIFFSImpl(start, size, page, block, 5) // 5 = max num open files
    )
  );

  if (fs->begin()) {
    FSInfo info;

    fs->info(info);

    log_print(F("FS:   SPIFFS mounted (total=%s, used=%s)\r\n"),
      fs_format_bytes(info.totalBytes).c_str(),
      fs_format_bytes(info.usedBytes).c_str()
    );

    return (true);
  }
you can set size and start to whatever you want
when you change the size or location of SPIFFS, you will lose all data on it of course.
i'm not positive i understand what you are trying to accomplish.
Mehrdad K
@mkeyno
Nov 13 2016 10:44
thanks @everslick , I think I should handle my problem with larger 16MB ESP module
but unfortunately SPIFF functions not work as it expected