2026-01-01 4:02 AM
I'm planning on moving from STM32F103 for more speed, so in advance of getting a board I thought I would try building an app for the STM32G431... so I found an small example project online that was using an OpAmp feature.
Having got that compiled ok in STM32CubeIDE I backported my app source code into the project (which went ok), but compiling it was missing some definitions for HAL UART structures.
Looking at "Drivers/STM32G4xx_HAL_Driver" in my original project and comparing it with "Drivers/STM32G4xx_HAL_Driver" in the new project I see that its missing some files like "stm32g4xx_hal_uart.h".
Is it possible to force STM32CubeIDE to regenerate the Drivers subfolder from scratch?
I always find switching a STM32CubeIDE project between different MCUs a harder job than it should be, e.g. it would be nice if there was a combo box listing MCUs in the project properties.
2026-01-01 6:49 AM
STM32CubeMX will regenerate code if you've started your project using an IOC.
Otherwise, you'll have to copy driver files over manually. They should be located at:
C:\Users\%USERNAME%\STM32Cube\Repository\STM32Cube_FW_F0_V1.11.5\Drivers\STM32F0xx_HAL_Driver\