Hello there, I’m trying to compile some C++ files to run on SiFive targets but it always fails, I think it’s a linker script problem so is there any tutorial or guidelines to how to add C++ files to my Freedom SDK project or it’s not supported at all? Thanks.
Hi Kareem,
C++ is not a supported feature of the freedom-e-sdk at this time but some users have been able to make adjustments for specific cases. Below are some notes on what might be required.
makefile in the src directory needs to be modified to pick up .cpp files.
#include “cpu.h” may have to be changed to extern “C” { #include <metal/cpu.h> }
freedom-e-sdk specs files add -nostartfiles and then add in a custom crt0.o, but crti.o, crtbegin.o, crtend.o, and crtn.o are missing. This can cause link errors for missing symbols if you link with libstdc+. It may break some C++ features like static constructors and destructors, frame unwinding for exceptions, etc.