yet another casting bug which while warning in C is fatal in C++:
../Generated_Code/SSI1.c: In function 'LDD_TError SSI1_SendBlocks(LDD_TDeviceData*, LDD_SSI_TDataBlocks*, std::uint16_t)':
../Generated_Code/SSI1.c:504:72: error: invalid conversion from 'LDD_TData* {aka void*}' to 'std::uint8_t* {aka unsigned char*}' [-fpermissive]
../Generated_Code/SSI1.c:505:72: error: invalid conversion from 'LDD_TData* {aka void*}' to 'std::uint8_t* {aka unsigned char*}' [-fpermissive]
mingw32-make: *** [Generated_Code/SSI1.o] Error 1
Can be fixed with proper casting.
The file is also missing the 'extern C' wrapper which causes other compile errors. Of course SSI1.h is also missing the wrapper as well.
Hello,
could you please specify what verison of CW do you use? I was able to reproduce only the casting issue.
Please note that C++ support was imporved from CW V10.4. We also do not test it. PEx is rather C++ ready, so as you can see in your case, some component neednt work properly. However we will try to improve all components for next release.
Best regards
Vojtech Filip
Processor Expert Support Team
Hi Vojtech,
I'm using CW 10.4 from about 2 weeks ago, all updates (from within Eclipse) applied. It would probably be worthwhile for you guys to at least compile every module (I assume you have regression testing scripts for this) to unearth these issues, as you did announce that PE is now C++ compatible.
I realize that the pattern of assigning pointers to void* is very common in C without explicit casting... I was looking around to see if there was a compiler flag or something to tell the C++ compiler to use C rules when compiling C files... seems it ought to do this but it's being C++ strict.
Regards, Marc
Hi again Vojtech,
I've been thinking more about this. The C pattern of assigning to void* without casting is so common. I started to wonder why all that code was breaking.
Well, turns out the C++ compiler is compiling those files as C++ and not as C.
There's a solution which I think makes more sense actually, which is to tell the C++ compiler (g++ in our case) to look at the file postfix and treat .c files as C and .cpp files as C++. I mistakenly thought that's what it did normally but it turns out you need to tell it to do that, by putting '-x none' before your source files.
I learned about this here:
http://mcuoneclipse.com/2013/03/23/compiling-c-files-with-gnu-arm-g/
So now, I'm questioning my own supposition that these are bugs in your code. Maybe the compiler flag for g++ should simply be invoked, so C files are compiled as C.
Regards,
Marc