Hello @Vergnani_ElEn
A typical STM32CubeMX project looks like:
Project/
├─ Core/
│ ├─ Inc/
│ ├─ Src/
│ ├─ Startup/
│ └─ ...
├─ Drivers/
│ ├─ CMSIS/
│ └─ STM32xxxx_HAL_Driver/
├─ Middlewares/ (if you enable USB, FATFS, FreeRTOS, etc.)
├─ .project / .cproject / .mxproject / Makefile / etc.
└─ ...
CubeMX guarantees that it will regenerate or update files under:
Core/Inc,Src
Drivers/STM32xxxx_HAL_Driver
Middlewares/...
You don’t need to keep all your code under Core; you can structure it like this:
Project/
├─ Core/ # CubeMX-owned
│ ├─ Inc/
│ └─ Src/
├─ Drivers/ # ST/CMSIS
├─ Middlewares/ # Optional (FreeRTOS, USB, etc.)
├─ App/ # Your application logic
│ ├─ Inc/
│ └─ Src/
└─ Framework/ # Your reusable firmware framework
├─ Inc/
└─ Src/
Regarding the example : Each MCU family has a Cube package where you can find STM32CubeMX examples .
To install any firmware package In STM32CubeMX :Go to:
Help → Manage embedded software packages
Install the package for your MCU family (e.g. STM32F4, STM32H7)
After installation, the packages are typically stored in a path similar to:
C:\Users\<user>\STM32Cube\Repository\STM32Cube_FW_F4_Vx.x.x\
Inside this folder you will find example projects under Projects, for example:
Projects/STM32F4-Discovery/Examples/
Projects/NUCLEO-F401RE/Applications/
These contain ready-to-build projects that follow the same structure generated by STM32CubeMX.