I am using a custom made AVR board with Atmege-328p on it and it doesn't have a 16MHz crystal on it. I would like to use the internal 8MHz as clock. I have set the appropriate Fuses but now I am unable to tell the programs that F_CPU is 8000000UL. One way of doing it is to add another variant to the boards. I would like to if there is another way to set F_CPU ?
No, the boards.txt file is where it is defined and the only place it is (or can be) defined. Making a new board variant is the proper way of adding a new board with new settings.
-
Maybe there is already a board in "boards.txt" that is compatible with your board. The bootloader doesn't know if the 8MHz is from a crystal or from the internal oscillator, that means you can even use a bootloader for a 8MHz crystal, and you only have to change the fuse for the internal oscillator. During programming (for example burn the bootloader) with a programmer the ATmega328p requires a clock. Therefor you have to be careful not to set the external crystal (when there is no crystal), because then the programmer doesn't work. – Jot Jun 13 '17 at 13:17