2017-02-09 08:23 AM
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
Solved! Go to Solution.
2017-02-13 01:53 AM
Hi
Castrignano.Adalgiso
,Please try to set the
Backup previously generated files when re-generating option :
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-
2017-02-13 01:53 AM
Hi
Castrignano.Adalgiso
,Please try to set the
Backup previously generated files when re-generating option :
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-
2017-02-20 09:44 AM
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.
2017-02-20 11:09 PM
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/