Hello, 

Please find attached my first attempt for a patch that enable the AVR-Dragon 
to recognize the AVR32 parts. This patch mimics the same code from jtag_mkII 
probe. 

With this patch on a 64-bit debian the part is recognized, but dumping memory 
fails 
due to a crash (see below), I need to investigate since I'm not sure it comes 
from 
this patch. (Note: The chip is empty)

I've added the part 32UC3A1256 to the default config file, and changed the 
Changelog accordingly.

Feel free to correct this as it fits, I'm willing to change my patch 
accordingly.

I'm testing user an up-to-date AVR-Dragon and two chips:
- 32UC3A1256,
- 32UC3A0512 on a EVK1100.

Thanks for your work and your time, and please ignore this mail if the patch 
does not interest you.

Julien

-- 
People in the embedded space don't do prototypes. They hack something until it 
works, then it's done.
--- 
Always code as if the person who will maintain your code is a maniac serial 
killer that knows where you live.
---
Programming is like sex.  One mistake and you have to support it for the rest 
of your life.
$ /usr/local/bin/avrdude  -c dragon_avr32 -p ucr3 -P usb -t -vvv

avrdude: Version 5.11svn, compiled on Nov  6 2011 at 22:23:47
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/usr/local/etc/avrdude.conf"
         User configuration file is "/home/jaube/.avrduderc"

         Using Port                    : usb
         Using Programmer              : dragon_avr32
avrdude: jtagmkII_dragon_open()
avrdude: usbdev_open(): Found AVRDRAGON, serno: 00A2000070E6
avrdude: usbdev_open(): using read endpoint 0x82
avrdude: jtagmkII_getsync()
avrdude: jtagmkII_getsync(): Sending sign-on command: 
avrdude: jtagmkII_send(): sending 1 bytes

avrdude: jtagmkII_recv(): Got message seqno 0 (command_sequence == 0)

Sign-on succeeded

JTAG ICE mkII sign-on message:
Communications protocol version: 1
M_MCU:
  boot-loader FW version:        255
  firmware version:              7.14
  hardware version:              1
S_MCU:
  boot-loader FW version:        255
  firmware version:              7.14
  hardware version:              6
Serial number:                   00:a2:00:00:70:e6
Device ID:                       AVRDRAGON
avrdude: jtagmkII_getsync(): Using a 298-byte device descriptor
avrdude: jtagmkII_setparm()
avrdude: jtagmkII_setparm(): Sending set parameter command (parm 0x03, 1 
bytes): 
avrdude: jtagmkII_send(): sending 3 bytes

avrdude: jtagmkII_recv(): Got message seqno 1 (command_sequence == 1)

OK

avrdude: jtagmkII_getsync(): Sending get sync command: 
avrdude: jtagmkII_send(): sending 1 bytes

avrdude: jtagmkII_recv(): Got message seqno 2 (command_sequence == 2)

OK


avrdude: jtagmkII_send(): sending 3 bytes

avrdude: jtagmkII_recv(): Got message seqno 3 (command_sequence == 3)

avrdude: jtagmkII_send(): sending 3 bytes

avrdude: jtagmkII_recv(): Got message seqno 4 (command_sequence == 4)

avrdude: jtagmkII_send(): sending 3 bytes

avrdude: jtagmkII_recv(): Got message seqno 5 (command_sequence == 5)
         AVR Part                      : 32UC3A1256
         Chip Erase delay              : 0 us
         PAGEL                         : P00
         BS2                           : P00
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 0
         StabDelay                     : 0
         CmdexeDelay                   : 0
         SyncLoops                     : 0
         ByteDelay                     : 0
         PollIndex                     : 0
         PollValue                     : 0x00
         Memory Detail                 :

                                  Block Poll               Page                 
      Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  
MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- 
----- ---------
           flash          0     0     0    0 yes    262144  512    512     0    
 0 0x00 0x00

         Programmer Type : DRAGON_AVR32
         Description     : Atmel AVR Dragon in AVR32 mode
avrdude: jtagmkII_getparm()
avrdude: jtagmkII_getparm(): Sending get parameter command (parm 0x01): 
avrdude: jtagmkII_send(): sending 2 bytes

avrdude: jtagmkII_recv(): Got message seqno 6 (command_sequence == 6)

parameter values:
0x01  0x06  

avrdude: jtagmkII_getparm()
avrdude: jtagmkII_getparm(): Sending get parameter command (parm 0x02): 
avrdude: jtagmkII_send(): sending 2 bytes

avrdude: jtagmkII_recv(): Got message seqno 7 (command_sequence == 7)

parameter values:
0x0e  0x07  0x0e  0x07  

         M_MCU hardware version: 1
         M_MCU firmware version: 7.14
         S_MCU hardware version: 6
         S_MCU firmware version: 7.14
         Serial number:          00:a2:00:00:70:e6
avrdude: jtagmkII_getparm()
avrdude: jtagmkII_getparm(): Sending get parameter command (parm 0x06): 
avrdude: jtagmkII_send(): sending 2 bytes

avrdude: jtagmkII_recv(): Got message seqno 8 (command_sequence == 8)

parameter values:
0x68  0x13  

         Vtarget         : 5.0 V
avrdude: jtagmkII_getparm()
avrdude: jtagmkII_getparm(): Sending get parameter command (parm 0x07): 
avrdude: jtagmkII_send(): sending 2 bytes

avrdude: jtagmkII_recv(): Got message seqno 9 (command_sequence == 9)

parameter values:
0x06  

         JTAG clock      : 891.7 kHz (1.1 us)

avrdude: jtagmkII_setparm()
avrdude: jtagmkII_setparm(): Sending set parameter command (parm 0x1b, 4 
bytes): 
avrdude: jtagmkII_send(): sending 6 bytes

avrdude: jtagmkII_recv(): Got message seqno 10 (command_sequence == 10)

OK


avrdude: jtagmkII_send(): sending 2 bytes

avrdude: jtagmkII_recv(): Got message seqno 11 (command_sequence == 11)

avrdude: jtagmkII_send(): sending 6 bytes

avrdude: jtagmkII_recv(): Got message seqno 12 (command_sequence == 12)

avrdude: jtagmkII_send(): sending 2 bytes

avrdude: jtagmkII_recv(): Got message seqno 13 (command_sequence == 13)

avrdude: jtagmkII_send(): sending 6 bytes

avrdude: jtagmkII_recv(): Got message seqno 14 (command_sequence == 14)
avrdude: AVR device initialized and ready to accept instructions
avrdude> part
>>> part 

AVR Part                      : 32UC3A1256
Chip Erase delay              : 0 us
PAGEL                         : P00
BS2                           : P00
RESET disposition             : dedicated
RETRY pulse                   : SCK
serial program mode           : yes
parallel program mode         : yes
Timeout                       : 0
StabDelay                     : 0
CmdexeDelay                   : 0
SyncLoops                     : 0
ByteDelay                     : 0
PollIndex                     : 0
PollValue                     : 0x00
Memory Detail                 :

                         Block Poll               Page                       
Polled
  Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   
ReadBack
  ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- 
---------
  flash          0     0     0    0 yes    262144  512    512     0     0 0x00 
0x00

avrdude> dump flash 
>>> dump flash 
avrdude: jtagmkII_read_byte(.., flash, 0x0, ...)
avrdude: jtagmkII_program_enable(): Sending enter progmode command: 
avrdude: jtagmkII_send(): sending 1 bytes

avrdude: jtagmkII_recv(): Got message seqno 15 (command_sequence == 15)

OK

avrdude: jtagmkII_program_enable(): Sending enter progmode command: 
avrdude: jtagmkII_send(): sending 1 bytes

avrdude: jtagmkII_recv(): Got message seqno 16 (command_sequence == 16)

OK

avrdude: jtagmkII_read_byte(): Sending read memory command: 
avrdude: jtagmkII_send(): sending 10 bytes

avrdude: jtagmkII_recv(): Got message seqno 17 (command_sequence == 17)

memory contents:
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x01  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 
0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00  
0x00  0x00  0x00 

avrdude: jtagmkII_read_byte(.., flash, 0x1, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x2, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x3, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x4, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x5, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x6, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x7, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x8, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x9, ...)
avrdude: jtagmkII_read_byte(.., flash, 0xa, ...)
avrdude: jtagmkII_read_byte(.., flash, 0xb, ...)
avrdude: jtagmkII_read_byte(.., flash, 0xc, ...)
avrdude: jtagmkII_read_byte(.., flash, 0xd, ...)
avrdude: jtagmkII_read_byte(.., flash, 0xe, ...)
avrdude: jtagmkII_read_byte(.., flash, 0xf, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x10, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x11, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x12, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x13, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x14, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x15, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x16, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x17, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x18, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x19, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x1a, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x1b, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x1c, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x1d, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x1e, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x1f, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x20, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x21, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x22, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x23, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x24, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x25, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x26, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x27, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x28, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x29, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x2a, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x2b, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x2c, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x2d, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x2e, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x2f, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x30, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x31, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x32, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x33, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x34, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x35, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x36, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x37, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x38, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x39, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x3a, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x3b, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x3c, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x3d, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x3e, ...)
avrdude: jtagmkII_read_byte(.., flash, 0x3f, ...)
0000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 01 00  |................|
0010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
0020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
0030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

*** glibc detected *** /usr/local/bin/avrdude: free(): invalid pointer: 
0x0000000000c12db0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x72606)[0x7fb3144ee606]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x6c)[0x7fb3144f333c]
/lib/x86_64-linux-gnu/libreadline.so.6(rl_set_prompt+0x1d)[0x7fb314c6031d]
/lib/x86_64-linux-gnu/libreadline.so.6(readline+0x12)[0x7fb314c613c2]
/usr/local/bin/avrdude[0x407995]
/usr/local/bin/avrdude[0x407b1a]
/usr/local/bin/avrdude[0x405274]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd)[0x7fb31449aead]
/usr/local/bin/avrdude[0x402dd9]
======= Memory map: ========
00400000-0045b000 r-xp 00000000 08:02 27132246                           
/usr/local/bin/avrdude
0065a000-0065c000 rw-p 0005a000 08:02 27132246                           
/usr/local/bin/avrdude
0065c000-00660000 rw-p 00000000 00:00 0 
00a02000-00c57000 rw-p 00000000 00:00 0                                  [heap]
7fb30c000000-7fb30c021000 rw-p 00000000 00:00 0 
7fb30c021000-7fb310000000 ---p 00000000 00:00 0 
7fb313ac6000-7fb313adb000 r-xp 00000000 08:02 15990938                   
/lib/x86_64-linux-gnu/libgcc_s.so.1
7fb313adb000-7fb313cdb000 ---p 00015000 08:02 15990938                   
/lib/x86_64-linux-gnu/libgcc_s.so.1
7fb313cdb000-7fb313cdc000 rw-p 00015000 08:02 15990938                   
/lib/x86_64-linux-gnu/libgcc_s.so.1
7fb313cdc000-7fb313e54000 r--p 00000000 08:02 26871997                   
/usr/lib/locale/locale-archive
7fb313e54000-7fb313e56000 r-xp 00000000 08:02 16007261                   
/lib/x86_64-linux-gnu/libdl-2.13.so
7fb313e56000-7fb314056000 ---p 00002000 08:02 16007261                   
/lib/x86_64-linux-gnu/libdl-2.13.so
7fb314056000-7fb314057000 r--p 00002000 08:02 16007261                   
/lib/x86_64-linux-gnu/libdl-2.13.so
7fb314057000-7fb314058000 rw-p 00003000 08:02 16007261                   
/lib/x86_64-linux-gnu/libdl-2.13.so
7fb314058000-7fb31406f000 r-xp 00000000 08:02 16007265                   
/lib/x86_64-linux-gnu/libpthread-2.13.so
7fb31406f000-7fb31426e000 ---p 00017000 08:02 16007265                   
/lib/x86_64-linux-gnu/libpthread-2.13.so
7fb31426e000-7fb31426f000 r--p 00016000 08:02 16007265                   
/lib/x86_64-linux-gnu/libpthread-2.13.so
7fb31426f000-7fb314270000 rw-p 00017000 08:02 16007265                   
/lib/x86_64-linux-gnu/libpthread-2.13.so
7fb314270000-7fb314274000 rw-p 00000000 00:00 0 
7fb314274000-7fb31427b000 r-xp 00000000 08:02 16007267                   
/lib/x86_64-linux-gnu/librt-2.13.so
7fb31427b000-7fb31447a000 ---p 00007000 08:02 16007267                   
/lib/x86_64-linux-gnu/librt-2.13.so
7fb31447a000-7fb31447b000 r--p 00006000 08:02 16007267                   
/lib/x86_64-linux-gnu/librt-2.13.so
7fb31447b000-7fb31447c000 rw-p 00007000 08:02 16007267                   
/lib/x86_64-linux-gnu/librt-2.13.so
7fb31447c000-7fb3145f6000 r-xp 00000000 08:02 16005035                   
/lib/x86_64-linux-gnu/libc-2.13.so
7fb3145f6000-7fb3147f6000 ---p 0017a000 08:02 16005035                   
/lib/x86_64-linux-gnu/libc-2.13.so
7fb3147f6000-7fb3147fa000 r--p 0017a000 08:02 16005035                   
/lib/x86_64-linux-gnu/libc-2.13.so
7fb3147fa000-7fb3147fb000 rw-p 0017e000 08:02 16005035                   
/lib/x86_64-linux-gnu/libc-2.13.so
7fb3147fb000-7fb314800000 rw-p 00000000 00:00 0 
7fb314800000-7fb314823000 r-xp 00000000 08:02 15990901                   
/lib/x86_64-linux-gnu/libtinfo.so.5.9
7fb314823000-7fb314a23000 ---p 00023000 08:02 15990901                   
/lib/x86_64-linux-gnu/libtinfo.so.5.9
7fb314a23000-7fb314a27000 r--p 00023000 08:02 15990901                   
/lib/x86_64-linux-gnu/libtinfo.so.5.9
7fb314a27000-7fb314a28000 rw-p 00027000 08:02 15990901                   
/lib/x86_64-linux-gnu/libtinfo.so.5.9
7fb314a28000-7fb314a49000 r-xp 00000000 08:02 15991082                   
/lib/x86_64-linux-gnu/libncurses.so.5.9
7fb314a49000-7fb314c48000 ---p 00021000 08:02 15991082                   
/lib/x86_64-linux-gnu/libncurses.so.5.9
7fb314c48000-7fb314c49000 r--p 00020000 08:02 15991082                   
/lib/x86_64-linux-gnu/libncurses.so.5.9
7fb314c49000-7fb314c4a000 rw-p 00021000 08:02 15991082                   
/lib/x86_64-linux-gnu/libncurses.so.5.9
7fb314c4a000-7fb314c87000 r-xp 00000000 08:02 16006312                   
/lib/x86_64-linux-gnu/libreadline.so.6.2
7fb314c87000-7fb314e87000 ---p 0003d000 08:02 16006312                   
/lib/x86_64-linux-gnu/libreadline.so.6.2
7fb314e87000-7fb314e89000 r--p 0003d000 08:02 16006312                   
/lib/x86_64-linux-gnu/libreadline.so.6.2
7fb314e89000-7fb314e8f000 rw-p 0003f000 08:02 16006312                   
/lib/x86_64-linux-gnu/libreadline.so.6.2
7fb314e8f000-7fb314e91000 rw-p 00000000 00:00 0 
7fb314e91000-7fb314f12000 r-xp 00000000 08:02 16007254                   
/lib/x86_64-linux-gnu/libm-2.13.so
7fb314f12000-7fb315111000 ---p 00081000 08:02 16007254                   
/lib/x86_64-linux-gnu/libm-2.13.so
7fb315111000-7fb315112000 r--p 00080000 08:02 16007254                   
/lib/x86_64-linux-gnu/libm-2.13.so
7fb315112000-7fb315113000 rw-p 00081000 08:02 16007254                   
/lib/x86_64-linux-gnu/libm-2.13.so
7fb315113000-7fb31511a000 r-xp 00000000 08:02 26873674                   
/usr/lib/x86_64-linux-gnu/libftdi.so.1.19.0
7fb31511a000-7fb315319000 ---p 00007000 08:02 26873674                   
/usr/lib/x86_64-linux-gnu/libftdi.so.1.19.0
7fb315319000-7fb31531a000 rw-p 00006000 08:02 26873674                   
/usr/lib/x86_64-linux-gnu/libftdi.so.1.19.0
7fb31531a000-7fb315327000 r-xp 00000000 08:02 16006309                   
/lib/x86_64-linux-gnu/libusb-1.0.so.0.0.0
7fb315327000-7fb315526000 ---p 0000d000 08:02 16006309                   
/lib/x86_64-linux-gnu/libusb-1.0.so.0.0.0
7fb315526000-7fb315527000 rw-p 0000c000 08:02 16006309                   
/lib/x86_64-linux-gnu/libusb-1.0.so.0.0.0
7fb315527000-7fb31552e000 r-xp 00000000 08:02 15990887                   
/lib/x86_64-linux-gnu/libusb-0.1.so.4.4.4
7fb31552e000-7fb31572d000 ---p 00007000 08:02 15990887                   
/lib/x86_64-linux-gnu/libusb-0.1.so.4.4.4
7fb31572d000-7fb31572e000 rw-p 00006000 08:02 15990887                   
/lib/x86_64-linux-gnu/libusb-0.1.so.4.4.4
7fb31572e000-7fb31572f000 rw-p 00000000 00:00 0 
7fb31572f000-7fb31574e000 r-xp 00000000 08:02 16007269                   
/lib/x86_64-linux-gnu/ld-2.13.so
7fb315898000-7fb315921000 rw-p 00000000 00:00 0 
7fb315943000-7fb315944000 rw-p 00000000 00:00 0 
7fb315944000-7fb31594b000 r--s 00000000 08:02 26887515                   
/usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
7fb31594b000-7fb31594e000 rw-p 00000000 00:00 0 
7fb31594e000-7fb31594f000 r--p 0001f000 08:02 16007269                   
/lib/x86_64-linux-gnu/ld-2.13.so
7fb31594f000-7fb315950000 rw-p 00020000 08:02 16007269                   
/lib/x86_64-linux-gnu/ld-2.13.so
7fb315950000-7fb315951000 rw-p 00000000 00:00 0 
7fff78a36000-7fff78a57000 rw-p 00000000 00:00 0                          [stack]
7fff78bfe000-7fff78c00000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  
[vsyscall]
Abandon
Index: jtagmkII.c
===================================================================
--- jtagmkII.c	(révision 1018)
+++ jtagmkII.c	(copie de travail)
@@ -166,6 +166,9 @@
                                  unsigned int page_size,
                                  unsigned int addr, unsigned int n_bytes);
 
+static int jtagmkII_dragon_open32(PROGRAMMER * pgm, char * port);
+
+
 void jtagmkII_setup(PROGRAMMER * pgm)
 {
   if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
@@ -1676,7 +1679,81 @@
   return 0;
 }
 
+static int jtagmkII_dragon_open32(PROGRAMMER * pgm, char * port)
+{
+  int status;
+  unsigned char buf[6], *resp;
+  long baud;
 
+  if (verbose >= 2)
+    fprintf(stderr, "%s: jtagmkII_dragon_open()\n", progname);
+
+  /*
+   * The JTAG ICE mkII always starts with a baud rate of 19200 Bd upon
+   * attaching.  If the config file or command-line parameters specify
+   * a higher baud rate, we switch to it later on, after establishing
+   * the connection with the ICE.
+   */
+  baud = 19200;
+
+  /*
+   * If the port name starts with "usb", divert the serial routines
+   * to the USB ones.  The serial_open() function for USB overrides
+   * the meaning of the "baud" parameter to be the USB device ID to
+   * search for.
+   */
+  if (strncmp(port, "usb", 3) == 0) {
+#if defined(HAVE_LIBUSB)
+    serdev = &usb_serdev;
+    baud = USB_DEVICE_AVRDRAGON;
+#else
+    fprintf(stderr, "avrdude was compiled without usb support.\n");
+    return -1;
+#endif
+  }
+
+  strcpy(pgm->port, port);
+  if (serial_open(port, baud, &pgm->fd)==-1) {
+    return -1;
+  }
+
+  /*
+   * drain any extraneous input
+   */
+  jtagmkII_drain(pgm, 0);
+
+  if (jtagmkII_getsync(pgm, EMULATOR_MODE_JTAG) < 0)
+    return -1;
+
+  // AVR32 "special"
+  buf[0] = CMND_SET_PARAMETER;
+  buf[1] = 0x2D;
+  buf[2] = 0x03;
+  jtagmkII_send(pgm, buf, 3);
+  status = jtagmkII_recv(pgm, &resp);
+  if(status < 0 || resp[0] != RSP_OK)
+    return -1;
+  free(resp);
+
+  buf[1] = 0x03;
+  buf[2] = 0x02;
+  jtagmkII_send(pgm, buf, 3);
+  status = jtagmkII_recv(pgm, &resp);
+  if(status < 0 || resp[0] != RSP_OK)
+    return -1;
+  free(resp);
+
+  buf[1] = 0x03;
+  buf[2] = 0x04;
+  jtagmkII_send(pgm, buf, 3);
+  status = jtagmkII_recv(pgm, &resp);
+  if(status < 0 || resp[0] != RSP_OK)
+    return -1;
+  free(resp);
+
+  return 0;
+}
+
 void jtagmkII_close(PROGRAMMER * pgm)
 {
   int status;
@@ -3734,6 +3811,38 @@
   pgm->flag           = PGM_FL_IS_DW;
 }
 
+void jtagmkII_dragon_avr32_initpgm(PROGRAMMER * pgm)
+{
+  strcpy(pgm->type, "DRAGON_AVR32");
+
+  /*
+   * mandatory functions
+   */
+  pgm->initialize     = jtagmkII_initialize32;
+  pgm->display        = jtagmkII_display;
+  pgm->enable         = jtagmkII_enable;
+  pgm->disable        = jtagmkII_disable;
+  pgm->program_enable = jtagmkII_program_enable_dummy;
+  pgm->chip_erase     = jtagmkII_chip_erase32;
+  pgm->open           = jtagmkII_dragon_open32;
+  pgm->close          = jtagmkII_close32;
+  pgm->read_byte      = jtagmkII_read_byte;
+  pgm->write_byte     = jtagmkII_write_byte;
+
+  /*
+   * optional functions
+   */
+  pgm->paged_write    = jtagmkII_paged_write32;
+  pgm->paged_load     = jtagmkII_paged_load32;
+  pgm->print_parms    = jtagmkII_print_parms;
+  pgm->set_sck_period = jtagmkII_set_sck_period;
+  pgm->parseextparams = jtagmkII_parseextparms;
+  pgm->setup          = jtagmkII_setup;
+  pgm->teardown       = jtagmkII_teardown;
+  pgm->page_size      = 256;
+  pgm->flag           = PGM_FL_IS_JTAG;
+}
+
 void jtagmkII_avr32_initpgm(PROGRAMMER * pgm)
 {
   strcpy(pgm->type, "JTAGMKII_AVR32");
Index: jtagmkII.h
===================================================================
--- jtagmkII.h	(révision 1018)
+++ jtagmkII.h	(copie de travail)
@@ -40,6 +40,7 @@
 void jtagmkII_dragon_initpgm (PROGRAMMER * pgm);
 void jtagmkII_dragon_dw_initpgm (PROGRAMMER * pgm);
 void jtagmkII_dragon_pdi_initpgm (PROGRAMMER * pgm);
+void jtagmkII_dragon_avr32_initpgm(PROGRAMMER * pgm);
 
 /*
  * These functions are referenced from stk500v2.c for JTAG ICE mkII
Index: config_gram.y
===================================================================
--- config_gram.y	(révision 1018)
+++ config_gram.y	(copie de travail)
@@ -103,6 +103,7 @@
 %token K_DRAGON_JTAG
 %token K_DRAGON_PDI
 %token K_DRAGON_PP
+%token K_DRAGON_AVR32
 %token K_STK500_DEVCODE
 %token K_AVR910_DEVCODE
 %token K_EEPROM
@@ -532,6 +533,11 @@
       jtagmkII_avr32_initpgm(current_prog);
     }
   } |
+  K_TYPE TKN_EQUAL K_DRAGON_AVR32 {
+    {
+      jtagmkII_dragon_avr32_initpgm(current_prog);
+    }
+  } |
 
   K_TYPE TKN_EQUAL K_JTAG_MKII_DW {
     {
Index: ChangeLog
===================================================================
--- ChangeLog	(révision 1018)
+++ ChangeLog	(copie de travail)
@@ -1,3 +1,9 @@
+2011-11-06  Julien Aube  <[email protected]>
+
+	* jtakmkII.c: Added a new programmer type "dragon_avr32", to 
+	let an AVR dragon program AVR32 parts.
+	* avrdude.conf: 32UC3A1256 part to config file.
+
 2011-10-19  Joerg Wunsch <[email protected]>
 
 	* configure.ac: Replace "cvs" in version number by "svn".
Index: lexer.l
===================================================================
--- lexer.l	(révision 1018)
+++ lexer.l	(copie de travail)
@@ -144,6 +144,7 @@
 dragon_jtag      { yylval=NULL; return K_DRAGON_JTAG; }
 dragon_pdi       { yylval=NULL; return K_DRAGON_PDI; }
 dragon_pp        { yylval=NULL; return K_DRAGON_PP; }
+dragon_avr32     { yylval=NULL; return K_DRAGON_AVR32; }
 eecr             { yylval=NULL; return K_EECR; }
 eeprom           { yylval=NULL; return K_EEPROM; }
 enablepageprogramming { yylval=NULL; return K_ENABLEPAGEPROGRAMMING; }
_______________________________________________
avrdude-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/avrdude-dev

Reply via email to