How you program the MCU is tied to the programmer you're using. For example, because Atmel Studio doesn't natively support the USB Tiny, the process is different.
If you happen to be programming AVR microcontrollers with the USB Tiny, there's a video explaining how to set up External Tools in Atmel Studio, making use of avrdude.
Here's the summary of how to set it up:
- Go to the Tools menu and select External Tools...
- Give the default
[New Tool 1]
a Title, for example, USBTinyISP
- The Command is
avrdude.com
- Arguments are the parameters passed to avrdude. Here you can insert placeholders for project filenames. The example in the video is:
-c usbtiny -p m324p -U flash:w:$(ProjectDir)Release\$(ItemFileName).hex:i
Change m324p
to the appropriate MCU. (You might want to make multiple External Tools if you work with multiple types, otherwise you need to change this as you change MCU's.)
$(ProjectDir)
and $(ItemFileName)
are variables which you can insert by clicking the arrow just after the arguments field.
Finally, be sure to include :i
at the end of the string, this indicates Intel Hex format.
- Leave Initial Directory blank (ref).
- Check Use Output window
When you've selected Release in Atmel Studio, building the project will build files in the bin\Release
subfolder in your project directory. (You can create a separate external tool for Debug if desired; the video shows this as well.) Selecting the External Tool will then use the output files per avrdude command line and write to the MCU.
If you want, right-click a menu bar and select Customize if you'd like to add a button for the External Tool, rather than selecting it from the Tools menu each time.
With this process, you can build the project (F7) then write to the microcontroller with a button click.