How do I redefine F_CPU

Hi, Platform IO for my board has defined F_CPU=180000000L
I want to change this to 160000000L but when I use build_flags = -DF_CPU=160000000L then both values are put into defines in c_cpp_properties.json instead of one being replaced with the other.

I tried doing build_unlfags = -DF_CPU=180000000L
and then build_flags = -DF_CPU=160000000L but that removes both of the definitions.

How do I get only one definition?
Thank you.

1 Like

Since you want to override the board default f_cpu, you want the board_build.f_cpu parameter.

i.e. In your platformio.ini:
board_build.f_cpu =160000000L

1 Like

Thank you! This is as simple as I hoped it would be. I spent an hour reading through the platformio.ini section documentation but I just couldn’t find anything like this; and this is exactly what I need.

1 Like

Know how you feel… sometimes you really curse extensive documentation… seems that detailed you can’t find that one thing you’re after! :laughing: :wink: