newlib: enabling floating point printf for cortex-m cpus#5094
newlib: enabling floating point printf for cortex-m cpus#5094kaspar030 merged 1 commit intoRIOT-OS:masterfrom
Conversation
|
could you do a buildsizes-diff summary? You could do it for examples/hello-world and for your bmp180 driver test (which needs float printf in order to print anything) |
|
I would like to see this optional, bound to a printf_float pseudomodule. |
Isn't it easier then to just document the existence of this flag? |
|
We didn't need it until now. If we add it and suddenly all builds gain some kilobytes of code, that's bloat.... |
|
@kaspar030 I did not argue against making it optional. |
|
I would prefer it in a module or as well. Or a build flag like USE_FLOAT_PRINTF and SCANF ofc |
|
Which you can set in your application, and the BMP180 could check this flag to decide to printf float or val *1000 int |
|
Sorry for the (small) answer delay. Here are the results based on the bmp180 test application with and without So there's indeed a significant memory overhead when activating this flag (~ 25%). |
|
No problem for the delay! Take your time :) |
|
Just pushed a commit adding a pseudo module for printf with float and added a small test application. It works on a SAMR21 board. |
sys/Makefile.include
Outdated
| endif | ||
|
|
||
| ifneq (,$(filter printf_float,$(USEMODULE))) | ||
| export LINKFLAGS += -u _printf_float |
|
Please add the two lines I inserted as comment. I don't know what the linker does if we call |
|
@DipSwitch You suggested change will execute the link test for nano specs twice, once in sys and once in cortexm_common. It's better to set an environment variable in cortexm_common and check that from sys/Makefile.include. |
80663f7 to
521a3ee
Compare
|
I pushed a change with @gebart suggestion (not tested, I have no board with me). |
tests/printf_float/main.c
Outdated
| * @} | ||
| */ | ||
|
|
||
| #include "stdlib.h" |
There was a problem hiding this comment.
please use "<>" for system headers.
701ea30 to
4ff3110
Compare
tests/printf_float/main.c
Outdated
| int main(void) | ||
| { | ||
| double floating_point_value = 2016.0317; | ||
| char result[8] = {0}; |
There was a problem hiding this comment.
This does not really mean what it seems like it does. See http://stackoverflow.com/questions/201101/how-to-initialize-an-array-in-c
It won't make any difference here, just a heads up.
9787fe2 to
19bcefa
Compare
|
Looks good! Please squash and rename the commit to something like: |
19bcefa to
4c6b073
Compare
|
@DipSwitch commits amended and squashed. Thanks ! |
|
Good buzy! |
sys/Makefile.include
Outdated
| endif | ||
|
|
||
| ifneq (,$(filter printf_float,$(USEMODULE))) | ||
| ifdef USE_NANO_SPECS |
There was a problem hiding this comment.
IMO ifeq (1,$(USE_NANO_SPECS)) is more flexible since we can set USE_NANO_SPECS=0 if we don't want it as well.
There was a problem hiding this comment.
----- Mail original -----
IMO ifeq (1,$(USE_NANO_SPECS)) is more flexible since we can set
USE_NANO_SPECS=0 if we don't want it as well.
Yes it sounds reasonable. I changed it.
4c6b073 to
cb69d5c
Compare
|
ACK |
|
Now all we have to do is wait for http://olsr.org/ to come back up... |
cb69d5c to
82e43c3
Compare
82e43c3 to
e1fcee6
Compare
|
All checks have passed, seems ready for merging :) |
|
&go! |
newlib: enabling floating point printf for cortex-m cpus
Addressing one of the comment from #5078.