cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX Freertos C++

Adalgiso
Associate II
Posted on February 09, 2017 at 17:23

Hi,

 I am trying to use the code generated by Cube including freertos for an STM32F2xx device. I uses the latest tool (cube 4.19 and Firmware package 1.14). After generating the code i changed  the compiler setting in IAR to c++ code.

my problem is that I cannot link the code as the function defined in assembly is not defined as extern 'C'.

extern void vPortStartFirstTask( void );

When I change the code I can link my project but next time I generate my code the file port.c is replaced and my modification are erased.

is there another solution to fix this?

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Nesrine M_O
Lead II
Posted on February 13, 2017 at 10:53

Hi

Castrignano.Adalgiso

,

Please try to set the

Backup previously generated files when re-generating option :

0690X00000605J8QAI.png

Backup previously generated files in a backup directory

The .bak extension is added to previously generated .c/.h files.

Keep user code when regenerating the C code.

This option applies only to user sections within STM32CubeMX generated files. It does

not apply to the user files that might have been added manually or generated via ftl

templates

-Nesrine-

View solution in original post

3 REPLIES 3
Nesrine M_O
Lead II
Posted on February 13, 2017 at 10:53

Hi

Castrignano.Adalgiso

,

Please try to set the

Backup previously generated files when re-generating option :

0690X00000605J8QAI.png

Backup previously generated files in a backup directory

The .bak extension is added to previously generated .c/.h files.

Keep user code when regenerating the C code.

This option applies only to user sections within STM32CubeMX generated files. It does

not apply to the user files that might have been added manually or generated via ftl

templates

-Nesrine-

Rob.Riggs
Senior III
Posted on February 20, 2017 at 18:44

In addition to Nesrine's solution, you can go into the firmware library itself and modify the problematic source file or template file directly.  I've had to do that when applying bug fixes to the library.

Adalgiso
Associate II
Posted on February 21, 2017 at 08:09

Thanks for your info. I fixed the issue by mixing c and C++ in my project. All source code related to Freertos is build in C and my project files are build with C++.

This is recommended in an IAR application note see 

https://www.iar.com/support/tech-notes/compiler/mixing-c-and-c/