-
Notifications
You must be signed in to change notification settings - Fork 3k
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
"default_lib": "small" no longer supported!? #2823
Comments
@RobMeades I believe the motivation behind this change was that small libs are not necessarily thread safe (GCC's small lib for instance). To deal with this, when using a small library we configure mbed OS to be in single threaded mode by default. Since one of the main features of mbed OS 5 is multi-threading, it was decided to enforce multi-threading capability on the default configuration for all mbed OS 5 targets. @sg- may be able to clarify a bit more on the specifics if you need more info. You're right this comes with increased memory usage, and @pan- has had a number of PRs that work on reducing the memory requirement of mbed OS in general as well as with config options. Maybe you can benefit from this work? |
I'm pretty sure we do not have enough RAM on this particular platform to run any multithreading but I would be interested to hear if that is not the case. My numbers for static RAM are (for blinky plus
With a 3 kbyte stack (seems sufficient), we're well into our 20 kbytes allocation. |
@bridadan, @sg- , @pan- In order to check whether mbed is at all viable for our platform with the flash sizes of std libs, I have tried
For each build I did both The detailed results are below. They raise a few specific questions:
|
@RobMeades There is few ways to reduce the size of a binary:
With all this advice, the binary size is greatly reduced:
#include <mbed.h>
int main() {
RawSerial serial(USBTX, USBRX);
while(true) {
serial.putc(serial.getc());
}
return 0;
}
{
"macros": [
"NDEBUG=1",
"OS_TASKCNT=1",
"OS_IDLESTKSIZE=32",
"OS_STKSIZE=1",
"OS_TIMERS=0",
"OS_FIFOSZ=4",
"OS_MUTEXCNT=1"
],
"target_overrides": {
"*": {
"core.stdio-flush-at-exit": false
}
}
} Results:
It is still a big executable but it is much more reasonable, we keep investigating on potential memory optimizations. |
That is brilliant advice @pan-, very much appreciated. Leaving std libs in place, applying the flush tweak and using My M0 platform:
K64F:
Absolutely spot-on. Someone asked me yesterday how I was doing with mbed. I said I have a love hate relationship and that I was currently in hate but I expected to be in love again by the end of the week. I am now in love again 👍 . |
With the current version of mbed-cli, running
mbed compile -s
tells me that the target I am in the process of integrating into mbed cannot be supported officially because it is using nano.spec libraries. When did using std libraries become a requirement!? We have very little flash/RAM to play with (128 kbytes/20 kbytes) and we NEED nano.spec to make useful applications fit in it. The difference in flash consumption is huge (blinky plusprintf()
underGCC_ARM
):"default_lib": "small"
29035 bytes"default_lib": "std"
72756 bytes...i.e. it takes up 34% more of our flash for no net gain. There's also a 3 kbyte RAM increase, which is even worse (as we have less left in the first place), but I hope there's some way of configuring that out; please tell me there is.
So, PLEASE explain why this is a requirement, 'cos it's making mbed too heavy weight for us and being so light and nimble was one of mbed's key differentiators.
The text was updated successfully, but these errors were encountered: