avrdude-serjtagをavrdude-5.11.1に対応させた

先日aitendoで買ったAVR-USBasp-Bファームウェアをアップデートするために、AE-UM232Rを使ってFTDI BitBang AVR-Writerを試してみた。

そのために、avrdudeにパッチを当て再ビルドする必要があるのだが、現在の最新版であるavrdude-5.11.1に、同じく現在の最新版のavrdude-serjtag04nのパッチを当てると、幾つかエラーが出たので、パッチを書き換え対応させた。

githubリポジトリ: laclefyoshi/avrdude-serjtag · GitHub

ビルドしてインストールしたところ (README参照) 、上手くUSBaspのファームウェアをアップデートできた。


$ sudo kextunload /System/Library/Extensions/FTDIUSBSerialDriver.kext

$ avrdude -C /opt/usr/avrdude/etc/avrdude.conf -c diecimila -P ft0 -p m8 -v

avrdude: Version 5.11.1, compiled on Mar 30 2013 at 17:18:59
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/opt/usr/avrdude/etc/avrdude.conf"
         User configuration file is "/Volumes/Macintosh HD/Users/yoshiyasu/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : ft0
         Using Programmer              : diecimila
avrdude: BitBang OK
avrdude: pin assign miso 3 sck 5 mosi 6 reset 7
avrdude: drain OK
         AVR Part                      : ATMEGA8
         Chip Erase delay              : 10000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom         4    20   128    0 no        512    4      0  9000  9000 0xff 0xff
           flash         33    10    64    0 yes      8192   64    128  4500  4500 0xff 0x00
           lfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
           calibration    0     0     0    0 no          4    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : ft245r
         Description     : FT232R Synchronous BitBang

 ft245r:  bitclk 230400 -> ft baud 115200
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9307
avrdude: safemode: lfuse reads as EF
avrdude: safemode: hfuse reads as D9

avrdude: safemode: lfuse reads as EF
avrdude: safemode: hfuse reads as D9
avrdude: safemode: Fuses OK

avrdude done.  Thank you.


$ avrdude -C /opt/usr/avrdude/etc/avrdude.conf -c diecimila -P ft0 -p m8 -U flash:w:usbasp.atmega8.2011-05-28.hex:i
avrdude: BitBang OK
avrdude: pin assign miso 3 sck 5 mosi 6 reset 7
avrdude: drain OK

 ft245r:  bitclk 230400 -> ft baud 115200
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9307
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
 ft245r:  bitclk 230400 -> ft baud 115200
avrdude: reading input file "usbasp.atmega8.2011-05-28.hex"
avrdude: writing flash (4700 bytes):

Writing | ################################################## | 100% 2.25s



avrdude: 4700 bytes of flash written
avrdude: verifying flash memory against usbasp.atmega8.2011-05-28.hex:
avrdude: load data flash data from input file usbasp.atmega8.2011-05-28.hex:
avrdude: input file usbasp.atmega8.2011-05-28.hex contains 4700 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 1.29s



avrdude: verifying ...
avrdude: 4700 bytes of flash verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

$ avrdude -C /opt/usr/avrdude/etc/avrdude.conf -c diecimila -P ft0 -p m8 -U hfuse:w:0xC9:m  # read http://www.fischl.de/usbasp/Readme.txt

$ sudo kextload /System/Library/Extensions/FTDIUSBSerialDriver.kext

avrdudeビルドの注意点として、libusbがライブラリパスに含まれていないと、configure時にUSB対応が無効になる。確認はconfig.logや、ビルドした後にotoolやlddですると良い。