Documentation:Tutorials AT90UsbKey under Linux
From AVRFreaks Wiki
Contents |
[edit] Getting started
This document describes the basic steps I used to get AT90UsbKey/AVR working on Linux. In this expamle linux distribution Ubuntu was used.
[edit] Download stuff
Basic gcc for avr
sudo apt-get install gcc-avr avr-libc gdb-avr gcc-doc gcc-4.2 gdb-doc eclipse sun-java6-jdk
get dfu-programmer rpm from source forge install with alien
sudo alien -i dfu-programmer-0.4.4-1.fc8.i386.rpm
=Flash without root Edit: /etc/udev/rules.d/99-dfu-programmer.rules
SUBSYSTEM=="usb", ACTION=="add", SYSFS{idVendor}=="03eb", SYSFS{idProduct}=="2ffb", MODE="660", GROUP="plugdev", SYMLINK+="at90usb-%k"
BUS=="usb", ACTION=="add", SYSFS{idVendor}=="03eb", SYSFS{idProduct}=="2ffb", MODE="660", GROUP="plugdev"
The last line modifies the hierarchy of /dev/bus/usb which is used by dfu-programmer to obtain access to the hardware
[edit] Eclipse
Get the standard cdt plugin from one of the default collections, e.g. kubuntu: sudo apt-get install eclipse-cdt
Start a new c/c++ project and change all the tools to the correct avr-gcc tool. See Eclipse AVR Guide
Remember to set the correct flag for your target MCU for the compiler by adding -mmcu=<dev> under:
Project -> Properties -> C/C++ Build -> Tool Settings -> GCC C Compiler -> Miscellaneous
and for the linker under:
Project -> Properties -> C/C++ Build -> Tool Settings -> GCC C Linker -> Miscellaneous
<dev> should be replaced by one of the following strings:
avr2 at90s2313 at90s2323 at90s2333 at90s2343 attiny22 attiny26 at90s4414 at90s4433 at90s4434 at90s8515 at90c8534 at90s8535 avr25 attiny13 attiny2313 attiny24 attiny44 attiny84 attiny25 attiny45 attiny85 attiny261 attiny461 attiny861 at86rf401 avr3 atmega103 atmega603 at43usb320 at43usb355 at76c711 avr4 atmega8 atmega48 atmega88 atmega8515 atmega8535 atmega8hva at90pwm1 at90pwm2 at90pwm3 avr5 atmega16 atmega161 atmega162 atmega163 atmega164p atmega165 atmega165p atmega168 atmega169 atmega169p atmega32 atmega323 atmega324p atmega325 atmega325p atmega3250 atmega3250p atmega329 atmega329p atmega3290 atmega3290p atmega406 atmega64 atmega640 atmega644 atmega644p atmega645 atmega6450 atmega649 atmega6490 atmega128 atmega1280 atmega1281 atmega16hva at90can32 at90can64 at90can128 at90usb82 at90usb162 at90usb646 at90usb647 at90usb1286 at90usb1287 at94k avr1 at90s1200 attiny11 attiny12 attiny15 attiny28
If your target MCU is not listed here, only enter -mmcu and do a build. The Console window should now contain a similar list where, hopefully, your device will be found.
post build rules: avr-objcopy -O ihex target.elf target.a90 (transform elf file to intel-hex format before flashing)
[edit] AVR Plugin for Eclipse
This plugin is using WinAVR and is targeted for Eclipse under Windows.
[edit] DFU-Programmer
After a successful build, it's time to flash it via USB using e.g. the DFU-Programmer.
Just plug in your board to the PC USB connector (the device should be visible with lsusb if everything is ok).
Jump to the build directory and locate the Debug directory, there you should find the target.a90 file to be flashed to the AT90UsbKey.
First erase the flash-memory with: dfu-programmer at90usb1287 erase
Then flash the new program with: dfu-programmer at90usb1287 flash target.a90
Press RST button and your cool program (e.g. Blinky) should start immediately.
[edit] Simulator
sudo apt-get install simulavr
simulavr does not support at90usb1287
