Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

felias-fogg
Copy link

@felias-fogg felias-fogg commented Sep 2, 2025

I have added two scripts (one Unix, one Windows) in the script directory that check whether the PROGMEM memory section below the 64k limit is exhausted. If so, a warning message is given. The script is called by abusing the objcopy recipe in platform.txt. The main thing is that the warning points out to use the PROGMEM_FAR macro from progmem_far.h, which you can install with the Arduino library manager. If you install the progmem_far library, you can try out the Arduino IDE on the two example programs progmem_fail and progmem_repaired.

@felias-fogg
Copy link
Author

To humor you (and everybody who got annoyed by this issue), I wrote a blog post.

@MCUdude
Copy link
Owner

MCUdude commented Sep 2, 2025

Thank you for doing the deep dive and providing a proper solution! I'm quite busy at the moment, but I'll happily test and merge a PR is you submit one for MegaCore and MightyCore

@felias-fogg
Copy link
Author

I just noted that the PROGMEM section in the README.md also needed adaptation.

echo _______________________________________________________________
echo ^| Severe Warning: PROGMEM section too large by %excess% bytes. ^|
echo ^| Your program will most probably be unstable! ^|
echo ^| Use the macro PROGMEM_FAR from ^<progmem_far.h^> and ^|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"progmem_far.h" is too vague. The user won't be able to understand what is being suggested from this information. I know you provide a detailed explanation in the documentation, but the average user isn't going to read that, and it is possible to communicate this concept much more clearly without any significant increase in the verbosity of the message.

It would be better to say something like:

Use the macro PROGMEM_FAR from the "progmem_far" library (available from Arduino Library Manager)

@MCUdude
Copy link
Owner

MCUdude commented Sep 3, 2025

Couldn't progmem_far.h be included as a library bundled with MegaCore, so users only have to #include <progmem_far.h> instead of downloading it through the library manager?

@felias-fogg
Copy link
Author

felias-fogg commented Sep 3, 2025

Sure! Shall I include it in the PR? I guess Per is right about the message when it comes to the Arduino core.

If the library is included in MegaCore, I would then change the message to 'Use the macro PROGMEM_FAR from the MegaCore library "progmem_far" and ...'

@felias-fogg
Copy link
Author

Wording changed and progmem_far included.

Co-authored-by: Per Tillisch <[email protected]>
@MCUdude
Copy link
Owner

MCUdude commented Sep 10, 2025

Sorry for being silent for so long. Been busy with other things, mostly children. The PR looks good to me! I will merge it in a few days if I don't hear anything.

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

Successfully merging this pull request may close these issues.

3 participants