hello, everyone
I want to print floating points in STC8 ,but I don t know how to correctly add the compilation flag “-DUSE_FLOATS=1”.
my platfromio.ini is list as follow:
printf() The default printf() implementation in printf_large.c does not support float (except on
ds390), only <NO FLOAT> will be printed instead of the value. To enable floating point output, recompile it
with the option -DUSE_FLOATS=1 on the command line. Use --model-large for the mcs51 port, since this uses a
lot of memory. To enable float support for the pic16 targets, see 4.7.9.
I don t know how to correctly add the compilation flag
If you want to test it out, download the latest tool chain version from Small Device C Compiler - Browse Files at SourceForge.net, install it locally then copy the toolchain files in C:\Users\<user>\.platformio\packages\toolchain-sdcc. So you can test that with 4.2.3.
Your platformio.ini is right, but you still need to copy printf_large.c from …\SDCC\lib\src to your project directory and recompile it. Then you can output float normally