From 04203ce8921fc81d97b207035a41aa541cbbc412 Mon Sep 17 00:00:00 2001 From: Joerg Wunsch <j@uriah.heep.sax.de> Date: Tue, 21 Nov 2006 11:56:26 +0000 Subject: [PATCH] Add debugWire entries for all devices where dW is known to exist (according to the XML files). Add an XSL stylesheet to extract the dW parameters from the XML files. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@690 81a1dc3b-b13d-400b-aceb-764788c761c2 --- ChangeLog | 2 + avrdude.conf.in | 33 ++++++++- tools/get-dw-params.xsl | 146 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 179 insertions(+), 2 deletions(-) create mode 100644 tools/get-dw-params.xsl diff --git a/ChangeLog b/ChangeLog index 2edfbef3..ed35b7cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,8 @@ * avrdude.conf.in: Add the new dW programmers. * avrdude.1: Document the dW support. * doc/avrdude.texi: (Ditto.) + * tools/get-dw-params.xsl: XSL stylesheet to extract the dW + parameters from the XML files. 2006-11-20 Joerg Wunsch <j@uriah.heep.sax.de> diff --git a/avrdude.conf.in b/avrdude.conf.in index 762a8679..200ae942 100644 --- a/avrdude.conf.in +++ b/avrdude.conf.in @@ -963,6 +963,8 @@ part part id = "t13"; desc = "ATtiny13"; + has_debugwire = yes; + flash_instr = 0xB4, 0x0E, 0x1E; stk500_devcode = 0x14; signature = 0x1e 0x90 0x07; chip_erase_delay = 4000; @@ -5911,6 +5913,8 @@ part part id = "t261"; desc = "ATTINY261"; + has_debugwire = yes; + flash_instr = 0xB4, 0x00, 0x10; # stk500_devcode = 0x21; # avr910_devcode = 0x5e; signature = 0x1e 0x91 0x0c; @@ -6095,6 +6099,8 @@ part part id = "t461"; desc = "ATTINY461"; + has_debugwire = yes; + flash_instr = 0xB4, 0x00, 0x10; # stk500_devcode = 0x21; # avr910_devcode = 0x5e; signature = 0x1e 0x92 0x08; @@ -6279,6 +6285,8 @@ part part id = "t861"; desc = "ATTINY861"; + has_debugwire = yes; + flash_instr = 0xB4, 0x00, 0x10; # stk500_devcode = 0x21; # avr910_devcode = 0x5e; signature = 0x1e 0x93 0x0d; @@ -6462,6 +6470,8 @@ part part id = "m48"; desc = "ATMEGA48"; + has_debugwire = yes; + flash_instr = 0xB6, 0x01, 0x11; stk500_devcode = 0x59; # avr910_devcode = 0x; signature = 0x1e 0x92 0x05; @@ -6644,6 +6654,8 @@ part part id = "m88"; desc = "ATMEGA88"; + has_debugwire = yes; + flash_instr = 0xB6, 0x01, 0x11; stk500_devcode = 0x73; # avr910_devcode = 0x; signature = 0x1e 0x93 0x0a; @@ -6825,6 +6837,8 @@ part part id = "m168"; desc = "ATMEGA168"; + has_debugwire = yes; + flash_instr = 0xB6, 0x01, 0x11; stk500_devcode = 0x86; # avr910_devcode = 0x; signature = 0x1e 0x94 0x06; @@ -7008,6 +7022,8 @@ part part id = "t2313"; desc = "ATtiny2313"; + has_debugwire = yes; + flash_instr = 0xB2, 0x0F, 0x1F; stk500_devcode = 0x23; ## Use the ATtiny26 devcode: avr910_devcode = 0x5e; @@ -7190,6 +7206,8 @@ part part id = "pwm2"; desc = "AT90PWM2"; + has_debugwire = yes; + flash_instr = 0xB6, 0x01, 0x11; stk500_devcode = 0x65; ## avr910_devcode = ?; signature = 0x1e 0x93 0x81; @@ -7369,6 +7387,8 @@ part part id = "pwm3"; desc = "AT90PWM3"; + has_debugwire = yes; + flash_instr = 0xB6, 0x01, 0x11; stk500_devcode = 0x65; ## avr910_devcode = ?; signature = 0x1e 0x93 0x81; @@ -7546,6 +7566,8 @@ part part id = "t25"; desc = "ATtiny25"; + has_debugwire = yes; + flash_instr = 0xB4, 0x02, 0x12; ## no STK500 devcode in XML file, use the ATtiny45 one stk500_devcode = 0x14; ## avr910_devcode = ?; @@ -7721,6 +7743,8 @@ part part id = "t45"; desc = "ATtiny45"; + has_debugwire = yes; + flash_instr = 0xB4, 0x02, 0x12; stk500_devcode = 0x14; ## avr910_devcode = ?; ## Try the AT90S2313 devcode: @@ -7895,6 +7919,8 @@ part part id = "t85"; desc = "ATtiny85"; + has_debugwire = yes; + flash_instr = 0xB4, 0x02, 0x12; ## no STK500 devcode in XML file, use the ATtiny45 one stk500_devcode = 0x14; ## avr910_devcode = ?; @@ -9022,6 +9048,8 @@ part part id = "t24"; desc = "ATtiny24"; + has_debugwire = yes; + flash_instr = 0xB4, 0x07, 0x17; ## no STK500 devcode in XML file, use the ATtiny45 one stk500_devcode = 0x14; ## avr910_devcode = ?; @@ -9200,6 +9228,7 @@ part id = "t44"; desc = "ATtiny44"; has_debugwire = yes; + flash_instr = 0xB4, 0x07, 0x17; ## no STK500 devcode in XML file, use the ATtiny45 one stk500_devcode = 0x14; ## avr910_devcode = ?; @@ -9246,8 +9275,6 @@ part programfusepolltimeout = 25; programlockpolltimeout = 25; - flash_instr = 0xb4, 0x07, 0x17; - memory "eeprom" size = 256; paged = no; @@ -9379,6 +9406,8 @@ part part id = "t84"; desc = "ATtiny84"; + has_debugwire = yes; + flash_instr = 0xB4, 0x07, 0x17; ## no STK500 devcode in XML file, use the ATtiny45 one stk500_devcode = 0x14; ## avr910_devcode = ?; diff --git a/tools/get-dw-params.xsl b/tools/get-dw-params.xsl new file mode 100644 index 00000000..e5cb7987 --- /dev/null +++ b/tools/get-dw-params.xsl @@ -0,0 +1,146 @@ +<?xml version="1.0" encoding='ISO-8859-1' ?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +<!-- + * Copyright (c) 2006 Joerg Wunsch + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * + * $Id$ +--> +<!-- + * Extract the debugWire parameters + * from the XML, and format it the way src/devdescr.cc needs it. + * + * Run this file together with the respective AVR's XML file through + * an XSLT processor (xsltproc, saxon), and capture the output for + * inclusion into avrdude.conf.in. +--> + <xsl:output method="text"/> + <xsl:template match="/"> + <!-- Extract everything we need out of the XML. --> + <xsl:variable name="devname_orig" + select="/AVRPART/ADMIN/PART_NAME" /> + <xsl:variable name="devname" + select="translate(/AVRPART/ADMIN/PART_NAME, + 'abcdefghijklmnopqrstuvwxyz', + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')" /> + <xsl:variable name="devname_lower" + select="translate(/AVRPART/ADMIN/PART_NAME, + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', + 'abcdefghijklmnopqrstuvwxyz')" /> + <xsl:variable name="ucFlashInst" + select="//AVRPART/ICE_SETTINGS/JTAGICEmkII/ucFlashInst" /> + + <!-- If there's a JTAGICEmkII node indicating debugWire, emit the entry. --> + <xsl:if test='//AVRPART/ICE_SETTINGS/JTAGICEmkII/Interface="DebugWire"'> + + <!-- start of new entry --> + <xsl:text>#------------------------------------------------------------
</xsl:text> + <xsl:text># </xsl:text> + <xsl:value-of select="$devname_orig" /> + <xsl:text>
</xsl:text> + <xsl:text>#------------------------------------------------------------
</xsl:text> + <xsl:text>part
 desc = "</xsl:text> + <xsl:value-of select="$devname_orig" /> + <xsl:text>";
 has_debugwire = yes;
</xsl:text> + + <xsl:text> flash_instr = </xsl:text> + <xsl:call-template name="format-hex"> + <xsl:with-param name="arg" select="$ucFlashInst" /> + <xsl:with-param name="count" select="0" /> + </xsl:call-template> + <xsl:text>;
</xsl:text> + + </xsl:if> <!-- JTAGICEmkII uses debugWire --> + + </xsl:template> + + <xsl:template name="toupper"> + </xsl:template> + + <!-- return argument $arg if non-empty, 0 otherwise --> + <xsl:template name="maybezero"> + <xsl:param name="arg" /> + <xsl:choose> + <xsl:when test="string-length($arg) = 0"><xsl:text>0</xsl:text></xsl:when> + <xsl:otherwise><xsl:value-of select="$arg" /></xsl:otherwise> + </xsl:choose> + </xsl:template> <!-- maybezero --> + + <!-- convert $XX hex number in $arg (if any) into 0xXX; --> + <!-- return 0 if $arg is empty --> + <xsl:template name="dollar-to-0x"> + <xsl:param name="arg" /> + <xsl:choose> + <xsl:when test="string-length($arg) = 0"> + <xsl:text>0</xsl:text> + </xsl:when> + <xsl:when test="substring($arg, 1, 1) = '$'"> + <xsl:text>0x</xsl:text> + <xsl:value-of select="substring($arg, 2)" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$arg" /> + </xsl:otherwise> + </xsl:choose> + </xsl:template> <!-- dollar-to-0x --> + + <!-- Format a string of 0xXX numbers: start a new line --> + <!-- after each 8 hex numbers --> + <!-- call with parameter $count = 0, calls itself --> + <!-- recursively then until everything has been done --> + <xsl:template name="format-hex"> + <xsl:param name="arg" /> + <xsl:choose> + <xsl:when test="string-length($arg) <= 4"> + <!-- Last element, print it, and leave template. --> + <xsl:value-of select="$arg" /> + </xsl:when> + <xsl:otherwise> + <!-- + * More arguments follow, print first value, + * followed by a comma, decide whether a space + * or a newline needs to be emitted, and recurse + * with the remaining part of $arg. + --> + <xsl:value-of select="substring($arg, 1, 4)" /> + <xsl:choose> + <xsl:when test="$count mod 8 = 7"> + <xsl:text>,
	 </xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>, </xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:variable name="newarg"> + <!-- see whether there is a space after comma --> + <xsl:choose> + <xsl:when test="substring($arg, 6, 1) = ' '"> + <xsl:value-of select="substring($arg, 7)" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring($arg, 6)" /> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:call-template name="format-hex"> + <xsl:with-param name="arg" select="$newarg" /> + <xsl:with-param name="count" select="$count + 1" /> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + +</xsl:stylesheet>