Easily Use printf on STM32

The SystemInit() function is defined in system_stm32l4xx.c. As I noted in Setting Up an Empty STM32CubeIDE Project :

Because the STM32L476 does include an FPU, I did include the file.

SystemCoreClockUpdate() simply updates the SystemCoreClock variable (also defined in system_stm32l4xx.c). For this example it’s not necessary, so I’ll edit my previous post to remove it.

I just used the default system clock configuration for this code.

Here’s a screenshot of my project explorer (click on it to view the entire image):

1 Like