Submitted by Jan Egil Ruud:

patch #10000: Add support for extended UPDI device context
* avrdude.conf.in (pickit4_updi, snap_updi, pkobn_updi):
new programmers
* avrdude.conf.in (ATmega808, ATmega809, ATmega1608, ATmega1609)
(AVR DA, AVR DB): new devices
* jtag3.c: Add support for extended UPDI device context
* jtag3_private.h: (Dito.)
* tools/atdf-to-avrdude.xslt: Bug fixes
* usbdevs.h: Bump USBDEV_MAX_XFER_3 to 912
* doc/avrdude.texi: Document changes
* avrdude.1: (Dito)



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1454 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Joerg Wunsch 2021-11-06 22:13:51 +00:00
parent c9aeaf8928
commit e074edf4cb
9 changed files with 1112 additions and 33 deletions

View File

@ -1,3 +1,18 @@
2021-11-06 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Jan Egil Ruud:
patch #10000: Add support for extended UPDI device context
* avrdude.conf.in (pickit4_updi, snap_updi, pkobn_updi):
new programmers
* avrdude.conf.in (ATmega808, ATmega809, ATmega1608, ATmega1609)
(AVR DA, AVR DB): new devices
* jtag3.c: Add support for extended UPDI device context
* jtag3_private.h: (Dito.)
* tools/atdf-to-avrdude.xslt: Bug fixes
* usbdevs.h: Bump USBDEV_MAX_XFER_3 to 912
* doc/avrdude.texi: Document changes
* avrdude.1: (Dito)
2021-06-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de> 2021-06-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #60753: Patch #1436 breaks multiple programmer/device combinations on MacOS BigSur bug #60753: Patch #1436 breaks multiple programmer/device combinations on MacOS BigSur

4
NEWS
View File

@ -17,6 +17,7 @@ Current:
- AVR Doper uses libhidapi rather than raw libusb (patch #9033) - AVR Doper uses libhidapi rather than raw libusb (patch #9033)
- -P net:host:port can use IPv6 now (Posix systems only) - -P net:host:port can use IPv6 now (Posix systems only)
- New configure option: -disable-libusb_1_0 - New configure option: -disable-libusb_1_0
- extended UPDI device context (> 64 Ki flash)
* New devices supported: * New devices supported:
@ -31,6 +32,7 @@ Current:
- ATtiny841, ATtiny441 - ATtiny841, ATtiny441
- ATmega64M1 - ATmega64M1
- ATmega324A - ATmega324A
- ATmega808, ATmega809, ATmega1608, ATmega1609, AVR DA, AVR DB
* New programmers supported: * New programmers supported:
@ -40,6 +42,7 @@ Current:
- JTAGICE3 in UPDI mode - JTAGICE3 in UPDI mode
- Atmel Powerdebugger in all modes (JTAG, PDI, UPDI, debugWIRE, ISP) - Atmel Powerdebugger in all modes (JTAG, PDI, UPDI, debugWIRE, ISP)
- linuxspi (direct SPI bus e.g. on Raspberry Pi devices) - linuxspi (direct SPI bus e.g. on Raspberry Pi devices)
- PICkit4, Snap, PKoB
* Bugfixes: * Bugfixes:
bug #47550: Linux GPIO broken bug #47550: Linux GPIO broken
@ -85,6 +88,7 @@ Current:
patch #9816: Implement new programmer type: linuxspi patch #9816: Implement new programmer type: linuxspi
patch #9811: ATmega328pb has efuse bit 3 patch #9811: ATmega328pb has efuse bit 3
patch #9744: Patch for ATMega324A support patch #9744: Patch for ATMega324A support
patch #10000: Add support for extended UPDI device context
* Internals: * Internals:
- New avrdude.conf keyword "family_id", used to verify SIB attributes - New avrdude.conf keyword "family_id", used to verify SIB attributes

View File

@ -219,6 +219,12 @@ The Atmel DFU bootloader is supported in both, FLIP protocol version 1
(AT90USB* and ATmega*U* devices), as well as version 2 (Xmega devices). (AT90USB* and ATmega*U* devices), as well as version 2 (Xmega devices).
See below for some hints about FLIP version 1 protocol behaviour. See below for some hints about FLIP version 1 protocol behaviour.
.Pp .Pp
The MPLAB(R) PICkit 4, MPLAB(R) SNAP, and Curiosity Nano boards are
supported in UPDI mode. The Curiosity Nano board is dubbed
.Dq PICkit on Board ,
thus the name
.Pa pkobn_updi .
.Pp
Input files can be provided, and output files can be written in Input files can be provided, and output files can be written in
different file formats, such as raw binary files containing the data different file formats, such as raw binary files containing the data
to download to the chip, Intel hex format, or Motorola S-record to download to the chip, Intel hex format, or Motorola S-record

File diff suppressed because it is too large Load Diff

View File

@ -287,6 +287,10 @@ The Atmel DFU bootloader is supported in both, FLIP protocol version 1
(AT90USB* and ATmega*U* devices), as well as version 2 (Xmega devices). (AT90USB* and ATmega*U* devices), as well as version 2 (Xmega devices).
See below for some hints about FLIP version 1 protocol behaviour. See below for some hints about FLIP version 1 protocol behaviour.
The MPLAB(R) PICkit 4, MPLAB(R) SNAP, and Curiosity Nano boards are
supported in UPDI mode. The Curiosity Nano board is dubbed ``PICkit on
Board'', thus the name @code{pkobn_updi}.
@menu @menu
* History:: * History::

61
jtag3.c
View File

@ -1181,32 +1181,81 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p)
m = ldata(ln); m = ldata(ln);
if (strcmp(m->desc, "flash") == 0) if (strcmp(m->desc, "flash") == 0)
{ {
u16_to_b2(xd.prog_base, m->offset); u16_to_b2(xd.prog_base, m->offset&0xFFFF);
xd.prog_base_msb = m->offset>>16;
if (m->readsize != 0 && m->readsize < m->page_size) if (m->readsize != 0 && m->readsize < m->page_size)
PDATA(pgm)->flash_pagesize = m->readsize; PDATA(pgm)->flash_pagesize = m->readsize;
else else
PDATA(pgm)->flash_pagesize = m->page_size; PDATA(pgm)->flash_pagesize = m->page_size;
xd.flash_page_size = m->page_size; xd.flash_page_size = m->page_size & 0xFF;
xd.flash_page_size_msb = (m->page_size)>>8;
u32_to_b4(xd.flash_bytes, m->size);
if (m->offset > 0xFFFF)
xd.address_mode = UPDI_ADDRESS_MODE_24BIT;
else
xd.address_mode = UPDI_ADDRESS_MODE_16BIT;
} }
else if (strcmp(m->desc, "eeprom") == 0) else if (strcmp(m->desc, "eeprom") == 0)
{ {
PDATA(pgm)->eeprom_pagesize = m->page_size; PDATA(pgm)->eeprom_pagesize = m->page_size;
xd.eeprom_page_size = m->page_size; xd.eeprom_page_size = m->page_size;
u16_to_b2(xd.eeprom_bytes, m->size);
u16_to_b2(xd.eeprom_base, m->offset);
}
else if (strcmp(m->desc, "usersig") == 0)
{
u16_to_b2(xd.user_sig_bytes, m->size);
u16_to_b2(xd.user_sig_base, m->offset);
}
else if (strcmp(m->desc, "signature") == 0)
{
u16_to_b2(xd.signature_base, m->offset);
xd.device_id[0] = p->signature[1];
xd.device_id[1] = p->signature[2];
}
else if (strcmp(m->desc, "fuses") == 0)
{
xd.fuses_bytes = m->size;
u16_to_b2(xd.fuses_base, m->offset);
}
else if (strcmp(m->desc, "lock") == 0)
{
u16_to_b2(xd.lockbits_base, m->offset);
} }
} }
u16_to_b2(xd.default_min_div1_voltage, DEFAULT_MINIMUM_CHARACTERISED_DIV1_VOLTAGE_MV);
u16_to_b2(xd.default_min_div2_voltage, DEFAULT_MINIMUM_CHARACTERISED_DIV2_VOLTAGE_MV);
u16_to_b2(xd.default_min_div4_voltage, DEFAULT_MINIMUM_CHARACTERISED_DIV4_VOLTAGE_MV);
u16_to_b2(xd.default_min_div8_voltage, DEFAULT_MINIMUM_CHARACTERISED_DIV8_VOLTAGE_MV);
u16_to_b2(xd.pdi_pad_fmax, MAX_FREQUENCY_SHARED_UPDI_PIN);
xd.syscfg_offset = FUSES_SYSCFG0_OFFSET;
xd.syscfg_write_mask_and = 0xFF;
xd.syscfg_write_mask_or = 0x00;
xd.syscfg_erase_mask_and = 0xFF;
xd.syscfg_erase_mask_or = 0x00;
avrdude_message(MSG_NOTICE2, "UPDI SET: \n\t" avrdude_message(MSG_NOTICE2, "UPDI SET: \n\t"
"xd->prog_base_msb=%x\n\t"
"xd->prog_base=%x %x\n\t" "xd->prog_base=%x %x\n\t"
"xd->flash_page_size_msb=%x\n\t"
"xd->flash_page_size=%x\n\t" "xd->flash_page_size=%x\n\t"
"xd->eeprom_page_size=%x\n\t" "xd->eeprom_page_size=%x\n\t"
"xd->nvmctrl=%x %x\n\t" "xd->nvmctrl=%x %x\n\t"
"xd->ocd=%x %x\n", "xd->ocd=%x %x\n\t",
"xd->address_mode=%x\n",
xd.prog_base_msb,
xd.prog_base[0], xd.prog_base[1], xd.prog_base[0], xd.prog_base[1],
xd.flash_page_size_msb,
xd.flash_page_size, xd.flash_page_size,
xd.eeprom_page_size, xd.eeprom_page_size,
xd.nvm_base_addr[0], xd.nvm_base_addr[1], xd.nvm_base_addr[0], xd.nvm_base_addr[1],
xd.ocd_base_addr[0], xd.ocd_base_addr[1]); xd.ocd_base_addr[0], xd.ocd_base_addr[1],
xd.address_mode);
if (jtag3_setparm(pgm, SCOPE_AVR, 2, PARM3_DEVICEDESC, (unsigned char *)&xd, sizeof xd) < 0) if (jtag3_setparm(pgm, SCOPE_AVR, 2, PARM3_DEVICEDESC, (unsigned char *)&xd, sizeof xd) < 0)
return -1; return -1;
@ -1787,8 +1836,10 @@ static int jtag3_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
cmd[3] = MTYPE_USERSIG; cmd[3] = MTYPE_USERSIG;
} else if ( ( strcmp(m->desc, "boot") == 0 ) ) { } else if ( ( strcmp(m->desc, "boot") == 0 ) ) {
cmd[3] = MTYPE_BOOT_FLASH; cmd[3] = MTYPE_BOOT_FLASH;
} else if ( p->flags & AVRPART_HAS_PDI || p->flags & AVRPART_HAS_UPDI ) { } else if ( p->flags & AVRPART_HAS_PDI ) {
cmd[3] = MTYPE_FLASH; cmd[3] = MTYPE_FLASH;
} else if ( p->flags & AVRPART_HAS_UPDI ) {
cmd[3] = MTYPE_SRAM;
} else { } else {
cmd[3] = MTYPE_SPM; cmd[3] = MTYPE_SPM;
} }

View File

@ -284,6 +284,16 @@
#define CMSISDAP_CMD_SWD_CONFIGURE 0x13 /* configure SWD protocol; (byte) */ #define CMSISDAP_CMD_SWD_CONFIGURE 0x13 /* configure SWD protocol; (byte) */
#define DEFAULT_MINIMUM_CHARACTERISED_DIV1_VOLTAGE_MV 4500 // Default minimum voltage for 32M => 4.5V
#define DEFAULT_MINIMUM_CHARACTERISED_DIV2_VOLTAGE_MV 2700 // Default minimum voltage for 16M => 2.7V
#define DEFAULT_MINIMUM_CHARACTERISED_DIV4_VOLTAGE_MV 2200 // Default minimum voltage for 8M => 2.2V
#define DEFAULT_MINIMUM_CHARACTERISED_DIV8_VOLTAGE_MV 1500 // Default minimum voltage for 4M => 1.5V
#define MAX_FREQUENCY_DEDICATED_UPDI_PIN 1500
#define MAX_FREQUENCY_SHARED_UPDI_PIN 750
#define UPDI_ADDRESS_MODE_16BIT 0
#define UPDI_ADDRESS_MODE_24BIT 1
#define FUSES_SYSCFG0_OFFSET 5
#if !defined(JTAG3_PRIVATE_EXPORTED) #if !defined(JTAG3_PRIVATE_EXPORTED)
struct mega_device_desc { struct mega_device_desc {
@ -345,5 +355,39 @@ struct updi_device_desc {
unsigned char eeprom_page_size; unsigned char eeprom_page_size;
unsigned char nvm_base_addr[2]; unsigned char nvm_base_addr[2];
unsigned char ocd_base_addr[2]; unsigned char ocd_base_addr[2];
// Configuration below, except for "Extended memory support", is only used by kits with
// embedded debuggers (XPlained, Curiosity, ...).
unsigned char default_min_div1_voltage[2]; // Default minimum voltage for 32M => 4.5V -> 4500
unsigned char default_min_div2_voltage[2]; // Default minimum voltage for 16M => 2.7V -> 2700
unsigned char default_min_div4_voltage[2]; // Default minimum voltage for 8M => 2.2V -> 2200
unsigned char default_min_div8_voltage[2]; // Default minimum voltage for 4M => 1.5V -> 1500
unsigned char pdi_pad_fmax[2]; // 750
unsigned char flash_bytes[4]; // Flash size in bytes
unsigned char eeprom_bytes[2]; // EEPROM size in bytes
unsigned char user_sig_bytes[2]; // UserSignture size in bytes
unsigned char fuses_bytes; // Fuses size in bytes
unsigned char syscfg_offset; // Offset of SYSCFG0 within FUSE space
unsigned char syscfg_write_mask_and; // AND mask to apply to SYSCFG0 when writing
unsigned char syscfg_write_mask_or; // OR mask to apply to SYSCFG0 when writing
unsigned char syscfg_erase_mask_and; // AND mask to apply to SYSCFG0 after erase
unsigned char syscfg_erase_mask_or; // OR mask to apply to SYSCFG0 after erase
unsigned char eeprom_base[2]; // Base address for EEPROM memory
unsigned char user_sig_base[2]; // Base address for UserSignature memory
unsigned char signature_base[2]; // Base address for Signature memory
unsigned char fuses_base[2]; // Base address for Fuses memory
unsigned char lockbits_base[2]; // Base address for Lockbits memory
unsigned char device_id[2]; // Two last bytes of the device ID
// Extended memory support. Needed for flash >= 64kb
unsigned char prog_base_msb; // Extends prog_base, used in 24-bit mode
unsigned char flash_page_size_msb; // Extends flash_page_size, used in 24-bit mode
unsigned char address_mode; // 0x00 = 16-bit mode, 0x01 = 24-bit mode
}; };
#endif /* JTAG3_PRIVATE_EXPORTED */ #endif /* JTAG3_PRIVATE_EXPORTED */

View File

@ -154,6 +154,9 @@
<xsl:when test="contains($device-name, 'ATmega')"> <xsl:when test="contains($device-name, 'ATmega')">
<xsl:value-of select="replace($device-name, 'ATmega', 'm')"/> <xsl:value-of select="replace($device-name, 'ATmega', 'm')"/>
</xsl:when> </xsl:when>
<xsl:when test="starts-with($device-name, 'AVR')">
<xsl:value-of select="lower-case($device-name)"/>
</xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:message terminate="yes">Unable to deduce device id from '<xsl:value-of select="$device-name"/>'</xsl:message> <xsl:message terminate="yes">Unable to deduce device id from '<xsl:value-of select="$device-name"/>'</xsl:message>
</xsl:otherwise> </xsl:otherwise>
@ -166,6 +169,8 @@
<xsl:choose> <xsl:choose>
<xsl:when test="contains($device-name, 'ATtiny')">.avr8x_tiny</xsl:when> <xsl:when test="contains($device-name, 'ATtiny')">.avr8x_tiny</xsl:when>
<xsl:when test="contains($device-name, 'ATmega')">.avr8x_mega</xsl:when> <xsl:when test="contains($device-name, 'ATmega')">.avr8x_mega</xsl:when>
<xsl:when test="matches($device-name, '^AVR[0-9]{1,3}D')">.avrdx</xsl:when>
<xsl:when test="matches($device-name, '^AVR[0-9]{1,3}E')">.avrex</xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:message terminate="yes">Unable to deduce parent name from '<xsl:value-of select="$device-name"/>'</xsl:message> <xsl:message terminate="yes">Unable to deduce parent name from '<xsl:value-of select="$device-name"/>'</xsl:message>
</xsl:otherwise> </xsl:otherwise>

View File

@ -69,7 +69,14 @@
#define USBDEV_BULK_EP_WRITE_3 0x01 #define USBDEV_BULK_EP_WRITE_3 0x01
#define USBDEV_BULK_EP_READ_3 0x82 #define USBDEV_BULK_EP_READ_3 0x82
#define USBDEV_EVT_EP_READ_3 0x83 #define USBDEV_EVT_EP_READ_3 0x83
#define USBDEV_MAX_XFER_3 512 /*
* The mk3 tools (type jtagice3) have a maxPayloadSize of 912. When
* accessing paged memory the access should be limited to pageSize.
* When accessing memory without pageSize the payload should be
* limited to 256.
*/
#define USBDEV_MAX_XFER_3 912
#define USBDEV_MAX_XFER_3_UNPAGED 256
/* /*
* When operating on the JTAGICE3, usbdev_recv_frame() returns an * When operating on the JTAGICE3, usbdev_recv_frame() returns an