diff options
Diffstat (limited to 'src/avrdude/tools')
-rw-r--r-- | src/avrdude/tools/build-mingw32.sh | 54 | ||||
-rw-r--r-- | src/avrdude/tools/get-dw-params.xsl | 155 | ||||
-rw-r--r-- | src/avrdude/tools/get-hv-params.xsl | 254 | ||||
-rw-r--r-- | src/avrdude/tools/get-stk600-cards.xsl | 62 | ||||
-rw-r--r-- | src/avrdude/tools/get-stk600-devices.xsl | 51 |
5 files changed, 576 insertions, 0 deletions
diff --git a/src/avrdude/tools/build-mingw32.sh b/src/avrdude/tools/build-mingw32.sh new file mode 100644 index 000000000..2d9e11261 --- /dev/null +++ b/src/avrdude/tools/build-mingw32.sh @@ -0,0 +1,54 @@ +#! /bin/sh + +# ---------------------------------------------------------------------------- +# "THE BEER-WARE LICENSE" (Revision 42): +# Joerg Wunsch wrote this file. As long as you retain this notice you +# can do whatever you want with this stuff. If we meet some day, and you think +# this stuff is worth it, you can buy me a beer in return. +# ---------------------------------------------------------------------------- + +# Script to cross-compile a MinGW32 executable under unixish host. +# Run this script from within the tools/ subdirectory. +# Override MINGW32_PREFIX and LIBUSB_PREFIX from the commandline +# when invoking the script, like +# +# env LIBUSB_PREFIX="$HOME/dos/ProgramFiles/LibUSB-Win32" ./build-mingw32.sh +# +# The LibUSB-Win32 package is shipped as a self-installing +# executable; it can be unpacked using Wine, and typically +# extracts into the Wine environment. +# +# libelf can be cross-compiled, and installed into the MinGW32 +# target environment if desired. + +MINGW32_PREFIX=${MINGW32_PREFIX:-/usr/local/mingw32} +LIBUSB_PREFIX=${LIBUSB_PREFIX:-/WINDOWS/ProgramFiles/LibUSB-Win32} + +for CC in mingw32-gcc i686-w64-mingw32-gcc i586-mingw32msvc-gcc +do + touch foo.c + if ${CC} -c foo.c 2> /dev/null + then + rm -f foo.* + break + fi +done +tgt=$(expr "$CC" : "\(.*\)-gcc") + +BUILDDIR=build-mingw32 +mkdir -p ${BUILDDIR} || { echo "Cannot create build dir $BUILDDIR"; exit 1; } + +cd ${BUILDDIR} || { echo "Cannot chdir to $BUILDDIR"; exit 1; } + +LDFLAGS="-L${MINGW32_PREFIX}/lib -L${LIBUSB_PREFIX}/lib/gcc" +CPPFLAGS="-I${MINGW32_PREFIX}/include -I${LIBUSB_PREFIX}/include" + +env \ + CC="${CC}" \ + CPPFLAGS="${CPPFLAGS}" \ + LDFLAGS="${LDFLAGS}" \ + ../../configure \ + --host=$(../../config.guess) \ + --target=${tgt} + +make all diff --git a/src/avrdude/tools/get-dw-params.xsl b/src/avrdude/tools/get-dw-params.xsl new file mode 100644 index 000000000..a3f083e96 --- /dev/null +++ b/src/avrdude/tools/get-dw-params.xsl @@ -0,0 +1,155 @@ +<?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, see <http://www.gnu.org/licenses/>. + * + * $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="ucEepromInst" + select="//AVRPART/ICE_SETTINGS/JTAGICEmkII/ucEepromInst" /> + <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:text> eeprom_instr = </xsl:text> + <xsl:call-template name="format-hex"> + <xsl:with-param name="arg" select="$ucEepromInst" /> + <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:param name="count" /> + <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> diff --git a/src/avrdude/tools/get-hv-params.xsl b/src/avrdude/tools/get-hv-params.xsl new file mode 100644 index 000000000..b4a595f13 --- /dev/null +++ b/src/avrdude/tools/get-hv-params.xsl @@ -0,0 +1,254 @@ +<?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, see <http://www.gnu.org/licenses/>. + * + * $Id$ +--> +<!-- + * Extract high-voltage (parallel and serial) programming parameters + * out of the Atmel XML files, and convert them into avrdude.conf + * snippets. + * + * 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="/"> + <xsl:for-each select="//*"> + <xsl:if test='name() = "STK500_2"'> + + <!-- + * High-voltage parallel programming parameters. + --> + <xsl:for-each + select="*[starts-with(translate(name(), + 'abcdefghijklmnopqrstuvwxyz', + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), + 'PP')]"> + <xsl:if test="self::node()[name() = 'PPControlStack']" + > pp_controlstack = + <xsl:call-template name="format_cstack"> + <xsl:with-param name="stack" select="." /> + <xsl:with-param name="count" select="0" /> + </xsl:call-template>; +</xsl:if> <!-- PPControlStack --> + + <xsl:if test="self::node()[name() = 'PpEnterProgMode']"> + <xsl:for-each select="*"> + <xsl:if test="self::node()[name() = 'stabDelay']" + > hventerstabdelay = <xsl:value-of select="." />; +</xsl:if> + <xsl:if test="self::node()[name() = 'progModeDelay']" + > progmodedelay = <xsl:value-of select="." />; +</xsl:if> + <xsl:if test="self::node()[name() = 'latchCycles']" + > latchcycles = <xsl:value-of select="." />; +</xsl:if> + <xsl:if test="self::node()[name() = 'toggleVtg']" + > togglevtg = <xsl:value-of select="." />; +</xsl:if> + <xsl:if test="self::node()[name() = 'powerOffDelay']" + > poweroffdelay = <xsl:value-of select="." />; +</xsl:if> + <xsl:if test="self::node()[name() = 'resetDelayMs']" + > resetdelayms = <xsl:value-of select="." />; +</xsl:if> + <xsl:if test="self::node()[name() = 'resetDelayUs']" + > resetdelayus = <xsl:value-of select="." />; +</xsl:if> + </xsl:for-each> + </xsl:if> <!-- PpEnterProgMode --> + + <xsl:if test="self::node()[name() = 'PpLeaveProgMode']"> + <xsl:for-each select="*"> + <xsl:if test="self::node()[name() = 'stabDelay']" + > hvleavestabdelay = <xsl:value-of select="." />; +</xsl:if> + </xsl:for-each> + </xsl:if> <!-- PpLeaveProgMode --> + + <xsl:if test="self::node()[name() = 'PpChipErase']"> + <xsl:for-each select="*"> + <xsl:if test="self::node()[name() = 'pulseWidth']" + > chiperasepulsewidth = <xsl:value-of select="." />; +</xsl:if> + <xsl:if test="self::node()[name() = 'pollTimeout']" + > chiperasepolltimeout = <xsl:value-of select="." />; +</xsl:if> + </xsl:for-each> + </xsl:if> <!-- PpChipErase --> + + <xsl:if test="self::node()[name() = 'PpProgramFuse']"> + <xsl:for-each select="*"> + <xsl:if test="self::node()[name() = 'pulseWidth']" + > programfusepulsewidth = <xsl:value-of select="." />; +</xsl:if> + <xsl:if test="self::node()[name() = 'pollTimeout']" + > programfusepolltimeout = <xsl:value-of select="." />; +</xsl:if> + </xsl:for-each> + </xsl:if> <!-- PpProgramFuse --> + + <xsl:if test="self::node()[name() = 'PpProgramLock']"> + <xsl:for-each select="*"> + <xsl:if test="self::node()[name() = 'pulseWidth']" + > programlockpulsewidth = <xsl:value-of select="." />; +</xsl:if> + <xsl:if test="self::node()[name() = 'pollTimeout']" + > programlockpolltimeout = <xsl:value-of select="." />; +</xsl:if> + </xsl:for-each> + </xsl:if> <!-- PpProgramLock --> + + </xsl:for-each> <!-- PP parameters --> + + <!-- + * High-voltage serial programming parameters. + --> + <xsl:for-each + select="*[starts-with(translate(name(), + 'abcdefghijklmnopqrstuvwxyz', + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), + 'HVSP')]"> + + <xsl:if test="self::node()[name() = 'HvspControlStack']" + > hvsp_controlstack = + <xsl:call-template name="format_cstack"> + <xsl:with-param name="stack" select="." /> + <xsl:with-param name="count" select="0" /> + </xsl:call-template>; +</xsl:if> <!-- HvspControlStack --> + + <xsl:if test="self::node()[name() = 'HvspEnterProgMode']"> + <xsl:for-each select="*"> + <xsl:if test="self::node()[name() = 'stabDelay']" + > hventerstabdelay = <xsl:value-of select="." />; +</xsl:if> + <xsl:if test="self::node()[name() = 'cmdexeDelay']" + > hvspcmdexedelay = <xsl:value-of select="." />; +</xsl:if> + <xsl:if test="self::node()[name() = 'synchCycles']" + > synchcycles = <xsl:value-of select="." />; +</xsl:if> + <xsl:if test="self::node()[name() = 'latchCycles']" + > latchcycles = <xsl:value-of select="." />; +</xsl:if> + <xsl:if test="self::node()[name() = 'toggleVtg']" + > togglevtg = <xsl:value-of select="." />; +</xsl:if> + <xsl:if test="self::node()[name() = 'powoffDelay']" + > poweroffdelay = <xsl:value-of select="." />; +</xsl:if> + <xsl:if test="self::node()[name() = 'resetDelay1']" + > resetdelayms = <xsl:value-of select="." />; +</xsl:if> + <xsl:if test="self::node()[name() = 'resetDelay2']" + > resetdelayus = <xsl:value-of select="." />; +</xsl:if> + </xsl:for-each> + </xsl:if> <!-- HvspEnterProgMode --> + + <xsl:if test="self::node()[name() = 'HvspLeaveProgMode']"> + <xsl:for-each select="*"> + <xsl:if test="self::node()[name() = 'stabDelay']" + > hvleavestabdelay = <xsl:value-of select="." />; +</xsl:if> + <xsl:if test="self::node()[name() = 'resetDelay']" + > resetdelay = <xsl:value-of select="." />; +</xsl:if> + </xsl:for-each> + </xsl:if> <!-- HvspLeaveProgMode --> + + <xsl:if test="self::node()[name() = 'HvspChipErase']"> + <xsl:for-each select="*"> + <xsl:if test="self::node()[name() = 'pollTimeout']" + > chiperasepolltimeout = <xsl:value-of select="." />; +</xsl:if> + <xsl:if test="self::node()[name() = 'eraseTime']" + > chiperasetime = <xsl:value-of select="." />; +</xsl:if> + </xsl:for-each> + </xsl:if> <!-- HvspChipErase --> + + <xsl:if test="self::node()[name() = 'HvspProgramFuse']"> + <xsl:for-each select="*"> + <xsl:if test="self::node()[name() = 'pollTimeout']" + > programfusepolltimeout = <xsl:value-of select="." />; +</xsl:if> + </xsl:for-each> + </xsl:if> <!-- HvspProgramFuse --> + + <xsl:if test="self::node()[name() = 'HvspProgramLock']"> + <xsl:for-each select="*"> + <xsl:if test="self::node()[name() = 'pollTimeout']" + > programlockpolltimeout = <xsl:value-of select="." />; +</xsl:if> + </xsl:for-each> + </xsl:if> <!-- HvspProgramLock --> + + </xsl:for-each> <!-- HVSP parameters --> + + </xsl:if> <!-- STK500_2 parameters --> + </xsl:for-each> <!-- All nodes --> + + </xsl:template> + + <!-- + * Format the control stack argument: replace space-separated + * list by a list separated with commas, followed by either + * a space or a newline, dependend on the current argument + * count. + * This template calls itself recursively, until the entire + * argument $stack has been processed. + --> + <xsl:template name="format_cstack"> + <xsl:param name="stack" /> + <xsl:param name="count" /> + <xsl:choose> + <xsl:when test="string-length($stack) <= 4"> + <!-- Last element, print it, and leave template. --> + <xsl:value-of select="$stack" /> + </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 $stack. + --> + <xsl:value-of select="substring($stack, 1, 4)" /> + <xsl:choose> + <xsl:when test="$count mod 8 = 7"> + <!-- comma, newline, 8 spaces indentation --> + <xsl:text>, + </xsl:text> + </xsl:when> + <xsl:otherwise> + <!-- comma, space --> + <xsl:text>, </xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:call-template name="format_cstack"> + <xsl:with-param name="stack" select="substring($stack, 6)" + /> + <xsl:with-param name="count" select="$count + 1" /> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> +</xsl:stylesheet> diff --git a/src/avrdude/tools/get-stk600-cards.xsl b/src/avrdude/tools/get-stk600-cards.xsl new file mode 100644 index 000000000..6165b526e --- /dev/null +++ b/src/avrdude/tools/get-stk600-cards.xsl @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding='ISO-8859-1' ?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +<!-- + * Copyright (c) 2008 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, see <http://www.gnu.org/licenses/>. + * + * $Id$ +--> +<!-- + * Extract STK600 routing and socket card information out of + * targetboards.xml. + * + * Run this like: + * + * xsltproc -param what "'RC'" \ + * tools/get-stk600-cards.xsl targetboard.xml | sort -u + * + * xsltproc -param what "'SC'" \ + * tools/get-stk600-cards.xsl targetboard.xml | sort -u + * + * and copy&paste the results into the respective tables. +--> +<xsl:output method="text"/> +<xsl:template match="/"> + <xsl:if test="$what = 'RC'"> + <xsl:for-each select="/STK600/ROUTING/CARD"> + <xsl:if test="RC_NAME != ''"> + <xsl:text> { </xsl:text> + <xsl:value-of select="RC_ID" /> + <xsl:text>, "</xsl:text> + <xsl:value-of select="RC_NAME" /> + <xsl:text>" },
</xsl:text> + </xsl:if> + </xsl:for-each> <!-- All cards --> + </xsl:if> <!-- Routing cards --> + + <xsl:if test="$what = 'SC'"> + <xsl:for-each select="/STK600/ROUTING/CARD"> + <xsl:if test="SC_NAME != ''"> + <xsl:text> { </xsl:text> + <xsl:value-of select="SC_ID" /> + <xsl:text>, "</xsl:text> + <xsl:value-of select="SC_NAME" /> + <xsl:text>" },
</xsl:text> + </xsl:if> + </xsl:for-each> <!-- All cards --> + </xsl:if> <!-- Socket cards --> + +</xsl:template> +</xsl:stylesheet> diff --git a/src/avrdude/tools/get-stk600-devices.xsl b/src/avrdude/tools/get-stk600-devices.xsl new file mode 100644 index 000000000..efba1628a --- /dev/null +++ b/src/avrdude/tools/get-stk600-devices.xsl @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding='ISO-8859-1' ?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +<!-- + * Copyright (c) 2008 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, see <http://www.gnu.org/licenses/>. + * + * $Id$ +--> +<!-- + * Extract STK600 device support out of + * targetboards.xml. + * + * Run this like: + * + * xsltproc \ + * tools/get-stk600-devices.xsl targetboard.xml + * + * and copy&paste the results into the respective table. +--> +<xsl:output method="text"/> +<xsl:template match="/"> + <xsl:text>@multitable @columnfractions .15 .15 .6
</xsl:text> + <xsl:text>Routing card @tab Socket card @tab Devices
</xsl:text> + <xsl:for-each select="/STK600/ROUTING/CARD"> + <xsl:text>@item @code{</xsl:text> + <xsl:value-of select="RC_NAME" /> + <xsl:text>} @tab @code{</xsl:text> + <xsl:value-of select="SC_NAME" /> + <xsl:text>} @tab</xsl:text> + <xsl:for-each select="TARGET"> + <xsl:text> </xsl:text> + <xsl:value-of select="NAME" /> + </xsl:for-each> + <xsl:text>
</xsl:text> + </xsl:for-each> <!-- All cards --> + <xsl:text>@end multitable
</xsl:text> + +</xsl:template> +</xsl:stylesheet> |