cancel
Showing results for 
Search instead for 
Did you mean: 

Cube MX IDE (and CubeMX) creates code with multiple definitions of `APBPrescTable' and others

CubeMXIDE 1.3.00, CubeMX 6.2.0

project with Truestudio (CubeMX) or CubeMXIDE.

FreeRTOS

FMC using SDRAM bank 1, LCD display on first SRAM bank.

GPIO outputs, I2C, SPI.

FREERTOS CMSIS V1 or V2 does not matter.

STM32F767ZIT Nucleo Board

Under <project>/drivers/CMSIS/Device/ST/STM32F7xx/Source/Templates it creates system_stm32f7xx.c, which contains duplicate definitions of at least..

AHBPrescTable, SystemCoreCLockUpdate, SystemInit and whatever else seems to be definined in this file.

Other, and earlier, versions of CubeMX (rev 6.2) seem to not generate this file.

Deleting this file seems to eliminate the multiple definitions, but this appears to be a bug.

A further bug is that the little red "error" flags on the files seem to never want to go away.

Any one else seeing this?

I suspect that if FreeRTOS is not used, this may not happen. It seems to happen regardless of the version of the interface.

4 REPLIES 4

Note that about six months later, and a new version of cubeMXIDE, it still hasn't been fixed.

You'll get about 8 multiply defined errors.

Each time you regenerate code from the .ioc file, the unwanted duplications pop up.

Delete the file under source/templates and the program will compile properly.

Mike_ST
ST Employee

Hello,

A template file like <project>/drivers/CMSIS/Device/ST/STM32F7xx/Source/Templates/system_stm32f7xx.c should not be part of the project.

In theory STM32CubeIDE generates a system_stm32f7xx.c file inside the Core/Src.

And, I have not reproduced the issue with the S1D_V2 project you shared in another thread.

Have you tried with latest STM32CUDEIDE 1.7.0 ?

I've tried, using the latest versions. Still does it.

I'm just deleting the excess, because I'm fighting with TouchGFX and STM32CUBEIDE, which do not get along at all.

In actutality, the file is generated in both locations, hence the already defined problems.

Tried with a new project based on the 469I disco board default settings

1) initial project did not have the excess file.

2) changed (and added) a timer for FreeRTOS high frequency ticks, made no changes to FreeRTOS: no excess file

3) changed settings in FreeRTOS: got the excess file.

Apparently has to do with making changes to FreeRTOS, as in....

There's a default in the FreeRTOS settings that adds that file, somewhere...

Without changing FreeRTOS, that default does not get set

When changing FreeRTOS, the default is set (or the logic says add the file). That logic never resets.

Instant excess file.