cancel
Showing results for 
Search instead for 
Did you mean: 

PWM Linker Issue on IAR with Simulink generated code

cameron.ross
Associate II

I'm having an issue with the timer block in the STM32 blockset in simulink setting it up for the STM32F030F4P6 processor. The project builds fine in simulink but when I build in IAR I get a linker error, see attached image. I've attached images showing the settings used in STM32CUBEMX and the errors in IAR. I'm using the most up to date version of the firmware on the ST website v1.9. I'm hoping this is just a setup issue that I can't seem to figure out. Any help is appreciated.

7 REPLIES 7

In [STM32Cube_FW_F0_V1.7.0]\Drivers\STM32F0xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h I see:

#define __HAL_TIM_SetAutoreload        __HAL_TIM_SET_AUTORELOAD

#define __HAL_TIM_SetCompare           __HAL_TIM_SET_COMPARE

I have no idea under which circumstances this header is supposed to be #included, and whether it should be #included directly or through some other header. I don't Cube.

JW

Khouloud GARSI
Lead II

Hi @cameron.ross​ ,

In order to fix this error, you should add the header file Legacy directory:

0690X000006CDnGQAW.png

And do not forget to include it on your code source:

 #include "stm32_hal_legacy.h"

Khouloud.

cameron.ross
Associate II

Hi @Khouloud GARSI​ The files you are referring to are already included. I will remind you that this is sumlink generated code using ST's block set which should in theory include all necessary includes, unless the block set does not work as stated.

> The files you are referring to are already included.

So you have

#include "stm32_hal_legacy.h"

in the source where __HAL_TIM_SetCompare() and __HAL_TIM_SetAutoreload() are used?

JW

[double post]

Khouloud GARSI
Lead II

Hi @cameron.ross​ ,

Have you added the #include "stm32_hal_legacy.h" to your code source?

Khouloud.

cameron.ross
Associate II

@Khouloud GARSI​ I haven't included anything nor have I writen source code I'm using Simulink and the ST block set St released to generate the code.

I can see that these files you refer to are included when I open the IAR project file created by simulink when it builds the model.

If you are unfamiliar with model based design using simulink can I ask that you not try and answer the question as my issue is specific to this circumstance. Though I do appreciate your effort in assisting me.