py32f0-template icon indicating copy to clipboard operation
py32f0-template copied to clipboard

C++ Support

Open garudaonekh opened this issue 1 year ago • 5 comments

Hi, I am from Arduino. I can get some code here to work. Somehow, I am not able to get CPP library to work here.

Any suggestion on how to get CPP to work here?

Thanks;

garudaonekh avatar May 07 '24 07:05 garudaonekh

Adding extern "C" { } around C function declarations? e.g. AIR32F10xLib

IOsetting avatar May 09 '24 23:05 IOsetting

The issue is the compiler does not recognize C++ and class.

garudaonekh avatar May 10 '24 01:05 garudaonekh

I think to make C++ works, I need to change to arm-none-eabi-c++ in the rules file. Somehow, I try to change it, but some parameters are interlinked and can't run properly

garudaonekh avatar May 13 '24 08:05 garudaonekh

Thanks for your update for CPP support. Your blinkCPP worked. But when I try to wrap a CPP class, i got error: **undefined reference to operator new(unsigned int)'**`

Archive.zip I attach the whole code for the Rectangle Class

garudaonekh avatar May 25 '24 07:05 garudaonekh

new and delete operators are not included in gcc-arm-none-eabi, use malloc and free instead.

IOsetting avatar May 25 '24 13:05 IOsetting

Thanks. It works. CPP support is a bridge for easy migration of many library to this.

garudaonekh avatar May 28 '24 07:05 garudaonekh