Changing clock settings in Arduino for STM32

The function that implements setting up the clock is always marked as weak in the variant, so that user / firmware code can overwrite it.

So in the src/main.cpp one can do

extern "C" void SystemClock_Config(void)
{
  // clock init code here... 
}

With the function’s content either being auto-generated by STM32CubeMX or copied and adapted from an existing variant.

This was also previously discussed in e.g. STM32F407VET6 external oscillator configuration