Atmel Studio 6 Setup

Download and Install Studio 6

This works on Windows only. It's the official tool for programming AVR chips, but if you ask me, compared to Eclipse I find it rather unintuitive and awkward. However you are welcome to try it for yourself, and it works just fine.

Download the most recent Atmel Studio 6 from the Atmel site:

It's free but it will ask you for your e-mail and verification before you can download it. Here is a less annoying direct link instead, but it might go obsolete at some point:

Setup a new project for the MarcDuino board

Go to File->New project, and select GCC C executable project.
Give it a name. I am not sure what this new business is about "Solutions" (that didn't exist in Studio 5), so I just left it as "Create new solution" and gave it the same name.

When you click OK, it prompts you for the hardware target, select ATmega328p

The project will appear in a window called "Solution Explorer". Studio 6 tries to help too much and creates some automatic code. Right click and delete the file .c file it created (called here MarcDuino_Panels.c):

Now right-Click on the project file, choose Add->Existing Item. Add the MarcDuino source files which you can download from this page:
Compiling the source code.

Define the F_CPU project variable

Your project is almost ready to compile. However, if you compiled now, it would complain about a missing F_CPU symbol. You have to define it for the project:
Go to Project properties > Toolchain > Symbols
In Configurations, select All Configurations (don't miss that step, or it will only do it for the Debug config!)
In Defined Symbol, click on the green arrow and add the following entry, defining our clock frequency at 16 MHz:

Build your project

Go to Build->Configuration Manger, select "Release"

Save the project. Now it choose Build->Build Solution
It will now compile the source code, ending with some console output like this:

Done building target "CoreBuild" in project "MarcDuino_Panels.cproj".
Target "PostBuildEvent" skipped, due to false condition; ('$(PostBuildEvent)' != '') was evaluated as ('' != '').
Target "Build" in file "C:\Program Files\Atmel\Atmel Studio 6.0\Vs\Avr.common.targets" from project "C:\Documents and Settings\Marc\My Documents\Atmel Studio\MarcDuino_Panels
\MarcDuino_Panels\MarcDuino_Panels.cproj" (entry point):
Done building target "Build" in project "MarcDuino_Panels.cproj".
Done building project "MarcDuino_Panels.cproj".
Build succeeded.
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========

Upload the code to the MarcDuino board

One of the annoyances of Studio 6 is that it only supports upload tools from Atmel, which is one of many reasons why I don't like to use it. To upload using the recommended AVR Pocket Programmer, you need to set the Fuses with AVRDude from outside Studio 6 following the method outlined here:
Uploading the Firmware

Once that's done, and assuming you have downloaded AVRDude, you can setup an ugly workaround to use the Pocket Programmer as an external tool.

Go to Tools, External Tools, Add
For command, navigate to your AVRdude.exe file (I downloaded mine as part of WinAVR, where it sits in the /bin folder)
For arguments, use
-c usbtiny -p m328p -U flash:w:Release\MarcDuino_Panels.hex:i (replace with the name of your .hex file)
For initial directory
Click Use Output Window

Once you click OK, the option USBTiny appears in the Tool menu, clicking it will upload your .hex file.