These are chat archives for SmingHub/Sming

3rd
Dec 2015
zhivko
@zhivko
Dec 03 2015 00:10
:(
Dan Loman
@dloman
Dec 03 2015 06:54
does anyone know how to make a sming softAP broadcast packets that are sent to the broadcast address?
Alex
@zdrc
Dec 03 2015 17:37
I'm running into a problem where after a number (about 1000) of wake - deepsleep cycles a file saved to spiffs is disappearing from flash memory. I think this is a problem with calling spiffs_mount() many times, but I'm unsure. My hunch is something is going wrong with spiffs_get_storage_config(). When I take raw dump of the spiffs flash using esptool it's entirely blank. Not only is the file disappearing, but all the data is being erased. Has anyone else experienced this, or does anyone have a direction I should be looking in?
hreintke
@hreintke
Dec 03 2015 18:52
This message was deleted
hreintke
@hreintke
Dec 03 2015 19:25
@zdrc :
spiffs_get_storage_config is "only" calculating the start of the spiffs area (directly after the application).
For a flashed application it will always return the same value.
When mounting and the start of the spiffs area is UINT32_MAX, sming erases the filesystem.
When during the processing this situation occurs and the system restarts -> empty filesystem.
SPIFFS is emptying blocks when garbage collecting, so I presume the first block is erased and sming detects (wrongly) initial FS)
I am working on an improved SPIFFS/Sming integration but that will not be ready for the coming release.
Alex
@zdrc
Dec 03 2015 19:48
This message was deleted
hreintke
@hreintke
Dec 03 2015 19:52
@zdrc :
I can make a quick fix for you but that would require :
  • you call spiffs_mount_noformat() in your application, a call which will be deleted in later versions
  • you use develop branch
  • you should be sure the FS in initialized also the first time you start the app.( although you could use a combination of spiffs_mount() and spiffs_mount_noformat())
Alex
@zdrc
Dec 03 2015 19:55

@hreintke So you are saying the the SPIFFS garbage collection routine is accidentally erasing the first block of the SPIFFS file system, and then the flashmem_read(&dat, cfg->phys_addr, 4); call in static void spiffs_mount_internal(spiffs_config *cfg) is erroneously giving uint32_t dat the value 0xFFFFFFFF which causes the file system to be reinitialized? This reinitialization then returns the file system to a blank state?

How come I don't see First init file system in the serial console the first time the device runs after a flash?

hreintke
@hreintke
Dec 03 2015 19:58
SPIFFS garbage collection is not accidentally erasing, it is expected behavior.
If you flash a initial FS created by spiffy, there is already a FS present after flash -> no first init message
Alex
@zdrc
Dec 03 2015 19:59
That makes sense. I would like that quick fix. How would I use a combination of spiffs_mount and spiffs_mount_noformat? Is there anything I can do to help?
hreintke
@hreintke
Dec 03 2015 20:01
If you are already flashing FS made by spiffy, there is no need for combination -> you just replace your spiffs_mount() call by spiffs_mount_noformat()
hreintke
@hreintke
Dec 03 2015 20:06

Of course you also can make a simular behavior by removing the lines in spiffs_mount()

  if  (dat == UINT32_MAX) 
  {
      debugf("First init file system");
      spiffs_format_internal(cfg);
      writeFirst = true;
  }

Then no need to update your application.

Quick fix I can make maybe tomorrow (friday) but not sure, if not it will be saturday
Alex
@zdrc
Dec 03 2015 20:08
This message was deleted
If I call spiffs_mount_noformat() instead of spiffs_mount() then that will get rid of my problem or do you still need to implement a fix? Also, as long as I am sure to build the FS with spiffy this fix won't cause any other problems?
hreintke
@hreintke
Dec 03 2015 20:11
spiffs_mount_noformat() is not yet available, it would be implemented by my quick fix
Alex
@zdrc
Dec 03 2015 20:13
Ah. I'll can just fix it on my version by removing the lines myself?
hreintke
@hreintke
Dec 03 2015 20:15
Yes, that would give the spiffs_mount_noformat() functionality to spiffs_mount().
If you make a local patch, that is OK. If merged in Sming, I need to keep backward compatibility
Alex
@zdrc
Dec 03 2015 20:16
I'll just make it a local patch for now. Thank you for the help.
hreintke
@hreintke
Dec 03 2015 20:16
OK, please let me know if it works OK.
And can you create an issue on github, then the known issue is documented