sprintf is part of libc (which comes with the toolchain). The standard ARM toolchain uses newlib as libc with floating point support for sprintf disabled by default. To enable float support, you need to append "-u _printf_float" to your link flags.
I have no idea how PlatformIO works. With a standard Arduino/Teensyduino, you can edit "arduino/hardware/teensy/avr/boards.txt" and change the link options, e.g. change:
teensy31.build.flags.libs=-larm_cortexM4l_math -lm
to:
teensy31.build.flags.libs=-larm_cortexM4l_math -lm -u _printf_float
Brilliant! I will try this out tomorrow! It's super easy to modify compilation/link flags in platformIO.
So far platformIO is quite nice in terms of project management and ease of use, but works mainly on Atom text editor (kinda slow and buggy sometimes) and I'm a Sublime guy. I'd recommend trying it out though.
I'm using CLion for editing my PlatformIO projects. I feel right at home, because my day job involves using IntelliJ IDEA (Java, Scala, Python).
The syntax highlighting is pretty good.. it's even sensitive to defined headers, and will fold code blocks that won't be included because of #ifdef and friends.View attachment 7988
sprintf is part of libc (which comes with the toolchain). The standard ARM toolchain uses newlib as libc with floating point support for sprintf disabled by default. To enable float support, you need to append "-u _printf_float" to your link flags.
I have no idea how PlatformIO works. With a standard Arduino/Teensyduino, you can edit "arduino/hardware/teensy/avr/boards.txt" and change the link options, e.g. change:
teensy31.build.flags.libs=-larm_cortexM4l_math -lm
to:
teensy31.build.flags.libs=-larm_cortexM4l_math -lm -u _printf_float
I dislike PlatformIO. Atom doesn't fully honor my font preferences (some fonts look like crap, I have Cleartype disabled), it crashes, it sometimes hangs with 100% CPU usage. PlatformIO doesn't ask for an install location, it dumps all its binaries into my home directory (no thank you). There doesn't seem to be an easy way to have multiple Arduino / Teensyduino versions or compiler versions, ...So far platformIO is quite nice in terms of project management and ease of use, but works mainly on Atom text editor (kinda slow and buggy sometimes) and I'm a Sublime guy. I'd recommend trying it out though.
I dislike PlatformIO. Atom doesn't fully honor my font preferences (some fonts look like crap, I have Cleartype disabled), it crashes, it sometimes hangs with 100% CPU usage. PlatformIO doesn't ask for an install location, it dumps all its binaries into my home directory (no thank you). There doesn't seem to be an easy way to have multiple Arduino / Teensyduino versions or compiler versions, ...
I'm using CMake projects (Ninja build backend) with QtCreator. All the syntax highlighting, #define recognition/highlighting (the CMake build configuration is checked), auto-completion, ... is there. I can do a full rebuild (including Teensy core) in 1.3 seconds (PlatformIO takes 2.6s). A build of just the sketch and generating the .hex file takes 300 milliseconds (PlatformIO takes 1s).