Arduino development with Eclipse – A step by step tutorial to the basic setup

If you want to build some electronic stuff that needs some programming, then Arduino is certainly the best choice. It just works, you only need to plug it in, write your code and press on the deploy button to have your board flashed and working.
And this is great, it saves you from tons of troubles, if you worked with microchip PICs in the past you probably know what I’m talking about.

The only thing that I don’t like about Arduino is it’s IDE, which is a very simple code editor written in Java with very few features and many annoying problems. The default IDE is very good to start learning Arduino programming, but the more you use it, the more you hate it, at least I do.

However until now I always used the default IDE, but for my last project (Sir Biss, an Arduino based snake robot) I figured out how to setup Eclipse for Arduino, and, after a bit of headache, it works great.

If you Google something like “Arduino development with eclipse” you’ll find some tutorials, some of them are very inaccurate and incomplete, others are pretty well explained but they simply don’t work, because some fundamental step is missing.

These tutorials, however, gave me the start to setup my own Eclipse, here they are:

So first of all, thanks to the people who wrote these tutorials.

What follows is a step by step guide of my personal way on how to setup a development environment for Arduino, I’ve done it on a Windows 7 32 bit PC, and my Arduino hardware is the Arduino Duemilanove board.
I do not own other boards so I cannot test this guide for other types of Arduino (Arduino Mega, Arduino Mini, …) if someone reading this guide is able to test it on different boards, please tell me if and what changes must be done I’ll be glad to update this tutorial, thank you!

Install Eclipse

First thing to do is download the latest Eclipse IDE for C/C++ developers from the Eclipse website, as I’m writing this the latest Eclipse version is Indigo.

To run Eclipse you need the Java Runtime Environment (not the JDK, because we are not going to develop in Java, so the JRE is fine), you can download the latest JRE from the Oracle website, click on the “Download” button under JRE, then choose the right JRE for your system, I downloaded the Win 32 x86 version, for offline installation (jre-7u3-windows-i586.exe).

Start Eclipse and choose a workspace, where all your Arduino projects will be saved.

Install the Eclipse AVR Plugin

From Eclipse, go to “Help” and then “Install New Software”.

In the “Work with:” box write this url:

http://avr-eclipse.sourceforge.net/updatesite

Then click “Add”.
Set the “Name:” to “Eclipse AVR Plugin”, leave the “Location” as is.

Click “OK” and wait until the installable components are loaded, then select all and click “Next”, a dependencies check will start for the selected components and it should take some minutes.

After the depencencies check completes you will be asked to review the selected components, click “Next”, then accept the license terms and hit “Finish”. The components installation will start. An alert dialog will appear saying that you are installing unsigned software, say “OK”.

When the installation completes you will be asked to restart Eclipse.

Download the Arduino SDK

Download the latest Arduino SDK, at the time I am writing this the latest available SDK is marked as Arduino 1.0. Nedless to say, download the right one for your machine, I downloaded arduino-1.0-windows.zip.

Choose a place on your file system for the Arduino SDK and then unzip the downloaded file, I unzipped mine in D:\arduino so from now on remember to replace this base path with the one you choose.

Setup the Eclipse AVR Plugin

From Eclipse go to “Window” and then “Preferences”, open the “AVR” section on the left, then select “Paths”

Select AVR-GCC, click “Edit”, in the window that appears set “Path source:” to “Custom”, click “Browse” and point it to this path <arduino_base_path>\hardware\tools\avr\bin which is the path to the AVR compiler (avr-gcc.exe) inside the arduino SDK directory. I pointed mine to D:\arduino\hardware\tools\avr\bin.

Select GNU Make, click “Edit”, in the window that appears set “Path source:” to “Custom”, click “Browse” and point it to this path <arduino_base_path>\hardware\tools\avr\utils\bin which is the path to the make executable inside the arduino SDK directory. I pointed mine to D:\arduino\hardware\tools\avr\bin.

Select AVR Header Files, click “Edit”, in the window that appears set “Path source:” to “Custom”, click “Browse” and point it to this path <arduino_base_path>\hardware\tools\avr\avr\include which is the path to the AVR toolchain headers files inside the arduino SDK directory. I pointed mine to D:\arduino\hardware\tools\avr\avr\include.

Select AVRDude, click “Edit”, in the window that appears set “Path source:” to “Custom”, click “Browse” and point it to this path <arduino_base_path>\hardware\tools\avr\bin which is the path to the AVRDude executable (used to deploy the binary on the Arduino board) inside the arduino SDK directory. I pointed mine to D:\arduino\hardware\tools\avr\bin.

Now the AVR plugin knows where to find the toolchain to build and deply code for the Arduino board.
Click “Apply” and then “OK”

Create the ArduinoCore library

The ArduinoCore library will contain all the basic functionalities to deal with the Arduino board, this library can be seen as the standard c library equivalent for Arduino. If you write some code for Arduino in the Arduino IDE, this library is silently linked to your code, but if you plan to use Eclipse you have to manually link the library to each of our projects before deploying them on the Arduino board.
Here are the steps to create the ArduinoCore library (which is just the name I gave it):

From Eclipse go to “New” then “C++ Project” then “AVR Cross Target Static Library” and select “Empty Project”.

Set the “Project Name:” to “ArduinoCore” and click “Next”.
This library will contain code distributed with the Arduino SDK which is considered to be stable, so deselect the “Debug” configuration and click “Next”.
Set the “MCU Type” and “MCU Frequency”, this depends on the specific board, my Arduino Duemilanove is equipped with an ATmega328P chip clocked at 16MHz (16000000 Hz). If you are not sure which values to use here, go to the arduino website in the “Hardware” section and click on your specific board to see the tech specs, here’s the link.
Once done hit “Finish”.

Now you have an empty library project, what we are going to do now is import the Arduino core files from the Arduino SDK folder.

In Eclipse right click on the “ArduinoCore” project, select “Properties” and then “C/C++ Build”.
Open the “AVR Compiler” section and select “Directories”.
Add the include path to the arduino core header files in the Arduino SDK, they are located inside “<arduino_base_path>\hardware\arduino\cores\arduino”
Add the include path to the pins_arduino.h header file, this again depends on the specific board you are working with.
Many version of the pins_arduino.h header file can be found, they are located inside specific folders under “<arduino_base_path>\hardware\arduino\variants\”:

  • <arduino_base_path>\hardware\arduino\variants\standard: I used this one for my Arduino Duemilanove
  • <arduino_base_path>\hardware\arduino\variants\mega: I guess you should use this one if you are working on an Arduino Mega board
  • <arduino_base_path>\hardware\arduino\variants\leonardo: maybe to be used with the new Arduino Leonardo board
  • <arduino_base_path>\hardware\arduino\variants\micro: absolutely dunno

Do the same for the “AVR C++ Compiler” section, then click “OK”.

From Eclipse right click on the “ArduinoCore” project, select “Import” and then “File System”. Point the file browser to the arduino core files directory inside the Arduino SDK which are located in “<arduino_base_path>\hardware\arduino\cores\arduino”.

Select all the files except main.cpp.

Click on “Advanced” and select “Create links in workspace” so the files are not copied into the library but only weak-referenced. It’s better to only reference these files so if you download a newer version of the Arduino SDK you can simply overwrite the existing one and the ArduinoCore library is automatically updated.
Click “Finish”.

If everything went well you should now be able to build the ArduinoCore library, right click on the “ArduinoCore” project and do a “Build Project”.

Create a test project

Let’s now create a test project to check that everything’s fine.
Remember that these steps must be done with every new project that you create.

In Eclipse go to “New” then “C++ Project” and then “AVR Cross Target Application” and select “Empty Project”.
Set the “Project Name:” to “TestProject” and click “Next”.
Deselect the “Debug” configuration and click “Next”.
Set the “MCU Type” and “MCU Frequency” to the same values you set in the ArduinoCore library project and hit “Finish”.

Right click on the “ArduinoCore” project, go to “Properties” and then “C/C++ Build” and in both “AVR Compiler” and “AVR C++ Compiler” add the same include paths that were added in the ArduinoCore library project plus the include path for the test project itself which is not added by default and can be added with this magic string: “${workspace_loc:/${ProjName}}” which simply expands to your workspace directory followed by the test project directory.

From the “C/C++ Build” section in the “Properties” window go to “AVR C++ Linker”.
Set the command line pattern to:

${COMMAND} --cref -s -Os ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS} -lm ${FLAGS}

Now click on the “Libraries” subsection.

In the “Libraries path” box add the path to the ArduinoCore library by clicking on the “Add” button on the top right corner of the box, then select “Workspace” and point it to the “Release” folder inside the ArduinoCore project. You can also directly insert this magic string: “${workspace_loc:/ArduinoCore/Release}” which is the same thing.

In the “Libraries” box add the ArduinoCore library by clicking on the “Add” button on the top right corner of the box and simply type “ArduinoCore”, this instructs the linker to link against “libArduinoCore.a” when linking the final executable.

In the project properties window, click on “Project references” in the left menu and check “ArduinoCore”, so the library will be automatically built (and re-built if needed) when building the test project.

In the test project create a new main.cpp file and paste the following code into it.
This is the classic Blink code sample that blinks the led linked on pin 13 of the Arduino board once every second:

 
#include <Arduino.h>
 
int ledPin =  13;    // LED connected to digital pin 13
 
// The setup() method runs once, when the sketch starts
void setup()   {
  // initialize the digital pin as an output:
  pinMode(ledPin, OUTPUT);
}
 
// the loop() method runs over and over again,
// as long as the Arduino has power
 
void loop()
{
  digitalWrite(ledPin, HIGH);   // set the LED on
  delay(1000);                  // wait for a second
  digitalWrite(ledPin, LOW);    // set the LED off
  delay(1000);                  // wait for a second
}
 
 
int main(void) {
 
  init();
  setup();
 
  while(true) {
    loop();
  }
}

You’ll notice that there are some difference between this code and the usual code that you write for Arduino, the next post will focus on these differences, for now just take it as it comes. No questions. Or this post will never end.

Deploy on the Arduino board

After compiling and linking the binary a tool named AVRDude will deploy it on the Arduino board.
AVRDude must be configured to work with Arduino.
What we are going to do now is stealing the AVRDude configuration from the Arduino SDK.

From Eclipse go to “Window” then “Preferences” and select the “AVR” section on the left, then select “AVRDude”.
Check “Use custom configuration file for AVRDude” and set “AVRDude config file” to the one provided with the Arduino SDK: it can be found under <arduino_base_path>\hardware\tools\avr\etc\avrdude.conf.
Click “Apply” and then “OK”.

From Eclipse select the test project and open the project properties once more (right click->“Properties”).
Select the “AVR” section and the click on “AVRDude”
You now have to create a new programmer configuration for your board, this must be done only once.
Click “New”, in the window that appears insert these data:

  • “Configuration Name” : “Arduino”
  • “Programmer Hardware” : “Arduino”
  • “Override default baudrate” : 57600

And set “Override default port” to the COM port that you use to work with the Arduino board. If you do not know what this value is, plug your Arduino board in and start the Default IDE, the COM port is showed at the bottom of the IDE window, my Arduino IDE says:

Arduino Duemilanove w/ ATMega328 on COM10

My COM port is COM10 so my “Override default port” field is set to:

//./COM10

Don’t ask me what the “//./” prefix means, I don’t know.
Click “OK”

Back in the “AVRDude” window select the “Advanced” tab.
Check “Disable Device signature check” and click “OK”.

First deploy

It’s time. Plug your Arduino board in.

Select the test project and build it, then right click on it and select “AVR” and then “Upload project to target device”, the deploy will start and if everything’s fine you should have your program running on the Arduino board after a few seconds. Look at the led at PIN 13 and it should be blinking. Mine blinks.
That’s all, hope this guide is useful.
Again, let me know any problem you had so I can update the tutorial with your info.

Related Posts Plugin for WordPress, Blogger...
If you enjoyed this post, make sure you subscribe to my RSS feed!
Leave a comment ?

40 Comments.

  1. I guess there is a html-based error:

    maybe you should have a look at:

    ${COMMAND} –cref -s -Os ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS} -lm ${FLAGS}

    my system (indigo, XP, mega2560), shows an error with this configuration. works without error, when typing:

    ${COMMAND} –-cref -s -Os ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS} -lm ${FLAGS} (there are two “-” advancing the cref, not only one)

  2. This is a great guide Francesco, thanks!
    There are a couple of stumbles though –
    1. In Eclipse right click on the “ArduinoCore” project, select “Properties” and then “C/C++ Build”.
    Open the “AVR Compiler” section and select “Directories”.

    (You don’t mention that the AVR Compiler options are under “C/C++” -> “Settings”)

    2. Your ${COMMAND} –-cref -s -Os ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS} -lm ${FLAGS}) still isn’t right, the two dashes, the first one is a hyphen (slightly longer) and the second dash is a minus symbol. This didn’t work for me and the hex never got built, but two minuses fixed it.

    The things above got this working great for me programming a atmega328 – thank you.

    Problems with a mega, but I’m working on them…

    • Ok, just as an update, I got it working on the mega2560 by changing the programmer to “Wiring”. It seems the problem is that the other programmers do not send a reset before programming. I could fix is manually, but pressing the reset but the same instant I went to upload, but changing the programmer makes it automatic. And hopefully doesn’t break anything else!

  3. This worked great. Thank you very much for this accurate tutorial:grin:.

    One quick path/folder step update for Mac users:
    Copy the /Applications/Arduino.app contents to another folder and point Eclipse there. The path selection menu will not allow navigation into a .app container. Unless a Mac guru knows some cheat codes…

    Again, thank you. This was a tremendous help.

  4. First off, I love the tutorial, easy to follow and straight forward, unlike a lot of the other ones I’ve found.
    However one issue, see below. I am using Ubuntu Linux 12.04, Eclipse Indigo, and Arduino 1.0.1 software. This is an error I get. Any advice ?

    Thanks for your time, and again thank you for the great tutorial.
    -Frank

    **** Build of configuration Release for project TestProject ****

    make all
    Building file: ../main.cpp
    Invoking: AVR C++ Compiler
    avr-g++ -I/apps/arduino-1.0.1/hardware/arduino/cores/arduino -I/apps/arduino-1.0.1/hardware/arduino/variants/standard -I”/home/fboyd/workspace/TestProject” -Wall -Os -fpack-struct -fshort-enums -funsigned-char -funsigned-bitfields -fno-exceptions -mmcu=atmega328p -DF_CPU=16000000UL -MMD -MP -MF”main.d” -MT”main.d” -c -o “main.o” “../main.cpp”
    Finished building: ../main.cpp

    Building target: TestProject.elf
    Invoking: AVR C++ Linker
    avr-g++ –cref -s -Os -o”TestProject.elf” ./main.o -lArduinoCore -lm -Wl,-Map,TestProject.map,–cref -L”/home/fboyd/workspace/ArduinoCore/Release” -mmcu=atmega328p
    /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr5/crtm328p.o: In function `__bad_interrupt’:
    ../../../../crt1/gcrt1.S:195: undefined reference to `main’
    collect2: ld returned 1 exit status
    make: *** [TestProject.elf] Error 1

    **** Build Finished ****

    • Wow, one dumb thing, I didn’t save the main.cpp file before trying to compile. No wonder I had an issue. Welp that works great, sorry to have posted before I tested everything.
      Again thank you for your great Tutorial
      -Frank

  5. Great Tutorial, how do you Libraries into the mix ? I’ve tried adding arduino/libraries/SPI into the 2 directory areas but get a SPI.h not found when trying to compile. Any thoughts ?
    -Frank

  6. I followed your guide but I get an error when I give “Upload project to target device”.
    You know how I can fix it?

    http://img.giltesa.com/images/817avr_fail2.png

    Thanks for the guide.

  7. You’ve wrote :
    “In Eclipse right click on the “ArduinoCore” project, select “Properties” and then “C/C++ Build”.
    Open the “AVR Compiler” section and select “Directories”.”

    It is in fact in :
    In Eclipse right click on the “ArduinoCore” project, select “Properties”, “C/C++ Build” AND THEN “SETTINGS”.

    Regars

  8. “Right click on the “ArduinoCore” project, go to “Properties” and then “C/C++ Build” and in both “AVR Compiler” and “AVR C++ Compiler” add the same include paths that were added in the ArduinoCore library project”

    I think you mean

    Right click on the “TESTPROJECT” project, go to “Properties” and…

  9. Well, some problem in the end :

    1) “Back in the “AVRDude” window select the “Advanced” tab.” : i don’t have any “Advanced” Tab in Eclipse 3.7 Indigo !

    2) Before the first build you miss to make ProjectTest / Properties / AVR / AVRDude / Programmer configuration set to the profile created before

    3) And the last, i can’t build my project because of a little error at the compiling :

    Description Resource Path Location Type
    cannot find -llibArduinoCore.a TestProject C/C++ Problem

    I’m french but your post is *very* clear for me, lot of thanks !

  10. (i’m sorry for this quadruple post, i allow you to delete my messages you don’t feel useful, or if you want to put them in an only message)

    I’ve search help on the web, it appear that another tuto is next to your’s http://itpedia.nyu.edu/wiki/Arduino_in_Eclipse espacialy because i’m doing that under Linux (Ubuntu 12.04 LTS) : for me, all your section “Setup the Eclipse AVR Plugin” was pre-linked by the system (perhaps could you notice that linux users could skip that ? it make me search for a long time, because i didn’t need to do this step and i hasn’t the same directories than you about “\hardware\tools\avr\bin” that doesn’t exist anyway)

  11. Hi Francesco,

    Wooouw! Thanks for this awesome tutorial! It worked great for me on an Arduino Mega ADK (ATMEGA2560 16AU 1121) on mac osx 10.7.4 with crosspack avr 2012 installed, and of course a bit of patience.

    On a mac the step Setup the Eclipse AVR Plugin works with CrossPack stuff.
    http://www.obdev.at/products/crosspack/download.html
    After installing crosspack, in project preferences AVR / Paths have to direct to:
    AVR-GCC: /usr/local/CrossPack-AVR-20120217/bin
    GNU make: /usr/bin
    AVR Header Files: /usr/local/CrossPack-AVR-20120217/avr/include
    AVRDude: /usr/local/CrossPack-AVR-20120217/bin

    Also, i had to apply these hacks to make the ArduinoCore compile finish succesfully:

    1. http://arduino.cc/forum/index.php/topic,92364.0.html
    put the following line as a third line into Arduino.h:
    #define __AVR_LIBC_DEPRECATED_ENABLE__ 1

    2. http://code.google.com/p/arduino/issues/detail?id=795
    The data type prog_char is no longer valid without the macro. It appears the solution would be to replace the data type “prog_char” with “char PROGMEM” in
    Print:print(const _FlashStringHelper*)

    For the programmer to hit Arduino Mega ADK i used these settings:
    ( in preferences / AVR / AVRDude > configurations: add/edit)

    programmer hardware: Atmel STK500 Version 2x firmware
    override port: //./dev/tty.usbmodemfa141 (retrieved from standard arduino IDE)
    override baudrate: 115200 (max on arduino adk)

    For navigating the osx .app bundle, here is a little trick:
    - go to your Arduino.app (mine happens to reside in some other folder than Applications, don’t know if this makes a difference)
    - hit show package contents at right click
    - navigate to Contents/Resources/Java
    - than drag the ‘hardware’ folder into you finder side bar into favorites
    - now if you are in a browse dialog in eclipse, you can hit the ‘hardware’ shortcut in the favorites sidebar and then access the arduino and tools folders.

    hope this post will save others some time.

    thanks again for your effort,

    Arne (NL)

  12. It’s running! Thank you, thank you, thank you!!!

    Here are a couple of minor updates to help make your instructions idiot-proof:
    1) As Sandy noted, the include directory additions for C and C++ are in the “Settings” category and that’s also needed in the Linker update where the command line is modified;
    2) When importing the Arduino core files, after selecting “Import” you need to expand “General” to then see “File System” (“General” is missing from your steps);
    3) In the “Create a test project” section, the third paragraph should say: “TestProject” instead of “ArduinoCore”; and
    4) For clarity and ease of understanding, you might add the phrase “of the AVR C++ Linker” after “Now click on the “Libraries” subsection”.

  13. Your writeup really helped! I was following the guide on the Arduino Playground. I’m using Eclipse Juno, and was having trouble linking. Your linker settings really helped. I only have one unresolved issue – the include path for the core library headers, ideally would be relative to the workspace, but I had to make this a full filesystem path, or it wouldn’t work. (Compiler was just seeing /ProjectName/src – no workspace prefix.) This was on Windows 7 64-bit. But it’s working, so thanks again for taking the time to write this article.

  14. This worked great for the blink LED example however when trying to build a project with other libraries such as Ethernet libraries, it generates a lot of errors. Anyone got this problem?
    If someone can provide me with some guidelines i will appreciate it a lot :)

    • There are at least two ways for using libraries:
      1. Do the steps like for the “ArduinoCore” lib for the Library you want do use. I just created one for the TimerOne

      2. Copy the .cpp and .h into your project (that means not using it as a library – the copy-paste-pattern)

    • Warren
      I import the code of the library in the project.
      My eclipse plugin for Arduino you can find at eclipse.baeyens.it has a import option to do so.
      Best regards
      Jantje

  15. Thanks for this tutorial, it was incredibly helpful.

    I found when I used it though, that my builds were way bigger than when built under the Arduino IDE and that some Arduino libraries would fail to build. Perhaps my tool versions are different, but here are some changes that I found improved things.

    In fact, a simple ‘Hello World!’ app was building to a whopping 14000 bytes. The changes below reduced this to 1664.

    On a Win7 64-bit machine:
    Arduino_1.0.1
    Eclipse Build id: 20110615-0604 for Windows 64-bit
    Avr Eclipse plugin 2.4.0.final

    For the library, and any projects, I changed the followinging build settings:
    Settings: in both ‘AVR Compiler’ & ‘AVR C++ Compiler’
    - Symbols: Add: USB_VID=null USB_PID=null ARDUINO=101
    - Optimizations: Remove: -fpack-struct -fshort-enums
    - Optimizations: Other optimization flags: -ffunction-sections -fdata-sections
    - Language Standard: Remove: -funsigned-char -funsigned-bitfields

    And for all application projects, I changed the AVR C++ Linker command line pattern to:
    ${COMMAND} -Os -Wl,–gc-sections ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS} -lm ${FLAGS}

    I also discovered:
    * The avr tools don’t work well with parenthesis in the file path, so DON’T install Arduino into your ‘C:\Program Files (x86)’ folder as I had.

    * The variants folder for the Arduino Nano w/ATMega328 is: C:\Arduino\hardware\arduino\variants\eightanaloginputs

    Thanks again, really helped. *thumbs_up*

  16. Thanks a lot for explaining this, this helped out awesomely.
    Little remark: In the programmer configuration section of the AVRDude preferences, I had to set the baudrate to 115200 instead of 57600 for my arduino Uno.

  17. Thank you very much for this great tutorial.
    I’m using eclipse Juno and Arduino-1.0.1 and its working great.

  18. Hello!Please give me a hand. I redo so many times. ALWAYS FAILS. Before add source file, the everything is OK! After that, I always get the same error message as follow:
    Function ‘delay’ could not be resolved
    Function ‘delay’ could not be resolved
    Function ‘digitalWrite’ could not be resolved
    Function ‘digitalWrite’ could not be resolved
    Function ‘pinMode’ could not be resolved
    Symbol ‘HIGH’ could not be resolved
    Symbol ‘LOW’ could not be resolved
    Symbol ‘OUTPUT’ could not be resolved
    Any help would be greatly appreciated. Thank you.

  19. I get this error when building:

    make all
    Building file: ../main.cpp
    Invoking: AVR C++ Compiler
    make: Interrupt/Exception caught (code = 0xc00000fd, addr = 0x4217b3)

    **** Build Finished ****

    What can I do?

  20. Great work. Got this working on Ubuntu 12.10, Windows 7 x64 (Eclipse Indigo and Juno). I recommend this over the Arduino IDE, specially if using the MEGA2560. For MEGA2560 set the programmer to Wiring as Sandy Noble said, also the overwrite programming Baud to 115200.

  21. Hi :-)

    This is great and it worked like charm after reading the comments:
    1) the “C++ Compiler -> settings -> AVR C Compiler/AVR C++ Compiler” – it would be great if you’d update it in the text
    2) I had to give the full path to “make” in “Properties” -> “C/C++ Build” to make it work

    Question: Can I translate this to polish, and publish it on my blog, referencing your page?

  22. Great guide, thanks loads!

    On avr-gcc 4.7.0 (installed on Ubuntu 12.10), the –cref option is no longer available, hence the linker exits with an error that “avr-g++: error: unrecognized command line option ‘–cref’”. I removed this option from the linker command and it seems to work.

    I’ve struggled to find what the “–cref” option does. The only hint of an explanation is that it tells the linker to “add cross reference to map file”. I haven’t been able to find an equivalent switch in avr-gcc 4.7.0.

    • So, I have removed “–cref” from the linker flags but looking at the Eclipse (4.2.1) console after I build my project, I see this still includes “-Wl,-Map,.map,–cref” which seems to work fine. So I guess it is still using the –cref option, it’s just that the syntax for the –cref option is slightly different.

  23. For TestProject, the AVR C++ Linker Library Path setting of “${workspace_loc:/ArduinoCore/Release}” will cause a file-not-found error for the library file ArduinoCore (libArduinoCore.a). The correct setting is “${workspace_loc:/ArduinoCore}/Release”. Note the location of the closing brace “}”.
    I’m running
    Win XP Pro SP3
    Eclipse Juno Service Release 1
    CDT V8.1.1
    AVR Eclise Plug-in V2.4.0
    Eclipse C/C++ Development tools and the Development tools SDK at V8.1.1
    JDK V6 Update 25
    Arduino IDE 1.0.1
    There is still something wrong with avrdude:
    Right after Eclipse is opened and the TestProject file is opened, this message comes up.
    “Launching C:\arduino-1.0.1\hardware\tools\avr\bin\avrdude -p?
    Output:
    avrdude: can’t open config file “”: No such file or directory
    avrdude: error reading system wide configuration file “”
    avrdude execution aborted”

  24. The obvious question is: Do I have to enter all these settings for every project such as TestProject?

  25. The set-up for avrdude fails in Eclipse Juno with plug-in V2.4.0, and Arduino-1.0.1. When selecting Properties > AVR > AVRDude, I get an error message dialog box that says “The currently displayed page has invalid values”, but does not specify what they are.

    • I’ve changed virtually everything I could on the AVRDude page, but that error message doesn’t go away.

      Also, when I try to upload to the mcu, AVRDude seems to try and fail to find TestProject.hex. I set the Flash/EEPROM tab to “${workspace_loc:/TestProject/Debug/TestProject.elf}”, but that seemed to cause a timeout:
      “Launching C:\arduino-1.0.1\hardware\tools\avr\bin\avrdude -pm328p -cwiring -P//./COM4 -b9600 -F “-Uflash:w:H:\EclipseWorkspace\TestProject\Debug\TestProject.elf:a” “-CC:\arduino-1.0.1\hardware\tools\avr\etc\avrdude.conf”
      Output:
      avrdude: stk500v2_ReceiveMessage(): timeout
      avrdude execution aborted” or
      “Launching C:\arduino-1.0.1\hardware\tools\avr\bin\avrdude -pm328p -carduino -P//./COM4 -b9600 -F “-Uflash:w:H:\EclipseWorkspace\TestProject\Debug\TestProject.elf:a” “-CC:\arduino-1.0.1\hardware\tools\avr\etc\avrdude.conf”
      Output:
      avrdude: stk500_getsync(): not in sync: resp=0×32
      avrdude done. Thank you.
      avrdude finished”

  26. Thanks for your recommendations on this blog. One particular thing I would want to say is the fact purchasing gadgets items in the Internet is not new. The truth is, in the past ten years alone, the marketplace for online electronic products has grown significantly. Today, you’ll find practically almost any electronic system and tools on the Internet, from cameras and camcorders to computer elements and video gaming consoles.

  27. The Arduino IDE 1.0.1 creates significantly smaller binaries compared to the Eclilpse setup. I examined the arguments the Arduino IDE sends to g++ (turn on “show verbose output during compilation”) and found some differences. To create smaller binaries on Eclipse, do this on every AVR project (including ArduinoCore): go to C/C++ Build -> Settings -> AVR Compiler -> Optimization and add -ffunction-sections -fdata-sections to “Other Optimization Flags”. Do the same for the AVR C++ compiler. In all AVR application projects (i.e. not static libraries) go to AVR C++ Linker -> General and add -Wl,--gc-sections to “Other Arguments”. Clean and re-build. My binary went from 26kbytes (81% full) to 14kbytes (43% full). For more info on what these switches are doing, see “function sections” on elinux.org and Stack Overflow: Query on -ffunction-section & -fdata-sections options of gcc

  28. I keep getting this error “avrdude: stk500v2_ReceiveMessage(): timeout” Im trying to make it work on my Arduino Uno. I actually followed the steps on the Arduino website but i figured someone may help me here.

  29. Thanks for this tutorial. One less to do :razz:
    I did try the led sample code, and the default serial communication.
    I’m playing with an arduino Mega 1280 16MHz board.
    It seems that there’s some issues with timing: the led is blinking fastest as every 1s, and regarding the serial communication, characters are not properly sended: ie ‘A’ becomes ‘y’ ,…
    I did set properly the F_CPU ?
    Any hints, idea ?

  30. :grin: Thank’s lot really good tutorial

Leave a Comment


*


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>