-
Notifications
You must be signed in to change notification settings - Fork 13.3k
boards.txt DebugLevel should have NDEBUG option #3978
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
fix esp8266#3978 and saves ram+flash on behalf of @earlephilhower
The python script is in #3722. |
Thanks for the super-fast response! |
* boards.txt: add missing -DESP8266 - fix #3973 * + debug menu NoAssert-NDEBUG => -DNDEBUG fix #3978 and saves ram+flash on behalf of @earlephilhower
An option to use "-DNDEBUG" should be added to all boards.txt debug levels to disable ASSERT macros (and save the string memory they use).
I sent in a merged pull request that takes the constant string of the filename in the assert() macro and moves them to PROGMEM. Unfortunately, the same can not be done with the function name part of the macro, PRETTY_FUNCTION, because it is defined as a char* by GCC and added to the function locals a "static const char[]="xxxx";" In a nutshell, you can't convert that to PROGMEM w/o changing GCC internals. (See https://stackoverflow.com/questions/4384765/whats-the-difference-between-pretty-function-function-func for more info)
In some cases, like ESP8266WiFiClient, those PRETTY_FUNCTION strings can take 100s of bytes due to C++ template expansion. My ESP8266 WebRadio sketch has ~500 bytes of template expansion strings stuck in RAM in .rodata because of this. That's a significant amount of total usable RAM for me and others pushing the ESP8266's capabilities.
In boards.txt the change would look like:
@d-a-v - I'd submit a patch myself, but I see some stuff about generating boards.txt from a python script in the file, but the referenced generator doesn't seem to be there. If there's some other repo I should look at and submit a PR, just point me in the right direction.
Thx
-EFP3
The text was updated successfully, but these errors were encountered: