Using Arduino project migrated to breadboard with 12 MHz crystal instead of 16 MHz
Some of the code running on the microcontroller needs to know the clock speed it's running at for correct timing. For this reason the macro F_CPU is set with this value. In the Arduino IDE this value is commonly defined in the boards.txt build.f_cpu property. If you're using a bootloader(which is used for uploading sketches over serial) it also needs to know the clock speed so that it can get the baud rate of the upload correct. The bootloader is not compiled in the Arduino IDE so it is not affected by your setting in boards.txt. You can recompile the bootloader with the correct clock speed setting and then install the compiled file on your microcontroller using an ISP.

There is a much more simple solution. All the hard work has already been done for you in MiniCore:
https://github.com/MCUdude/MiniCore

You only need to:


Install MiniCore following the instructions at https://github.com/MCUdude/MiniCore
Tools > Board > ATmega328
Tools > Variant > 328P / 328PA
Tools > Clock > 12 MHz external
Tools > Burn Bootloader