Setting up AVR Studio with Arduino

3.6k views Asked by At

I have tried setting up AVR studio 5.1 and 6 to use my Arduino libraries. The instructions I have followed are here: http://www.engblaze.com/tutorial-using-avr-studio-5-with-arduino-projects/ My project includes the necessary libraries and they are within the same directory. They have also been added to the project within AVR Studio. I am still having issues with undefined references to everything.

My questions are: How can I fix this issue? Does anyone else have these same issues after jumping through all the hoops in the instructions above?

Should I use AVR Studio 4? Are there the same issues? Should I just skip AVR Studio and use Eclipse instead?

Thanks in advanced.

2

There are 2 answers

0
engblaze On

When you say you've added the libraries to your project, do you mean you've added them to your compiler source directories, or added the library source files as "Existing Items" to the project itself?

Undefined references usually appear because the source files haven't been added as links to the project. If they're not added so that they show up in the Solution Explorer, Studio doesn't add them as build targets to the Makefile. The undefined errors are the linker complaining when it can't find the compiled object files (since they were never built to begin with). Specifically, this is in "Compiler and Linker Setup", Step 11 in our Studio 5 tutorial.

This means you must add the libraries in both places (C++ compiler setup AND as links/existing items to the project itself). If you've already done both of these things, I'm not sure what's up, as that's always worked for us. You can also check out our updated tutorial for using Arduino with Atmel Studio 6, though it uses the same basic strategy.

Edit: as an addendum, you can use Eclipse if you don't like the Atmel Studio workflow: http://arduino.cc/playground/Main/DevelopmentTools There is the potential for some of the same issues, since you're still setting up a custom toolchain to replicate the Arduino IDE. Your particular mileage may vary.

AVR Studio 4 is based on Eclipse. It's pretty old at this point, but also has a well-defined workflow for that reason, so if you don't need the new features, there's a good chance it will work.

0
iyahdub On

Code-Blocks is brilliant as well. You can use this Arduino specific version with a wizard and simulator and all, ready to be used. http://www.arduinodev.com/codeblocks/