I’ve got no experience whatsoever with Leonardo boards, but, the board_build.f_cpu doesn’t change the physical clock speed of the board, it’s there for when you have changed the hardware to a non-default CPU frequency as the F_CPU value is passed into the code to make sure that things “flash” at the correct speed.
It’s the same with my ATtiny85 boards. The default is an 8 MHz internal clock, with a divide by 8 fuse set, so it’s running actually at 1 MHz. If I set the board build f_cpu to anything different, the timings don’t work correctly.
You need to either default the frequency, leave it out of the ini file, or set it to the actual CPU clock frequency that the board is running. Then things should be fine.
I tested the blink sketch on my Uno.
The default clock is 16 MHz and a 1 second delay is roughly that and the scope says period = 1.98 S and frequency = 0.505 Hz which is as expected as there are two delays per flash! (That always catches me out!)
In the ini file, I then added board_build.f_cpu = 1000000L which is 16 times slower than the actual clock. Uploading blink gives me a 8 Hz flash frequency with a period of 125 mS.
The actual delay is 62.5 mS, which is exactly 1000/16.
Now I’m confused. The board has a 16 MHz crystal on it, so your F_CPU should be the default, 16 MHz surely? Unless you are telling your code to check if the build has assumed an 8 MHz clock speed, and you set the clock prescaler to suit? Are you using board_build.f_cpu to tell the code to change the prescaler? Interesting.
According to what you wrote earlier, board_build.f_cpu = 8000000L will set F_CPU == 8000000 and all timing dependent modules will be scaled accordingly when built from source. The crystal produces 16MHz clock, but clock_prescale_set(clock_div_2) divides it by 2 and everything works fine with CPU clocked at 8MHz now.