Skip to main content
Harvey White
Senior III
February 6, 2022
Question

CubeMXIDE multiple definition bug still here

  • February 6, 2022
  • 12 replies
  • 3962 views

FreeRTOS project:

code generated includes code in Drivers/CMSIS/Device/ST/STM32F4x/Source/templates

File is of definitions, likely stm32F4xx.h

This conflicts with the file included at Drivers/CMSIS/Device/ST/STM32F4x/Include.

This seems to only happen when using FreeRTOS and CMSIS V2 interface.

Did you mean to include something like stm32F4xx.C in the templates location?

The information is redundant, giving me about 8 multiple definitions. Deleting the template file produces working code.

This has been around for a long while.

This topic has been closed for replies.

12 replies

Harvey White
Senior III
February 17, 2022

Reinstalling CubeMXIDE does not eliminate the problem.

Harvey White
Senior III
March 14, 2023

WORKAROUND

ST has not been able to duplicate or analyze the problem.

For some reason, it happens.

Go to the following path which contains the unwanted file:

<project name>/Drivers/CMSIS/Device/ST/<processor name>'/Source/Templates

Under that directory, there will be a file: system_stm32L5xx.c

where system_stm32L5xx.c is the processor you're using.

select that file. Alt Enter to get the file properties.

Go to C/C++ build to find the properties

check "EXCLUDE RESOURCE FROM BUILD"

This becomes a persistent setting.

Each time (in my system) the .ioc file is altered, the software puts back that system<processor>.c file. Thus, deleting it has to happen once per change. With this modification, the file is excluded and nine multiple definitions do not happen.

Pavel A.
Super User
March 14, 2023

This is strange. Template files should be never copied from the shared "repository" to the user's project dir (by Cube or manually). They are supposed to be "cloned" only once, when the project is created. If new cube versions do this, please file a bug.

Harvey White
Senior III
March 14, 2023

I have filed a bug, many times. They cannot reproduce it even given most of the project. I conclude that it's something odd at my end, but it is quite consistent. I have a copy generated under /core/src which seems to be the actual file, but what's duplicated seems to act like a link. Delete it, and you're fine (but it gets regenerated the next mod to the .ioc file). Then you need to delete it again. Delete what's under /core, and the compile fails spectacularly.

Seems to be related to using CMSIS, either version 1 or 2. I even had it show up when trying (unsuccessfully) to make AZURE behave reasonably.