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

@@ -17,51 +17,49 @@
# Possible entry formats are:
#
# 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 (1)
# 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 (1)
# 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) (2)
# 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) (2)
# 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
# ;
#
# # To invert a bit, use = ~ <num>, the spaces are important.
# # For a pin list all pins must be inverted.
# # A single pin can be specified as usual = ~ <num>, for lists
# # specify it as follows = ~ ( <num> [, <num2> ... ] ).
# #
# # (1) The following program modes are known:
# # - PM_SPM: Bootloaders, self-programming with SPM opcodes or NVM Controllers
# # - PM_TPI: Tiny Programming Interface (t4, t5, t9, t10, t20, t40, t102, t104)
# # - PM_ISP: SPI programming for In-System Programming (almost all classic parts)
# # - PM_PDI: Program and Debug Interface (xmega parts)
# # - PM_UPDI: Unified Program and Debug Interface
# # - PM_HVSP: High Voltage Serial Programming (some classic parts)
# # - PM_HVPP: High Voltage Parallel Programming (most non-HVSP classic parts)
# # - PM_debugWIRE: Simpler alternative to JTAG (a subset of HVPP/HVSP parts)
# # - PM_JTAG: Joint Test Action Group standard (some classic parts, some xmega)
# # - PM_aWire: AVR32 parts
# #
# # (2) Not all programmer types can process a list of PIDs
# # To invert a pin use = ~ <num>
# # To invert a pin list (all pins get inverted) use ~ ( <num1> [, <num2> ... ] )
# #
# # (1) The following program modes are known:
# # - PM_SPM: Bootloaders, self-programming with SPM opcodes or NVM Controllers
# # - PM_TPI: Tiny Programming Interface (t4, t5, t9, t10, t20, t40, t102, t104)
# # - PM_ISP: SPI programming for In-System Programming (almost all classic parts)
# # - PM_PDI: Program and Debug Interface (xmega parts)
# # - PM_UPDI: Unified Program and Debug Interface
# # - PM_HVSP: High Voltage Serial Programming (some classic parts)
# # - PM_HVPP: High Voltage Parallel Programming (most non-HVSP classic parts)
# # - PM_debugWIRE: Simpler alternative to JTAG (a subset of HVPP/HVSP parts)
# # - PM_JTAG: Joint Test Action Group standard (some classic parts, some xmega)
# # - PM_aWire: AVR32 parts
# #
# # (2) Not all programmer types can process a list of PIDs
#
# part
# desc = <description> ; # quoted string
@@ -75,13 +73,12 @@
# 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
@@ -94,7 +91,7 @@
# 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> ;
@@ -106,13 +103,13 @@
# 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> ;
@@ -120,21 +117,21 @@
# 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> ;
@@ -154,7 +151,7 @@
# 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, to be taken from Atmel's XML files
# mode = <num> ; # STK500 v2 file parameter from ATDF files
# delay = <num> ; # "
# blocksize = <num> ; # "
# readsize = <num> ; # "
@@ -171,10 +168,13 @@
# ;
#
# If any of the above parameters are not specified, the default value
# of 0 is used for numerics (except for hvupdi_variant and ocdrev,
# where the default value is -1) or the empty string ("") for string
# values. If a required parameter is left empty, AVRDUDE will
# complain.
# of 0 is used for numerics (except for mcuid, hvupdi_variant and
# ocdrev, where the default value is -1) or the empty string "" 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.
#
# Parts can also inherit parameters from previously defined parts
# using the following syntax. In this case specified integer and
@@ -185,7 +185,7 @@
# memory definition is extended, and components overwritten with new
# values. Assigning NULL removes an inherited SPI instruction format,
# memory definition, control stack, eeprom or flash instruction, eg,
# as in memory "efuse" = NULL;
# as in memory "efuse" = NULL;
#
# part parent <id> # quoted string
# id = <id> ; # quoted string
@@ -195,16 +195,16 @@
# NOTES:
# * 'devicecode' is the device code used by the STK500 (see codes
# listed below)
# * Not all memory types will implement all instructions.
# * AVR Fuse bits and Lock bits are implemented as a type of memory.
# * Not all memory types will implement all instructions
# * AVR Fuse bits and Lock bits are implemented as a type of memory
# * Example memory types are:
# "flash", "eeprom", "fuse", "lfuse" (low fuse), "hfuse" (high
# fuse), "signature", "calibration", "lock"
# * The memory type specified on the avrdude command line must match
# one of the memory types defined for the specified chip.
# one of the memory types defined for the specified chip
# * The pwroff_after_write flag causes avrdude to attempt to
# power the device off and back on after an unsuccessful write to
# the affected memory area if VCC programmer pins are defined. If
# the affected memory area if VCC programmer pins are defined. If
# VCC pins are not defined for the programmer, a message
# indicating that the device needs a power-cycle is printed out.
# This flag was added to work around a problem with the