-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Bug: EEPROM addresses after compiling changed in new Arduino Software 1.6.4 #3061
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
Comments
The EEMEM attribute ensure that your data will go into EEPROM section but it doesn't guarantees the ordering: the compiler is free to sort the data in any arbitrary order. The documentation here says:
And indeed in all your examples the variable are in the .eeprom section. Maybe you want to access the data using the symbols |
Hi Maglie, I use absolute addressing as well. All my programs worked well with V1.0.5. Upgrades are made for guinea pigs and not for serious people, like me ;-) . Jack |
I recall another (unrelated) bug report (for some other project), where a bug was exposed because a newer compiler version ordered symbols reversed compared to an older compiler version. There, the suggested fix was to add Perhaps that works here as well? You can try by modifying your platform.txt file. Not sure if there are any (performance) downsides connected to that option, though. |
Hello Mathijs, Thanks for your info. Life is beautiful, when others will help you. I have looked in this file what is there. Jack |
This file lists various compiler options. In particular, there are lines starting with:
To each of these lines add " -fno-toplevel-reorder" (without quotes, but include the space to separate this new option from the previous ones). Then restart the IDE to reload the file and try again. If this breaks the compilation entirely, remove the option from the last of the three lines above again (there's a chance that this option is only supported during compilation, not linking). Also, make sure you use the "avr/platform.txt", not "sam/platform.txt" (if you even have the latter). |
I'm closing this one since it's gcc related, we can't do much to solve it (besides downgrading the compiler version...). |
@cmaglie, I actually think that adding Also, a (slightly) more portable solution for an EEPROM layout would be to have just a single global variable in EEPROM, using a struct to let it contain multiple subfields. |
I think this "update compiler and lose compatibility" reveals a bit of code smell: your code depend on implementation details of a compiler. I would suggest in the next version put all of your |
Yep, that is exactly what EEMEM is for, just like PROGMEM. The ability to initialize is just a bonus (but necessary for flash data). |
Hello all,
I use EEMEM with library
#include <avr/eeprom.h>
.It very practical, because I can use "read block", "update block" and "write block"
without giving EEPROM addresses.
Example:
When doing variable declaration, according to the AVR-documentation (attached),
the compiler should begin with address 0 and ascending 1,2,3, ................
In the new version 1.6.4 the last EEMEM declaration begins with address 0. It has
changed the EEPROM addressing in a reversed way (from down to up)
V1.0.5
Now with V1.6.4 (not logical for humans)
Jack
The text was updated successfully, but these errors were encountered: