Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 11 of 11

Thread: Teensy LC printf float options

Threaded View

  1. #1
    Member capricorn one's Avatar
    Join Date
    Oct 2014
    Los Angeles

    Teensy LC printf float options

    Trying to printf with %e and %f, looks like it's not included in the compiler options for the LC. Anyone know the flag to add it? Can't seem to find it in all my searching.

    I realize I may have to use dtostrf, but what I really need is dtostre, which doesn't appear to be included either. Any options out there for me to print in scientific notation without rewriting hundreds of lines of my program?


    Doing some digging, if you compile with optimization at FAST or greater, you get the printf floats, but in the smallest code optimization you don't. That's understandable, the difference unfortunately is huge. When compiling with FAST my code is 65K, when using SMALLEST, it's 35K. I know the floating point printf requires a lot of space, but I know it's less than 30K, would be nice to be able to add it while still optimizing the rest of the code for smallest. Anyone know how to do that?

    I've come across a lot of posts suggesting adding this flag to the linker : -u _printf_float

    Unfortunately, it compiles, but crashes when executing printf with a float.
    Last edited by capricorn one; 02-12-2019 at 09:38 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts