Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


C++ Project for System Workbench

I have a project generated from STM32CubeMX for STM32F439x and I was able to compile the code and run with system workbench. Now, I would like to include C++ files into the project. When I add any .cc or .cpp file, I don’t see the make command invoking the call for the newly added file.
Is there any special procedure that you have to do in order to support C++ files? Has anyone compiles C++ files with System Workbench?
I tried converting main.c to main.cpp and the linker can’t link the main function ( I am assuming since the file isn’t being compiled by gcc?)
Thanks in advance!


-Rup

I had the same problem: my cpp files were not compiled.
I found that the file was not compiled because while importing c++ files, the compiler is not automatically set as it is for C files.
To correct this, you have to select your cpp file in the project explorer, right click -> Properties -> C/C++ build -> Tool chain Editor -> Select tool
Here select “MCU G++ Compiler” instead of “NO TOOL”

Once done, on my side, the workbench now tries to compile the file but I have no compilation errors:
cc1plus: error: invalid option `thumb’
cc1plus: error: invalid option `float-abi=soft’
myfile.cpp:1: warning: -ffunction-sections may affect debugging on some targets

and I don’t know yet why?

Hmm, interesting. Thanks for the tip.

I have MCU G++ added, though when I look at the workbench settings, looks like it is grayed out.

Also, once the G++ is added, I would expect on the tool settings to have MCU C++ Compiler options for c++, just like what you would expect for c.

Below are the screenshots I took.
Eclipss Tools GPP1

ECLPISE GPP 2

ECLPISE GPP 3

Notice there is no G++ compiler and linker options, under tool settings :-(


Hi everyone,

Converting C project to C++ project is not supported yet. However i found a trick to manually do it.
In the project directory, you should find a “.project” file. Add “org.eclipse.cdt.core.ccnature” under the “natures” parent element, then save the changes.
The project has to be refreshed (or close then re-open).

Under the project properties, you should find the G++ settings :

Convert C C++

Hope it help you.

Kevin.


Thanks. This workaround allows me to compile.

Nevertheless, I had to redefine the include paths (included the ones of the HAL driver) and the preprocessor options “USE_HAL_DRIVER” and “STM32F401xE” (in my case) via the following path(C/C++ General -> Paths and Symbols -> Symbols-> Gnu C++.


Kevin,
The workaround also worked for me too! Like uncommonmanu said, I had to add the path and symbols, also add the right linker file since the g++ linker was pointing to some default *.ld file.
I was able to create a dummy c++ test class and compile and run with the stmf439xx micro. Can’t wait to port our project from IAR to gcc. Goodbye 3K+ compiler license fees :-)

-Rup


 

Newest Forum Posts

  1. reservation car service Seattle by Jamesprede, 2025-05-01 10:06
  2. Last day: drone bonus by Danielrug, 2025-04-19 16:55
  3. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  4. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  5. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  6. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  7. Insightful Perspectives on This Subject by davidsycle, 2025-03-04 05:45
  8. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  9. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  10. Build a project in "release" mode by tang, 2025-02-20 10:36

Last-Modified Blogs