XML Converter

Introduction

The XML Converter is a separate command-line tool used to produce assembler include files and C header files from the part description files (XML) used by AVR Studio.

All assembler include files for AVR Assembler 2 in the AVR Studio distribution are produced using this tool. The tool is also capable of producing header files for AVR-GCC and the IAR C compiler, in addition to "generic" (not compiler-specific) C header files.

The XML converter program is presently not available from the AVR Studio GUI, and must be invoked from the command line.

Location and invocation

The following assumes AVR Studio is installed in the default directory
C:\Program Files\Atmel\AVR Tools
. If that is not the case, adjust the following accordingly.

The XML converter is located here:

C:\Program Files\Atmel\AVR Tools\AvrStudio4\xmlconvert.exe

For convenient access, the XML converter directory should be included in PATH, this can be done from Control panel -> System Properties, or from the command line with the following command:

PATH = %PATH%;"C:\Program Files\Atmel\AVR Tools\AvrStudio4"

Assuming this is in place, the XML converter can be accessed by typing xmlconvert from the command prompt. When invoked without arguments, xmlconvert print a usage message:

xmlconvert: No source file specified
Usage: xmlconvert [-f output-format] [-o outdir] [-1nbclV] infile ...
Output formats: a[vrasm] | g[cc] | i[ar] | c[c] (generic c)
Options:
-1  = Don't generate AVRASM2 #pragma's
-n  = Don't warn about bad names
-b  = use DISPLAY_BITS attribute to limit bit definitions
-c  = Add some definitions for compatibility with old files
-l  = Produce linker file (IAR only)
-q  = Allow linked register quadruple (32-bit)
-V  = print xmlconvert version number

The AVR part description files reside in C:\Program Files\Atmel\AVR Tools\Partdescriptionfiles. There is one file per part. The use is simplest explained by some examples:

Create assembler include file for mega128

xmlconvert -c -o c:\Work\Tmp "C:\Program Files\Atmel\AVR Tools\Partdescriptionfiles\ATmega128.xml"

This creates an assembler include file for mega128 in the output directory C:\Work\Tmp. If the -o option is omitted, the output file(s) will be located in the same directory as the input file.

Note: The -c option should always be used, if the created files are to be compatible with existing files.

The output file from this command will be C:\Work\Tmp\m128def.inc.

Create header and link files for all devices for the IAR C compiler

cd "C:\Program Files\Atmel\AVR Tools\Partdescriptionfiles"
xmlconvert -c -n -fiar -l -o C:\Work\tmp *.xml

When using multiple input files it is recommended to cd to the source directory first. The -fiar option requests IAR output files, the -l option requests linker file creation, the -n option suppresses some warning messages.

Note: the linker file facility is somewhat experimental and the resulting file may require editing before being usable, depending on device. Please consult the IAR manuals for details about these files.

Create header files for all devices for the AVR-GCC compiler

cd "C:\Program Files\Atmel\AVR Tools\Partdescriptionfiles"
xmlconvert -c -n -fgcc -o C:\Work\tmp *.xml

This is almost the same command as in the previous example, except for using -fgcc to specify gcc output files, and omitting the -l option, which does nothing for gcc.

File name conventions

The XML part description files are always named devicename.xml. The following conventions are used for producing assembler file names for various AVR device families.  nnn refers to the number section of a device name (e.g., 2313 in ATtiny2313).

When producing header files for the C compilers (IAR, GCC) XML converter attempts to follow the conventions used by the respective compiler manufacturers. For instance, both IAR and GCC will call the ATmega128 header file iom128.h. The XML converter obeys these conventions as far as they are known/documented.

If the 'generic C' format is selected, the header files are simply named device.h, e.g., ATmega128.h.

Changelog

Version 2.24, released with AVR Studio 4.12 SP4

Version 2.20, released with AVR Studio 4.12

Version 2.17, released with AVR Studio 4.11 SP1