2018-03-17 01:08 PM
Like
•
Show 0 LikesComment
•
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)
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_BKP);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?
Dave
#cubemx-bug-init.-code2018-03-18 07:48 AM
As a temporary workaround, I replaced these lines with which generated by older version of CubeMX.
However, this will be replaced back by CubeMX after re-generation.
LL_PWR_EnableBkUpAccess
();
/* Enable BKP CLK enable for backup registers */
LL_APB1_GRP1_EnableClock
(LL_APB1_GRP1_PERIPH_BKP);
Replaced with:
HAL_PWR_EnableBkUpAccess
();
/* Enable BKP CLK enable for backup registers */
__HAL_RCC_BKP_CLK_ENABLE
();
2018-03-22 07:25 AM
Hello,
This is knownissue already reported to CubeMx team for fix.
https://community.st.com/0D50X00009XkWuZSAV
Sorry for the inconvenience it may bring.
Kind Regards,
Imen
2018-06-05 09:00 AM
,
,
I put this code into the user code section before the problem code to avoid the CubeMX code replacement:
♯ warning These definitions is a temporary workaround. Remove them, when the STM32CubeMX bug will be fixed.
,
♯ define LL_PWR_EnableBkUpAccess() HAL_PWR_EnableBkUpAccess(),
♯ define LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_BKP) __HAL_RCC_BKP_CLK_ENABLE()