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.
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)
-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:
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.
cd "C:\Program Files\Atmel\AVR
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.
cd "C:\Program Files\Atmel\AVR
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.
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).
Classic AVR devices: AT90Snnn -> nnndef.inc. Example: AT90S8515 -> 8515def.inc
Tiny AVR devices: ATtinynnn -> tnnnndef.inc. Example: ATtiny13 -> tn13def.inc
Mega AVR devices: ATmegannn -> mnnndef.inc. Example: ATmega644 -> m644def.inc
AVR CAN devices: AT90CANnnn -> cannnndef.inc. Example: AT90CAN128 -> can128def.inc
AVR PWM devices: AT90PWMnnn -> pwmnnndef.inc. Example: AT90PWM3 -> pwm3def.inc
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.
Bug fixed: Dropped some bit definitions (Issue #4757)
Minor bug fixes and enhancements only.
Removed bogus EEADRBITS output for parts without EEPROM
Added support for tiny28 LowLevel interrupt vector
Added experimental support for 32-bit register quadruples (-q option).
Wrong output file name if upper/lower case mismatch in input filename.