Skip to content
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

atof() function does not compile #1299

Closed
krichardsson opened this issue Jun 19, 2023 · 3 comments · Fixed by #1310
Closed

atof() function does not compile #1299

krichardsson opened this issue Jun 19, 2023 · 3 comments · Fixed by #1310
Milestone

Comments

@krichardsson
Copy link
Contributor

krichardsson commented Jun 19, 2023

Converting strings to floats using the atof() function does not work, some libraries seems to be missing.
It has been confirmed to work in 2022.01 and my guess is that it got lost in the introduction of kbuild.

Also see https://github.com/orgs/bitcraze/discussions/784

@krichardsson
Copy link
Contributor Author

krichardsson commented Aug 22, 2023

This seems to be caused by the -nostdlib flag that was added to LDFLAGS in the Makefile, when converting to KBUILD

atof() builds without the flag. Not sure why the flag was added or if it is a bad idea to remove it.

@whoenig
Copy link
Contributor

whoenig commented Aug 22, 2023

Did you compare the size of the resulting image? I think not using stdlib can save both flash and potentially improve the runtime due to better optimizations. I am also surprised that there is even a use-case for converting a string to a float number.

@krichardsson
Copy link
Contributor Author

Yes, and the results are (drum roll..):

With -nostdlib
Flash | 265452/1032192 (26%), 766740 free | text: 257500, data: 7952, ccmdata: 0
RAM | 82700/131072 (63%), 48372 free | bss: 74748, data: 7952
CCM | 62024/65536 (95%), 3512 free | ccmbss: 62024, ccmdata: 0

Without -nostdlib
Flash | 271188/1032192 (26%), 761004 free | text: 264212, data: 6976, ccmdata: 0
RAM | 81740/131072 (62%), 49332 free | bss: 74764, data: 6976
CCM | 62024/65536 (95%), 3512 free | ccmbss: 62024, ccmdata: 0

So the cost is 5-6k of flash and 960 bytes of RAM

I am also surprised that there is even a use-case for converting a string to a float number.

I could imagine using it in a configuration file, like the SD card config for instance, but I don't think it is that common :-)

@knmcguire knmcguire added this to the next-release milestone Oct 24, 2023
gemenerik added a commit that referenced this issue Oct 15, 2024
This reverts commit af0cbe5.

`-nostdlib` was added to LDFLAGS when we converted to kbuild.
PR #1310 removed -nostdlib in order to make it impossible to use the `atof()` function.
However, this now causes similar linker warnings to those it was trying to solve (discussion 784).
420 days later, `atof()` is not being used anywhere internally. Discussion in #1299 is not very conclusive on why this is needed. The arguing mostly relies that the cost in flash and RAM is so low that there is no good reason not to do it. There is now!
gemenerik added a commit that referenced this issue Oct 15, 2024
This reverts commit af0cbe5.

`-nostdlib` was added to LDFLAGS when we converted to kbuild.
PR #1310 removed -nostdlib in order to make it possible to use the `atof()` function.
However, this now causes similar linker warnings to those it was trying to solve (discussion 784).
420 days later, `atof()` is not being used anywhere internally. Discussion in #1299 is not very conclusive on why this is needed. The arguing mostly relies that the cost in flash and RAM is so low that there is no good reason not to do it. There is now!
vBruegge pushed a commit to vBruegge/crazyflie-firmware that referenced this issue Oct 21, 2024
This reverts commit af0cbe5.

`-nostdlib` was added to LDFLAGS when we converted to kbuild.
PR bitcraze#1310 removed -nostdlib in order to make it possible to use the `atof()` function.
However, this now causes similar linker warnings to those it was trying to solve (discussion 784).
420 days later, `atof()` is not being used anywhere internally. Discussion in bitcraze#1299 is not very conclusive on why this is needed. The arguing mostly relies that the cost in flash and RAM is so low that there is no good reason not to do it. There is now!
vBruegge pushed a commit to vBruegge/crazyflie-firmware that referenced this issue Oct 21, 2024
This reverts commit af0cbe5.

`-nostdlib` was added to LDFLAGS when we converted to kbuild.
PR bitcraze#1310 removed -nostdlib in order to make it possible to use the `atof()` function.
However, this now causes similar linker warnings to those it was trying to solve (discussion 784).
420 days later, `atof()` is not being used anywhere internally. Discussion in bitcraze#1299 is not very conclusive on why this is needed. The arguing mostly relies that the cost in flash and RAM is so low that there is no good reason not to do it. There is now!
ToveRumar pushed a commit that referenced this issue Oct 24, 2024
This reverts commit af0cbe5.

`-nostdlib` was added to LDFLAGS when we converted to kbuild.
PR #1310 removed -nostdlib in order to make it possible to use the `atof()` function.
However, this now causes similar linker warnings to those it was trying to solve (discussion 784).
420 days later, `atof()` is not being used anywhere internally. Discussion in #1299 is not very conclusive on why this is needed. The arguing mostly relies that the cost in flash and RAM is so low that there is no good reason not to do it. There is now!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants