Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 9 months ago.
need -DNDEBUG in the compile of mbed library for online compiler
Hi,
Since rev86 of mbed library, the object code size of 'mbed_blink' increase 5 timed bigger. I found the following two files are newly introduced in rev86;
mbed/api/mbed_assert.h, and mbed/common/assert.c
I examined these codes and found that NDEBUG macro need to be defined when mbed library is build for online compiler, otherwise, assertion code is embedded in the library.
It's ok for offline compilers as the macro is defined for these environments.
Could you check the build environment of mbed library for online compiler ?
-Yoshi
Yoshitaka Kuwata, morecat_lab
Question relating to:
2 Answers
9 years ago.
Could you add this info in the area of reducing the size of the output code?
A user could use the error messages until he gets successful code compiling and then comment it out to reduce the size of the code when no errors are present.
9 years, 9 months ago.
5x bigger? Can you share the numbers? I don't think assert would cause 5x bigger, in many places error was used. Provide more details
The assertation is enabled in the online IDE by default to provide users a feedback, as you can't debug it to find a cause. For example using NC for a pin which needs to be defined to a real pin.
Thank you for your comment.
On LPC1114 platform, compile "mbed_blinky" with Rev85 mbed-lib, I got an object with 1.7KB flash. On LPC1114 platform, compile "mbed_blinky" with Rev86 mbed-lib, I got an object with 10KB flash.
well, 6 times bigger.
posted by 20 Feb 2015Hi,
This is not a small impact, if the platform does not have large flash memory space. e.g. LPC1114 has only 32kB flash memory.
I personally think the LPC1114 (or other small flash targets) should disable the assert message at runtime. This can be configured in the device.h for each target.
#define DEVICE_STDIO_MESSAGES 0
Any thoughts?
posted by 20 Feb 2015Users would loose the only debugging messages they get from the online compiler :/
posted by 21 Feb 2015I agree that assertion messages are useful for debugging. Do you have any plan to release non-debugging version of mbed library ? You have source code version (mbed-src) already in your lineup. 'mbed-no-debug', or 'mbed-release' version will be also useful for those who want to use mbed lib for practical applications.
posted by 23 Feb 2015