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


Error after converting cube project to C++

== UPDATE ==
BUG REPORT, see “Answer to Question2” in reply below. There is a bug when converting C to C++ project. The linker script is removed
== END ==

Hi, I have to add some c++ code to my project. The project was created by latest STM32CubeMX for STM32L1. Works and runs on MCU. I followed steps in previous post how to convert project to C++. This works. But, get following linker errors:

undefined reference to `_exit’
undefined reference to `_close’
.....

I am using printf and other functions. I fixed problem by adding syscalls.c file with these functions.

Question 1

Is there a reference “syscalls.c” file to use with cube projects? I got one from the net, and don’t trust it at all!

Question 2

After adding the syscalls.c file mentioned above, project builds. But, now when I try to program the STM32L151RC I get following errors. Can anyone help?

‘’Programming Finished
Perify Started
target state: halted
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x2000002e msp: 0x20008000
Error: checksum mismatch - attempting binary compare
diff 0 address 0x00008000. Was 0x82 instead of 0xf8
diff 1 address 0x00008001. Was 0x62 instead of 0xb5
diff 2 address 0x00008002. Was 0x98 instead of 0x00
..... Many more diff x lines .....’’

To anser my own questions:

Answer to Question 1

I got a syscalls.c from SW4STM by creating a new project, and using the generated “syscalls.c” file.

Answer to Question 2:

The problem was that after converting to C++ file, the linker file is removed from project properties. Have to go to section and give in the linker file again.