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


BUG report "error: expected '}' at end of input" when compiling with g++

Hello,

I have the following Problem. When I want to write C++ code, the project will not compile. Here are the steps I do.

1. Create new C++ Project
2. Select STM32F413ZHT as MCU
3. Create the Project with “StdPeriph_Driver”
4. Rename main.c to main.cpp
5. Now you will get the error “../src/main.cpp:19:1: error: expected ‘}’ at end of input”

So what is the problem?

When I do the same steps above but do not select the MCU as STM32F413ZHT but select the Nucleon Board with the STM32F413ZHT assambled, than it will compile the C++ code.

First I thought it has something to to with the stm32f4xx.h but when I use the devKit it is working fine...

Do I have to define some Preprocessor symbols?

Thanks


EDIT

This problem only occurs when selecting STM32F413ZHT as MCU, when I select STM32F2 or STM32F1 it is working with main.cpp




WORKING SOLUTION

The file “stm32f4xx_fmpi2c.h” has a wrong syntax when the project is created only selecting the MCU.

The Last 3 preprocessor directives are in wrong order:

This is wrong:
#ifdef __cplusplus
}
#endif
#endif /*__STM32F4xx_FMPI2C_H */

#endif



This is correct:
#endif
#ifdef __cplusplus
}
#endif
#endif /*__STM32F4xx_FMPI2C_H */



EDITEDITEDIT

Also, why is this directive added for the file “stm32f4xx_fmpi2c.h”??

  1. if defined(STM32F446xx)

Why is this nessessary for the STM32F413ZHT???