0
\$\begingroup\$

I downloaded the new STM32CubeMX (with the 'fancy' but quite annoying GUI). When I make a project (using some GPIO's, timers), I create the code (for System Workbench for STM/AC6/SW4STM Eclipse). And without changing any code, just compiling I get a lot of errors.

What needs to be done more to have it work out of the box (as the previous STM32CubeMX did)?

Errors (parts):

    Building file: ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c
Invoking: MCU GCC Compiler
C:\Users\mkeijzers\OneDrive\Mestra\Galaxy Ceiling Light\Debug
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -mfloat-abi=soft '-D__weak=__attribute__((weak))' '-D__packed=__attribute__((__packed__))' -DUSE_HAL_DRIVER -DSTM32F103xB -I"C:/Users/mkeijzers/OneDrive/Mestra/Galaxy Ceiling Light/Core/Inc" -I"C:/Users/mkeijzers/OneDrive/Mestra/Galaxy Ceiling Light/Drivers/STM32F1xx_HAL_Driver/Inc" -I"C:/Users/mkeijzers/OneDrive/Mestra/Galaxy Ceiling Light/Drivers/STM32F1xx_HAL_Driver/Inc/Legacy" -I"C:/Users/mkeijzers/OneDrive/Mestra/Galaxy Ceiling Light/Drivers/CMSIS/Device/ST/STM32F1xx/Include" -I"C:/Users/mkeijzers/OneDrive/Mestra/Galaxy Ceiling Light/Drivers/CMSIS/Include"  -Og -g3 -Wall -fmessage-length=0 -ffunction-sections -c -fmessage-length=0 -MMD -MP -MF"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.d" -MT"Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.o" -o "Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.o" "../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c"
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:88:1: error: unknown type name 'RTC_HandleTypeDef'; did you mean 'ADC_HandleTypeDef'?
 RTC_HandleTypeDef        hRTC_Handle;
 ^~~~~~~~~~~~~~~~~
 ADC_HandleTypeDef
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c: In function 'HAL_InitTick':
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:139:18: error: request for member 'Instance' in something not a structure or union
       hRTC_Handle.Instance = RTC;
                  ^
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:141:18: error: request for member 'Init' in something not a structure or union
       hRTC_Handle.Init.AsynchPrediv = (HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_RTC) / 10000) - 1;
                  ^
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:142:18: error: request for member 'Init' in something not a structure or union
       hRTC_Handle.Init.OutPut = RTC_OUTPUTSOURCE_NONE;
                  ^
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:142:33: error: 'RTC_OUTPUTSOURCE_NONE' undeclared (first use in this function); did you mean 'RTC_CLOCK_SOURCE_HSE'?
       hRTC_Handle.Init.OutPut = RTC_OUTPUTSOURCE_NONE;
                                 ^~~~~~~~~~~~~~~~~~~~~
                                 RTC_CLOCK_SOURCE_HSE
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:142:33: note: each undeclared identifier is reported only once for each function it appears in
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:143:7: warning: implicit declaration of function 'HAL_RTC_Init'; did you mean 'HAL_ADC_Init'? [-Wimplicit-function-declaration]
       HAL_RTC_Init(&hRTC_Handle);
       ^~~~~~~~~~~~
       HAL_ADC_Init
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:146:7: warning: implicit declaration of function '__HAL_RTC_WRITEPROTECTION_DISABLE'; did you mean '__HAL_RCC_AFIO_CLK_DISABLE'? [-Wimplicit-function-declaration]
       __HAL_RTC_WRITEPROTECTION_DISABLE(&hRTC_Handle);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __HAL_RCC_AFIO_CLK_DISABLE
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:149:7: warning: implicit declaration of function '__HAL_RTC_ALARM_CLEAR_FLAG'; did you mean '__HAL_FLASH_CLEAR_FLAG'? [-Wimplicit-function-declaration]
       __HAL_RTC_ALARM_CLEAR_FLAG(&hRTC_Handle, RTC_FLAG_ALRAF);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~
       __HAL_FLASH_CLEAR_FLAG
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:149:48: error: 'RTC_FLAG_ALRAF' undeclared (first use in this function); did you mean 'RCC_FLAG_PLLRDY'?
       __HAL_RTC_ALARM_CLEAR_FLAG(&hRTC_Handle, RTC_FLAG_ALRAF);
                                                ^~~~~~~~~~~~~~
                                                RCC_FLAG_PLLRDY
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:153:14: warning: implicit declaration of function '__HAL_RTC_ALARM_GET_FLAG'; did you mean '__HAL_RCC_GET_FLAG'? [-Wimplicit-function-declaration]
       while (__HAL_RTC_ALARM_GET_FLAG(&hRTC_Handle, RTC_FLAG_ALRAF) != RESET)
              ^~~~~~~~~~~~~~~~~~~~~~~~
              __HAL_RCC_GET_FLAG
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:162:18: error: request for member 'Instance' in something not a structure or union
       hRTC_Handle.Instance->ALRH = 0x00U;
                  ^
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:164:18: error: request for member 'Instance' in something not a structure or union
       hRTC_Handle.Instance->ALRL = 0x09U;
                  ^
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:167:7: warning: implicit declaration of function '__HAL_RTC_ALARM_EXTI_ENABLE_IT'; did you mean '__HAL_PWR_PVD_EXTI_ENABLE_IT'? [-Wimplicit-function-declaration]
       __HAL_RTC_ALARM_EXTI_ENABLE_IT();
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __HAL_PWR_PVD_EXTI_ENABLE_IT
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:168:7: warning: implicit declaration of function '__HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE'; did you mean '__HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE'? [-Wimplicit-function-declaration]
       __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE();
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE
In file included from C:/Users/mkeijzers/OneDrive/Mestra/Galaxy Ceiling Light/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h:46:0,
                 from C:/Users/mkeijzers/OneDrive/Mestra/Galaxy Ceiling Light/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h:45,
                 from C:/Users/mkeijzers/OneDrive/Mestra/Galaxy Ceiling Light/Core/Inc/stm32f1xx_hal_conf.h:219,
                 from C:/Users/mkeijzers/OneDrive/Mestra/Galaxy Ceiling Light/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h:46,
                 from ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:63:
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:171:28: error: request for member 'Instance' in something not a structure or union
       CLEAR_BIT(hRTC_Handle.Instance->CRL, (RTC_FLAG_SEC | RTC_FLAG_OW));
                            ^
C:/Users/mkeijzers/OneDrive/Mestra/Galaxy Ceiling Light/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h:198:33: note: in definition of macro 'CLEAR_BIT'
 #define CLEAR_BIT(REG, BIT)   ((REG) &= ~(BIT))
                                 ^~~
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:171:45: error: 'RTC_FLAG_SEC' undeclared (first use in this function); did you mean 'ADC_FLAG_JEOC'?
       CLEAR_BIT(hRTC_Handle.Instance->CRL, (RTC_FLAG_SEC | RTC_FLAG_OW));
                                             ^
C:/Users/mkeijzers/OneDrive/Mestra/Galaxy Ceiling Light/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h:198:43: note: in definition of macro 'CLEAR_BIT'
 #define CLEAR_BIT(REG, BIT)   ((REG) &= ~(BIT))
                                           ^~~
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:171:60: error: 'RTC_FLAG_OW' undeclared (first use in this function); did you mean 'RTC_FLAG_SEC'?
       CLEAR_BIT(hRTC_Handle.Instance->CRL, (RTC_FLAG_SEC | RTC_FLAG_OW));
                                                            ^
C:/Users/mkeijzers/OneDrive/Mestra/Galaxy Ceiling Light/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h:198:43: note: in definition of macro 'CLEAR_BIT'
 #define CLEAR_BIT(REG, BIT)   ((REG) &= ~(BIT))
                                           ^~~
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:174:18: error: request for member 'Instance' in something not a structure or union
       hRTC_Handle.Instance->CNTH = 0x00U;
                  ^
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:176:18: error: request for member 'Instance' in something not a structure or union
       hRTC_Handle.Instance->CNTL = 0x00U;
                  ^
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:179:7: warning: implicit declaration of function '__HAL_RTC_ALARM_ENABLE_IT'; did you mean '__HAL_UART_ENABLE_IT'? [-Wimplicit-function-declaration]
       __HAL_RTC_ALARM_ENABLE_IT(&hRTC_Handle, RTC_IT_ALRA);
       ^~~~~~~~~~~~~~~~~~~~~~~~~
       __HAL_UART_ENABLE_IT
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:179:47: error: 'RTC_IT_ALRA' undeclared (first use in this function); did you mean 'RTC_CRL_ALRF'?
       __HAL_RTC_ALARM_ENABLE_IT(&hRTC_Handle, RTC_IT_ALRA);
                                               ^~~~~~~~~~~
                                               RTC_CRL_ALRF
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:182:7: warning: implicit declaration of function '__HAL_RTC_WRITEPROTECTION_ENABLE'; did you mean '__HAL_RCC_GPIOC_CLK_ENABLE'? [-Wimplicit-function-declaration]
       __HAL_RTC_WRITEPROTECTION_ENABLE(&hRTC_Handle);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __HAL_RCC_GPIOC_CLK_ENABLE
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:186:26: error: request for member 'Instance' in something not a structure or union
       while ((hRTC_Handle.Instance->CRL & RTC_CRL_RTOFF) == (uint32_t)RESET)
                          ^
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c: In function 'HAL_SuspendTick':
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:211:3: warning: implicit declaration of function '__HAL_RTC_ALARM_DISABLE_IT'; did you mean '__HAL_TIM_DISABLE_IT'? [-Wimplicit-function-declaration]
   __HAL_RTC_ALARM_DISABLE_IT(&hRTC_Handle, RTC_IT_ALRA);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~
   __HAL_TIM_DISABLE_IT
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:211:44: error: 'RTC_IT_ALRA' undeclared (first use in this function); did you mean 'RTC_CRL_ALRF'?
   __HAL_RTC_ALARM_DISABLE_IT(&hRTC_Handle, RTC_IT_ALRA);
                                            ^~~~~~~~~~~
                                            RTC_CRL_ALRF
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c: In function 'HAL_ResumeTick':
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:228:14: error: request for member 'Instance' in something not a structure or union
   hRTC_Handle.Instance->CNTH = 0x00U;
              ^
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:230:14: error: request for member 'Instance' in something not a structure or union
   hRTC_Handle.Instance->CNTL = 0x00U;
              ^
In file included from C:/Users/mkeijzers/OneDrive/Mestra/Galaxy Ceiling Light/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h:46:0,
                 from C:/Users/mkeijzers/OneDrive/Mestra/Galaxy Ceiling Light/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc.h:45,
                 from C:/Users/mkeijzers/OneDrive/Mestra/Galaxy Ceiling Light/Core/Inc/stm32f1xx_hal_conf.h:219,
                 from C:/Users/mkeijzers/OneDrive/Mestra/Galaxy Ceiling Light/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h:46,
                 from ../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:63:
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:233:24: error: request for member 'Instance' in something not a structure or union
   CLEAR_BIT(hRTC_Handle.Instance->CRL, (RTC_FLAG_SEC | RTC_FLAG_OW | RTC_FLAG_ALRAF));
                        ^
C:/Users/mkeijzers/OneDrive/Mestra/Galaxy Ceiling Light/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h:198:33: note: in definition of macro 'CLEAR_BIT'
 #define CLEAR_BIT(REG, BIT)   ((REG) &= ~(BIT))
                                 ^~~
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:233:41: error: 'RTC_FLAG_SEC' undeclared (first use in this function); did you mean 'ADC_FLAG_JEOC'?
   CLEAR_BIT(hRTC_Handle.Instance->CRL, (RTC_FLAG_SEC | RTC_FLAG_OW | RTC_FLAG_ALRAF));
                                         ^
C:/Users/mkeijzers/OneDrive/Mestra/Galaxy Ceiling Light/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h:198:43: note: in definition of macro 'CLEAR_BIT'
 #define CLEAR_BIT(REG, BIT)   ((REG) &= ~(BIT))
                                           ^~~
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:233:56: error: 'RTC_FLAG_OW' undeclared (first use in this function); did you mean 'RTC_FLAG_SEC'?
   CLEAR_BIT(hRTC_Handle.Instance->CRL, (RTC_FLAG_SEC | RTC_FLAG_OW | RTC_FLAG_ALRAF));
                                                        ^
C:/Users/mkeijzers/OneDrive/Mestra/Galaxy Ceiling Light/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h:198:43: note: in definition of macro 'CLEAR_BIT'
 #define CLEAR_BIT(REG, BIT)   ((REG) &= ~(BIT))
                                           ^~~
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:233:70: error: 'RTC_FLAG_ALRAF' undeclared (first use in this function); did you mean 'RTC_FLAG_OW'?
   CLEAR_BIT(hRTC_Handle.Instance->CRL, (RTC_FLAG_SEC | RTC_FLAG_OW | RTC_FLAG_ALRAF));
                                                                      ^
C:/Users/mkeijzers/OneDrive/Mestra/Galaxy Ceiling Light/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h:198:43: note: in definition of macro 'CLEAR_BIT'
 #define CLEAR_BIT(REG, BIT)   ((REG) &= ~(BIT))
                                           ^~~
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:236:43: error: 'RTC_IT_ALRA' undeclared (first use in this function); did you mean 'RTC_CRL_ALRF'?
   __HAL_RTC_ALARM_ENABLE_IT(&hRTC_Handle, RTC_IT_ALRA);
                                           ^~~~~~~~~~~
                                           RTC_CRL_ALRF
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:242:22: error: request for member 'Instance' in something not a structure or union
   while ((hRTC_Handle.Instance->CRL & RTC_CRL_RTOFF) == (uint32_t)RESET)
                      ^
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c: At top level:
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:259:34: error: unknown type name 'RTC_HandleTypeDef'; did you mean 'ADC_HandleTypeDef'?
 void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc)
                                  ^~~~~~~~~~~~~~~~~
                                  ADC_HandleTypeDef
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c: In function 'RTC_Alarm_IRQHandler':
../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.c:294:3: warning: implicit declaration of function 'HAL_RTC_AlarmIRQHandler'; did you mean 'RTC_Alarm_IRQHandler'? [-Wimplicit-function-declaration]
   HAL_RTC_AlarmIRQHandler(&hRTC_Handle);
   ^~~~~~~~~~~~~~~~~~~~~~~
   RTC_Alarm_IRQHandler
Drivers/STM32F1xx_HAL_Driver/Src/subdir.mk:198: recipe for target 'Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.o' failed
make: *** [Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_timebase_rtc_alarm_template.o] Error 1

22:43:32 Build Finished (took 20s.155ms)
\$\endgroup\$
3
  • 1
    \$\begingroup\$ Looks like additional header files are required \$\endgroup\$
    – uglyoldbob
    Jan 29, 2019 at 21:53
  • \$\begingroup\$ RTC_HandleTypeDef should be defined in your ../Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rtc.h header file, and this file should be #includeed at the top of your .c file. \$\endgroup\$
    – brhans
    Jan 29, 2019 at 22:39
  • \$\begingroup\$ But are you certain that you're supposed to be compiling the xxxx_template.c files? Didn't STM32CubeMX create some "real" .c files for your project? \$\endgroup\$
    – brhans
    Jan 29, 2019 at 22:40

1 Answer 1

1
\$\begingroup\$

I found a solution:

In the following screen, make sure the Application Structure is set to Basic, not to Advanced. In my case initially this drop down box was disabled (and set to Advanced). I could change it by resaving the project under a different name and change it to Basic.

enter image description here

Also, in the following screen, set the Project to either 'Copy on the necessary library files' or 'Add necessary library files as reference in the toolchain project configuration.

Initially the setting was to the disabled first option: Copy all used libraries into the project folder.

enter image description here

\$\endgroup\$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.