Closed eznas closed 9 months ago
ch32v003fun provides a stripped-down version of printf() which doesn't support floating point numbers. Use of floating point on the ch32v003 MCU is discouraged due to the heavy code size requirements. If you require floating point output you will need to provide that yourself.
Okay, understood and thanks!
If, having heeded @emeb's sound advice, you still really need float
support, then maybe consider using a self-contained "tiny" printf()
implementation, ideally one that doesn't use heap which should generally be avoided in a resource constrained embedded environment. There are several such implementations available. For example (in no particular order):
WCH's properiatary toolchain does provide a printfloat
library that can do that, and that works just fine: https://github.com/Community-PIO-CH32V/platform-ch32v/issues/41#issuecomment-1792337029
However, that is so big in code size anyways that you should never ever use it. Avoid floating pointing at all costs, or do cheaper fixed-point arithmetic instead.
When I use " printf("%f\r\n", 1/3); " , I got only " f "? How can I print a float number?