-
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
Enable minimal-printf by default for all builds #12233
Conversation
@bulislaw, thank you for your changes. |
Can you expand that to cover what it does and doesn't do with regard to field width, precision, zero pad and other auxiliary bits? We need to audit the complete Mbed OS code-base to check it doesn't use anything beyond minimal-printf functionality anywhere itself (or extend minimal printf to handle whatever it is). (Perhaps add assert traps inside minimal printf for debug/develop mode to catch unknown format options?) You could maybe get away with not doing that when it was off by default, but there's no excuse if it's the default. (Or add an interlock to ensure you get an error if compiling a feature/component that needs full). |
I went through our code base, looking at which features of printf are used in our code base. The most used unsupported feature seems to be field width (eg I also explored adding asserts or warnings where the minimal-printf encounters specifier it doesn't recognize. Asserts wouldn't probably be a good idea as it would be impossible to compile the code in debug mode. While runtime warnings are possible it would be very verbose and I don't think it's the right direction. The options we have:
Thoughts? |
The |
This PR cannot be merged due to conflicts. Please rebase to resolve them. |
8b2d66c
to
be735bc
Compare
I rebased the branch on master. |
@kjbracey-arm any further comments on this ? |
@bulislaw from an outsider's perspective, I'm in favor of |
@kjbracey-arm are you ok with this change as it is (especially the reply about asserts)? @ARMmbed/mbed-os-maintainers Could we run nightlies on this branch? |
@@ -12,10 +12,10 @@ Supports: | |||
* %u: unsigned integer [h, hh, (none), l, ll, z, j, t]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should addnote that ll -variants are ONLY supported if minimal-printf-enable-64-bit
is enabled. We've already had our run with this issue in the client side. LwM2M specification states that int == int64_t...
Also, in that case it failed and printed just lld
, would be nice and more convenient to spot the issue if the % sign would have also been left there...
be735bc
to
df31ee1
Compare
ping |
df31ee1
to
954f22b
Compare
CI started |
Test run: FAILEDSummary: 3 of 8 test jobs failed Failed test jobs:
|
This PR cannot be merged due to conflicts. Please rebase to resolve them. |
Test kicked after Evelyne fixes. |
Test run: FAILEDSummary: 1 of 7 test jobs failed Failed test jobs:
|
CI started |
Test run: FAILEDSummary: 2 of 7 test jobs failed Failed test jobs:
|
both tests restarted |
Ready for maintainers approval. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this considered breaking change, I would say yes (I added a label) .
@kjbracey-arm @AnttiKauppila @hugueskamba Any more reviews? We should aim to integrate this early this week |
Summary of changes
This PR enables minimal-printf library for all builds. That means that all calls to printf family (including snprintf) will be handled by the minimal-printf library. Main reason for the change are substantial ROM savings that can reach up to 20k. The below table shows result for simple RTOS blinky example in two variants (explicitly calling printf and without) for two boards and three profiles:
Impact of changes
Minimal-printf library supports most of the basic usecases:
If your application requires more advanced functionality you'll have to revert to using standard library version.
Migration actions required
If your application requires advance features of printf family calls, you'll either simplify it or switch to the standard C library version. To do so modify your application configuration in
mbed_app.json
file to override the parametertarget.printf_lib
with the valuestd
as shown below:Documentation
No new documentation necessary. Generic heads up will be part of Mbed 6 blog post series.
Pull request type
Test results
Reviewers
@evedon @hugueskamba @kjbracey-arm @AnttiKauppila