Cubicle Hero

Just another pollutant in the Internet wasteland

Using Eclipse for AVRs

  1. Install either Atmel Studio or the toolchains from Atmel?
    1. Download Part Description Files from:
  2. Install WinAVR
  3. Install Cygwin
  4. Install the AVR Eclipse Plugin from Eclipse Marketplace (Help > Eclipse Marketplace...)
  5. In preferences, go to AVR > Paths.
    1. Set AVR-GCC to Custom path: C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin
    2. GNU make to: C:\cygwin64\bin
    3. AVR Header files to: C:\WinAVR-20100110\avr\include
    4. AVRDude to: C:\WinAVR-20100110\bin
  6. In preferences, go to AVR > AVRDude, and add programmer
    1. SparkFun AVR Pocket Programmer = USBtiny
    2. WaveShare = Atmel AVR ISP mkII

New Project

  1. File > New > C Project
  2. Set project name at top
  3. Select AVR Cross Target Application > Empty Project
  4. Next button twice, until in AVR Target Hardware Properties
  5. Enter chip and frequency
  6. Finish

Configuring Projects

Before programming, right-click on project and hit Properties.

  1. AVR > AVRDude, select default programmer
  2. Double-check AVR > Target Hardware
  3. C/C++ Build > Settings > Additional Tools in Toolchains (at the top), check "Generate HEX file for Flash Memory."
    1. Don't check AVRDude in this same window
  4. C/C++ Build > Settings > AVR C Compiler > Optimization, set any optimization (I usually use Size Optimizations but Atmel Studio defaults to Slight)

Simple Projects

All C source and header files can be directly in the project folder. This isn't terribly scalable or very C-ish, so this isn't recommended. It's not difficult to switch, though, so... meh.

Regular Projects

For normal projects, .c files will be contained in a src/ directory and .h files will be in the include/ directory. Create these two in the project folder. Then, in project settings:

  1. C/C++ General > Paths and Symbols > Source Location
    1. Add src/
    2. Delete old, default directory
  2. C/C++ Build > Settings > AVR Compiler > Directories, add "${workspace_loc:/${ProjName}/include}" (or navigate using the UI).

Referencing Other Projects

  1. C/C++ General > Paths and Symbols > Includes, add ${workspace_loc}/<other-project-name>/include
  2. C/C++ General > Paths and Symbols > Source Location > Link Folder
    1. Name folder, hit checkbox, add: ${WORKSPACE_LOC}\<other-project-name>\src