2018-10-04 01:17 AM
My task is to change our current microcontroller solution to STM32, for this i choose to use Atollic True Studio. My goal is to keep the current software and only replace the hardware access (which is the only mcu specific part).
Since all the libraries are C++, i tried to convet the project from cube to c++ with the follwoing steps
Now i'm getting alot of errors, most comming from the lines that contain the followin code:
#ifdef __cplusplus
extern "C" {
#endif
....
#ifdef __cplusplus
}
#endif
And the error (~15 times) is called:
expected identifier or '(' before string constant
Another error i already get is
unknown type name 'uint32_t'
What could be the solution to this problem?
2018-10-04 02:09 AM
Seems the wrong approach to me.
> Select MCU in Cube, generate project
AFAIK, Cube does not support C++.
Second, the framework of your application is defined by the structure of said existing application. I would really wonder if that matches with the restrictions and quirks of Cube.
I would check if the project to port is properly layered, i.e. you can separate the more abstract application parts from the low-level hardware dependant code. If not (sh*t happens), you might be better of rewriting it.
Then I would generate a fresh C++ project in Atollic for the MCU, and add the high-level code directly.
Low level code needs more attention, consider different peripherals, interrupt mechanisms and priorities, timing inter-dependecies, and MCU concepts (like FIFOs vs. DMA).
uint32_t is a CMSIS standard type define.
2018-10-04 03:09 AM
uint32_t is a standard c++ and c99 typedef.
See:
http://www.cplusplus.com/reference/cstdint/?kw=stdint.h
http://www.cplusplus.com/reference/cinttypes/?kw=inttypes.h
-- pa
2018-10-04 03:22 AM
> uint32_t is a standard c++ and c99 typedef.
The toolchain for my current projects is from the 1997...
2018-10-04 06:05 AM
Mabye i forgot to say, that i don't have imported any custom content in the project, i just generated "emtpy" project via cube, and that does not compile. I really don't understand why the cube application should limit the code, since the "ifdef __cplusplus" is already present everywhere, i guess it should be meant to be possible to convert C++. I don't think the cube isnt to blame here, its more a problem of the IDE (Atollic True Studio).
If my approach is wrong, what would be the propper way to set up a C++ Project with the STM32?