Sunteți pe pagina 1din 8

Programming the Arduino with AVRdude from AVR Studio

This tutorial will allow you to program your Arduino with AVRdude from within the AVR Studio
IDE. This is part 2 of the AVR Studio integration project.

At this point you should have already completed the the AVR Studio Arduino core code tutorial
and if not you can still use this, however, the path configuration will not be the same.

Step1: Our program has been written and simulated. Now it needs to be verified on hardware.
The program will toggle a LED every second.

NOTE: MAKE SURE THE PROJECT OPTION FOR OPTIMIZATION IS CHANGED TO -


O2 OR -Os AND RE_BUILD, OTHERWISE, THE DELAY FUNCTIONS WILL NOT WORK
PROPERLY.
Step2: Create a batch file with 2 parameters and a user choice to select the target, UNO or
Duemilanove.
1. Parameter 1 is the COM port number (%1) - could be hard coded but changes are more
cumbersome.
2. Parameter 2 is the binary file path (%2)
3. Save this file in the directory one folder closer to the root than the project folder created
in the last tutorial. The folder created in the last tutorial is circled in red
4. Save the file as upload.bat
Step3a: Create an entry into the tools menu
1. Click on the tools menu and select customize
Step3b: Click the tools tab.
1. Create a new entry (if this is the first time yours will be blank) and name it appropriately.
Upload via AVRDude (project_name)
2. In the command line we need to find the batch file that invokes AVRDude from Step2.
3. The arguments are going to be the port number that your computer registers the Arduino
as (use the windows tool Device Manager to figure this out if you don't already know
it). The second parameter is the path to the hex file created by any project. This path
begins at the Initial Directory mentioned below. There is 1 space between the port
number and the partial file path.
4. The initial directory is the directory one folder closer to the root than the project folder.
This is where the *.bat file should have been saved.
Every project will need an entry since I cant find a way to access IDE variables related to
current project settings.

Step4: Invoke AVRDude and program your device


1. Click Tools and select Upload via AVRDude (test_arudino_project)
If everything was done correctly you should see this.
Step3a and Step3b need to be done for every project that is created using AVR Studio.

An example of this can be found here.

S-ar putea să vă placă și