I've implemented some commands with the ChibiOS shell, one of which I would like to take a floating point number. When I use atof() to convert this string to a double, my code size increases by 13kb. This seems like a lot. Am I doing something wrong or is there a better way to do this?
Thanks,
Luke
atof code size
Moderators: RoccoMarco, lbednarz, tfAteba
Re: atof code size
It's known that string manipulating functions like itoa, atio, sprintf and similar take a lot of space.
When you just need for example itoa(), wich does not need to support all it's features form the known string.h library, you can google them.
~ Tectu
When you just need for example itoa(), wich does not need to support all it's features form the known string.h library, you can google them.
~ Tectu
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: atof code size
Tectu is right, probably that function has dependencies on a lot of FP-related code in the C library. Consider writing your own implementation if you use just that FP function.
Giovanni
Giovanni
-
DrunkenDonkey
- Posts: 124
- Joined: Sun Aug 28, 2011 5:16 pm
Re: atof code size
While on the topic, is there a way to really make sure you are not using any of the std lib/newlib/whatever functions? It is better to get a linker error, go implement your own than link something huge.