Skip to content

Add option to boards to remove the spiffs filesystem and increase the code space #862

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

Closed
robertgregor opened this issue Oct 6, 2015 · 11 comments
Milestone

Comments

@robertgregor
Copy link

Hello, would it be possible to add to the boards.txt also:

generic.menu.FlashSize.512K=512K (0K SPIFFS)

@robertgregor
Copy link
Author

I did this and it is working:
generic.menu.FlashSize.512K64=512K (64K SPIFFS)
generic.menu.FlashSize.512K64.build.flash_size=512K
generic.menu.FlashSize.512K64.build.flash_ld=eagle.flash.512k.ld
generic.menu.FlashSize.512K64.build.spiffs_start=0x6B000
generic.menu.FlashSize.512K64.build.spiffs_end=0x7B000
generic.menu.FlashSize.512K64.build.spiffs_blocksize=4096
generic.menu.FlashSize.512K64.upload.maximum_size=434160

generic.menu.FlashSize.512K0=512K (0K SPIFFS)
generic.menu.FlashSize.512K0.build.flash_size=512K
generic.menu.FlashSize.512K0.build.flash_ld=eagle.flash.512k.ld
generic.menu.FlashSize.512K0.build.spiffs_start=0x6B000
generic.menu.FlashSize.512K0.build.spiffs_end=0x7B000
generic.menu.FlashSize.512K0.build.spiffs_blocksize=4096
generic.menu.FlashSize.512K0.upload.maximum_size=499696

@igrr
Copy link
Member

igrr commented Oct 7, 2015

It may look like it works, but both options use the same linker script (eagle.flash.512k.ld). This means that the linker will use the same memory map for your 512K/0K variant, so when your code exceeds 434160, you will get linker error. You would also need to create another linker script (eagle.flash.512k0.ld) and adjust the values there.

igrr added a commit that referenced this issue Oct 25, 2015
@igrr
Copy link
Member

igrr commented Oct 26, 2015

Added in 81566a9

@asetyde
Copy link

asetyde commented Oct 26, 2015

Also I want this ! Thx

Sent from my iPhone

On 26 ott 2015, at 08:00, Ivan Grokhotkov [email protected] wrote:

Added in 81566a9


Reply to this email directly or view it on GitHub.

igrr added a commit that referenced this issue Oct 29, 2015
@igrr igrr modified the milestone: 2.0.0 Nov 5, 2015
@igrr igrr closed this as completed Nov 30, 2015
@sven337
Copy link

sven337 commented Nov 30, 2015

You could go further: the SPIFFS library is pretty big in terms of code space.
In order to support OTAs on a 512kB ESP03, I had to remove this lib to ensure that the code would be small enough.
I don't know what the best way of doing this conditionally is, but I think it would be a valuable feature.

@igrr
Copy link
Member

igrr commented Nov 30, 2015

@sven337 that would be a nice feature. Perhaps can be done by adding -DDISABLE_SPIFFS to compiler flags for the "no spiffs" variant.

@igrr
Copy link
Member

igrr commented Nov 30, 2015

Actually this doesn't seem to be necessary, because linker does a good job at removing unused code.

When I build an empty sketch for Generic (64k SPIFFS), binary size is 198636 bytes.
Running xtensa-lx106-elf-nm -C out.elf | grep spiffs returns no symbols.

When I add some FS functions, like this:

#include <FS.h>
void setup() {SPIFFS.begin();}
void loop() {}

Sketch size goes up to 229496 bytes. Running nm again, i see that spiffs library functions are present in the output file.

@sven337
Copy link

sven337 commented Nov 30, 2015

This doesn't match my findings, on the contrary I had spiffs functions show up in the binary even without using any spiffs functions in the program. I'll check and get back to you.

@asetyde
Copy link

asetyde commented Nov 30, 2015

Ok perfect . Thanks

On 30/nov/2015, at 09:59, Ivan Grokhotkov [email protected] wrote:

Actually this doesn't seem to be necessary, because linker does a good job at removing unused code.

When I build an empty sketch for Generic (64k SPIFFS), binary size is 198636 bytes.
Running xtensa-lx106-elf-nm -C out.elf | grep spiffs returns no symbols.

When I add some FS functions, like this:

#include <FS.h>
void setup() {SPIFFS.begin();}
void loop() {}
Sketch size goes up to 229496 bytes. Running nm again, i see that spiffs library functions are present in the output file.


Reply to this email directly or view it on GitHub #862 (comment).

@sven337
Copy link

sven337 commented Nov 30, 2015

An empty sketch like you used does indeed not pull any spiffs functions, but one that includes ESP8266WebServer.h does.
It increases the code size by about 16kB.

Interestingly, removing cores/esp8266/spiffs_api.cpp doesn't make the build fail, it simply removes this extra code that is useless when no spiffs is in use.

@igrr
Copy link
Member

igrr commented Nov 30, 2015

Thanks, i think i have fixed that in 9e930e5. Code size is down from 250k to 228k for HelloServer sample.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants