
Want to know how to flash Arduino from AVR Studio 4? Read on.
It so happened that I have been drawing circuits for several years and programming microcontrollers for AVR. Development with the use of any kind of programmable microcircuits is faced with the fact that the firmware needs to start writing before the final piece of hardware is ready so as not to delay testing the device and access to the working sample. For this reason, while the idea of ​​the circuit is being worked out, the production of printed circuit boards, the assembly of elements and the like, individual one or two people stand out who throw a small layout on which you can check the final code fragments before debugging on the live hardware.
For the past six months, I started using the Arduino board and the layouts that I put on all sides for such pre-debugging. I did not even get used to the native Arduino programming environment, I use compilers from IAR, AVR-GCC and debugging in the AVR Studio 4 package.
')
For me personally, there was one inconvenience in the Arduino board: the inability to flash from AVR Studio without using the command line or a separate programmer. AVR Studio can only work with Atmel programmers, but if you force the Arduino to “pretend” for a computer with a proprietary programmer, the problem would be solved. This can be done with the help of a bootloader - a special program in a dedicated area of ​​flash memory that can read, erase and modify the contents of flash memory.
A search on the Internet for a ready bootloader for Arduino gave only that there are enough people willing to get such a bootloader, but those who want to write it are not. Having estimated that the task is quite real, I took the well-known
loader Peter Fleury and at the cost of a dead weekend I remade it to work with the Arduino. Download the source
here .
Now, in order to stitch the program from AVR Studio 4 to Arduino, you need to close pin 12 to the ground and press the RESET on the handkerchief, the L indicator lights up, after which you can remove the jumper and press Connect from the studio and flash Arduino as STK500 or AVR-ISP. For those who are accustomed to the studio firmware dialogs, everything is elementary. If it is inconvenient to use output 12 - you can fix this point in the source code and rebuild it yourself.
In the bootloader there is one small bug, when connected to the studio, it incorrectly reports the version of iron and the studio throws out a warning window. If someone who has read this post can correct this problem - let me know and send corrections, I will post them on AVR Freaks.