Clock, PLL, divider, multiplier overide in the project files with arduino framework

There was a reason to change the cpu clock frequency (not the standard 8 or 16 MHz but 10MHz for example)
To get it running, i might edit the variants files (e.g. variant_BLACK_F407VX.cpp)

RCC_OscInitStruct.PLL.PLLM = 4; // 4 = 8MHz, 8 = 16MHz 5=10MHz etc

RCC_OscInitStruct.PLL.PLLN = 168;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 7;

RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;

Is it possible to override these settings in a project file (maybe platformio.ini) ?

Thanks in advance
Ulrich

Assuming you’re using the STM32 platform and the STM32Duino arduino core (and not maple) in the platformio.ini you can change the used variant and variant folder. The clock init happens in the variant.cpp inside the variant folder of the selected variant. See GitHub - maxgerhardt/pio-custom-stm32duino-variants: A short example of how to use a custom variant folder for the PlatformIO + STM32Duino environment for an example on that and Add documentation for board_build.variants_dir option · Issue #462 · platformio/platform-ststm32 · GitHub.

Thank you, that is what i am looking for.

Ulrich