2013

How To Use C++ With PSoC Creator

Article by:
Date Published:
Last Modified:

Ever wanted to write C++ for the PSoC 5 or 5LP chips in PSoC Creator?

Well, although PSoC Creator doesn’t natively support it, you can quite easily do a few ‘hacks’, and you’ll be writing in C++ in no time.

A new page Using C++ With PSoC Creator, explains the steps required to compile C++ code in Cypress’s PSoC Creator.

It covers the four main steps:

  1. Compiling with G++ rather than GCC using custom compiler flags

    Adding custom command line flags in PSoC Creator to force GCC to use the C++ compiler.

    Adding custom command line flags in PSoC Creator to force GCC to use the C++ compiler.

  2. Wrapping C code with guards:

    1
    
    extern C{< C code goes here>}
    
  3. Defining the operators new and delete (this is optional)

    1
    
    void* operator new(size_t size)
    
  4. Prevent Exception Functionality

    Preventing exception functionality to prevent linker errors such as undefined reference to __gxx_personality_v0 and undefined reference to __cxa_end_cleanup (again, this is optional, and only applied if you want to use new and delete)

    Add the custom compile flag '-fno-exceptions' to every .cpp file you want to compile in PSoC Creator to prevent the 'undefined reference to __gxx_personality_v0' linker error.

    Add the custom compile flag ‘-fno-exceptions’ to every .cpp file you want to compile in PSoC Creator to prevent the ‘undefined reference to __gxx_personality_v0’ linker error.

The steps have pictures and code examples to help you through the process.

Checkout the page here.


Authors

Geoffrey Hunter

Dude making stuff.

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License .

Related Content:

Tags

comments powered by Disqus