Change external clock value w/o editing boards.txt

How to change the external clock value w/o editing boards.txt?

I have Arduino boards and regularly I need to test the same program under different clock values. As expected, I have a socket for the crystal.

My current solution is to edit the boards.txt file and edit the value of the clock for my platform. I am wondering if I can do the same at compilation time.

Thanks.

At the moment, editing boards.txt is the only way to do this.

You can define "new" board types in your boards.txt for the same hardware running at different clock rates. That way you'd have one edit to create "Uno8M", "Uno1M", etc, and all you would have to do is select the right board in the ide, rather than exit/edit/restart...

Thanks for the comments.

I made the following modification at the boards.txt file and now I can SUCCESSFULLY compile with both modes without exiting the Arduino IDE:

atmega328.name=Arduino Duemilanove or Nano w/ ATmega328 atmega328.upload.protocol=stk500 atmega328.upload.maximum_size=30720 atmega328.upload.speed=57600 atmega328.bootloader.low_fuses=0xFF atmega328.bootloader.high_fuses=0xDA atmega328.bootloader.extended_fuses=0x05 atmega328.bootloader.path=atmega atmega328.bootloader.file=ATmegaBOOT_168_atmega328.hex atmega328.bootloader.unlock_bits=0x3F atmega328.bootloader.lock_bits=0x0F atmega328.build.mcu=atmega328p atmega328.build.f_cpu=16000000L atmega328.build.core=arduino

atmega328_2M.name=Arduino w/ ATmega328 @ 2MHz atmega328_2M.upload.protocol=stk500 atmega328_2M.upload.maximum_size=30720 atmega328_2M.upload.speed=57600 atmega328_2M.bootloader.low_fuses=0xFF atmega328_2M.bootloader.high_fuses=0xDA atmega328_2M.bootloader.extended_fuses=0x05 atmega328_2M.bootloader.path=atmega atmega328_2M.bootloader.file=ATmegaBOOT_168_atmega328.hex atmega328_2M.bootloader.unlock_bits=0x3F atmega328_2M.bootloader.lock_bits=0x0F atmega328_2M.build.mcu=atmega328p atmega328_2M.build.f_cpu=2000000L atmega328_2M.build.core=arduino