Lesson KB 07: Floating Point Problem in PSoC Creator

In the PSoC Creator, the default library is newlib-nano. It is leaner, which leaves more flash and memory for your design, and weak references the code that handles floating points as a part of stdio. Therefore, some of the floating point functions will not work as you expect, such as:

    sprintf( str, "Testing: %f", 12.35); // is not working with Creator 3

 If you have to use the floating point in your code, you can use the following steps to enable the floating point support:

  1. Enable "Use newlib-nano Float Formatting"

    Build Settings ➤ Linker ➤ General ➤ Use newlib-nano Float Formatting:Must be set to True for floating point
    FloatingPointInPSoCCreator3 1
  2. You also need to increase the Heap size.

    From the Workspace Explorer panel, double-click on the yourproject.cydwr file to open Design-Wide Resource (DWR) panel. In the System tab, edit the Heap Size (bytes) to 0x2000
    FloatingPointInPSoCCreator3 2
  3. Done, rebuild your code, and try it!!