cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 Code generation terminology

PVaaz.1
Associate III

Hello ,

I am a student and want to understand the basic terminologies of the files being generated from the STM32CubeMX. Any document/Video to it will also be helpful.

When I generate the code say for Nucleo-F401RE from the STM32CubeMX , I get these files in the project :

stm32f4xx_hal.msp.c , stm32f4xx_hal_conf.h in the src and inc respectively.

But if I see any CUBE MX project we have files like :

stm32f4xx_nucleo.c , stm32f4xx_nucleo_bus.c and corresponding header file as well

apart from what we get in the STM32Cube code generation like hal_msp and conf header.

Why cant we have these two files also get generated.

I see that we have BSP_inits defined in the bus.c and then from that we call MX_<method> for any given peripheral ( i2c,uart) and this MX is what is generated inside the hal_msp.c.

why to have files like nucleo and nucleo_bus when we can do with the hal_msp.c files?

Thanks for reading this !!

Regards,

Ped

3 REPLIES 3
Paul1
Lead

Only generate the files that depend on settings in MX.

Much of the code is stable, proven, and independent of MX settings, so it can be in fixed files that are just added to the project. No need to generate it again and chance adding bugs.

Paul

PVaaz.1
Associate III

i agree but looking for the design thinking behind this.

Paul1
Lead

Educated Guess: Limited Resources.

  • Change what must be changed
  • Don't change what doesn't need to be changed.

Also:

  • Grow from previous = Pre-STM32CubeMX = Import as much of the previous as possible (LL, etc.)

Paul