| 1 |
#! /bin/sh |
| 2 |
# Copyright (c) 2008 Atmel Corporation |
| 3 |
# All rights reserved. |
| 4 |
# |
| 5 |
# Redistribution and use in source and binary forms, with or without |
| 6 |
# modification, are permitted provided that the following conditions are met: |
| 7 |
# |
| 8 |
# * Redistributions of source code must retain the above copyright |
| 9 |
# notice, this list of conditions and the following disclaimer. |
| 10 |
# |
| 11 |
# * Redistributions in binary form must reproduce the above copyright |
| 12 |
# notice, this list of conditions and the following disclaimer in |
| 13 |
# the documentation and/or other materials provided with the |
| 14 |
# distribution. |
| 15 |
# |
| 16 |
# * Neither the name of the copyright holders nor the names of |
| 17 |
# contributors may be used to endorse or promote products derived |
| 18 |
# from this software without specific prior written permission. |
| 19 |
# |
| 20 |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 21 |
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 22 |
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 23 |
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
| 24 |
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 25 |
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 26 |
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 27 |
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 28 |
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 29 |
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 30 |
# POSSIBILITY OF SUCH DAMAGE. |
| 31 |
|
| 32 |
# $Id$ |
| 33 |
|
| 34 |
# Convert Atmel XML Device file to AVR GCC I/O header file. |
| 35 |
# Needs: xmlstarlet (executable: xml), sed, grep, uniq, mv, rm, echo, sort. |
| 36 |
|
| 37 |
usage() { |
| 38 |
cat << EOF |
| 39 |
usage: $0 -d <xml device file> -h <io header file> [-x] |
| 40 |
-d <xml device file> XML Device File (Input) |
| 41 |
-h <io header file> I/O Header File (Output). |
| 42 |
If file exists, it will be overwritten. |
| 43 |
-x Optional XMEGA header file output |
| 44 |
EOF |
| 45 |
} |
| 46 |
|
| 47 |
|
| 48 |
abort() { |
| 49 |
echo $@ |
| 50 |
exec /bin/false |
| 51 |
} |
| 52 |
|
| 53 |
|
| 54 |
# Get options |
| 55 |
devicefile= |
| 56 |
headerfile= |
| 57 |
xmega= |
| 58 |
while test $# -gt 0 |
| 59 |
do |
| 60 |
case "$1" in |
| 61 |
-d) devicefile="$2"; shift;; |
| 62 |
-h) headerfile="$2"; shift;; |
| 63 |
-x) xmega="1";; |
| 64 |
--) shift; break;; |
| 65 |
-*) usage; exit 1;; |
| 66 |
*) break;; # terminate while loop |
| 67 |
esac |
| 68 |
shift |
| 69 |
done |
| 70 |
# all command line switches are processed, |
| 71 |
|
| 72 |
|
| 73 |
# Test parameters. |
| 74 |
if test "$devicefile" = ""; then |
| 75 |
usage |
| 76 |
abort "Error: No device file specified." |
| 77 |
fi |
| 78 |
if test "$headerfile" = ""; then |
| 79 |
usage |
| 80 |
abort "Error: No header file specified." |
| 81 |
fi |
| 82 |
|
| 83 |
|
| 84 |
set -x |
| 85 |
|
| 86 |
|
| 87 |
if test -e "$headerfile"; then rm "$headerfile"; fi |
| 88 |
|
| 89 |
|
| 90 |
# Header |
| 91 |
#------------------- |
| 92 |
|
| 93 |
# Get device name. |
| 94 |
DEVICE=$(xml sel -T -t -v /AVRPART/ADMIN/PART_NAME $devicefile) |
| 95 |
|
| 96 |
# todo: upper-case function not found. Use this value in idempotent guard. |
| 97 |
#DEVICEUPPER=$(xml sel -T -t -v "upper-case(/AVRPART/ADMIN/PART_NAME)" $devicefile) |
| 98 |
|
| 99 |
# Get the current year to place in copyright statement. |
| 100 |
YEAR=$(date --rfc-3339=date | cut -d '-' -f 1) |
| 101 |
|
| 102 |
cat << eof > $headerfile |
| 103 |
/* Copyright (c) $YEAR Atmel Corporation |
| 104 |
All rights reserved. |
| 105 |
|
| 106 |
Redistribution and use in source and binary forms, with or without |
| 107 |
modification, are permitted provided that the following conditions are met: |
| 108 |
|
| 109 |
* Redistributions of source code must retain the above copyright |
| 110 |
notice, this list of conditions and the following disclaimer. |
| 111 |
|
| 112 |
* Redistributions in binary form must reproduce the above copyright |
| 113 |
notice, this list of conditions and the following disclaimer in |
| 114 |
the documentation and/or other materials provided with the |
| 115 |
distribution. |
| 116 |
|
| 117 |
* Neither the name of the copyright holders nor the names of |
| 118 |
contributors may be used to endorse or promote products derived |
| 119 |
from this software without specific prior written permission. |
| 120 |
|
| 121 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 122 |
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 123 |
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 124 |
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
| 125 |
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 126 |
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 127 |
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 128 |
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 129 |
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 130 |
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 131 |
POSSIBILITY OF SUCH DAMAGE. */ |
| 132 |
|
| 133 |
/* \$Id\$ */ |
| 134 |
|
| 135 |
/* avr/$headerfile - definitions for ${DEVICE} */ |
| 136 |
|
| 137 |
/* This file should only be included from <avr/io.h>, never directly. */ |
| 138 |
|
| 139 |
#ifndef _AVR_IO_H_ |
| 140 |
# error "Include <avr/io.h> instead of this file." |
| 141 |
#endif |
| 142 |
|
| 143 |
#ifndef _AVR_IOXXX_H_ |
| 144 |
# define _AVR_IOXXX_H_ "$headerfile" |
| 145 |
#else |
| 146 |
# error "Attempt to include more than one <avr/ioXXX.h> file." |
| 147 |
#endif |
| 148 |
|
| 149 |
|
| 150 |
#ifndef _AVR_${DEVICE}_H_ |
| 151 |
#define _AVR_${DEVICE}_H_ 1 |
| 152 |
|
| 153 |
|
| 154 |
eof |
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
if test -n "$xmega" ; then |
| 159 |
|
| 160 |
# XMEGA AVR |
| 161 |
#================== |
| 162 |
|
| 163 |
|
| 164 |
# Build IO groups temporary XML file |
| 165 |
#------------------------------------ |
| 166 |
if test -e $headerfile-iogroups.xml; then |
| 167 |
rm -f $headerfile-iogroups.xml |
| 168 |
fi |
| 169 |
|
| 170 |
# Get set of register group names. |
| 171 |
GROUP_NAMES=$(xml sel -T -t -m /AVRPART/V2/modules/module/registers -s "A:T:-" "@offset" -v "concat(@name,' ')" $devicefile) |
| 172 |
|
| 173 |
# Create base iogroups temporary xml file. |
| 174 |
echo "<AVRPART>" | sed "s,>,>\r,g" >> $headerfile-iogroups.xml |
| 175 |
for i in $GROUP_NAMES ; do \ |
| 176 |
xml sel -t -m '/AVRPART/V2/modules/module/registers[@name='\'${i}\'']' -c . $devicefile | sed s,registers,group,g | sed "s,/>,>,g" >> $headerfile-iogroups.xml |
| 177 |
TYPE=$(xml sel -T -t -m '/AVRPART/V2/modules/module/registers[@name='\'${i}\'']' -v "@implements" $devicefile) |
| 178 |
xml sel -t -m '/AVRPART/V2/templates/module/registers[@name='\'${TYPE}\'']' -c . $devicefile >> $headerfile-iogroups.xml |
| 179 |
echo "</group>" | sed "s,>,>\r,g" >> $headerfile-iogroups.xml |
| 180 |
done |
| 181 |
echo "</AVRPART>" | sed "s,>,>\r,g" >> $headerfile-iogroups.xml |
| 182 |
|
| 183 |
# Make all groups have consistent width of offset address. |
| 184 |
for i in $GROUP_NAMES ; do \ |
| 185 |
value=$(printf "0x%04X" $(xml sel -T -t -m '/AVRPART/group[@name='\'${i}\'']' -v "@offset" $headerfile-iogroups.xml)) |
| 186 |
xml ed -O -u '/AVRPART/group[@name='\'${i}\'']/@offset' -v "$value" $headerfile-iogroups.xml > $headerfile-temp.xml |
| 187 |
mv -f $headerfile-temp.xml $headerfile-iogroups.xml |
| 188 |
done |
| 189 |
|
| 190 |
# Re-sort iogroups temporary XML file. |
| 191 |
xml sel -t -e AVRPART -m "/AVRPART/group" -s "A:T:-" "@offset" -c . $headerfile-iogroups.xml > $headerfile-temp.xml |
| 192 |
mv -f $headerfile-temp.xml $headerfile-iogroups.xml |
| 193 |
|
| 194 |
# Re-get set of register group names. |
| 195 |
GROUP_NAMES=$(xml sel -T -t -m /AVRPART/group -s "A:T:-" "@offset" -v "concat(@name,' ')" $headerfile-iogroups.xml) |
| 196 |
|
| 197 |
# Add absolute address to registers. |
| 198 |
for i in $GROUP_NAMES ; do \ |
| 199 |
GROUP_OFFSET=$(xml sel -T -t -m '/AVRPART/group[@name='\'${i}\'']' -v "@offset" $headerfile-iogroups.xml) |
| 200 |
REG_NAMES=$(xml sel -T -t -m '/AVRPART/group[@name='\'${i}\'']/registers/child::*' -v "concat(@name,' ')" $headerfile-iogroups.xml) |
| 201 |
for j in $REG_NAMES ; do \ |
| 202 |
value=$(printf "0x%04X" $(($GROUP_OFFSET + $(xml sel -T -t -m '/AVRPART/group[@name='\'${i}\'']/registers/child::*[@name='\'${j}\'']' -v "@offset" $headerfile-iogroups.xml)))) |
| 203 |
xml ed -O -a '/AVRPART/group[@name='\'${i}\'']/registers/child::*[@name='\'${j}\'']' -t attr -n "address" -v "$value" $headerfile-iogroups.xml > $headerfile-temp.xml |
| 204 |
mv -f $headerfile-temp.xml $headerfile-iogroups.xml |
| 205 |
done |
| 206 |
done |
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
# XMEGA Global Registers |
| 211 |
#--------------------------- |
| 212 |
echo "/* Ungrouped common registers */" >> $headerfile |
| 213 |
for i in $GROUP_NAMES ; do |
| 214 |
REGISTERS=$(xml sel -T -t -m '/AVRPART/group[@name='\'${i}\'']/registers[@globalregs='\'true\'']' -v "concat(@name,' ')" $headerfile-iogroups.xml) |
| 215 |
for j in $REGISTERS ; do |
| 216 |
REG_OFFSETS=$(xml sel -T -t -m '/AVRPART/group[@name='\'${i}\'']/registers[@globalregs='\'true\''][@name='\'${j}\'']/child::*' -v "concat(@offset,' ')" $headerfile-iogroups.xml | sort) |
| 217 |
for k in $REG_OFFSETS ; do |
| 218 |
REG_NAME=$(xml sel -T -t -m '/AVRPART/group[@name='\'${i}\'']/registers[@globalregs='\'true\''][@name='\'${j}\'']/child::*[@offset='\'${k}\'']' -v "@name" $headerfile-iogroups.xml) |
| 219 |
if test -n "$REG_NAME" ; then |
| 220 |
REG_SIZE=$(xml sel -T -t -m '/AVRPART/group[@name='\'${i}\'']/registers[@name='\'${j}\'']/child::*[@offset='\'${k}\'']' -v "@size" $headerfile-iogroups.xml) |
| 221 |
REG_ADDRESS=$(xml sel -T -t -m '/AVRPART/group[@name='\'${i}\'']/registers[@name='\'${j}\'']/child::*[@offset='\'${k}\'']' -v "@address" $headerfile-iogroups.xml) |
| 222 |
REG_TEXT=$(xml sel -T -t -m '/AVRPART/group[@name='\'${i}\'']/registers[@name='\'${j}\'']/child::*[@offset='\'${k}\'']' -v "@text" $headerfile-iogroups.xml) |
| 223 |
if test -n "$REG_SIZE" ; then |
| 224 |
if test "$REG_SIZE" = "1" ; then |
| 225 |
echo "#define ${REG_NAME} _SFR_MEM8(${REG_ADDRESS}) /* ${REG_TEXT} */" >> $headerfile |
| 226 |
fi |
| 227 |
if test "$REG_SIZE" = "2" ; then |
| 228 |
echo "#define ${REG_NAME} _SFR_MEM16(${REG_ADDRESS}) /* ${REG_TEXT} */" >> $headerfile |
| 229 |
fi |
| 230 |
fi |
| 231 |
fi |
| 232 |
done |
| 233 |
echo "" >> $headerfile |
| 234 |
done |
| 235 |
done |
| 236 |
echo "" >> $headerfile |
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
# XMEGA types |
| 241 |
#----------------- |
| 242 |
cat << eof >> $headerfile |
| 243 |
/* C Language Only */ |
| 244 |
#if !defined (__ASSEMBLER__) |
| 245 |
|
| 246 |
#include <stdint.h> |
| 247 |
|
| 248 |
typedef volatile uint8_t register8_t; |
| 249 |
typedef volatile uint16_t register16_t; |
| 250 |
typedef volatile uint32_t register32_t; |
| 251 |
|
| 252 |
|
| 253 |
#ifdef _WORDREGISTER |
| 254 |
#undef _WORDREGISTER |
| 255 |
#endif |
| 256 |
#define _WORDREGISTER(regname) \\ |
| 257 |
__extension__ union \\ |
| 258 |
{ \\ |
| 259 |
register16_t regname; \\ |
| 260 |
struct \\ |
| 261 |
{ \\ |
| 262 |
register8_t regname ## L; \\ |
| 263 |
register8_t regname ## H; \\ |
| 264 |
}; \\ |
| 265 |
} |
| 266 |
|
| 267 |
#ifdef _DWORDREGISTER |
| 268 |
#undef _DWORDREGISTER |
| 269 |
#endif |
| 270 |
#define _DWORDREGISTER(regname) \\ |
| 271 |
__extension__ union \\ |
| 272 |
{ \\ |
| 273 |
register32_t regname; \\ |
| 274 |
struct \\ |
| 275 |
{ \\ |
| 276 |
register8_t regname ## 0; \\ |
| 277 |
register8_t regname ## 1; \\ |
| 278 |
register8_t regname ## 2; \\ |
| 279 |
register8_t regname ## 3; \\ |
| 280 |
}; \\ |
| 281 |
} |
| 282 |
|
| 283 |
|
| 284 |
eof |
| 285 |
|
| 286 |
|
| 287 |
# XMEGA Register and Enumerator Structures |
| 288 |
#----------------------------------------- |
| 289 |
|
| 290 |
echo "/*" >> $headerfile |
| 291 |
echo "==========================================================================" >> $headerfile |
| 292 |
echo "IO Module Structures" >> $headerfile |
| 293 |
echo "==========================================================================" >> $headerfile |
| 294 |
echo "*/" >> $headerfile |
| 295 |
echo "" >> $headerfile |
| 296 |
|
| 297 |
MODULES=$(xml sel -T -t -m "/AVRPART/V2/templates/module" -v "concat(@class,' ')" $devicefile) |
| 298 |
for i in $MODULES ; do |
| 299 |
MODULE_TEXT=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${i}\'']' -v "@text" $devicefile) |
| 300 |
|
| 301 |
# Generate register structures. |
| 302 |
REGISTERS=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${i}\'']/registers' -v "concat(@name,' ')" $devicefile) |
| 303 |
for j in $REGISTERS ; do |
| 304 |
GLOBALREGS=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${i}\'']/registers[@name='\'${j}\'']' -v "@globalregs" $devicefile) |
| 305 |
|
| 306 |
if test "$GLOBALREGS" != "true" ; then |
| 307 |
|
| 308 |
echo "/*" >> $headerfile |
| 309 |
echo "--------------------------------------------------------------------------" >> $headerfile |
| 310 |
echo "$i - $MODULE_TEXT" >> $headerfile |
| 311 |
echo "--------------------------------------------------------------------------" >> $headerfile |
| 312 |
echo "*/" >> $headerfile |
| 313 |
echo "" >> $headerfile |
| 314 |
|
| 315 |
REGISTERS_TEXT=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${i}\'']/registers[@name='\'${j}\'']' -v "@text" $devicefile) |
| 316 |
echo "/* ${REGISTERS_TEXT} */" >> $headerfile |
| 317 |
echo "typedef struct ${j}_struct" >> $headerfile |
| 318 |
echo "{" >> $headerfile |
| 319 |
|
| 320 |
REG_OFFSETS=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${i}\'']/registers[@name='\'${j}\'']/child::*' -v "concat(@offset,' ')" $devicefile | sort) |
| 321 |
for k in $REG_OFFSETS ; do |
| 322 |
REG_NAME=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${i}\'']/registers[@name='\'${j}\'']/child::*[@offset='\'${k}\'']' -v "@name" $devicefile) |
| 323 |
REG_TEXT=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${i}\'']/registers[@name='\'${j}\'']/child::*[@offset='\'${k}\'']' -v "@text" $devicefile) |
| 324 |
REG_SIZE=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${i}\'']/registers[@name='\'${j}\'']/child::*[@offset='\'${k}\'']' -v "@size" $devicefile) |
| 325 |
|
| 326 |
if test -z "$REG_NAME" ; then |
| 327 |
echo " register8_t reserved_${k};" >> $headerfile |
| 328 |
else |
| 329 |
if test -n "$REG_SIZE" ; then |
| 330 |
if test "$REG_SIZE" = "1" ; then |
| 331 |
echo " register8_t ${REG_NAME}; /* ${REG_TEXT} */" >> $headerfile |
| 332 |
elif test "$REG_SIZE" = "2" ; then |
| 333 |
echo " _WORDREGISTER(${REG_NAME}); /* ${REG_TEXT} */" >> $headerfile |
| 334 |
fi |
| 335 |
else |
| 336 |
REG_IMPLEMENTS=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${i}\'']/registers[@name='\'${j}\'']/child::*[@offset='\'${k}\'']' -v "@implements" $devicefile) |
| 337 |
echo " ${REG_IMPLEMENTS}_t ${REG_NAME}; /* ${REG_TEXT} */" >> $headerfile |
| 338 |
fi |
| 339 |
fi |
| 340 |
done |
| 341 |
|
| 342 |
echo "} ${j}_t;" >> $headerfile |
| 343 |
echo "" >> $headerfile |
| 344 |
|
| 345 |
fi |
| 346 |
done |
| 347 |
|
| 348 |
# Generate enumerator structures. |
| 349 |
ENUMERATORS=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${i}\'']/enumerator' -v "concat(@name,' ')" $devicefile) |
| 350 |
for j in $ENUMERATORS ; do |
| 351 |
ENUMERATOR_TEXT=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${i}\'']/enumerator[@name='\'${j}\'']' -v "@text" $devicefile) |
| 352 |
echo "/* ${ENUMERATOR_TEXT} */" >> $headerfile |
| 353 |
echo "typedef enum ${j}_enum" >> $headerfile |
| 354 |
echo "{" >> $headerfile |
| 355 |
|
| 356 |
# Get enum shift value from bitfield data in a different part of the V2 data. |
| 357 |
ENUM_SHIFT= |
| 358 |
for m in $REGISTERS ; do |
| 359 |
REG_OFFSETS=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${i}\'']/registers[@name='\'${m}\'']/child::*' -v "concat(@offset,' ')" $devicefile | sort) |
| 360 |
for n in $REG_OFFSETS ; do |
| 361 |
BITFIELD_NAMES=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${i}\'']/registers[@name='\'${m}\'']/child::*[@offset='\'${n}\'']/bitfield' -v "concat(@name,' ')" $devicefile) |
| 362 |
for p in $BITFIELD_NAMES ; do |
| 363 |
BITFIELD_ENUM=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${i}\'']/registers[@name='\'${m}\'']/child::*[@offset='\'${n}\'']/bitfield[@name='\'${p}\'']' -v "@enum" $devicefile) |
| 364 |
if test "$BITFIELD_ENUM" = "$j" ; then |
| 365 |
|
| 366 |
# The enum shift value is equal to the number of lsb 0 bits |
| 367 |
# in the mask value of the bitfield that has a matching enum name. |
| 368 |
ENUM_SHIFT=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${i}\'']/registers[@name='\'${m}\'']/child::*[@offset='\'${n}\'']/bitfield[@name='\'${p}\'']' \ |
| 369 |
-v "@mask" $devicefile | \ |
| 370 |
sed "s,0x.2,1,g" | \ |
| 371 |
sed "s,0x.4,2,g" | \ |
| 372 |
sed "s,0x.6,1,g" | \ |
| 373 |
sed "s,0x.8,3,g" | \ |
| 374 |
sed "s,0x.C,2,g" | \ |
| 375 |
sed "s,0x.E,1,g" | \ |
| 376 |
sed "s,0x10,4,g" | \ |
| 377 |
sed "s,0x30,4,g" | \ |
| 378 |
sed "s,0x70,4,g" | \ |
| 379 |
sed "s,0xF0,4,g" | \ |
| 380 |
sed "s,0x20,5,g" | \ |
| 381 |
sed "s,0x60,5,g" | \ |
| 382 |
sed "s,0xE0,5,g" | \ |
| 383 |
sed "s,0x40,6,g" | \ |
| 384 |
sed "s,0xC0,6,g" | \ |
| 385 |
sed "s,0x80,7,g" | \ |
| 386 |
sed "s,0x..,0,g" ) |
| 387 |
|
| 388 |
# Match only the first enum value found so break out. |
| 389 |
break 3 |
| 390 |
fi |
| 391 |
done |
| 392 |
done |
| 393 |
done |
| 394 |
|
| 395 |
ENUMS=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${i}\'']/enumerator[@name='\'${j}\'']/enum' -v "concat(@name,' ')" $devicefile) |
| 396 |
for k in $ENUMS ; do |
| 397 |
ENUM_VALUE=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${i}\'']/enumerator[@name='\'${j}\'']/enum[@name='\'${k}\'']' -v "@val" $devicefile) |
| 398 |
ENUM_TEXT=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${i}\'']/enumerator[@name='\'${j}\'']/enum[@name='\'${k}\'']' -v "@text" $devicefile) |
| 399 |
echo " ${j}_${k}_gc = (${ENUM_VALUE}<<${ENUM_SHIFT}), /* ${ENUM_TEXT} */" >> $headerfile |
| 400 |
done |
| 401 |
|
| 402 |
echo "} ${j}_t;" >> $headerfile |
| 403 |
echo "" >> $headerfile |
| 404 |
done |
| 405 |
echo "" >> $headerfile |
| 406 |
done |
| 407 |
echo "" >> $headerfile |
| 408 |
|
| 409 |
|
| 410 |
|
| 411 |
|
| 412 |
# XMEGA Register Structure Instances |
| 413 |
#-------------------------------------- |
| 414 |
echo "/*" >> $headerfile |
| 415 |
echo "==========================================================================" >> $headerfile |
| 416 |
echo "IO Module Instances. Mapped to memory." >> $headerfile |
| 417 |
echo "==========================================================================" >> $headerfile |
| 418 |
echo "*/" >> $headerfile |
| 419 |
echo "" >> $headerfile |
| 420 |
for i in $(xml sel -T -t -m /AVRPART/group -s "A:T:-" "@offset" -v "concat(@name,' ')" $headerfile-iogroups.xml | sed "s,GPIO ,,g" | sed "s,CPU ,,g") ; do |
| 421 |
IMPLEMENTS=$(xml sel -T -t -m '/AVRPART/group[@name='\'${i}\'']' -v @implements $headerfile-iogroups.xml) |
| 422 |
OFFSET=$(xml sel -T -t -m '/AVRPART/group[@name='\'${i}\'']' -v @offset $headerfile-iogroups.xml) |
| 423 |
TEXT=$(xml sel -T -t -m '/AVRPART/group[@name='\'${i}\'']' -v @text $headerfile-iogroups.xml) |
| 424 |
echo "#define ${i} (*(${IMPLEMENTS}_t *) ${OFFSET}) /* ${TEXT} */" >> $headerfile |
| 425 |
done |
| 426 |
echo "" >> $headerfile |
| 427 |
echo "" >> $headerfile |
| 428 |
|
| 429 |
|
| 430 |
|
| 431 |
echo "#endif /* !defined (__ASSEMBLER__) */" >> $headerfile |
| 432 |
echo "" >> $headerfile |
| 433 |
echo "" >> $headerfile |
| 434 |
|
| 435 |
|
| 436 |
|
| 437 |
|
| 438 |
# XMEGA Flattened fully qualified IO register names |
| 439 |
#--------------------------------------------------- |
| 440 |
|
| 441 |
echo "/* ========== Flattened fully qualified IO register names ========== */" >> $headerfile |
| 442 |
echo "" >> $headerfile |
| 443 |
|
| 444 |
for i in $GROUP_NAMES ; do |
| 445 |
GROUP_TEXT=$(xml sel -T -t -m '/AVRPART/group[@name='\'${i}\'']' -v "@text" $headerfile-iogroups.xml) |
| 446 |
echo "/* ${i} - ${GROUP_TEXT} */" >> $headerfile |
| 447 |
|
| 448 |
REGISTERS=$(xml sel -T -t -m '/AVRPART/group[@name='\'${i}\'']/registers' -v "concat(@name,' ')" $headerfile-iogroups.xml) |
| 449 |
for j in $REGISTERS ; do |
| 450 |
|
| 451 |
REG_OFFSETS=$(xml sel -T -t -m '/AVRPART/group[@name='\'${i}\'']/registers[@name='\'${j}\'']/child::*' -v "concat(@offset,' ')" $headerfile-iogroups.xml | sort) |
| 452 |
for k in $REG_OFFSETS ; do |
| 453 |
REG_NAME=$(xml sel -T -t -m '/AVRPART/group[@name='\'${i}\'']/registers[@name='\'${j}\'']/child::*[@offset='\'${k}\'']' -v "@name" $headerfile-iogroups.xml) |
| 454 |
if test -n "$REG_NAME" ; then |
| 455 |
REG_SIZE=$(xml sel -T -t -m '/AVRPART/group[@name='\'${i}\'']/registers[@name='\'${j}\'']/child::*[@offset='\'${k}\'']' -v "@size" $headerfile-iogroups.xml) |
| 456 |
REG_ADDRESS=$(xml sel -T -t -m '/AVRPART/group[@name='\'${i}\'']/registers[@name='\'${j}\'']/child::*[@offset='\'${k}\'']' -v "@address" $headerfile-iogroups.xml) |
| 457 |
if test -n "$REG_SIZE" ; then |
| 458 |
if test "$REG_SIZE" = "1" ; then |
| 459 |
echo "#define ${i}_${REG_NAME} _SFR_MEM8(${REG_ADDRESS})" >> $headerfile |
| 460 |
fi |
| 461 |
if test "$REG_SIZE" = "2" ; then |
| 462 |
echo "#define ${i}_${REG_NAME} _SFR_MEM16(${REG_ADDRESS})" >> $headerfile |
| 463 |
fi |
| 464 |
else |
| 465 |
REG_IMPLEMENTS=$(xml sel -T -t -m '/AVRPART/group[@name='\'${i}\'']/registers[@name='\'${j}\'']/child::*[@offset='\'${k}\'']' -v "@implements" $headerfile-iogroups.xml) |
| 466 |
|
| 467 |
|
| 468 |
MODULES=$(xml sel -T -t -m "/AVRPART/V2/templates/module" -v "concat(@class,' ')" $devicefile) |
| 469 |
for m in $MODULES ; do |
| 470 |
REGISTERS=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${m}\'']/registers' -v "concat(@name,' ')" $devicefile) |
| 471 |
for n in $REGISTERS ; do |
| 472 |
if test "$n" = "$REG_IMPLEMENTS" ; then |
| 473 |
REG_OFFSETS=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${m}\'']/registers[@name='\'${n}\'']/child::*' -v "concat(@offset,' ')" $devicefile | sort) |
| 474 |
for p in $REG_OFFSETS ; do |
| 475 |
SUBREG_NAME=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${m}\'']/registers[@name='\'${n}\'']/child::*[@offset='\'${p}\'']' -v "@name" $devicefile) |
| 476 |
SUBREG_SIZE=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${m}\'']/registers[@name='\'${n}\'']/child::*[@offset='\'${p}\'']' -v "@size" $devicefile) |
| 477 |
SUBREG_OFFSET=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${m}\'']/registers[@name='\'${n}\'']/child::*[@offset='\'${p}\'']' -v "@offset" $devicefile) |
| 478 |
if test -n "$SUBREG_NAME" ; then |
| 479 |
ADDRESS=$(printf "0x%04X" $(($REG_ADDRESS + $SUBREG_OFFSET))) |
| 480 |
if test "$SUBREG_SIZE" = "1" ; then |
| 481 |
echo "#define ${i}_${REG_NAME}_${SUBREG_NAME} _SFR_MEM8(${ADDRESS})" >> $headerfile |
| 482 |
fi |
| 483 |
if test "$SUBREG_SIZE" = "2" ; then |
| 484 |
echo "#define ${i}_${REG_NAME}_${SUBREG_NAME} _SFR_MEM16(${ADDRESS})" >> $headerfile |
| 485 |
fi |
| 486 |
fi |
| 487 |
done |
| 488 |
break 2 |
| 489 |
fi |
| 490 |
done |
| 491 |
done |
| 492 |
fi |
| 493 |
fi |
| 494 |
done |
| 495 |
done |
| 496 |
echo "" >> $headerfile |
| 497 |
done |
| 498 |
echo "" >> $headerfile |
| 499 |
|
| 500 |
|
| 501 |
|
| 502 |
#echo "#endif /* !defined (__ASSEMBLER__) */" >> $headerfile |
| 503 |
#echo "" >> $headerfile |
| 504 |
echo "" >> $headerfile |
| 505 |
|
| 506 |
|
| 507 |
# XMEGA Bitfield definitions |
| 508 |
#--------------------------------------------------- |
| 509 |
|
| 510 |
echo "/*================== Bitfield Definitions ================== */" >> $headerfile |
| 511 |
echo "" >> $headerfile |
| 512 |
MODULE_NAMES=$(xml sel -T -t -m /AVRPART/V2/templates/module -v "concat(@class,' ')" $devicefile) |
| 513 |
for i in $MODULE_NAMES ; do |
| 514 |
PREV_MODULE_NAME= |
| 515 |
MODULE_TEXT=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${i}\'']' -v "@text" $devicefile) |
| 516 |
|
| 517 |
REGISTER_GROUPS=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${i}\'']/registers' -v "concat(@name,' ')" $devicefile) |
| 518 |
for j in $REGISTER_GROUPS ; do |
| 519 |
|
| 520 |
REG_OFFSETS=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${i}\'']/registers[@name='\'${j}\'']/child::*' -v "concat(@offset,' ')" $devicefile | sort) |
| 521 |
for k in $REG_OFFSETS ; do |
| 522 |
REGNAME=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${i}\'']/registers[@name='\'${j}\'']/child::*[@offset='\'${k}\'']' -v "@name" $devicefile) |
| 523 |
BITFIELDS=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${i}\'']/registers[@name='\'${j}\'']/child::*[@offset='\'${k}\'']/bitfield' -v "concat(@name,' ')" $devicefile) |
| 524 |
|
| 525 |
if test -n "$BITFIELDS" ; then |
| 526 |
if test -z $PREV_MODULE_NAME ; then |
| 527 |
echo "/* ${i} - ${MODULE_TEXT} */" >> $headerfile |
| 528 |
PREV_MODULE_NAME=$i |
| 529 |
fi |
| 530 |
|
| 531 |
echo "/* ${j}.${REGNAME} bit masks and bit positions */" >> $headerfile |
| 532 |
|
| 533 |
for m in $BITFIELDS ; do |
| 534 |
BITFIELD_GROUP_MASK=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${i}\'']/registers[@name='\'${j}\'']/child::*[@offset='\'${k}\'']/bitfield[@name='\'${m}\'']' -v "@mask" $devicefile) |
| 535 |
BITFIELD_TEXT=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'${i}\'']/registers[@name='\'${j}\'']/child::*[@offset='\'${k}\'']/bitfield[@name='\'${m}\'']' -v "@text" $devicefile) |
| 536 |
BITFIELD_GROUP_POSITION=$(echo $BITFIELD_GROUP_MASK | \ |
| 537 |
sed "s,0x.2,1,g" | \ |
| 538 |
sed "s,0x.4,2,g" | \ |
| 539 |
sed "s,0x.6,1,g" | \ |
| 540 |
sed "s,0x.8,3,g" | \ |
| 541 |
sed "s,0x.C,2,g" | \ |
| 542 |
sed "s,0x.E,1,g" | \ |
| 543 |
sed "s,0x10,4,g" | \ |
| 544 |
sed "s,0x30,4,g" | \ |
| 545 |
sed "s,0x70,4,g" | \ |
| 546 |
sed "s,0xF0,4,g" | \ |
| 547 |
sed "s,0x20,5,g" | \ |
| 548 |
sed "s,0x60,5,g" | \ |
| 549 |
sed "s,0xE0,5,g" | \ |
| 550 |
sed "s,0x40,6,g" | \ |
| 551 |
sed "s,0xC0,6,g" | \ |
| 552 |
sed "s,0x80,7,g" | \ |
| 553 |
sed "s,0x..,0,g" ) |
| 554 |
|
| 555 |
BITFIELD_MASK=$(($BITFIELD_GROUP_MASK >> $BITFIELD_GROUP_POSITION)) |
| 556 |
if test $(( $BITFIELD_MASK )) -gt 1 ; then |
| 557 |
DEFINITION=" ${j}_${m}_gm " |
| 558 |
grep "${DEFINITION}" $headerfile |
| 559 |
if test $? -eq 0 ; then |
| 560 |
echo "/*${DEFINITION} Predefined. */" >> $headerfile |
| 561 |
else |
| 562 |
echo "#define ${j}_${m}_gm ${BITFIELD_GROUP_MASK} /* ${BITFIELD_TEXT} group mask. */" >> $headerfile |
| 563 |
fi |
| 564 |
|
| 565 |
DEFINITION=" ${j}_${m}_gp " |
| 566 |
grep "${DEFINITION}" $headerfile |
| 567 |
if test $? -eq 0 ; then |
| 568 |
echo "/*${DEFINITION} Predefined. */" >> $headerfile |
| 569 |
else |
| 570 |
echo "#define ${j}_${m}_gp ${BITFIELD_GROUP_POSITION} /* ${BITFIELD_TEXT} group position. */" >> $headerfile |
| 571 |
fi |
| 572 |
|
| 573 |
BITNUM="0" |
| 574 |
while test $(($BITFIELD_MASK & 0x01)) -eq 1 ; do |
| 575 |
DEFINITION=" ${j}_${m}${BITNUM}_bm " |
| 576 |
grep "${DEFINITION}" $headerfile |
| 577 |
if test $? -eq 0 ; then |
| 578 |
echo "/*${DEFINITION} Predefined. */" >> $headerfile |
| 579 |
else |
| 580 |
echo "#define ${j}_${m}${BITNUM}_bm (1<<${BITFIELD_GROUP_POSITION}) /* ${BITFIELD_TEXT} bit ${BITNUM} mask. */" >> $headerfile |
| 581 |
fi |
| 582 |
|
| 583 |
DEFINITION=" ${j}_${m}${BITNUM}_bp " |
| 584 |
grep "${DEFINITION}" $headerfile |
| 585 |
if test $? -eq 0 ; then |
| 586 |
echo "/*${DEFINITION} Predefined. */" >> $headerfile |
| 587 |
else |
| 588 |
echo "#define ${j}_${m}${BITNUM}_bp ${BITFIELD_GROUP_POSITION} /* ${BITFIELD_TEXT} bit ${BITNUM} position. */" >> $headerfile |
| 589 |
fi |
| 590 |
|
| 591 |
BITFIELD_GROUP_POSITION=$(($BITFIELD_GROUP_POSITION + 1)) |
| 592 |
BITFIELD_MASK=$(($BITFIELD_MASK >> 1)) |
| 593 |
BITNUM=$(($BITNUM + 1)) |
| 594 |
done |
| 595 |
else |
| 596 |
DEFINITION=" ${j}_${m}_bm " |
| 597 |
grep "${DEFINITION}" $headerfile |
| 598 |
if test $? -eq 0 ; then |
| 599 |
echo "/*${DEFINITION} Predefined. */" >> $headerfile |
| 600 |
else |
| 601 |
echo "#define ${j}_${m}_bm ${BITFIELD_GROUP_MASK} /* ${BITFIELD_TEXT} bit mask. */" >> $headerfile |
| 602 |
fi |
| 603 |
|
| 604 |
DEFINITION=" ${j}_${m}_bp " |
| 605 |
grep "${DEFINITION}" $headerfile |
| 606 |
if test $? -eq 0 ; then |
| 607 |
echo "/*${DEFINITION} Predefined. */" >> $headerfile |
| 608 |
else |
| 609 |
echo "#define ${j}_${m}_bp ${BITFIELD_GROUP_POSITION} /* ${BITFIELD_TEXT} bit position. */" >> $headerfile |
| 610 |
fi |
| 611 |
fi |
| 612 |
echo "" >> $headerfile |
| 613 |
|
| 614 |
done |
| 615 |
echo "" >> $headerfile |
| 616 |
fi |
| 617 |
done |
| 618 |
done |
| 619 |
done |
| 620 |
echo "" >> $headerfile |
| 621 |
|
| 622 |
|
| 623 |
# XMEGA Generic Port Pin definitions |
| 624 |
#--------------------------------------------------- |
| 625 |
cat << eof >> $headerfile |
| 626 |
// Generic Port Pins |
| 627 |
|
| 628 |
#define PIN0_bm 0x01 |
| 629 |
#define PIN0_bp 0 |
| 630 |
#define PIN1_bm 0x02 |
| 631 |
#define PIN1_bp 1 |
| 632 |
#define PIN2_bm 0x04 |
| 633 |
#define PIN2_bp 2 |
| 634 |
#define PIN3_bm 0x08 |
| 635 |
#define PIN3_bp 3 |
| 636 |
#define PIN4_bm 0x10 |
| 637 |
#define PIN4_bp 4 |
| 638 |
#define PIN5_bm 0x20 |
| 639 |
#define PIN5_bp 5 |
| 640 |
#define PIN6_bm 0x40 |
| 641 |
#define PIN6_bp 6 |
| 642 |
#define PIN7_bm 0x80 |
| 643 |
#define PIN7_bp 7 |
| 644 |
|
| 645 |
|
| 646 |
eof |
| 647 |
|
| 648 |
|
| 649 |
|
| 650 |
# XMEGA Interrupt Vector definitions |
| 651 |
#--------------------------------------------------- |
| 652 |
echo "/* ========== Interrupt Vector Definitions ========== */" >> $headerfile |
| 653 |
echo "/* Vector 0 is the reset vector */" >> $headerfile |
| 654 |
echo "" >> $headerfile |
| 655 |
INTERRUPT_MODULES=$(xml sel -T -t -m /AVRPART/V2/interrupts/interrupt-group -v "concat(@module,' ')" $devicefile) |
| 656 |
for i in $INTERRUPT_MODULES ; do |
| 657 |
echo "/* ${i} interrupt vectors */" >> $headerfile |
| 658 |
MODULE_REF=$(xml sel -T -t -m '/AVRPART/V2/interrupts/interrupt-group[@module='\'${i}\'']' -v "@ref" $devicefile) |
| 659 |
MODULE_OFFSET=$(xml sel -T -t -m '/AVRPART/V2/interrupts/interrupt-group[@module='\'${i}\'']' -v "@offset" $devicefile) |
| 660 |
|
| 661 |
INTERRUPTS=$(xml sel -T -t -m '/AVRPART/V2/templates/module/interrupt-group[@name='\'${MODULE_REF}\'']/int' -s "A:T:-" "@offset" -v "concat(@name,' ')" $devicefile) |
| 662 |
for j in $INTERRUPTS ; do |
| 663 |
INT_OFFSET=$(xml sel -T -t -m '/AVRPART/V2/templates/module/interrupt-group[@name='\'${MODULE_REF}\'']/int[@name='\'${j}\'']' -v "@offset" $devicefile) |
| 664 |
INT_TEXT=$(xml sel -T -t -m '/AVRPART/V2/templates/module/interrupt-group[@name='\'${MODULE_REF}\'']/int[@name='\'${j}\'']' -v "@text" $devicefile) |
| 665 |
VECTOR_NUM=$(($MODULE_OFFSET + $INT_OFFSET)) |
| 666 |
echo "#define ${i}_${j}_vect_num ${VECTOR_NUM}" >> $headerfile |
| 667 |
echo "#define ${i}_${j}_vect _VECTOR(${VECTOR_NUM}) /* ${INT_TEXT} */" >> $headerfile |
| 668 |
done |
| 669 |
echo "" >> $headerfile |
| 670 |
done |
| 671 |
echo "" >> $headerfile |
| 672 |
|
| 673 |
# todo: Remove hard-coded vector size. |
| 674 |
echo "#define _VECTOR_SIZE 4 /* Size of individual vector. */" >> $headerfile |
| 675 |
VECTOR_NUM=$(($VECTOR_NUM + 1)) |
| 676 |
echo "#define _VECTORS_SIZE (${VECTOR_NUM} * _VECTOR_SIZE)" >> $headerfile |
| 677 |
echo "" >> $headerfile |
| 678 |
echo "" >> $headerfile |
| 679 |
|
| 680 |
|
| 681 |
|
| 682 |
# XMEGA Constant definitions |
| 683 |
#--------------------------------------------------- |
| 684 |
echo "/* ========== Constants ========== */" >> $headerfile |
| 685 |
echo "" >> $headerfile |
| 686 |
|
| 687 |
MEMSPACE_NAMES=$(xml sel -T -t -m "/AVRPART/V2/memspaces/memspace" -v "concat(@name,' ')" $devicefile) |
| 688 |
for i in $MEMSPACE_NAMES ; do |
| 689 |
MEMSPACE_START=$(xml sel -T -t -m '/AVRPART/V2/memspaces/memspace[@name='\'${i}\'']' -v "@start" $devicefile) |
| 690 |
MEMSPACE_SIZE=$(( $(xml sel -T -t -m '/AVRPART/V2/memspaces/memspace[@name='\'${i}\'']' -v "@size" $devicefile) )) |
| 691 |
MEMSPACE_PAGE_SIZE=$(( $(xml sel -T -t -m '/AVRPART/V2/memspaces/memspace[@name='\'${i}\'']' -v "@pagesize" $devicefile) )) |
| 692 |
echo "#define ${i}_START (${MEMSPACE_START})" >> $headerfile |
| 693 |
echo "#define ${i}_SIZE (${MEMSPACE_SIZE})" >> $headerfile |
| 694 |
echo "#define ${i}_PAGE_SIZE (${MEMSPACE_PAGE_SIZE})" >> $headerfile |
| 695 |
echo "#define ${i}_END (${i}_START + ${i}_SIZE - 1)" >> $headerfile |
| 696 |
echo "" >> $headerfile |
| 697 |
done |
| 698 |
|
| 699 |
echo "#define FLASHEND PROGMEM_END" >> $headerfile |
| 700 |
echo "#define SPM_PAGESIZE PROGMEM_PAGE_SIZE" >> $headerfile |
| 701 |
echo "#define RAMSTART INTERNAL_SRAM_START" >> $headerfile |
| 702 |
echo "#define RAMSIZE INTERNAL_SRAM_SIZE" >> $headerfile |
| 703 |
echo "#define RAMEND INTERNAL_SRAM_END" >> $headerfile |
| 704 |
echo "#define XRAMSTART EXTERNAL_SRAM_START" >> $headerfile |
| 705 |
echo "#define XRAMSIZE EXTERNAL_SRAM_SIZE" >> $headerfile |
| 706 |
if test $(( $(xml sel -T -t -m "/AVRPART/V2/memspaces/memspace[@name='EXTERNAL_SRAM']" -v "@size" $devicefile) )) -gt 0 ; then |
| 707 |
echo "#define XRAMEND EXTERNAL_SRAM_END" >> $headerfile |
| 708 |
else |
| 709 |
echo "#define XRAMEND INTERNAL_SRAM_END" >> $headerfile |
| 710 |
fi |
| 711 |
echo "#define E2END EEPROM_END" >> $headerfile |
| 712 |
echo "#define E2PAGESIZE EEPROM_PAGE_SIZE" >> $headerfile |
| 713 |
echo "" >> $headerfile |
| 714 |
echo "" >> $headerfile |
| 715 |
|
| 716 |
|
| 717 |
|
| 718 |
# XMEGA Fuse information |
| 719 |
#--------------------------------------------------- |
| 720 |
FUSECOUNT=$(xml sel -T -t -v 'count(/AVRPART/V2/templates/module/registers[@memspace='\'FUSE\'']/reg)' $devicefile) |
| 721 |
echo "/* ========== Fuses ========== */" >> $headerfile |
| 722 |
echo "#define FUSE_MEMORY_SIZE ${FUSECOUNT}" >> $headerfile |
| 723 |
echo "" >> $headerfile |
| 724 |
FUSEBYTES=$(xml sel -T -t -m '/AVRPART/V2/templates/module/registers[@memspace='\'FUSE\'']/reg' -s "A:T:-" "@offset" -v "concat(@offset,' ')" $devicefile) |
| 725 |
FUSEBYTENUM=0 |
| 726 |
for i in $FUSEBYTES ; do |
| 727 |
FUSEBYTENAME=$(xml sel -T -t -m '/AVRPART/V2/templates/module/registers[@memspace='\'FUSE\'']/reg[@offset='\'${i}\'']' -v "@name" $devicefile) |
| 728 |
if test -z "$FUSEBYTENAME" ; then |
| 729 |
echo "/* Fuse Byte ${FUSEBYTENUM} Reserved */" >> $headerfile |
| 730 |
else |
| 731 |
echo "/* Fuse Byte ${FUSEBYTENUM} */" >> $headerfile |
| 732 |
FUSEBITFIELDS=$(xml sel -T -t -m '/AVRPART/V2/templates/module/registers[@memspace='\'FUSE\'']/reg[@offset='\'${i}\'']/bitfield' -s "A:T:-" "@mask" -v "concat(@name,' ')" $devicefile) |
| 733 |
for j in $FUSEBITFIELDS ; do |
| 734 |
FUSEBITFIELD_TEXT=$(xml sel -T -t -m '/AVRPART/V2/templates/module/registers[@memspace='\'FUSE\'']/reg[@offset='\'${i}\'']/bitfield[@name='\'${j}\'']' \ |
| 735 |
-v "@text" $devicefile) |
| 736 |
FUSEBITFIELD_MASK=$(xml sel -T -t -m '/AVRPART/V2/templates/module/registers[@memspace='\'FUSE\'']/reg[@offset='\'${i}\'']/bitfield[@name='\'${j}\'']' \ |
| 737 |
-v "@mask" $devicefile) |
| 738 |
FUSEBITFIELD_SHIFT=$(echo "$FUSEBITFIELD_MASK" | \ |
| 739 |
sed "s,0x.2,1,g" | \ |
| 740 |
sed "s,0x.4,2,g" | \ |
| 741 |
sed "s,0x.6,1,g" | \ |
| 742 |
sed "s,0x.8,3,g" | \ |
| 743 |
sed "s,0x.C,2,g" | \ |
| 744 |
sed "s,0x.E,1,g" | \ |
| 745 |
sed "s,0x10,4,g" | \ |
| 746 |
sed "s,0x30,4,g" | \ |
| 747 |
sed "s,0x70,4,g" | \ |
| 748 |
sed "s,0xF0,4,g" | \ |
| 749 |
sed "s,0x20,5,g" | \ |
| 750 |
sed "s,0x60,5,g" | \ |
| 751 |
sed "s,0xE0,5,g" | \ |
| 752 |
sed "s,0x40,6,g" | \ |
| 753 |
sed "s,0xC0,6,g" | \ |
| 754 |
sed "s,0x80,7,g" | \ |
| 755 |
sed "s,0x..,0,g" ) |
| 756 |
FUSEBITFIELD_MASK=$(( $FUSEBITFIELD_MASK >> $FUSEBITFIELD_SHIFT )) |
| 757 |
if test $(( $FUSEBITFIELD_MASK )) -gt 1 ; then |
| 758 |
BITNUM=0 |
| 759 |
while test $(($FUSEBITFIELD_MASK & 0x01)) -eq 1 ; do |
| 760 |
echo "#define FUSE_${j}${BITNUM} (unsigned char)~_BV(${FUSEBITFIELD_SHIFT}) /* ${FUSEBITFIELD_TEXT} Bit ${BITNUM} */" >> $headerfile |
| 761 |
FUSEBITFIELD_MASK=$(($FUSEBITFIELD_MASK >> 1)) |
| 762 |
BITNUM=$(($BITNUM + 1)) |
| 763 |
FUSEBITFIELD_SHIFT=$(($FUSEBITFIELD_SHIFT + 1)) |
| 764 |
done |
| 765 |
else |
| 766 |
echo "#define FUSE_${j} (unsigned char)~_BV(${FUSEBITFIELD_SHIFT}) /* ${FUSEBITFIELD_TEXT} */" >> $headerfile |
| 767 |
fi |
| 768 |
done |
| 769 |
echo "#define FUSE${FUSEBYTENUM}_DEFAULT (0xFF)" >> $headerfile |
| 770 |
fi |
| 771 |
echo "" >> $headerfile |
| 772 |
FUSEBYTENUM=$((FUSEBYTENUM + 1)) |
| 773 |
done |
| 774 |
echo "" >> $headerfile |
| 775 |
# todo: Default XMEGA fuse values are currently hardcoded to 0xFF. |
| 776 |
|
| 777 |
|
| 778 |
|
| 779 |
# XMEGA Lockbit information |
| 780 |
#--------------------------------------------------- |
| 781 |
echo "/* ========== Lock Bits ========== */" >> $headerfile |
| 782 |
LOCK_BITS=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'NVM\'']/registers/reg[@name='\'LOCKBITS\'']/bitfield[@name='\'LB\'']' -v "@name" $devicefile) |
| 783 |
if test -n "$LOCK_BITS" ; then |
| 784 |
echo "#define __LOCK_BITS_EXIST" >> $headerfile |
| 785 |
fi |
| 786 |
|
| 787 |
BOOT_LOCK_APPLICATION_TABLE_BITS=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'NVM\'']/registers/reg[@name='\'LOCKBITS\'']/bitfield[@name='\'BLBAT\'']' -v "@name" $devicefile) |
| 788 |
if test -n "$BOOT_LOCK_APPLICATION_TABLE_BITS" ; then |
| 789 |
echo "#define __BOOT_LOCK_APPLICATION_TABLE_BITS_EXIST" >> $headerfile |
| 790 |
fi |
| 791 |
|
| 792 |
BOOT_LOCK_APPLICATION_BITS=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'NVM\'']/registers/reg[@name='\'LOCKBITS\'']/bitfield[@name='\'BLBA\'']' -v "@name" $devicefile) |
| 793 |
if test -n "$BOOT_LOCK_APPLICATION_BITS" ; then |
| 794 |
echo "#define __BOOT_LOCK_APPLICATION_BITS_EXIST" >> $headerfile |
| 795 |
fi |
| 796 |
|
| 797 |
BOOT_LOCK_BOOT_BITS=$(xml sel -T -t -m '/AVRPART/V2/templates/module[@class='\'NVM\'']/registers/reg[@name='\'LOCKBITS\'']/bitfield[@name='\'BLBB\'']' -v "@name" $devicefile) |
| 798 |
if test -n "$BOOT_LOCK_BOOT_BITS" ; then |
| 799 |
echo "#define __BOOT_LOCK_BOOT_BITS_EXIST" >> $headerfile |
| 800 |
fi |
| 801 |
echo "" >> $headerfile |
| 802 |
echo "" >> $headerfile |
| 803 |
|
| 804 |
|
| 805 |
# XMEGA Signature information |
| 806 |
#---------------------------------------------- |
| 807 |
SIGNATURE_0=$(xml sel -T -t -m "/AVRPART/ADMIN/SIGNATURE" -v "ADDR000" $devicefile | sed "s,\\$,0x,g") |
| 808 |
SIGNATURE_1=$(xml sel -T -t -m "/AVRPART/ADMIN/SIGNATURE" -v "ADDR001" $devicefile | sed "s,\\$,0x,g") |
| 809 |
SIGNATURE_2=$(xml sel -T -t -m "/AVRPART/ADMIN/SIGNATURE" -v "ADDR002" $devicefile | sed "s,\\$,0x,g") |
| 810 |
echo "/* ========== Signature ========== */" >> $headerfile |
| 811 |
echo "#define SIGNATURE_0 ${SIGNATURE_0}" >> $headerfile |
| 812 |
echo "#define SIGNATURE_1 ${SIGNATURE_1}" >> $headerfile |
| 813 |
echo "#define SIGNATURE_2 ${SIGNATURE_2}" >> $headerfile |
| 814 |
echo "" >> $headerfile |
| 815 |
echo "" >> $headerfile |
| 816 |
|
| 817 |
|
| 818 |
else |
| 819 |
|
| 820 |
|
| 821 |
# Classic AVR |
| 822 |
#================== |
| 823 |
|
| 824 |
# Registers and bit numbers. |
| 825 |
#----------------------------- |
| 826 |
|
| 827 |
# Get register section from input file and remove some unused elements. |
| 828 |
xml sel -t -c /AVRPART/MEMORY/IO_MEMORY $devicefile | \ |
| 829 |
xml ed -O \ |
| 830 |
-d /IO_MEMORY/IO_START_ADDR \ |
| 831 |
-d /IO_MEMORY/IO_STOP_ADDR \ |
| 832 |
-d /IO_MEMORY/EXT_IO_START_ADDR \ |
| 833 |
-d /IO_MEMORY/EXT_IO_STOP_ADDR \ |
| 834 |
-d /IO_MEMORY/MEM_START_ADDR \ |
| 835 |
-d /IO_MEMORY/MEM_STOP_ADDR > $headerfile-iomemory.xml |
| 836 |
|
| 837 |
# Get list of register names. |
| 838 |
REGNAMES=$(xml el $headerfile-iomemory.xml | sed "s,IO_MEMORY$,,g" | cut -d '/' -f 2 | sed "s,\r,,g" | uniq) |
| 839 |
|
| 840 |
# Convert temporary working XML file to PYX. |
| 841 |
xml pyx $headerfile-iomemory.xml > $headerfile-iomemory.pyx |
| 842 |
|
| 843 |
# For each register... |
| 844 |
MAX_ADDRESS_WIDTH=0 |
| 845 |
for i in $REGNAMES ; do \ |
| 846 |
|
| 847 |
# Get IO address. |
| 848 |
IOADDR=$(xml sel -t -v /IO_MEMORY/$i/IO_ADDR $headerfile-iomemory.xml | sed "s,\r,," | sed "s,NA,," | sed "s,\\$,0x,g") |
| 849 |
|
| 850 |
# Get Memory address. |
| 851 |
MEMADDR=$(xml sel -t -v /IO_MEMORY/$i/MEM_ADDR $headerfile-iomemory.xml | sed "s,\r,," | sed "s,\\$,0x,g") |
| 852 |
|
| 853 |
# Check for max width of address |
| 854 |
WIDTH=$(( $(echo "$IOADDR" | wc -m) )) |
| 855 |
if test $WIDTH -gt $MAX_ADDRESS_WIDTH ; then |
| 856 |
MAX_ADDRESS_WIDTH=$WIDTH |
| 857 |
fi |
| 858 |
WIDTH=$(( $(echo "$MEMADDR" | wc -m) )) |
| 859 |
if test $WIDTH -gt $MAX_ADDRESS_WIDTH ; then |
| 860 |
MAX_ADDRESS_WIDTH=$WIDTH |
| 861 |
fi |
| 862 |
|
| 863 |
# Get initialization value (if exists). |
| 864 |
INIT=$(xml sel -t -v /IO_MEMORY/$i/INIT $headerfile-iomemory.xml | sed "s,\r,,") |
| 865 |
|
| 866 |
# Determine type of address. |
| 867 |
if test -z "$IOADDR"; then |
| 868 |
TYPE="mem" |
| 869 |
else |
| 870 |
TYPE="io" |
| 871 |
fi |
| 872 |
|
| 873 |
# Convert named register element to REGISTER element with attributes in the PYX file. |
| 874 |
sed -i "s,(${i}$,(REGISTER\nAname $i\nAtype $TYPE\nAio_addr $IOADDR\nAmem_addr $MEMADDR\nAsize 8\nAinit $INIT," $headerfile-iomemory.pyx |
| 875 |
sed -i "s,)${i}$,)REGISTER," $headerfile-iomemory.pyx |
| 876 |
done |
| 877 |
# Subtract 3 from max address width: 2 for "0x" and 1 for line feed when echoing to wc. |
| 878 |
MAX_ADDRESS_WIDTH=$(( $MAX_ADDRESS_WIDTH - 3 )) |
| 879 |
|
| 880 |
|
| 881 |
# - Convert temporary PYX file back to temporary XML file. |
| 882 |
# - Remove unused (previously converted) elements, and common registers we won't keep. |
| 883 |
# - Convert named bit mask elements to BIT elements with attributes |
| 884 |
# - Sort the register names based on the memory address element. |
| 885 |
# - Save it to the temporary XML file. |
| 886 |
xml depyx $headerfile-iomemory.pyx | \ |
| 887 |
xml ed -O \ |
| 888 |
-d "/IO_MEMORY/REGISTER/IO_ADDR" \ |
| 889 |
-d "/IO_MEMORY/REGISTER/MEM_ADDR" \ |
| 890 |
-d "/IO_MEMORY/REGISTER/INIT" \ |
| 891 |
-d "/IO_MEMORY/REGISTER[@name='SREG']" \ |
| 892 |
-d "/IO_MEMORY/REGISTER[@name='SP']" \ |
| 893 |
-d "/IO_MEMORY/REGISTER[@name='SPL']" \ |
| 894 |
-d "/IO_MEMORY/REGISTER[@name='SPH']" | \ |
| 895 |
sed 's,<.*_MASK>0x01</,<BIT value="0" name=",g' | \ |
| 896 |
sed 's,<.*_MASK>0x02</,<BIT value="1" name=",g' | \ |
| 897 |
sed 's,<.*_MASK>0x04</,<BIT value="2" name=",g' | \ |
| 898 |
sed 's,<.*_MASK>0x08</,<BIT value="3" name=",g' | \ |
| 899 |
sed 's,<.*_MASK>0x10</,<BIT value="4" name=",g' | \ |
| 900 |
sed 's,<.*_MASK>0x20</,<BIT value="5" name=",g' | \ |
| 901 |
sed 's,<.*_MASK>0x40</,<BIT value="6" name=",g' | \ |
| 902 |
sed 's,<.*_MASK>0x80</,<BIT value="7" name=",g' | \ |
| 903 |
sed 's,_MASK>$,"/>,g' | \ |
| 904 |
xml sel -t -e IO_MEMORY -n -m "/IO_MEMORY/REGISTER" -s "A:T:-" "@mem_addr" -c . -n > $headerfile-iomemory.xml |
| 905 |
|
| 906 |
# Remove temporary PYX file. |
| 907 |
rm $headerfile-iomemory.pyx |
| 908 |
|
| 909 |
# Calculate the set of word size register names needed. |
| 910 |
# - Get list of all register names, each name followed by an EOL. |
| 911 |
# - Convert to Unix line endings (for sed patterns to work). |
| 912 |
# - Cut off ending '_L' of register names. |
| 913 |
# - Cut off ending '_H' of register names. |
| 914 |
# - Cut off ending 'L' of register names. |
| 915 |
# - Cut off ending 'H' of register names. |
| 916 |
# - Get list of only duplicate register names. |
| 917 |
# - Remove duplicates. |
| 918 |
REGNAMES_WORD=$(xml sel -T -t -m "/IO_MEMORY/REGISTER" -v "@name" -n $headerfile-iomemory.xml | \ |
| 919 |
sed "s,\r\n,\n,g" | \ |
| 920 |
sed "s,_L$,,g" | \ |
| 921 |
sed "s,_H$,,g" | \ |
| 922 |
sed "s,L$,,g" | \ |
| 923 |
sed "s,H$,,g" | \ |
| 924 |
uniq -d | \ |
| 925 |
uniq) |
| 926 |
|
| 927 |
# Add word registers to temporary working XML file. |
| 928 |
# - For each word register... |
| 929 |
for i in $REGNAMES_WORD ; do \ |
| 930 |
|
| 931 |
# Get the register type from the Low register, |
| 932 |
# convert to Unix line endings. |
| 933 |
TYPE=$(xml sel -t -m '/IO_MEMORY/REGISTER[@name='\'${i}L\'']' -v "@type" $headerfile-iomemory.xml | sed "s,\r,,") |
| 934 |
|
| 935 |
# Get the io address from the Low register, |
| 936 |
# convert to Unix line endings. |
| 937 |
IOADDR=$(xml sel -t -m '/IO_MEMORY/REGISTER[@name='\'${i}L\'']' -v "@io_addr" $headerfile-iomemory.xml | sed "s,\r,,") |
| 938 |
|
| 939 |
# Get the memory address from the Low register, |
| 940 |
# convert to Unix line endings. |
| 941 |
MEMADDR=$(xml sel -t -m '/IO_MEMORY/REGISTER[@name='\'${i}L\'']' -v "@mem_addr" $headerfile-iomemory.xml | sed "s,\r,,") |
| 942 |
|
| 943 |
# - Insert a new element before the Low register, name it as the word register |
| 944 |
# - Append a 'name' attribute |
| 945 |
# - Append a 'type' attribute |
| 946 |
# - Append a 'io_addr' attribute |
| 947 |
# - Append a 'mem_addr' attribute |
| 948 |
# - Append a 'size' attribute |
| 949 |
# - Rename the element to REGISTER |
| 950 |
# - Save to a 2nd temporary XML file. |
| 951 |
xml ed -O -i '/IO_MEMORY/REGISTER[@name='\'${i}L\'']' --type "elem" -n "$i" -v "" \ |
| 952 |
-a '/IO_MEMORY/'${i} --type "attr" -n "name" -v "$i" \ |
| 953 |
-a '/IO_MEMORY/'${i} --type "attr" -n "type" -v "$TYPE" \ |
| 954 |
-a '/IO_MEMORY/'${i} --type "attr" -n "io_addr" -v "$IOADDR" \ |
| 955 |
-a '/IO_MEMORY/'${i} --type "attr" -n "mem_addr" -v "$MEMADDR" \ |
| 956 |
-a '/IO_MEMORY/'${i} --type "attr" -n "size" -v "16" \ |
| 957 |
-r '/IO_MEMORY/'${i} -v "REGISTER" $headerfile-iomemory.xml > $headerfile-iomem2.xml |
| 958 |
|
| 959 |
# Move 2nd temporary XML file to first. |
| 960 |
mv $headerfile-iomem2.xml $headerfile-iomemory.xml |
| 961 |
done |
| 962 |
|
| 963 |
|
| 964 |
# Fix width of all addresses. |
| 965 |
ALLREGS=$(xml sel -T -t -m "/IO_MEMORY/REGISTER" -v "concat(@name,' ')" $headerfile-iomemory.xml) |
| 966 |
for i in $ALLREGS ; do |
| 967 |
MEM_ADDR=$(xml sel -T -t -m '/IO_MEMORY/REGISTER[@name='\'${i}\'']' -v "@mem_addr" $headerfile-iomemory.xml) |
| 968 |
if test -n "$MEM_ADDR" ; then |
| 969 |
NEW_MEM_ADDR=$(printf "0x%0${MAX_ADDRESS_WIDTH}X" $(( $MEM_ADDR )) ) |
| 970 |
xml ed -O -u '/IO_MEMORY/REGISTER[@name='\'${i}\'']/@mem_addr' -v "$NEW_MEM_ADDR" $headerfile-iomemory.xml > $headerfile-tmp.xml |
| 971 |
mv $headerfile-tmp.xml $headerfile-iomemory.xml |
| 972 |
fi |
| 973 |
IO_ADDR=$(xml sel -T -t -m '/IO_MEMORY/REGISTER[@name='\'${i}\'']' -v "@io_addr" $headerfile-iomemory.xml) |
| 974 |
if test -n "$IO_ADDR" ; then |
| 975 |
NEW_IO_ADDR=$(printf "0x%0${MAX_ADDRESS_WIDTH}X" $(( $IO_ADDR )) ) |
| 976 |
xml ed -O -u '/IO_MEMORY/REGISTER[@name='\'${i}\'']/@io_addr' -v "$NEW_IO_ADDR" $headerfile-iomemory.xml > $headerfile-tmp.xml |
| 977 |
mv $headerfile-tmp.xml $headerfile-iomemory.xml |
| 978 |
fi |
| 979 |
done |
| 980 |
|
| 981 |
|
| 982 |
# Output data from temporary working XML file to avr-libc I/O header file. |
| 983 |
# Replace hyphens with underscores. |
| 984 |
echo "/* Registers and associated bit numbers. */" >> $headerfile |
| 985 |
xml sel -T \ |
| 986 |
-t -m "/IO_MEMORY/REGISTER[@type='io']" -s "A:T:-" "@io_addr" -n -v "concat('#define ',@name,' _SFR_IO',@size,'(',@io_addr,')')" -n \ |
| 987 |
-m "BIT[@value]" -s "A:T:-" "@value" -v "concat('#define ',@name,' ',@value)" -n \ |
| 988 |
-t -m "/IO_MEMORY/REGISTER[@type='mem']" -s "A:T:-" "@mem_addr" -n -v "concat('#define ',@name,' _SFR_MEM',@size,'(',@mem_addr,')')" -n \ |
| 989 |
-m "BIT[@value]" -s "A:T:-" "@value" -v "concat('#define ',@name,' ',@value)" -n \ |
| 990 |
-t -n -n $headerfile-iomemory.xml | \ |
| 991 |
sed "s,-,_,g" >> $headerfile |
| 992 |
|
| 993 |
|
| 994 |
# Check for ADC 16-bit register and create ADCW with guard for assembly. |
| 995 |
ADC=$(grep "#define ADC " $headerfile | cut -d ' ' -f 3) |
| 996 |
if test -n "$ADC" ; then |
| 997 |
sed -i "s,#define ADC ,#ifndef __ASSEMBLER__\\n#define ADC $ADC\\n#endif\\n#define ADCW ,g" $headerfile |
| 998 |
fi |
| 999 |
|
| 1000 |
# Create list of 8-bit registers that have no associated bit names. |
| 1001 |
REGS_NO_BITNAMES=$(xml sel -T -t -m "/IO_MEMORY/REGISTER[@size='8']" \ |
| 1002 |
-i "count(BIT)=0" -v "@name" -n $headerfile-iomemory.xml | sed "s,\r\n,\n,g") |
| 1003 |
|
| 1004 |
# Create list of 8-bit registers in the XML file that have hyphens in the names. |
| 1005 |
REGS_WITH_HYPHENS=$(xml sel -T -t -m "/IO_MEMORY/REGISTER[@size='8']" \ |
| 1006 |
-i "contains(@name, '-')" -v "@name" -n \ |
| 1007 |
-b -m "BIT" \ |
| 1008 |
-i "contains(@name, '-')" -v "@name" -n \ |
| 1009 |
$headerfile-iomemory.xml | sed "s,\r\n,\n,g") |
| 1010 |
|
| 1011 |
|
| 1012 |
# Interrupt vectors. |
| 1013 |
#---------------------- |
| 1014 |
NMB_VECTORS=$(xml sel -T -t -v /AVRPART/INTERRUPT_VECTOR/NMB_VECTORS $devicefile | sed "s,\r,,g") |
| 1015 |
VECTOR_SIZE=$(( $(xml sel -T -t -v /AVRPART/INTERRUPT_VECTOR/VECTOR2/PROGRAM_ADDRESS $devicefile | sed "s,\\$,0x,g" | sed "s,\r,,g") * 2 )) |
| 1016 |
echo "/* Interrupt vectors */" >> $headerfile |
| 1017 |
echo "/* Vector 0 is the reset vector */" >> $headerfile |
| 1018 |
VECTORS=$(xml sel -T -t -m "/AVRPART/INTERRUPT_VECTOR/*[PROGRAM_ADDRESS]" -s "A:T:-" "PROGRAM_ADDRESS" -v "concat(name(),' ')" $devicefile) |
| 1019 |
for i in $VECTORS ; do |
| 1020 |
if test "$i" != "VECTOR1" ; then |
| 1021 |
VECTOR_SOURCE=$(xml sel -T -t -m "/AVRPART/INTERRUPT_VECTOR/$i" -v "SOURCE" $devicefile | \ |
| 1022 |
sed "s,Reserved.*,Reserved,g" | \ |
| 1023 |
sed "s/,//g" | \ |
| 1024 |
sed "s, ,_,g") |
| 1025 |
if test "$VECTOR_SOURCE" != "Reserved" ; then |
| 1026 |
VECTOR_NUM=$(( $(echo $i | sed "s,VECTOR,,g") - 1)) |
| 1027 |
VECTOR_DESC=$(xml sel -T -t -m "/AVRPART/INTERRUPT_VECTOR/$i" -v "DEFINITION" $devicefile) |
| 1028 |
echo "#define ${VECTOR_SOURCE}_vect_num ${VECTOR_NUM}" >> $headerfile |
| 1029 |
echo "#define ${VECTOR_SOURCE}_vect _VECTOR(${VECTOR_NUM}) /* ${VECTOR_DESC} */" >> $headerfile |
| 1030 |
fi |
| 1031 |
fi |
| 1032 |
done |
| 1033 |
echo "" >> $headerfile |
| 1034 |
echo "#define _VECTOR_SIZE ${VECTOR_SIZE} /* Size of individual vector. */" >> $headerfile |
| 1035 |
echo "#define _VECTORS_SIZE (${NMB_VECTORS} * _VECTOR_SIZE)" >> $headerfile |
| 1036 |
echo "" >> $headerfile |
| 1037 |
echo "" >> $headerfile |
| 1038 |
|
| 1039 |
|
| 1040 |
|
| 1041 |
# Constants |
| 1042 |
#------------- |
| 1043 |
echo "/* Constants */" >> $headerfile |
| 1044 |
|
| 1045 |
# SPM_PAGESIZE |
| 1046 |
SPM_PAGESIZE=$(( $(xml sel -T -t -v "/AVRPART/MEMORY/BOOT_CONFIG/PAGESIZE" $devicefile) * 2)) |
| 1047 |
echo "#define SPM_PAGESIZE (${SPM_PAGESIZE})" >> $headerfile |
| 1048 |
|
| 1049 |
# RAMSTART |
| 1050 |
RAMSTART=$(xml sel -T -t -v "/AVRPART/MEMORY/INT_SRAM/START_ADDR" $devicefile | sed "s,\\$,0x,g") |
| 1051 |
echo "#define RAMSTART (${RAMSTART})" >> $headerfile |
| 1052 |
|
| 1053 |
# RAMSIZE |
| 1054 |
RAMSIZE=$(xml sel -T -t -v "/AVRPART/MEMORY/INT_SRAM/SIZE" $devicefile) |
| 1055 |
echo "#define RAMSIZE (${RAMSIZE})" >> $headerfile |
| 1056 |
|
| 1057 |
# RAMEND |
| 1058 |
echo "#define RAMEND (RAMSTART + RAMSIZE - 1)" >> $headerfile |
| 1059 |
|
| 1060 |
# XRAMSTART |
| 1061 |
XRAMSTART=$(xml sel -T -t -v "/AVRPART/MEMORY/EXT_SRAM/START_ADDR" $devicefile | sed "s,\\$,0x,g") |
| 1062 |
echo "#define XRAMSTART (${XRAMSTART})" >> $headerfile |
| 1063 |
|
| 1064 |
# XRAMSIZE |
| 1065 |
XRAMSIZE=$(xml sel -T -t -v "/AVRPART/MEMORY/EXT_SRAM/SIZE" $devicefile) |
| 1066 |
echo "#define XRAMSIZE (${XRAMSIZE})" >> $headerfile |
| 1067 |
|
| 1068 |
# XRAMEND |
| 1069 |
if test $XRAMSIZE -gt 0 ; then |
| 1070 |
echo "#define XRAMEND (XRAMSIZE - 1)" >> $headerfile |
| 1071 |
else |
| 1072 |
echo "#define XRAMEND (RAMEND)" >> $headerfile |
| 1073 |
fi |
| 1074 |
|
| 1075 |
# E2END |
| 1076 |
EEPROM_SIZE=$(( $(xml sel -T -t -v "/AVRPART/MEMORY/EEPROM" $devicefile) )) |
| 1077 |
if test $EEPROM_SIZE -gt 0 ; then |
| 1078 |
EEPROM_LAST=$(( $EEPROM_SIZE - 1 )) |
| 1079 |
else |
| 1080 |
EEPROM_LAST=0 |
| 1081 |
fi |
| 1082 |
E2END=$(printf "0x%X" $EEPROM_LAST) |
| 1083 |
echo "#define E2END (${E2END})" >> $headerfile |
| 1084 |
|
| 1085 |
# E2PAGESIZE |
| 1086 |
E2PAGESIZE=$(xml sel -T -t -v "/AVRPART/PROGRAMMING/EepromPageSize" $devicefile) |
| 1087 |
echo "#define E2PAGESIZE (${E2PAGESIZE})" >> $headerfile |
| 1088 |
|
| 1089 |
# FLASHEND |
| 1090 |
FLASHEND=$(printf "0x%X" $(( $(xml sel -T -t -v "/AVRPART/MEMORY/PROG_FLASH" $devicefile) - 1)) ) |
| 1091 |
echo "#define FLASHEND (${FLASHEND})" >> $headerfile |
| 1092 |
|
| 1093 |
echo "" >> $headerfile |
| 1094 |
echo "" >> $headerfile |
| 1095 |
|
| 1096 |
|
| 1097 |
|
| 1098 |
# Fuse information |
| 1099 |
#--------------------- |
| 1100 |
xml sel -T -t -o "/* Fuses */" -n $devicefile >> $headerfile |
| 1101 |
|
| 1102 |
# Certain XML files have "templates", others do not. Use V1 information. |
| 1103 |
NUM_FUSE_BYTES=$(xml sel -T -t -m /AVRPART/FUSE -v "count(LOW) + count(HIGH) + count(EXTENDED)" $devicefile) |
| 1104 |
echo "#define FUSE_MEMORY_SIZE ${NUM_FUSE_BYTES}" >> $headerfile |
| 1105 |
echo "" >> $headerfile |
| 1106 |
|
| 1107 |
if test $NUM_FUSE_BYTES -eq 1 ; then |
| 1108 |
# Single Fuse Byte |
| 1109 |
xml sel -t -e AVRPART -m /AVRPART/FUSE/LOW -c . $devicefile | \ |
| 1110 |
xml pyx | \ |
| 1111 |
sed "s,(FUSE,(FUSE\nAbitnum ,g" | \ |
| 1112 |
sed "s,)FUSE.*,)FUSE,g" | \ |
| 1113 |
sed "s,-\\$,-,g" | \ |
| 1114 |
xml depyx | \ |
| 1115 |
xml sel -T \ |
| 1116 |
-t -i "count(/AVRPART/LOW)" -o "/* Fuse Byte */" -n \ |
| 1117 |
-t -m "/AVRPART/LOW/FUSE[@bitnum]" -s "A:T:-" "@bitnum" -v "concat('#define FUSE_',NAME,' (unsigned char)~_BV(',@bitnum,') /* ',TEXT,' */')" -n \ |
| 1118 |
-t -i "count(/AVRPART/LOW)" -o "#define FUSE_DEFAULT (" \ |
| 1119 |
-m "/AVRPART/LOW/FUSE" -i "DEFAULT=0" -v "concat('FUSE_',NAME,' & ')" \ |
| 1120 |
-t -i "count(/AVRPART/LOW)" -o ")" -n -n | \ |
| 1121 |
sed "s, \& ),)," | \ |
| 1122 |
sed "s,DEFAULT (),DEFAULT (0xFF)," >> $headerfile |
| 1123 |
else |
| 1124 |
# Low Fuse Byte |
| 1125 |
xml sel -t -e AVRPART -m /AVRPART/FUSE/LOW -c . $devicefile | \ |
| 1126 |
xml pyx | \ |
| 1127 |
sed "s,(FUSE,(FUSE\nAbitnum ,g" | \ |
| 1128 |
sed "s,)FUSE.*,)FUSE,g" | \ |
| 1129 |
sed "s,-\\$,-,g" | \ |
| 1130 |
xml depyx | \ |
| 1131 |
xml sel -T \ |
| 1132 |
-t -i "count(/AVRPART/LOW)" -o "/* Low Fuse Byte */" -n \ |
| 1133 |
-t -m "/AVRPART/LOW/FUSE[@bitnum]" -s "A:T:-" "@bitnum" -v "concat('#define FUSE_',NAME,' (unsigned char)~_BV(',@bitnum,') /* ',TEXT,' */')" -n \ |
| 1134 |
-t -i "count(/AVRPART/LOW)" -o "#define LFUSE_DEFAULT (" \ |
| 1135 |
-m "/AVRPART/LOW/FUSE" -i "DEFAULT=0" -v "concat('FUSE_',NAME,' & ')" \ |
| 1136 |
-t -i "count(/AVRPART/LOW)" -o ")" -n -n | \ |
| 1137 |
sed "s, \& ),)," | \ |
| 1138 |
sed "s,DEFAULT (),DEFAULT (0xFF)," >> $headerfile |
| 1139 |
|
| 1140 |
# High Fuse Byte |
| 1141 |
xml sel -t -e AVRPART -m /AVRPART/FUSE/HIGH -c . $devicefile | \ |
| 1142 |
xml pyx | \ |
| 1143 |
sed "s,(FUSE,(FUSE\nAbitnum ,g" | \ |
| 1144 |
sed "s,)FUSE.*,)FUSE,g" | \ |
| 1145 |
sed "s,-\\$,-,g" | \ |
| 1146 |
xml depyx | \ |
| 1147 |
xml sel -T \ |
| 1148 |
-t -i "count(/AVRPART/HIGH)" -o "/* High Fuse Byte */" -n \ |
| 1149 |
-t -m "/AVRPART/HIGH/FUSE[@bitnum]" -s "A:T:-" "@bitnum" -v "concat('#define FUSE_',NAME,' (unsigned char)~_BV(',@bitnum,') /* ',TEXT,' */')" -n \ |
| 1150 |
-t -i "count(/AVRPART/HIGH)" -o "#define HFUSE_DEFAULT (" \ |
| 1151 |
-m "/AVRPART/HIGH/FUSE" -i "DEFAULT=0" -v "concat('FUSE_',NAME,' & ')" \ |
| 1152 |
-t -i "count(/AVRPART/HIGH)" -o ")" -n -n | \ |
| 1153 |
sed "s, \& ),)," | \ |
| 1154 |
sed "s,DEFAULT (),DEFAULT (0xFF)," >> $headerfile |
| 1155 |
|
| 1156 |
# Extended Fuse Byte |
| 1157 |
xml sel -t -e AVRPART -m /AVRPART/FUSE/EXTENDED -c . $devicefile | \ |
| 1158 |
xml pyx | \ |
| 1159 |
sed "s,(FUSE,(FUSE\nAbitnum ,g" | \ |
| 1160 |
sed "s,)FUSE.*,)FUSE,g" | \ |
| 1161 |
sed "s,-\\$,-,g" | \ |
| 1162 |
xml depyx | \ |
| 1163 |
xml sel -T \ |
| 1164 |
-t -i "count(/AVRPART/EXTENDED)" -o "/* Extended Fuse Byte */" -n \ |
| 1165 |
-t -m "/AVRPART/EXTENDED/FUSE[@bitnum]" -s "A:T:-" "@bitnum" -v "concat('#define FUSE_',NAME,' (unsigned char)~_BV(',@bitnum,') /* ',TEXT,' */')" -n \ |
| 1166 |
-t -i "count(/AVRPART/EXTENDED)" -o "#define EFUSE_DEFAULT (" \ |
| 1167 |
-m "/AVRPART/EXTENDED/FUSE" -i "DEFAULT=0" -v "concat('FUSE_',NAME,' & ')" \ |
| 1168 |
-t -i "count(/AVRPART/EXTENDED)" -o ")" -n -n | \ |
| 1169 |
sed "s, \& ),)," | \ |
| 1170 |
sed "s,DEFAULT (),DEFAULT (0xFF)," >> $headerfile |
| 1171 |
fi |
| 1172 |
echo "" >> $headerfile |
| 1173 |
|
| 1174 |
|
| 1175 |
|
| 1176 |
# Lockbit information |
| 1177 |
#----------------------- |
| 1178 |
xml sel -T -t -o "/* Lock Bits */" -n $devicefile >> $headerfile |
| 1179 |
|
| 1180 |
# Normal V2 information location. |
| 1181 |
xml sel -T -t -i "count(/AVRPART/V2/templates/module[@class='LOCKBIT']/registers/reg/bitfield[@name='LB'])" -o "#define __LOCK_BITS_EXIST" -n \ |
| 1182 |
-i "count(/AVRPART/V2/templates/module[@class='LOCKBIT']/registers/reg/bitfield[@name='BLB0'])" -o "#define __BOOT_LOCK_BITS_0_EXIST" -n \ |
| 1183 |
-i "count(/AVRPART/V2/templates/module[@class='LOCKBIT']/registers/reg/bitfield[@name='BLB1'])" -o "#define __BOOT_LOCK_BITS_1_EXIST" -n $devicefile >> $headerfile |
| 1184 |
|
| 1185 |
# Certain XML files have "templates", others do not. Use alternate XPath. |
| 1186 |
xml sel -T -t -i "count(/AVRPART/LOCKBIT/V2/module[@class='LOCKBIT']/registers/reg/bitfield[@name='LB'])" -o "#define __LOCK_BITS_EXIST" -n \ |
| 1187 |
-i "count(/AVRPART/LOCKBIT/V2/module[@class='LOCKBIT']/registers/reg/bitfield[@name='BLB0'])" -o "#define __BOOT_LOCK_BITS_0_EXIST" -n \ |
| 1188 |
-i "count(/AVRPART/LOCKBIT/V2/module[@class='LOCKBIT']/registers/reg/bitfield[@name='BLB1'])" -o "#define __BOOT_LOCK_BITS_1_EXIST" -n $devicefile >> $headerfile |
| 1189 |
|
| 1190 |
xml sel -T -t -n -n $devicefile >> $headerfile |
| 1191 |
|
| 1192 |
|
| 1193 |
|
| 1194 |
# Signature information |
| 1195 |
#-------------------------- |
| 1196 |
SIGNATURE_0=$(xml sel -T -t -m "/AVRPART/ADMIN/SIGNATURE" -v "ADDR000" $devicefile | sed "s,\\$,0x,g") |
| 1197 |
SIGNATURE_1=$(xml sel -T -t -m "/AVRPART/ADMIN/SIGNATURE" -v "ADDR001" $devicefile | sed "s,\\$,0x,g") |
| 1198 |
SIGNATURE_2=$(xml sel -T -t -m "/AVRPART/ADMIN/SIGNATURE" -v "ADDR002" $devicefile | sed "s,\\$,0x,g") |
| 1199 |
echo "/* Signature */" >> $headerfile |
| 1200 |
echo "#define SIGNATURE_0 ${SIGNATURE_0}" >> $headerfile |
| 1201 |
echo "#define SIGNATURE_1 ${SIGNATURE_1}" >> $headerfile |
| 1202 |
echo "#define SIGNATURE_2 ${SIGNATURE_2}" >> $headerfile |
| 1203 |
echo "" >> $headerfile |
| 1204 |
echo "" >> $headerfile |
| 1205 |
|
| 1206 |
|
| 1207 |
|
| 1208 |
# Device Pin information |
| 1209 |
#--------------------------- |
| 1210 |
# Only available in AVR Studio 4 XML V1 information. V2 does not have this data. |
| 1211 |
echo "/* Device Pin Definitions */" >> $headerfile |
| 1212 |
# Get all package types. |
| 1213 |
PACKAGE_TYPES=$(xml sel -T -t -v '/AVRPART/PACKAGE/PACKAGES' $devicefile | cut -d '[' -f 2 | cut -d ']' -f 1 | cut -d ':' -f 1- --output-delimiter=' ') |
| 1214 |
# Determine which package has the most number of pins. |
| 1215 |
PACKAGE_MAX=0 |
| 1216 |
PACKAGE_SELECTED= |
| 1217 |
for i in $PACKAGE_TYPES ; do |
| 1218 |
PACKAGE_SIZE=$(xml sel -T -t -v /AVRPART/PACKAGE/${i}/NMB_PIN $devicefile | sed "s,\r,,g") |
| 1219 |
if test $PACKAGE_SIZE -gt $PACKAGE_MAX ; then |
| 1220 |
PACKAGE_MAX=$PACKAGE_SIZE |
| 1221 |
PACKAGE_SELECTED=$i |
| 1222 |
fi |
| 1223 |
done |
| 1224 |
# Check to make sure that package information is included in the XML file. |
| 1225 |
if test -n $PACKAGE_SELECTED ; then |
| 1226 |
# Get list of pins from selected package, and check each pin. |
| 1227 |
PINS=$(xml sel -T -t -m /AVRPART/PACKAGE/$PACKAGE_SELECTED/* -v "name()" -o ' ' $devicefile | sed "s,\r,,g" | sed "s,NMB_PIN,,g") |
| 1228 |
for i in $PINS ; do |
| 1229 |
TARGET= |
| 1230 |
MAP_LIST= |
| 1231 |
|
| 1232 |
# The XML files are inconsistent in their format. Try several options. |
| 1233 |
|
| 1234 |
# Check for NAME tag. |
| 1235 |
NAME=$(xml sel -T -t -m /AVRPART/PACKAGE/$PACKAGE_SELECTED/${i}/NAME -v . -o ' ' $devicefile | sed "s,\r,,g") |
| 1236 |
if test $NAME ; then |
| 1237 |
# Get list of mappings. Inside brackets, colon delimited. The first one in the list is the target information. |
| 1238 |
TARGET=$(echo $NAME | cut -d '[' -f 2 | cut -d ']' -f 1 | cut -d ':' -f 1 --output-delimiter=' ') |
| 1239 |
MAP_LIST=$(echo $NAME | cut -d '[' -f 2 | cut -d ']' -f 1 | cut -d ':' -f 2- --output-delimiter=' ') |
| 1240 |
else |
| 1241 |
# Check for PIN_NAME and ALT_NAME tags. |
| 1242 |
PIN_NAME=$(xml sel -T -t -m /AVRPART/PACKAGE/$PACKAGE_SELECTED/${i}/PIN_NAME -v . -o ' ' $devicefile | sed "s,\r,,g") |
| 1243 |
ALT_NAME=$(xml sel -T -t -m /AVRPART/PACKAGE/$PACKAGE_SELECTED/${i}/ALT_NAME -v . -o ' ' $devicefile | sed "s,\r,,g") |
| 1244 |
|
| 1245 |
if test -n "$PIN_NAME" -a -n "$ALT_NAME" ; then |
| 1246 |
# Determine which field has the target and which has the mappings. |
| 1247 |
TARGET=$ALT_NAME |
| 1248 |
MAP_LIST=$(echo $PIN_NAME | sed "s,^[*]$,&,") |
| 1249 |
if test -z $MAP_LIST ; then |
| 1250 |
MAP_LIST=$ALT_NAME |
| 1251 |
TARGET=$PIN_NAME |
| 1252 |
fi |
| 1253 |
|
| 1254 |
# Get list of mappings. Inside brackets, colon delimited. |
| 1255 |
MAP_LIST=$(echo $MAP_LIST | cut -d '[' -f 2 | cut -d ']' -f 1 | cut -d ':' -f 1- --output-delimiter=' ') |
| 1256 |
|
| 1257 |
# Make sure target isn't just a blank character. |
| 1258 |
TARGET=$(echo $TARGET | sed "s, ,,g") |
| 1259 |
fi |
| 1260 |
fi |
| 1261 |
|
| 1262 |
if test -n "$TARGET" -a -n "$MAP_LIST" ; then |
| 1263 |
# Make transformations on map list. |
| 1264 |
# Remove active low character signified by single quote |
| 1265 |
# Replace '+' with "_P" |
| 1266 |
# Replace '-' with "_N" |
| 1267 |
MAP_LIST=$(echo $MAP_LIST | sed "s,',,g" | sed "s,+,_P,g" | sed "s,-,_N,g") |
| 1268 |
|
| 1269 |
# Remove these pin mappings because they cannot be manipulated by software. |
| 1270 |
for j in TOSC1 TOSC2 PDI PDO TCK TMS TDO TDI AVCC AREF AGND HWB RESET XTAL1 XTAL2 VCC GND NC; do |
| 1271 |
MAP_LIST=$(echo $MAP_LIST | sed "s,${j},,g") |
| 1272 |
done |
| 1273 |
|
| 1274 |
TARGET_LETTER=$(echo $TARGET | sed "s,^P,,g" | sed "s,[0-9]$,,g") |
| 1275 |
TARGET_NUMBER=$(echo $TARGET | sed "s,^P[A-Z],,g") |
| 1276 |
|
| 1277 |
# Add definitions to map alternate pin names to register definitions. |
| 1278 |
for j in $MAP_LIST ; do |
| 1279 |
echo "#define ${j}_DDR DDR${TARGET_LETTER}" >> $headerfile |
| 1280 |
echo "#define ${j}_PORT PORT${TARGET_LETTER}" >> $headerfile |
| 1281 |
echo "#define ${j}_PIN PIN${TARGET_LETTER}" >> $headerfile |
| 1282 |
echo "#define ${j}_BIT ${TARGET_NUMBER}" >> $headerfile |
| 1283 |
echo "" >> $headerfile |
| 1284 |
done |
| 1285 |
fi |
| 1286 |
done |
| 1287 |
fi |
| 1288 |
|
| 1289 |
|
| 1290 |
# End of XMEGA/Classic |
| 1291 |
fi |
| 1292 |
|
| 1293 |
|
| 1294 |
# Ending idempotent guard. |
| 1295 |
#-------------------------- |
| 1296 |
echo "#endif /* _AVR_${DEVICE}_H_ */" >> $headerfile |
| 1297 |
echo "" >> $headerfile |
| 1298 |
|
| 1299 |
# Convert to Unix line endings. |
| 1300 |
#------------------------------- |
| 1301 |
sed -i "s,\r\n,\n,g" $headerfile |
| 1302 |
|
| 1303 |
|
| 1304 |
# Set permissions on the file |
| 1305 |
#------------------------------ |
| 1306 |
chmod 644 $headerfile |
| 1307 |
|
| 1308 |
|
| 1309 |
# I/O Header File and XML Device File Verification |
| 1310 |
#-------------------------------------------------- |
| 1311 |
LOGFILE=$headerfile.log |
| 1312 |
# Turn off printing of commands for the verification. |
| 1313 |
set +ex |
| 1314 |
|
| 1315 |
if test -e $LOGFILE ; then |
| 1316 |
rm -f $LOGFILE |
| 1317 |
fi |
| 1318 |
|
| 1319 |
echo Checking for package information in XML file... | tee -a $LOGFILE |
| 1320 |
PACKAGE_TYPES=$(xml sel -t -v '/AVRPART/PACKAGE/PACKAGES' $devicefile | cut -d ']' -f 1 | cut -d ':' -f 1- --output-delimiter=' ') |
| 1321 |
if test -z "$PACKAGE_TYPES" ; then |
| 1322 |
echo "Package types missing from XML file." | tee -a $LOGFILE |
| 1323 |
fi |
| 1324 |
echo | tee -a $LOGFILE |
| 1325 |
|
| 1326 |
echo Checking for misspelled preprocessor directives in header file... | tee -a $LOGFILE |
| 1327 |
grep "#" $headerfile | cut -d '#' -f 2 | cut -d ' ' -f 1 | sort | uniq | tee -a $LOGFILE |
| 1328 |
echo | tee -a $LOGFILE |
| 1329 |
|
| 1330 |
echo Checking for duplicate definitions in header file... | tee -a $LOGFILE |
| 1331 |
grep "#define" $headerfile | cut -d '#' -f 2 | cut -d ' ' -f 2 | sort | uniq -d | uniq | tee -a $LOGFILE |
| 1332 |
echo | tee -a $LOGFILE |
| 1333 |
|
| 1334 |
echo Checking for hyphens in defined names in header file... | tee -a $LOGFILE |
| 1335 |
grep "#define" $headerfile | cut -d '#' -f 2 | cut -d ' ' -f 2 | grep '-' | tee -a $LOGFILE |
| 1336 |
echo | tee -a $LOGFILE |
| 1337 |
|
| 1338 |
echo Checking for hyphens in register and bit names in XML device file... | tee -a $LOGFILE |
| 1339 |
echo "$REGS_WITH_HYPHENS" | tee -a $LOGFILE |
| 1340 |
echo | tee -a $LOGFILE |
| 1341 |
|
| 1342 |
echo Checking for invalid signature... | tee -a $LOGFILE |
| 1343 |
if test "$SIGNATURE_0" = "0x0" -a "$SIGNATURE_1" = "0x0" -a "$SIGNATURE_2" = "0x0" ; then |
| 1344 |
echo " Invalid signature: ${SIGNATURE_0} ${SIGNATURE_1} ${SIGNATURE_2}" | tee -a $LOGFILE |
| 1345 |
fi |
| 1346 |
echo | tee -a $LOGFILE |
| 1347 |
|
| 1348 |
echo Checking for registers that have no associated bit names... | tee -a $LOGFILE |
| 1349 |
echo "$REGS_NO_BITNAMES" | tee -a $LOGFILE |
| 1350 |
echo | tee -a $LOGFILE |
| 1351 |
|
| 1352 |
# todo: |
| 1353 |
# Properly get all preprocessor directives |
| 1354 |
# Check directives against a known dictionary. |