# Programming and Debugging Targets

## Programming with avrdude

Note:
  avrdude uses libusb to access JTAG-ICE, Dragon, ISP etc. Section Using USB connected Programmers under Linux describes, what to do, that normal users can access these devices.

      (1)  avrdude -P usb -p m1281 -c jtag2 -U fl:w:install/bin/sniffer_stk541.hex
      (2)  avrdude -P usb:4711 -p m1281 -c jtag2 -U fl:w:install/bin/sniffer_stk541.hex
      (3)  avrdude -P usb:1234 -p m1281 -c avrisp2 -U fl:w:install/bin/sniffer_stk541.hex

## Debugging with avarice + avr-gdb (ddd)

       avarice -I -P atmega1281 -2 -j usb --detach :4242
       ddd --debugger avr-gdb install/bin/sniffer_stk541.elf &

When ddd/avr-gdb has opened, type `"target remote:4242<ENTER>"` in order to connect avarice and avr-gdb.

## Using DebugWire

Enable DebugWire

Todo:
  finish this section, it is incomplete not fully tested.

- use any isp capable programmer: stk500v2, jtag2isp, dragon_isp??

          ISPDUDE="-c jtag2isp -P usb -p t44"
          DWDUDE="-c jtag2dw -P usb -p t44"
          avrdude $ISPDUDE  -F -U hfuse:w:????:m
          avrdude $DWDUDE -F

http://www.homebuilthardware.com/index.php/avr/linux-avrdragon-tutorial-1/