cancel
Showing results for 
Search instead for 
Did you mean: 

BUG: CubeMX SW4STM32 Project generation and STM32 MAT Target

Greenteam KrBi
Associate
Posted on April 15, 2017 at 01:46

Hi there,

when generating code  from Simulink using the STM32 MAT Target, the project build in SW4STM32 will not succeed, because CubeMX doesn't include the <modelName>/Src  directory into the eclipse project's code search paths. This has to be done manually each time the code generation is re-run. The <modelName>/Inc directory is included correctly. I am not sure if this is a bug in CubeMX or in the STM32 MAT Target, but it is definitively annoying and I would appreciate to see it fixed soon.

Another bug appearing to me in this context is the inclusion of the C math library. In Eclipse project settings, the C math library can be included by activating a checkbox in C/C++ Build > Settings > MCU GCC Linker > Libraries. This is set by default in the CubeMx generated projects. But results in linker failure. Unchecking the checkbox and adding the library 'm' to the Libraries list in the same configuration page helps.

The difference in the linker call seems to be the order of inclusion:

with checkbox Use C math library (-lm) checked:

arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -specs=nosys.specs -specs=nano.specs -T'../STM32F405RGTx_FLASH.ld' -Wl,-Map=output.map -Wl,--gc-sections -lm -o 'Application.elf' @'objects.list'

=> Linker fails to build binary

without checkbox checked, but m included in libraries list:

arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -specs=nosys.specs -specs=nano.specs -T'../STM32F405RGTx_FLASH.ld' -Wl,-Map=output.map -Wl,--gc-sections -o 'Application.elf' @'objects.list'  -lm

=> Linker succeeds to build binary

I hope that my descriptions are clear enough. If not, feel free to ask for more information. Or maybe there is a simple solution for this? Some configuration option I missed so far?

Thank you!

Btw: How many of you are actually using the STM32 MAT Target library for Code Generation in Simulink? I can't find much references on the web. Most private users seem to use the Waijung Blockset? Are there any good professional solutions besides the STM32 MAT Target library?

2 REPLIES 2
Imen.D
ST Employee
Posted on April 17, 2017 at 11:55

Hello

Binder.Kristian

,

I will report your feedback internally andwill come back to you as soon as possible.

Thank you for your contribution.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
stm32cube-t
Senior III
Posted on February 21, 2018 at 09:06

When generating with SW4STM32 IDE, uncheck the 'Generate under root option' in the Project > Settings window. Then select your project root folder as the workspace.