-
Notifications
You must be signed in to change notification settings - Fork 69
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
EEPROM storage allocated even though it is not used #31
Comments
There is already an EEPROM::init() method. Perhaps the allocation could be done there? The way the FlashStorage define works and the FlashStorageClass is templated, it is not obvious how to move the allocation into a class. I was trying do so using my own class and encountered compiler error. The declaration of the _data array is declared as static storage class and this causes problems with the FlashStorageClass template. Is there a way to instantiate the FlashStorageClass object from within a class? I have two different types of storage that I would like to create two different FlashStorageClass objects for. |
I defined EEPROM_EMULATION_SIZE 0 as follows:
but for some reason that does not appear to prevent the allocation of the memory. Here are the relevant allocations from nm:
There is 1K of RAM and 1.2K of FLASH allocated to the EEPROM storage. Note that I do not include FlashAsEEPROM.h. So, it appears to me that FlashAsEEPROM.cpp is being compiled and linked regardless of its inclusion. Does this imply that FlashAsEEPROM.* need to be in their own separate library or is there a way to prevent them from being compiled when not used? |
interesting question... |
I noticed the following two declarations in EEPROM.cpp
FlashStorage/src/FlashAsEEPROM.cpp
Line 24 in 18c0212
FlashStorage/src/FlashAsEEPROM.cpp
Line 74 in 18c0212
This allocates quite a bit of RAM (1K) when you are not using the EEPROM emulation.
Would it be advantageous to have an initialization method (ie: EEPROM:begin() ) that is called to allocate the storage?
The text was updated successfully, but these errors were encountered: