Allow integer expressions in config file where numbers are expected

Notable exceptions are for pin numbers and where numbers are separated by
space only, eg, in signature and readback assignments.
This commit is contained in:
Stefan Rueger
2022-08-31 11:29:06 +01:00
parent b328067f87
commit 40896802af
4 changed files with 213 additions and 194 deletions

View File

@@ -1694,31 +1694,31 @@ The format of the programmer definition is as follows:
@smallexample
programmer
parent <id> # optional parent
id = <id1> [, <id2> [, <id3>] ...] ; # <idN> are quoted strings
desc = <description> ; # quoted string
type = <type>; # programmer type, quoted string
# supported types can be listed by "-c ?type"
prog_modes = PM_<i/f> @{ | PM_<i/f> @} # interfaces, eg, PM_SPM|PM_PDI
parent <id> # optional parent
id = <id1> [, <id2> ... ] ; # <idN> are quoted strings
desc = <description> ; # quoted string
type = <type>; # programmer type, quoted string
# supported types can be listed by "-c ?type"
prog_modes = PM_<i/f> @{ | PM_<i/f> @} # interfaces, eg, PM_SPM|PM_PDI
connection_type = parallel | serial | usb | spi
baudrate = <num> ; # baudrate for avr910-programmer
vcc = <pin1> [, <pin2> ... ] ; # pin number(s)
buff = <pin1> [, <pin2> ... ] ; # pin number(s)
reset = <pin> ; # pin number
sck = <pin> ; # pin number
mosi = <pin> ; # pin number
miso = <pin> ; # pin number
errled = <pin> ; # pin number
rdyled = <pin> ; # pin number
pgmled = <pin> ; # pin number
vfyled = <pin> ; # pin number
usbvid = <hexnum> ; # USB VID (Vendor ID)
usbpid = <hexnum> [, <hexnum> ...] ; # USB PID (Product ID)
usbdev = <interface> ; # USB interface or other device info
usbvendor = <vendorname> ; # USB Vendor Name
usbproduct = <productname> ; # USB Product Name
usbsn = <serialno> ; # USB Serial Number
hvupdi_support = <num> [, <num>, ... ] ; # UPDI HV Variants Support
baudrate = <num> ; # baudrate for avr910-programmer
vcc = <pin1> [, <pin2> ... ] ; # pin number(s)
buff = <pin1> [, <pin2> ... ] ; # pin number(s)
reset = <pin> ; # pin number
sck = <pin> ; # pin number
mosi = <pin> ; # pin number
miso = <pin> ; # pin number
errled = <pin> ; # pin number
rdyled = <pin> ; # pin number
pgmled = <pin> ; # pin number
vfyled = <pin> ; # pin number
usbvid = <hexnum> ; # USB VID (Vendor ID)
usbpid = <hexnum> [, <hexnum> ...] ; # USB PID (Product ID)
usbdev = <interface> ; # USB interface or other device info
usbvendor = <vendorname> ; # USB Vendor Name
usbproduct = <productname> ; # USB Product Name
usbsn = <serialno> ; # USB Serial Number
hvupdi_support = <num> [, <num>, ... ] ; # UPDI HV Variants Support
;
@end smallexample
@@ -1742,7 +1742,8 @@ Known programming modes are
@end itemize
@noindent
To invert a bit in the pin definitions, use @code{= ~ <num>}.
To invert a bit in the pin definitions, use @code{= ~ <num>}. To invert a pin list
(all pins get inverted) use @code{~ ( <num1> [, <num2> ... ] )}.
@noindent
Not all programmer types can handle a list of USB PIDs.
@@ -1765,7 +1766,7 @@ part
desc = <description> ; # quoted string
id = <id> ; # quoted string
family_id = <id> ; # quoted string, eg, "megaAVR" or "tinyAVR"
prog_modes = PM_<i/f> @{ | PM_<i/f> @} # interfaces, eg, PM_SPM|PM_ISP|PM_HVPP|PM_debugWIRE
prog_modes = PM_<i/f> @{| PM_<i/f>@} # interfaces, eg, PM_SPM|PM_ISP|PM_HVPP|PM_debugWIRE
mcuid = <num>; # unique id in 0..2039 for 8-bit AVRs
n_interrupts = <num>; # number of interrupts, used for vector bootloaders
n_page_erase = <num>; # if set, number of pages erased during NVM erase
@@ -1773,12 +1774,12 @@ part
devicecode = <num> ; # deprecated, use stk500_devcode
stk500_devcode = <num> ; # numeric
avr910_devcode = <num> ; # numeric
has_jtag = <yes/no> ; # part has JTAG i/f
has_debugwire = <yes/no> ; # part has debugWire i/f
has_pdi = <yes/no> ; # part has PDI i/f
has_updi = <yes/no> ; # part has UPDI i/f
has_tpi = <yes/no> ; # part has TPI i/f
is_avr32 = <yes/no> ; # AVR32 part
has_jtag = <yes/no> ; # part has JTAG i/f (deprecated, use prog_modes)
has_debugwire = <yes/no> ; # part has debugWire i/f (deprecated, use prog_modes)
has_pdi = <yes/no> ; # part has PDI i/f (deprecated, use prog_modes)
has_updi = <yes/no> ; # part has UPDI i/f (deprecated, use prog_modes)
has_tpi = <yes/no> ; # part has TPI i/f (deprecated, use prog_modes)
is_avr32 = <yes/no> ; # AVR32 part (deprecated, use prog_modes)
is_at90s1200 = <yes/no> ; # AT90S1200 part
signature = <num> <num> <num> ; # signature bytes
usbpid = <num> ; # DFU USB PID
@@ -1791,7 +1792,7 @@ part
bs2 = <num> ; # pin name in hex, i.e., 0xA0
serial = <yes/no> ; # can use serial downloading
parallel = <yes/no/pseudo> ; # can use par. programming
# STK500v2 parameters, to be taken from Atmel's XML files
# STK500v2 parameters, to be taken from Atmel's ATDF files
timeout = <num> ;
stabdelay = <num> ;
cmdexedelay = <num> ;
@@ -1803,13 +1804,13 @@ part
postdelay = <num> ;
pollmethod = <num> ;
hvspcmdexedelay = <num> ;
# STK500v2 HV programming parameters, from XML
pp_controlstack = <num>, <num>, ... ; # PP only
hvsp_controlstack = <num>, <num>, ... ; # HVSP only
# STK500v2 HV programming parameters, from ATDFs
pp_controlstack = <num>, <num>, ... ; # PP only
hvsp_controlstack = <num>, <num>, ... ; # HVSP only
flash_instr = <num>, <num>, <num> ;
eeprom_instr = <num>, <num>, ... ;
hventerstabdelay = <num> ;
progmodedelay = <num> ; # PP only
progmodedelay = <num> ; # PP only
latchcycles = <num> ;
togglevtg = <num> ;
poweroffdelay = <num> ;
@@ -1817,21 +1818,21 @@ part
resetdelayus = <num> ;
hvleavestabdelay = <num> ;
resetdelay = <num> ;
synchcycles = <num> ; # HVSP only
chiperasepulsewidth = <num> ; # PP only
synchcycles = <num> ; # HVSP only
chiperasepulsewidth = <num> ; # PP only
chiperasepolltimeout = <num> ;
chiperasetime = <num> ; # HVSP only
programfusepulsewidth = <num> ; # PP only
chiperasetime = <num> ; # HVSP only
programfusepulsewidth = <num> ; # PP only
programfusepolltimeout = <num> ;
programlockpulsewidth = <num> ; # PP only
programlockpulsewidth = <num> ; # PP only
programlockpolltimeout = <num> ;
# JTAG ICE mkII parameters, also from XML files
# JTAG ICE mkII parameters, also from ATDF files
allowfullpagebitstream = <yes/no> ;
enablepageprogramming = <yes/no> ;
idr = <num> ; # IO addr of IDR (OCD) reg
rampz = <num> ; # IO addr of RAMPZ reg
spmcr = <num> ; # mem addr of SPMC[S]R reg
eecr = <num> ; # mem addr of EECR reg only when != 0x3f
idr = <num> ; # IO addr of IDR (OCD) reg
rampz = <num> ; # IO addr of RAMPZ reg
spmcr = <num> ; # mem addr of SPMC[S]R reg
eecr = <num> ; # mem addr of EECR reg only when != 0x3f
mcu_base = <num> ;
nvm_base = <num> ;
ocd_base = <num> ;
@@ -1851,7 +1852,7 @@ part
readback_p1 = <num> ; # byte value (first component)
readback_p2 = <num> ; # byte value (second component)
pwroff_after_write = <yes/no> ; # yes/no
mode = <num> ; # STK500 v2 file parameter from Atmel's XML files
mode = <num> ; # STK500 v2 file parameter from ATDF files
delay = <num> ; # "
blocksize = <num> ; # "
readsize = <num> ; # "
@@ -1868,6 +1869,16 @@ part
;
@end smallexample
@noindent
If any of the above parameters are not specified, the default value
of 0 is used for numerics (except for @code{mcuid}, @code{hvupdi_variant} and @code{ocdrev},
where the default value is -1) or the empty string @code{""} for string
values. If a required parameter is left empty, AVRDUDE will complain.
Almost all occurrences of numbers (with the exception of pin numbers
and where they are separated by space, eg, in signature and readback)
can also be given as simple expressions involving arithemtic and
bitwise operators.
@menu
* Parent Part::
* Instruction Format::
@@ -1880,11 +1891,19 @@ part
@subsection Parent Part
@noindent
Parts can also inherit parameters from previously defined parts
using the following syntax. In this case specified integer and
string values override parameter values from the parent part. New
memory definitions are added to the definitions inherited from the
parent.
Parts can also inherit parameters from previously defined parts using
the following syntax. In this case specified integer and string values
override parameter values from the parent part. New memory definitions
are added to the definitions inherited from the parent. If, however, a
new memory definition refers to an existing one of the same name for
that part then, from v7.1, the existing memory definition is extended,
and components overwritten with new values. Assigning @code{NULL}
removes an inherited SPI instruction format, memory definition, control
stack, eeprom or flash instruction, eg, as in @code{memory "efuse" =
NULL;}
@noindent
Example format for part inheritance:
@smallexample
part parent <id> # quoted string