Supporting multiple clock frequencies with board config files

Our XLR8 and Snō boards can both support 16MHz or 32MHz operation depending on the image that is loaded into the on-board FPGA. By default, they run at 16MHz and work with the default cpu frequency define in the board file:

“f_cpu”: “16000000L”,

I suspect I can manually override this with the following addition to the platformio.ini file?

build_flags = -DF_CPU=32000000L

Is this the best way to do it?

Is there a way to add some kind of conditional select to the board config file, or would it make more sense to provide two options for each board - 16 and 32?

Thanks!
Jason

You can overwrite any options from board manifest using build environment in platformio.ini. See Redirecting...