-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Fix #2226 for boards that have >64K of PROGMEM available #6317
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
base: master
Are you sure you want to change the base?
Conversation
…K of PROGMEM available, to fix #2226
Any progress on getting this merged? |
I'm not so sure if this is really a proper fix for this issue. Because:
I guess that the problem is that
Neither of these approaches are really practical right now, unfortunately. |
@matthijskooijman: Thanks for the write-up. That indeed sounds reasonable, although this is probably the most common case. Perhaps a good middle ground solution (until this gets fixed properly) would be to at least update the Arduino PROGMEM documentation to make clear note of this, since the symptoms are quite puzzling indeed. |
I agree that using the _far functions is undesirable because the performance change might break existing code. Some alternatives:
Realistically though, while the proposed GCCPROGMEM approach is inelegant, it is better than leaving the Arduino Mega broken. The Arduino foundation to advertises and sells a device with 256k of Flash but only 64k of it is accessible. If we don't fix this, is their a workaround? |
Since after 1.5 years nobody has fixed this properly I would like to echo @themobydisk in that an (this) inelegant fix is better than no fix, for an issue that completely(?) undoes the RAM benefits of the Mega. |
I manually applied the patch and I confirm that pinMode() and digitalWrite() now work. I meant to test Tone() this weekend, I'll do that and post the results. |
I confirm that tone() also works. I still use this PR by merging it in manually whenever I need to use an Arduino Mega. |
Happy to see this PR was at least of some use ;) @mastrolinux since we're now 3 years on, and over 5.5 years beyond the original bug #2226; perhaps it is worthwhile merging this (kind of) solution? Even though it may not be the 'best' solution, having basic functionality broken cannot possibly be better. |
|
(As a work around for anyone who manages to find this in the future.) I stumbled across this problem while trying to stick a 150K binary blob (an image of course) into PROGMEM, on a Mega2560. While the patch works as far as it goes, (eg: pins & ports variables) I was still running into the problem with other assorted PROGMEM variables stored in sundry libraries. So, I cheated and moved the blob into the text section, and not progmem. I don't claim to be a GCC/ARM/LD Linker Script/Arduino expert, but my object creation now doesn't conflict, with "just about everything else". eg: I use this to convert a binary blob into an object module. I believe a similar '#define FARPROGMEM attribute((section(".text.image_data")))' would work in header files (but must admit I've not tried it.) Hope this helps someone in the future, it was driving me buggy.... |
Defined GCCPROGMEM for boards with ATmega 1280 and 2560 that have >64K of PROGMEM available, to fix arduino/ArduinoCore-avr#174