User Tools

Site Tools


eclipse-avr

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

eclipse-avr [2019/07/21 20:03] (current)
Line 1: Line 1:
 +====== Eclipse for AVR development ======
  
 +Description of how to setup Eclipse on Ubuntu for AVR development,​ using GCC, GDB and AVeRICE.
 +
 +Basic install instructions can be found [[http://​www.wiki.elektronik-projekt.de/​mikrocontroller/​avr/​avr_eclipse_tutorial|here]].
 +
 +These are my special notes about the process, and should be merged with the basic instructions where appropriate.
 +
 +===== Install toolchain =====
 +<code bash>
 +sudo apt-get install avrdude avr-libc binutils-avr gcc-avr simulavr avarice
 +</​code>​
 +
 +Install gdb-avr from sources, to get the newest version:
 +
 +<code bash>
 +sudo apt-get source gdb
 +cd gdb*
 +sudo ./configure --prefix=/​usr/​local/​avr --program-prefix="​avr-"​ --target=avr --disable-werror
 +sudo make
 +sudo make install
 +</​code>​
 +
 +I had to make a symlink to the avr-gdb program:
 +
 +<code bash>
 +sudo ln -s /​usr/​local/​avr/​bin/​avr-gdb /​usr/​bin/​avr-gdb
 +</​code>​
 +
 +===== AVR Dude =====
 +The basic instructions for setting up avrdude is working.
 +I found it impossible to debug a program if I didn't load it with avrdude before debugging.
 +Simply build the project and pres the AVR Upload button to do so.
 +
 +===== Create a project =====
 +In order to use an already existing project with the avr plugin, I only found this solution:
 +  - Delete the old eclipse project.
 +  - Create a new project of type "C Project"​ and set the location to the already existing source directory.
 +
 +===== Fix paths =====
 +If a project uses an external makefile, it might be necessary to change some environment variables for the project:
 +  - Select Project->​Properties and goto C/C++ Build->​Environment
 +  - Change the PWD and CWD variables to the project directory
 +
 +===== Setup debugger =====
 +To use GDB an interface is required to use the mkII ICE debugger.
 +  - Select Run->​External Tools->​External Tools Configurations
 +  - Add a new launch and name it **AVeRICE**
 +  - Location is **/​usr/​bin/​avarice**
 +  - Working Directory should be the project root
 +  - For arguments I use <​code>​--mkII
 +--jtag usb
 +:​4242</​code>​
 +
 +Now setup avr-gdb:
 +  - Select Run->​Debug Configurations
 +  - Select the Debugger tab
 +  - Choose **gdbserver Debugger**
 +  - GDB debugger: **avr-gdb**
 +  - GDB command file: **leave empty**
 +  - Select Connection tab
 +  - Choose **TCP, localhost and port 4242**
 +
 +Now to debug simply run External Tools->​AVeRICE. Then start the debugger.
 +
 +===== Final Note =====
 +My setup is not very stable. As I mentioned above the program crashes for good if I don't load it with avrdude before debugging.
 +
 +Also I have problems catching a breakpoint after a longer time period. It seems like AVeRICE looses connection to the mkII.
 +It might be a problem with the mkII firmware, AVeRICE or both.
 +If there is a problem with the mkII it could explain why debugging with AVR Studio on Windows is such a pain also.
eclipse-avr.txt ยท Last modified: 2019/07/21 20:03 (external edit)