Skip to content
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

Move UMM debug messages into PMEM #3478

Merged
merged 2 commits into from
Aug 7, 2017
Merged

Conversation

earlephilhower
Copy link
Collaborator

Store the UMM debug format strings in PMEM instead of RODATA. Frees around 300 bytes of RAM with debugging disabled, much more when debugging is enabled.

@@ -550,44 +551,45 @@
#undef DBG_LOG_FORCE

/* ------------------------------------------------------------------------- */
#define printf_P(fmt, ...) do { static const char fstr[] PROGMEM = fmt; char rstr[sizeof(fmt)]; for (size_t i=0; i<sizeof(rstr); i++) rstr[i] = fstr[i]; printf(rstr, ##__VA_ARGS__); } while (0)
Copy link
Member

Choose a reason for hiding this comment

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

Since we're doing this, can we also #define printf(...) printf_P(__VA_ARGS__)? It will make it much easier to upgrade umm to upstream version, if we ever want to do that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the collaborator status. I'm happy to help out.

I'll refactor the patch this weekend and put in a new one with printf() macro'd instead of the changes inline.

@igrr
Copy link
Member

igrr commented Aug 1, 2017

(p.s. Thank you for all the contributions — I have also added you as collaborator to the repository!)

UMM debugging strings are normally placed in RODATA, which uses up scarse
memory.  Move them to PROGMEM and use macros to replace printf with a
version that can handle ROM strings.
@earlephilhower
Copy link
Collaborator Author

Here's the new, 2-liner.

@igrr igrr merged commit 4bed115 into esp8266:master Aug 7, 2017
d-a-v pushed a commit to d-a-v/Arduino that referenced this pull request Sep 29, 2017
UMM debugging strings are normally placed in RODATA, which uses up scarse
memory.  Move them to PROGMEM and use macros to replace printf with a
version that can handle ROM strings.
@earlephilhower earlephilhower deleted the ummdebugtopmem branch November 18, 2020 00:13
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.

2 participants