Loading...
 

SW4STM32 and SW4Linux fully supports the STM32MP1 asymmetric multicore Cortex/A7+M4 MPUs

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world.
And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4.
You can get more information from the ac6-tools website and download two short videos (registration required) highlighting:

System Workbench for STM32


STM32CubeMX for SW4STM32 : where is c++ compiler ?

Hi,


I’ve generated a project with cubeMx for System workbench.
Now, I add some c++ classes which does not compile because they are
compiled by eclipse with gcc and not g++.

Can anyone tell me how to fix this ? I can neither find G++ options in project settings.

Thanks
Julien

France

Hi Julien,

CubeMX generates a C project, not a C++ project, as the HAL code is fully writtent, and tested, in C.

To compile C++ code, you must convert your C project to a C++ project. You just have to use the project >> Convert to C++ project converter and it should work seamlessly.

The only thing is that you must first check that your IDE is up-to-date, by Help >> Check for Updates... as a small bug on C++ compile options was corrected recently

Bernard


Hello,

I am fighting with the same issues and my IDE SW4STM32 and Cube softawres are up to date.

I switched the project to C++, add the missing includes to G++ setting and change some linker settings.

Now when I compile, it look to call only yhe GCC compiler, not G++ and at the end I have an error that say : unknown type name ‘class’.

Thnaks.

Philippe

France

Hi Philippe,

C++ source code must be in files suffixed as .cpp, .cxx or .cc; on Linux you can also use .C (capital C) but on Windows it is equivalent to .c (lowercase C) so is compiled as C code, and not C++ code, due to the case-independent Windows filesystem...

Hope this helps,

Bernard


same for me..
(error: unknown type name ‘class’)

latest eclipse, latest tools and latest libs, everything up to date.. i also renamed main.c to main.cpp. Somehow the .cpp files are not being compiled by the cpp compiler in my guess..

does someone knows any possible workaround? a thousand thanks in advance

-I”D:/BACKUP/BACKUP3/willianma/Documents/stm32projects/FreeRTOSLwIPt4dhcp2eclipseN01/Drivers/CMSIS/Device/ST/STM32F4xx/Include” -I”D:/BACKUP/BACKUP3/willianma/Documents/stm32projects/FreeRTOSLwIPt4dhcp2eclipseN01/Inc” -Os -g3 -Wall -fmessage-length=0 -ffunction-sections -c -fmessage-length=0 -MMD -MP -MF”Src/freertos.d” -MT”Src/freertos.o” -o “Src/freertos.o” “../Src/freertos.c”
In file included from ../Src/freertos.c:41:0:
D:/BACKUP/BACKUP3/willianma/Documents/stm32projects/FreeRTOSLwIPt4dhcp2eclipseN01/Inc/TestCppClass.h:10:1: error: unknown type name ‘class’
class TestCppClass {

D:/BACKUP/BACKUP3/willianma/Documents/stm32projects/FreeRTOSLwIPt4dhcp2eclipseN01/Inc/TestCppClass.h:10:20: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘{’ token
class TestCppClass {

make: *** Src/freertos.o Error 1

tryed the simplest class as below:

/*
* TestCppClass.h
*
* Created on: Mar 31, 2016
* Author: willi
*/

  1. ifndef _TESTCPPCLASS_H_
  2. define _TESTCPPCLASS_H_


class TestCppClass {
public:

TestCppClass();//constructor
virtual ~TestCppClass();//destructor
void setLenght(int len);
int getLenght(void);

private:
int lenght;
};

  1. endif /*_TESTCPPCLASS_H_ */


/*
* TestCppClass.cpp
*
* Created on: Mar 31, 2016
* Author: willi
*/

  1. include “TestCppClass.h”


TestCppClass::TestCppClass() {
// TODO Auto-generated constructor stub
lenght=0;
}

TestCppClass::~TestCppClass() {
// TODO Auto-generated destructor stub
}

void TestCppClass::setLenght(int len){
lenght = len;
}
int TestCppClass::getLenght(){
return this->lenght;
}

France

Hi,

To compile C++ code you must create a C++ project; if you have a C project, you must convert it by right clicking on your project >> Convert to C++

Then be careful, files suffixed by .c are C files, not C++ files, in which you should probably not include C++ header files (like you do above in SRC/freertos.c)...

Hope this helps,

Bernard (Ac6)


Hi,

Right-click on your project, then you will find menu “Convert to C++”

Rgds,
Kevin.


If rename main.c to main.cpp i have error:
/startup/startup_stm32f303xc.s:111: undefined reference to `main’
Src/stm32f3xx_it.o: In function `DMA1_Channel3_IRQHandler’:...



Hi Everyone,

I also have same issue! After adding my C++ code to the project, and convert the project to C++, I tried to build the code, but I received “Unknown type name ‘class’” which means the compiler didn’t recognize my c++ code! Has any one found a solution to resolve this issue? I really would like to be able to run C++ code on my STM32 mcu.

Thank you.

France

Hi,

What extension do you use for your C++ code; on Windows, as file names are case insensitive, you must use .cpp instead of .c or .C for the C++ compiler to be called; a C++ project may include both C and C++ code but will be linked as a C++ program, using the C++ linker.

HTH

Bernard (Ac6)