Enabling Floating Point Support in PSoC Creator

Introduction

Floating point math is not enabled by default in PSoC Creator because of the larger memory footprint it imposes on the microcontroller.

Steps

To enable floating point support in the PSoC compiler, follow these steps:

  1. In the Workspace Explorer, right-click on your open project and choose Build Settings…

  2. Click on ARM GCC -> Linker -> General -> Additional libraries

    1. type a single m in the textbox. This will provide access to the math.h library.
  3. Click on ARM GCC -> Linker -> Command Line -> Custom Flags

    1. Enter -u _printf_float (make sure you have 1 dash and 2 underscores). This will permit the print function to display floating point numbers.

    Enabling floating-point support in the PSoC compiler
    Enabling floating-point support in the PSoC compiler

  4. Next, increase the heap size to 0x0800. From the project.cydwr page, go to the System tab and change the Heap Size (bytes) to 0x0800. This will increase the memory available by the compiler to process the formatting of strings and floating point math.

    Increase Heap
    Increase Heap