-
Notifications
You must be signed in to change notification settings - Fork 13.3k
inconsistent block size for spiffs in board.txt. and ld files #5412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
inconsistent block size for spiffs in board.txt. and ld files #5412
Conversation
… be consistent with ld files spiffs < 1M has a 4096 block size and 8192 for all the other ones only impacted boards 2M (128K), 2M (256K) 2M (512K)
tools/boards.txt.py
Outdated
else: | ||
max_upload_size = 1024 * 1024 - reserved | ||
spiffs_start = (flashsize_kb - spiffs_kb) * 1024 | ||
|
||
if spiffs_kb < 1024: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be < or <=?
it should be < 1024: for example 2M (SPIFFS 1M) should sill have a block size of 8192. |
@apicquot you mentioned a problem, but you didn't specify what. What did you encounter? |
Currently spiffs does not work for boards 2M (SPIFFS 128K), 2M (SPIFFS 256K) and 2M (SPIFFS 512K): |
@apicquot what about creating a SPIFFS image from the IDE for flashing? what decision is made for the block size there? |
@devyte the block size when flashing the spiffs from the ide (parameters passed to mkspiffs) is coming from board.txt. That is why it has to be the same value than in the ld files |
While understandable, this is to me dangerous as-is, because users already using existing from some time 2M512 will have their spiffs reformated on boot after this patch. You are basically stating that spiffs block size should be 4096 when spiffs size < 1MB. We can see below that it is 4096/0x1000 when size is
|
good point @d-a-v changing to if spiffs_kb < 512 is a good idea |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per @d-a-v 's comments about < 512KB.
only impacts boards 2M (SPIFFS 128K) and 2M (SPIFFS 256K) 2M (SPIFFS 512K) remains with 8192 block size
….com/apicquot/Arduino into fixing_inconsistent_spiffs_blocksize
blocks size of 4096 for spiffs < 512 block size of 8192 for all other boards
….com/apicquot/Arduino into fixing_inconsistent_spiffs_blocksize
indent is changed in package/package_esp8266com_index.template.json |
#5429 will take care of the indent. The SPIFFS blocksize change hasn't been tested by me, can't comment on it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm OK w/a merge either w/the package/JSON or w/o it (spacing fix coming already).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this logic
The tests I did with the 2M/512k layout simply did not work. Also a practical question about the block size. |
2M 512K works great for me and so do the 2 new board configs 2M 128K and 2M 256K. I use the IDE for launching mkspiffs and setting up properly the parameters. As of the maximum number of files, my understanding is that they can more files than number of blocks, the minimum file size is the page size. I have 47 small files that works fine with the 128K so going below 4096 block size won't do any good. Hope it helps |
@apicquot thanks for the info! |
boardtxt.py is not consistent for generating spiffs block size in boards.txt and ld files:
it takes the flash size for boards.txt but the spiffs size for the lf files: there is currently a problem for boards with flash size >= 1M and spiffs size < 1M
impacted boards 2M (SPIFFS 128K), 2M (SPIFFS 256K) 2M (SPIFFS 512K)
Suggested change is to make block size dependable on spiffs size for board.txt:
if spiffs size < 1M block size=4096 else block size=8192