AnsweredAssumed Answered

Bug Report: CubeMX Generates Bad Init Code

Question asked by sidlauskas.david on Mar 17, 2018
Latest reply on Mar 22, 2018 by Imen D
  • Like0
  • Comment2

Using CubeMX V4.7.25.0 I get initialization code for RTC.c that won't compile when I request initialization be generated as .c.h file pairs.


Simple demo case:

Start CubeMX

New Project

Select STMf103C8Tx as target

Under Pins Select RTC-> Activate Clock Source.

Under Project settings:

   Project Name: Test

   Location: C:\Temp\

   Under Code Generator Tab:

         Check Generate peripheral initialization as pair of .c/.h files

Generate code for TrueStudio

When I build the generated code I get the following errors:


..\..\..\Src\rtc.c:73:5: warning: implicit declaration of function 'LL_PWR_EnableBkUpAccess' [-Wimplicit-function-declaration] LL_PWR_EnableBkUpAccess();


..\..\..\Src\rtc.c:75:5: warning: implicit declaration of function 'LL_APB1_GRP1_EnableClock' [-Wimplicit-function-declaration]  LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_BKP);


..\..\..\Src\rtc.c:75:30: error: 'LL_APB1_GRP1_PERIPH_BKP' undeclared (first use in this function)
If I generate code for the test project with the peripheral inits in main(), the project will then build without error.
Is this a CubeMx bug?