Some investigations I have conducted as a learning vehicle in an attempt to understand how things work, which I thought might be of interest.
I am using VisualMicro version 1.1404.01 with Atmel Studio 6 version 6.2.1153 & Arduino 1.5.6-r2
I have been experimenting with the Attiny84 using the cores found at:
https://code.google.com/p/arduino-tiny/downloads/detail?name=arduino-tiny-0150-0... I upload my programmes using an Avrisp ISP and so don’t use a boot-loader.
I have modified the two board descriptions from the downloaded cores to suit my ISP:
attiny84at8.name=ATtiny84 @ 8 MHz
attiny84at1.name=ATtiny84 @ 1 MHz
To keep things simple I have adapted the blink programme which builds and uploads OK apart from the clock setting which does not get changed when I switch from the 8MHz to 1MHz device causing the LED to flash 8 times too fast because F_CPU is now 1000000. When I examine the CKDIV8 and other Fuse settings using “Tools-Device Programming” it is not programmed as per the above boards file.
I have examined the verbose output from a build and cant see where the fuses are set apart from at the start where what I think is preparation for a boot loader upload which I don’t use.
The only uploading to the chip I can see is at the end of the verbose output where atprogram is used to upload the project hex file. Whilst I believe atprogram (with the correct settings) is capable of setting the fuses the hex file only contains programme code.
I also checked the verbose output when a different device/clock frequency (1 or 8 MHz) was chosen in the “Micro Boards” selection to see if the fuses were set at that stage, but they weren’t.
As the boot_loader settings seemed to be set-up I thought I would try “Tools – VM - Burn Boot loader” but that produced the following:
System.Exception: Could not find tool arduino:avrdude
I can easily set the fuses using “Tools-Device Programming” but I think it would be better if done each time an upload is performed, perhaps checking to see if the fuses need changing. This way the same project could be used to programme several chips.
I am now trying to find a way of adding the correct lines to the process to programme the fuses but not sure where to look yet.