Skip to main content
Visitor II
November 20, 2020
Question

STM32Cube_FW_G0_V1.4.0 bug ?

  • November 20, 2020
  • 5 replies
  • 4708 views

Hello,

I work with STM32G070RBT. I upgrade FW to STM32Cube_FW_G0_V1.4.0.

These definitions have disappeared from the file stm32g070xx.h:

#define RCC_CFGR_SWS_HSI              (0UL)                                  /*!< HSI used as system clock */

#define RCC_CFGR_SWS_HSE              (0x00000008UL)                         /*!< HSE used as system clock */

#define RCC_CFGR_SWS_PLL              (0x00000010UL)                         /*!< PLL used as system clock */

#define RCC_CFGR_SWS_LSI              (0x00000018UL)                         /*!< LSI used as system clock */

#define RCC_CFGR_SWS_LSE              (0x00000020UL)                         /*!< LSE used as system clock */

My project cannot bild at this time.

Peter

    This topic has been closed for replies.

    5 replies

    Technical Moderator
    November 20, 2020

    Hello @Peko​ ,

    Could you please provide more details on your case: Have you an Error message?

    Are you using STM32CubeMx to generate your project ? If it is the case, please share your ioc file.

    Imen

    PekoAuthor
    Visitor II
    November 20, 2020
    Hello,
    The problem has occurred at migrate project (created with STM32Cube_FW_G0_V1.3.0) to STM32Cube_FW_G0_V1.4.0 in STM32Cube IDE V1.5.
    All necessary files have been upgraded, only file system_stm32g0xx.c in my project remained unchanged.
    In this file is function void SystemCoreClockUpdate(void)
    {
    case RCC_CFGR_SWS_HSE: /* HSE used as system clock */ !!!! this definitions are missing in new stm32g070xx.h
    SystemCoreClock = HSE_VALUE;
    break;
    case RCC_CFGR_SWS_LSI: /* LSI used as system clock */ !!!! this definitions are missing in new stm32g070xx.h
    SystemCoreClock = LSI_VALUE;
    break;
    case RCC_CFGR_SWS_LSE: /* LSE used as system clock */ !!!! this definitions are missing in new stm32g070xx.h
    SystemCoreClock = LSE_VALUE;
    break;
    case RCC_CFGR_SWS_PLL: /* PLL used as system clock */ !!!! this definitions are missing in new stm32g070xx.h
    }
    !!! The „migrate program“ should overwrite the function void SystemCoreClockUpdate(void) !!!
    switch (RCC->CFGR & RCC_CFGR_SWS)
    {
    case RCC_CFGR_SWS_0: /* HSE used as system clock */
    SystemCoreClock = HSE_VALUE;
    break;
    case (RCC_CFGR_SWS_1 | RCC_CFGR_SWS_0): /* LSI used as system clock */
    SystemCoreClock = LSI_VALUE;
    break;
    case RCC_CFGR_SWS_2: /* LSE used as system clock */
    SystemCoreClock = LSE_VALUE;
    break;
    case RCC_CFGR_SWS_1: /* PLL used as system clock */
    }
    I rewrote the stm32g0xx.c file in my project with the new file stm32g0xx.c from Repository STM32Cube_FW_G0_V1.4.0 and now everything is fine.
    Best Regards
    Peter
    November 27, 2020

    Thank you, I used the same solution.

    The naming convention of the defines seems to be less descriptive in the new version 1.4.0, compared to 1.3.0

    David

    Technical Moderator
    November 25, 2020

    Hi @Peko​ ,

    Thank you for bringing this to our attention.

    I have passed your feedback along to our CubeMX team for fix.

    Imen

    Visitor II
    December 4, 2020

    Hello,

    Deleting the system_stm32g0xx.c file and regenerating code will generate the correct file. This seems to be a quick solution for now.

    Steven

    Visitor II
    December 21, 2020

    Yeah Steven, this worked! No more compilation errors. Hope will not find other issues in version 1.4

    Visitor II
    January 22, 2021

    Just to add to follow up. This work around did not worked completely, the code compiles, but it does not work on the target.

    Had to roll back to the previous FW version to continue development.

    Visitor II
    December 25, 2020

    After migrating I also now get a load of this warnings besides the error above:

    <command-line>:0:0: warning: "HSE_STARTUP_TIMEOUT" redefined
    <command-line>:0:0: warning: "HSE_STARTUP_TIMEOUT" redefined
    <command-line>:0:0: note: this is the location of the previous definition
    <command-line>:0:0: note: this is the location of the previous definition
    <command-line>:0:0: warning: "HSE_STARTUP_TIMEOUT" redefined
    <command-line>:0:0: note: this is the location of the previous definition
    <command-line>:0:0: warning: "HSE_STARTUP_TIMEOUT" redefined
    <command-line>:0:0: note: this is the location of the previous definition
    <command-line>:0:0: warning: "HSE_STARTUP_TIMEOUT" redefined
    <command-line>:0:0: note: this is the location of the previous definition
    <command-line>:0:0: warning: "HSE_STARTUP_TIMEOUT" redefined
    <command-line>:0:0: note: this is the location of the previous definition
    <command-line>:0:0: warning: "HSE_STARTUP_TIMEOUT" redefined
    <command-line>:0:0: note: this is the location of the previous definition
    arm-none-eabi-gcc "../Core/Src/stm32g0xx_it.c" -mcpu=cortex-m0plus -std=gnu11 -g3 -DSTM32G071xx '-DHSE_VALUE=16000000' '-DLSI_VALUE=32000' '-DHSI_VALUE=16000000' '-DHSE_STARTUP_TIMEOUT=5' -DDEBUG '-DLSE_STARTUP_TIMEOUT=5000' '-DLSE_VALUE=32768' '-DHSE_STARTUP_TIMEOUT=5000' '-DDATA_CACHE_ENABLE=1' '-DVDD_VALUE=3300' '-DINSTRUCTION_CACHE_ENABLE=1' '-DEXTERNAL_CLOCK_VALUE=48000' -DUSE_FULL_LL_DRIVER '-DPREFETCH_ENABLE=0' -c -I../Core/Inc -I../Drivers/STM32G0xx_HAL_Driver/Inc -I../Drivers/CMSIS/Device/ST/STM32G0xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/stm32g0xx_it.d" -MT"Core/Src/stm32g0xx_it.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Core/Src/stm32g0xx_it.o"
    <command-line>:0:0: warning: "HSE_STARTUP_TIMEOUT" redefined
    <command-line>:0:0: note: this is the location of the previous definition
    arm-none-eabi-gcc "../Core/Src/syscalls.c" -mcpu=cortex-m0plus -std=gnu11 -g3 -DSTM32G071xx '-DHSE_VALUE=16000000' '-DLSI_VALUE=32000' '-DHSI_VALUE=16000000' '-DHSE_STARTUP_TIMEOUT=5' -DDEBUG '-DLSE_STARTUP_TIMEOUT=5000' '-DLSE_VALUE=32768' '-DHSE_STARTUP_TIMEOUT=5000' '-DDATA_CACHE_ENABLE=1' '-DVDD_VALUE=3300' '-DINSTRUCTION_CACHE_ENABLE=1' '-DEXTERNAL_CLOCK_VALUE=48000' -DUSE_FULL_LL_DRIVER '-DPREFETCH_ENABLE=0' -c -I../Core/Inc -I../Drivers/STM32G0xx_HAL_Driver/Inc -I../Drivers/CMSIS/Device/ST/STM32G0xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/syscalls.d" -MT"Core/Src/syscalls.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Core/Src/syscalls.o"
    arm-none-eabi-gcc "../Core/Src/sysmem.c" -mcpu=cortex-m0plus -std=gnu11 -g3 -DSTM32G071xx '-DHSE_VALUE=16000000' '-DLSI_VALUE=32000' '-DHSI_VALUE=16000000' '-DHSE_STARTUP_TIMEOUT=5' -DDEBUG '-DLSE_STARTUP_TIMEOUT=5000' '-DLSE_VALUE=32768' '-DHSE_STARTUP_TIMEOUT=5000' '-DDATA_CACHE_ENABLE=1' '-DVDD_VALUE=3300' '-DINSTRUCTION_CACHE_ENABLE=1' '-DEXTERNAL_CLOCK_VALUE=48000' -DUSE_FULL_LL_DRIVER '-DPREFETCH_ENABLE=0' -c -I../Core/Inc -I../Drivers/STM32G0xx_HAL_Driver/Inc -I../Drivers/CMSIS/Device/ST/STM32G0xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/sysmem.d" -MT"Core/Src/sysmem.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Core/Src/sysmem.o"
    <command-line>:0:0: warning: "HSE_STARTUP_TIMEOUT" redefined
    <command-line>:0:0: note: this is the location of the previous definition
    <command-line>:0:0: warning: "HSE_STARTUP_TIMEOUT" redefined
    <command-line>:0:0: note: this is the location of the previous definition
    arm-none-eabi-gcc "../Core/Src/system_stm32g0xx.c" -mcpu=cortex-m0plus -std=gnu11 -g3 -DSTM32G071xx '-DHSE_VALUE=16000000' '-DLSI_VALUE=32000' '-DHSI_VALUE=16000000' '-DHSE_STARTUP_TIMEOUT=5' -DDEBUG '-DLSE_STARTUP_TIMEOUT=5000' '-DLSE_VALUE=32768' '-DHSE_STARTUP_TIMEOUT=5000' '-DDATA_CACHE_ENABLE=1' '-DVDD_VALUE=3300' '-DINSTRUCTION_CACHE_ENABLE=1' '-DEXTERNAL_CLOCK_VALUE=48000' -DUSE_FULL_LL_DRIVER '-DPREFETCH_ENABLE=0' -c -I../Core/Inc -I../Drivers/STM32G0xx_HAL_Driver/Inc -I../Drivers/CMSIS/Device/ST/STM32G0xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/system_stm32g0xx.d" -MT"Core/Src/system_stm32g0xx.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Core/Src/system_stm32g0xx.o"
    <command-line>:0:0: warning: "HSE_STARTUP_TIMEOUT" redefined
    <command-line>:0:0: note: this is the location of the previous definition>

    Visitor II
    July 17, 2023

    I encountered the same error when switching from stm32g0-hal-1-3-0 to stm32g0-hal-1-4-0. I looked for the definitions that were missing and generating compilation errors in stm32g0-hal-1-4-0 in the old stm32g0-hal-1-3-0 version. I found that in the file stm32g070xx.h from stm32g0-hal-1-4-0 the following definitions are missing:

     

    #define RCC_CFGR_SWS_HSI (0UL) /*!< HSI used as system clock */
    #define RCC_CFGR_SWS_HSE (0x00000008UL) /*!< HSE used as system clock */
    #define RCC_CFGR_SWS_PLL (0x00000010UL) /*!< PLL used as system clock */
    #define RCC_CFGR_SWS_LSI (0x00000018UL) /*!< LSI used as system clock */
    #define RCC_CFGR_SWS_LSE (0x00000020UL) /*!< LSE used as system clock */

     

    I copied the definitions from the stm32g070xx.h file from the STM32Cube_FW_G0_V1.3.0 firmware version into the stm32g070xx.h file from the STM32Cube_FW_G0_V1.4.0 firmware version and I managed to compile the project without errors.eroare fw_g0_v140.bmp