Bug Report MCSDK 5.Y.3: Generated code has macro redefinition and undefined identifier errors
- November 5, 2021
- 3 replies
- 2216 views
Hello,
I'm experimenting with the Motor Control SDK toolchain (MCSDK v5.Y.3).
- I set up the config in Motor Control Workbench (the .stmcx file is attached, I changed the extension to .txt so that I can upload it...)
- After having check all pin assignments are OK, I generate the project for IAR v8, CubeMX 6.1.1, with HAL drivers type, firmware package 1.25.2. The generation complete without warning nor error.
- I then open the IAR project that has just been generated and try to build it as-it-is. I got the warning and the error below:
Macro redefinition:
Warning[Pa181]: incompatible redefinition of macro "SPD_TIM_M1_IRQHandler" (declared at line 173) ***\Inc\parameters_conversion.h 178=> I set a different timer for the hall sensors and for the auxiliary speed sensor (quadrature encoder), but the same symbole SPD_TIM_M1_IRQHandler is defined for both timers:
#define SPD_TIM_M1_IRQHandler TIM2_IRQHandler
#define SPD_TIM_M1_IRQHandler TIM3_IRQHandlerI expected to be able to choose different timers, or to get a warning if I use different ones.
A workaround is to use the same timer for both in MotorControl Workbench.
Undefined identifier:
Error[Pe020]: identifier "VirtualSpeedSensorM1" is undefined ***\Src\mc_tasks.c 162=> This symbol is defined in .../Src/mc_config.c. However other symbols like
However other symbols like PIDIqHandle_M1 are also defined in this same file and also used in mc_tasks.c, and they don't triggers error.
Maybe a missing include or external reference ?
I expected the generated code to compile out-of-the box.
Additional info:
The error and the warning also happen if the code is generated with LL drivers instead of HAL drivers, in MotorControl Workbench.
Thanks for your insight :)
