2017-05-05 11:10 AM
Hello,
When I compile STM32CubeMX generated C file with my IDE ( OpenSTM32 last version)
to
C is ever think ok.In the Project Explorer I convert to c++.
But when I change main.c
to main.cpp I get an error message “make: ***http://www.openstm32.org/Drivers/Hans.o
Error 258�?.Is there a solution available?
Thanks JohannesOS windows 10
Version: Mars.2 Release (4.5.2) STM32L432KU STM32Cube V1.0 Version 4.20.#2017-05-10 07:21 AM
I think , that will be a good thing ST, Atollic/AC6 work here together and look for a solution…
The best solution would be if Cube supported C++ out of the box.
Everything else would be just a workaround.
2017-05-11 03:23 AM
I have converted C project into C++ and had to solve issue with static objects.
The solution was to add definition for linker in *.ld file:
/* .ctors .dtors are used for c++ constructors/destructors */
.ctors : { PROVIDE(__ctors_start__ = .); KEEP(*(SORT(.ctors.*))) KEEP(*(.ctors)) PROVIDE(__ctors_end__ = .); } >FLASH.dtors :
{ PROVIDE(__dtors_start__ = .); KEEP(*(SORT(.dtors.*))) KEEP(*(.dtors)) PROVIDE(__dtors_end__ = .); } >FLASHSo, don't forget also for this.
Tomas.
2017-10-25 09:30 PM
Hmm, can you give an example please?
I've never had any issue with any static objects (static class members? or static functions? or static local variables?)
2017-10-29 02:11 PM
Hello Valentin,
It was a long time ago, so I cannot find the right example but in general, it was like:
&sharpinclude 'myclass.hpp'
static MyClass my_object_of_class;
int main()
{
my_object_of_class.call_method();
}
When I call 'call_method()' of object 'my_object_of_class' which is allocated above main(), without initialization of sections ctors and dtors, it fails. Now I cannot remember if it was necessary static allocation or if it also fails without static.
Tomas
2017-10-30 01:04 PM
Hmm, interesting. I never had that issue so far. But I will keep this in mind in case I run into problems. Thanks!
2018-01-18 06:31 AM
Hi all,
For your information, we do understand the need for you to generate C++ project and this need is well known internally.
However, for the moment, with the success of STM32CubeMX, we have a lot of requests/suggestions to study and many improvements to integrate.
And the C++ generation project item is not yet under study currently.
Sorry, for the inconvenience it may cause.
BR. Jeanne