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
No known key found for this signature in database
GPG Key ID: B0B4F1FD86B1EC55
4 changed files with 213 additions and 194 deletions

View File

@ -18,7 +18,7 @@
# #
# programmer # programmer
# parent <id> # optional parent # parent <id> # optional parent
# id = <id1> [, <id2> [, <id3>] ...] ; # <idN> are quoted strings # id = <id1> [, <id2> ... ] ; # <idN> are quoted strings
# desc = <description> ; # quoted string # desc = <description> ; # quoted string
# type = <type>; # programmer type, quoted string # type = <type>; # programmer type, quoted string
# # supported types can be listed by "-c ?type" # # supported types can be listed by "-c ?type"
@ -44,10 +44,8 @@
# hvupdi_support = <num> [, <num>, ... ] ; # UPDI HV Variants Support # hvupdi_support = <num> [, <num>, ... ] ; # UPDI HV Variants Support
# ; # ;
# #
# # To invert a bit, use = ~ <num>, the spaces are important. # # To invert a pin use = ~ <num>
# # For a pin list all pins must be inverted. # # To invert a pin list (all pins get inverted) use ~ ( <num1> [, <num2> ... ] )
# # A single pin can be specified as usual = ~ <num>, for lists
# # specify it as follows = ~ ( <num> [, <num2> ... ] ).
# # # #
# # (1) The following program modes are known: # # (1) The following program modes are known:
# # - PM_SPM: Bootloaders, self-programming with SPM opcodes or NVM Controllers # # - PM_SPM: Bootloaders, self-programming with SPM opcodes or NVM Controllers
@ -75,13 +73,12 @@
# devicecode = <num> ; # deprecated, use stk500_devcode # devicecode = <num> ; # deprecated, use stk500_devcode
# stk500_devcode = <num> ; # numeric # stk500_devcode = <num> ; # numeric
# avr910_devcode = <num> ; # numeric # avr910_devcode = <num> ; # numeric
# has_jtag = <yes/no> ; # part has JTAG i/f # has_jtag = <yes/no> ; # part has JTAG i/f (deprecated, use prog_modes)
# has_debugwire = <yes/no> ; # part has debugWire i/f # has_debugwire = <yes/no> ; # part has debugWire i/f (deprecated, use prog_modes)
# has_pdi = <yes/no> ; # part has PDI i/f # has_pdi = <yes/no> ; # part has PDI i/f (deprecated, use prog_modes)
# has_updi = <yes/no> ; # part has UPDI i/f # has_updi = <yes/no> ; # part has UPDI i/f (deprecated, use prog_modes)
# has_tpi = <yes/no> ; # part has TPI i/f # has_tpi = <yes/no> ; # part has TPI i/f (deprecated, use prog_modes)
# is_avr32 = <yes/no> ; # AVR32 part # is_avr32 = <yes/no> ; # AVR32 part (deprecated, use prog_modes)
#
# is_at90s1200 = <yes/no> ; # AT90S1200 part # is_at90s1200 = <yes/no> ; # AT90S1200 part
# signature = <num> <num> <num> ; # signature bytes # signature = <num> <num> <num> ; # signature bytes
# usbpid = <num> ; # DFU USB PID # usbpid = <num> ; # DFU USB PID
@ -94,7 +91,7 @@
# bs2 = <num> ; # pin name in hex, i.e., 0xA0 # bs2 = <num> ; # pin name in hex, i.e., 0xA0
# serial = <yes/no> ; # can use serial downloading # serial = <yes/no> ; # can use serial downloading
# parallel = <yes/no/pseudo> ; # can use par. programming # 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> ; # timeout = <num> ;
# stabdelay = <num> ; # stabdelay = <num> ;
# cmdexedelay = <num> ; # cmdexedelay = <num> ;
@ -106,7 +103,7 @@
# postdelay = <num> ; # postdelay = <num> ;
# pollmethod = <num> ; # pollmethod = <num> ;
# hvspcmdexedelay = <num> ; # hvspcmdexedelay = <num> ;
# # STK500v2 HV programming parameters, from XML # # STK500v2 HV programming parameters, from ATDFs
# pp_controlstack = <num>, <num>, ... ; # PP only # pp_controlstack = <num>, <num>, ... ; # PP only
# hvsp_controlstack = <num>, <num>, ... ; # HVSP only # hvsp_controlstack = <num>, <num>, ... ; # HVSP only
# flash_instr = <num>, <num>, <num> ; # flash_instr = <num>, <num>, <num> ;
@ -128,7 +125,7 @@
# programfusepolltimeout = <num> ; # programfusepolltimeout = <num> ;
# programlockpulsewidth = <num> ; # PP only # programlockpulsewidth = <num> ; # PP only
# programlockpolltimeout = <num> ; # programlockpolltimeout = <num> ;
# # JTAG ICE mkII parameters, also from XML files # # JTAG ICE mkII parameters, also from ATDF files
# allowfullpagebitstream = <yes/no> ; # allowfullpagebitstream = <yes/no> ;
# enablepageprogramming = <yes/no> ; # enablepageprogramming = <yes/no> ;
# idr = <num> ; # IO addr of IDR (OCD) reg # idr = <num> ; # IO addr of IDR (OCD) reg
@ -154,7 +151,7 @@
# readback_p1 = <num> ; # byte value (first component) # readback_p1 = <num> ; # byte value (first component)
# readback_p2 = <num> ; # byte value (second component) # readback_p2 = <num> ; # byte value (second component)
# pwroff_after_write = <yes/no> ; # yes/no # 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> ; # " # delay = <num> ; # "
# blocksize = <num> ; # " # blocksize = <num> ; # "
# readsize = <num> ; # " # readsize = <num> ; # "
@ -171,10 +168,13 @@
# ; # ;
# #
# If any of the above parameters are not specified, the default value # If any of the above parameters are not specified, the default value
# of 0 is used for numerics (except for hvupdi_variant and ocdrev, # of 0 is used for numerics (except for mcuid, hvupdi_variant and
# where the default value is -1) or the empty string ("") for string # ocdrev, where the default value is -1) or the empty string "" for
# values. If a required parameter is left empty, AVRDUDE will # string values. If a required parameter is left empty, AVRDUDE will
# complain. # 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 # Parts can also inherit parameters from previously defined parts
# using the following syntax. In this case specified integer and # using the following syntax. In this case specified integer and
@ -195,13 +195,13 @@
# NOTES: # NOTES:
# * 'devicecode' is the device code used by the STK500 (see codes # * 'devicecode' is the device code used by the STK500 (see codes
# listed below) # listed below)
# * Not all memory types will implement all instructions. # * Not all memory types will implement all instructions
# * AVR Fuse bits and Lock bits are implemented as a type of memory. # * AVR Fuse bits and Lock bits are implemented as a type of memory
# * Example memory types are: # * Example memory types are:
# "flash", "eeprom", "fuse", "lfuse" (low fuse), "hfuse" (high # "flash", "eeprom", "fuse", "lfuse" (low fuse), "hfuse" (high
# fuse), "signature", "calibration", "lock" # fuse), "signature", "calibration", "lock"
# * The memory type specified on the avrdude command line must match # * 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 # * The pwroff_after_write flag causes avrdude to attempt to
# power the device off and back on after an unsuccessful write 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

View File

@ -227,7 +227,7 @@ static int pin_name;
%% %%
number_real : number_real :
TKN_NUMBER { numexpr {
$$ = $1; $$ = $1;
/* convert value to real */ /* convert value to real */
$$->value.number_real = $$->value.number; $$->value.number_real = $$->value.number;
@ -461,8 +461,8 @@ string_list :
num_list : num_list :
TKN_NUMBER { ladd(number_list, $1); } | numexpr { ladd(number_list, $1); } |
num_list TKN_COMMA TKN_NUMBER { ladd(number_list, $3); } num_list TKN_COMMA numexpr { ladd(number_list, $3); }
; ;
prog_parms : prog_parms :
@ -496,7 +496,7 @@ prog_parm :
current_prog->desc = cache_string($3->value.string); current_prog->desc = cache_string($3->value.string);
free_token($3); free_token($3);
} | } |
K_BAUDRATE TKN_EQUAL TKN_NUMBER { K_BAUDRATE TKN_EQUAL numexpr {
{ {
current_prog->baudrate = $3->value.number; current_prog->baudrate = $3->value.number;
free_token($3); free_token($3);
@ -545,7 +545,7 @@ prog_parm_usb:
free_token($3); free_token($3);
} }
} | } |
K_USBVID TKN_EQUAL TKN_NUMBER { K_USBVID TKN_EQUAL numexpr {
{ {
current_prog->usbvid = $3->value.number; current_prog->usbvid = $3->value.number;
free_token($3); free_token($3);
@ -573,7 +573,7 @@ prog_parm_usb:
; ;
usb_pid_list: usb_pid_list:
TKN_NUMBER { numexpr {
{ {
/* overwrite pids, so clear the existing entries */ /* overwrite pids, so clear the existing entries */
if(current_prog->usbpid) if(current_prog->usbpid)
@ -587,7 +587,7 @@ usb_pid_list:
free_token($1); free_token($1);
} }
} | } |
usb_pid_list TKN_COMMA TKN_NUMBER { usb_pid_list TKN_COMMA numexpr {
{ {
int *ip = cfg_malloc("usb_pid_list", sizeof(int)); int *ip = cfg_malloc("usb_pid_list", sizeof(int));
*ip = $3->value.number; *ip = $3->value.number;
@ -602,7 +602,7 @@ prog_parm_updi:
; ;
hvupdi_support_list: hvupdi_support_list:
TKN_NUMBER { numexpr {
{ {
/* overwrite list entries, so clear the existing entries */ /* overwrite list entries, so clear the existing entries */
if(current_prog->hvupdi_support) if(current_prog->hvupdi_support)
@ -616,7 +616,7 @@ hvupdi_support_list:
free_token($1); free_token($1);
} }
} | } |
hvupdi_support_list TKN_COMMA TKN_NUMBER { hvupdi_support_list TKN_COMMA numexpr {
{ {
int *ip = cfg_malloc("hvupdi_support_list", sizeof(int)); int *ip = cfg_malloc("hvupdi_support_list", sizeof(int));
*ip = $3->value.number; *ip = $3->value.number;
@ -727,13 +727,13 @@ part_parm :
free_token($3); free_token($3);
} | } |
K_HVUPDI_VARIANT TKN_EQUAL TKN_NUMBER K_HVUPDI_VARIANT TKN_EQUAL numexpr
{ {
current_part->hvupdi_variant = $3->value.number; current_part->hvupdi_variant = $3->value.number;
free_token($3); free_token($3);
} | } |
K_DEVICECODE TKN_EQUAL TKN_NUMBER { K_DEVICECODE TKN_EQUAL numexpr {
{ {
yyerror("devicecode is deprecated, use " yyerror("devicecode is deprecated, use "
"stk500_devcode instead"); "stk500_devcode instead");
@ -741,14 +741,14 @@ part_parm :
} }
} | } |
K_STK500_DEVCODE TKN_EQUAL TKN_NUMBER { K_STK500_DEVCODE TKN_EQUAL numexpr {
{ {
current_part->stk500_devcode = $3->value.number; current_part->stk500_devcode = $3->value.number;
free_token($3); free_token($3);
} }
} | } |
K_AVR910_DEVCODE TKN_EQUAL TKN_NUMBER { K_AVR910_DEVCODE TKN_EQUAL numexpr {
{ {
current_part->avr910_devcode = $3->value.number; current_part->avr910_devcode = $3->value.number;
free_token($3); free_token($3);
@ -766,7 +766,7 @@ part_parm :
} }
} | } |
K_USBPID TKN_EQUAL TKN_NUMBER { K_USBPID TKN_EQUAL numexpr {
{ {
current_part->usbpid = $3->value.number; current_part->usbpid = $3->value.number;
free_token($3); free_token($3);
@ -921,19 +921,19 @@ part_parm :
} }
} | } |
K_CHIP_ERASE_DELAY TKN_EQUAL TKN_NUMBER K_CHIP_ERASE_DELAY TKN_EQUAL numexpr
{ {
current_part->chip_erase_delay = $3->value.number; current_part->chip_erase_delay = $3->value.number;
free_token($3); free_token($3);
} | } |
K_PAGEL TKN_EQUAL TKN_NUMBER K_PAGEL TKN_EQUAL numexpr
{ {
current_part->pagel = $3->value.number; current_part->pagel = $3->value.number;
free_token($3); free_token($3);
} | } |
K_BS2 TKN_EQUAL TKN_NUMBER K_BS2 TKN_EQUAL numexpr
{ {
current_part->bs2 = $3->value.number; current_part->bs2 = $3->value.number;
free_token($3); free_token($3);
@ -949,169 +949,169 @@ part_parm :
free_tokens(2, $1, $3); free_tokens(2, $1, $3);
} | } |
K_TIMEOUT TKN_EQUAL TKN_NUMBER K_TIMEOUT TKN_EQUAL numexpr
{ {
current_part->timeout = $3->value.number; current_part->timeout = $3->value.number;
free_token($3); free_token($3);
} | } |
K_STABDELAY TKN_EQUAL TKN_NUMBER K_STABDELAY TKN_EQUAL numexpr
{ {
current_part->stabdelay = $3->value.number; current_part->stabdelay = $3->value.number;
free_token($3); free_token($3);
} | } |
K_CMDEXEDELAY TKN_EQUAL TKN_NUMBER K_CMDEXEDELAY TKN_EQUAL numexpr
{ {
current_part->cmdexedelay = $3->value.number; current_part->cmdexedelay = $3->value.number;
free_token($3); free_token($3);
} | } |
K_HVSPCMDEXEDELAY TKN_EQUAL TKN_NUMBER K_HVSPCMDEXEDELAY TKN_EQUAL numexpr
{ {
current_part->hvspcmdexedelay = $3->value.number; current_part->hvspcmdexedelay = $3->value.number;
free_token($3); free_token($3);
} | } |
K_SYNCHLOOPS TKN_EQUAL TKN_NUMBER K_SYNCHLOOPS TKN_EQUAL numexpr
{ {
current_part->synchloops = $3->value.number; current_part->synchloops = $3->value.number;
free_token($3); free_token($3);
} | } |
K_BYTEDELAY TKN_EQUAL TKN_NUMBER K_BYTEDELAY TKN_EQUAL numexpr
{ {
current_part->bytedelay = $3->value.number; current_part->bytedelay = $3->value.number;
free_token($3); free_token($3);
} | } |
K_POLLVALUE TKN_EQUAL TKN_NUMBER K_POLLVALUE TKN_EQUAL numexpr
{ {
current_part->pollvalue = $3->value.number; current_part->pollvalue = $3->value.number;
free_token($3); free_token($3);
} | } |
K_POLLINDEX TKN_EQUAL TKN_NUMBER K_POLLINDEX TKN_EQUAL numexpr
{ {
current_part->pollindex = $3->value.number; current_part->pollindex = $3->value.number;
free_token($3); free_token($3);
} | } |
K_PREDELAY TKN_EQUAL TKN_NUMBER K_PREDELAY TKN_EQUAL numexpr
{ {
current_part->predelay = $3->value.number; current_part->predelay = $3->value.number;
free_token($3); free_token($3);
} | } |
K_POSTDELAY TKN_EQUAL TKN_NUMBER K_POSTDELAY TKN_EQUAL numexpr
{ {
current_part->postdelay = $3->value.number; current_part->postdelay = $3->value.number;
free_token($3); free_token($3);
} | } |
K_POLLMETHOD TKN_EQUAL TKN_NUMBER K_POLLMETHOD TKN_EQUAL numexpr
{ {
current_part->pollmethod = $3->value.number; current_part->pollmethod = $3->value.number;
free_token($3); free_token($3);
} | } |
K_HVENTERSTABDELAY TKN_EQUAL TKN_NUMBER K_HVENTERSTABDELAY TKN_EQUAL numexpr
{ {
current_part->hventerstabdelay = $3->value.number; current_part->hventerstabdelay = $3->value.number;
free_token($3); free_token($3);
} | } |
K_PROGMODEDELAY TKN_EQUAL TKN_NUMBER K_PROGMODEDELAY TKN_EQUAL numexpr
{ {
current_part->progmodedelay = $3->value.number; current_part->progmodedelay = $3->value.number;
free_token($3); free_token($3);
} | } |
K_LATCHCYCLES TKN_EQUAL TKN_NUMBER K_LATCHCYCLES TKN_EQUAL numexpr
{ {
current_part->latchcycles = $3->value.number; current_part->latchcycles = $3->value.number;
free_token($3); free_token($3);
} | } |
K_TOGGLEVTG TKN_EQUAL TKN_NUMBER K_TOGGLEVTG TKN_EQUAL numexpr
{ {
current_part->togglevtg = $3->value.number; current_part->togglevtg = $3->value.number;
free_token($3); free_token($3);
} | } |
K_POWEROFFDELAY TKN_EQUAL TKN_NUMBER K_POWEROFFDELAY TKN_EQUAL numexpr
{ {
current_part->poweroffdelay = $3->value.number; current_part->poweroffdelay = $3->value.number;
free_token($3); free_token($3);
} | } |
K_RESETDELAYMS TKN_EQUAL TKN_NUMBER K_RESETDELAYMS TKN_EQUAL numexpr
{ {
current_part->resetdelayms = $3->value.number; current_part->resetdelayms = $3->value.number;
free_token($3); free_token($3);
} | } |
K_RESETDELAYUS TKN_EQUAL TKN_NUMBER K_RESETDELAYUS TKN_EQUAL numexpr
{ {
current_part->resetdelayus = $3->value.number; current_part->resetdelayus = $3->value.number;
free_token($3); free_token($3);
} | } |
K_HVLEAVESTABDELAY TKN_EQUAL TKN_NUMBER K_HVLEAVESTABDELAY TKN_EQUAL numexpr
{ {
current_part->hvleavestabdelay = $3->value.number; current_part->hvleavestabdelay = $3->value.number;
free_token($3); free_token($3);
} | } |
K_RESETDELAY TKN_EQUAL TKN_NUMBER K_RESETDELAY TKN_EQUAL numexpr
{ {
current_part->resetdelay = $3->value.number; current_part->resetdelay = $3->value.number;
free_token($3); free_token($3);
} | } |
K_CHIPERASEPULSEWIDTH TKN_EQUAL TKN_NUMBER K_CHIPERASEPULSEWIDTH TKN_EQUAL numexpr
{ {
current_part->chiperasepulsewidth = $3->value.number; current_part->chiperasepulsewidth = $3->value.number;
free_token($3); free_token($3);
} | } |
K_CHIPERASEPOLLTIMEOUT TKN_EQUAL TKN_NUMBER K_CHIPERASEPOLLTIMEOUT TKN_EQUAL numexpr
{ {
current_part->chiperasepolltimeout = $3->value.number; current_part->chiperasepolltimeout = $3->value.number;
free_token($3); free_token($3);
} | } |
K_CHIPERASETIME TKN_EQUAL TKN_NUMBER K_CHIPERASETIME TKN_EQUAL numexpr
{ {
current_part->chiperasetime = $3->value.number; current_part->chiperasetime = $3->value.number;
free_token($3); free_token($3);
} | } |
K_PROGRAMFUSEPULSEWIDTH TKN_EQUAL TKN_NUMBER K_PROGRAMFUSEPULSEWIDTH TKN_EQUAL numexpr
{ {
current_part->programfusepulsewidth = $3->value.number; current_part->programfusepulsewidth = $3->value.number;
free_token($3); free_token($3);
} | } |
K_PROGRAMFUSEPOLLTIMEOUT TKN_EQUAL TKN_NUMBER K_PROGRAMFUSEPOLLTIMEOUT TKN_EQUAL numexpr
{ {
current_part->programfusepolltimeout = $3->value.number; current_part->programfusepolltimeout = $3->value.number;
free_token($3); free_token($3);
} | } |
K_PROGRAMLOCKPULSEWIDTH TKN_EQUAL TKN_NUMBER K_PROGRAMLOCKPULSEWIDTH TKN_EQUAL numexpr
{ {
current_part->programlockpulsewidth = $3->value.number; current_part->programlockpulsewidth = $3->value.number;
free_token($3); free_token($3);
} | } |
K_PROGRAMLOCKPOLLTIMEOUT TKN_EQUAL TKN_NUMBER K_PROGRAMLOCKPOLLTIMEOUT TKN_EQUAL numexpr
{ {
current_part->programlockpolltimeout = $3->value.number; current_part->programlockpolltimeout = $3->value.number;
free_token($3); free_token($3);
} | } |
K_SYNCHCYCLES TKN_EQUAL TKN_NUMBER K_SYNCHCYCLES TKN_EQUAL numexpr
{ {
current_part->synchcycles = $3->value.number; current_part->synchcycles = $3->value.number;
free_token($3); free_token($3);
@ -1201,49 +1201,49 @@ part_parm :
free_token($3); free_token($3);
} | } |
K_IDR TKN_EQUAL TKN_NUMBER K_IDR TKN_EQUAL numexpr
{ {
current_part->idr = $3->value.number; current_part->idr = $3->value.number;
free_token($3); free_token($3);
} | } |
K_RAMPZ TKN_EQUAL TKN_NUMBER K_RAMPZ TKN_EQUAL numexpr
{ {
current_part->rampz = $3->value.number; current_part->rampz = $3->value.number;
free_token($3); free_token($3);
} | } |
K_SPMCR TKN_EQUAL TKN_NUMBER K_SPMCR TKN_EQUAL numexpr
{ {
current_part->spmcr = $3->value.number; current_part->spmcr = $3->value.number;
free_token($3); free_token($3);
} | } |
K_EECR TKN_EQUAL TKN_NUMBER K_EECR TKN_EQUAL numexpr
{ {
current_part->eecr = $3->value.number; current_part->eecr = $3->value.number;
free_token($3); free_token($3);
} | } |
K_MCU_BASE TKN_EQUAL TKN_NUMBER K_MCU_BASE TKN_EQUAL numexpr
{ {
current_part->mcu_base = $3->value.number; current_part->mcu_base = $3->value.number;
free_token($3); free_token($3);
} | } |
K_NVM_BASE TKN_EQUAL TKN_NUMBER K_NVM_BASE TKN_EQUAL numexpr
{ {
current_part->nvm_base = $3->value.number; current_part->nvm_base = $3->value.number;
free_token($3); free_token($3);
} | } |
K_OCD_BASE TKN_EQUAL TKN_NUMBER K_OCD_BASE TKN_EQUAL numexpr
{ {
current_part->ocd_base = $3->value.number; current_part->ocd_base = $3->value.number;
free_token($3); free_token($3);
} | } |
K_OCDREV TKN_EQUAL TKN_NUMBER K_OCDREV TKN_EQUAL numexpr
{ {
current_part->ocdrev = $3->value.number; current_part->ocdrev = $3->value.number;
free_token($3); free_token($3);
@ -1399,14 +1399,14 @@ mem_spec :
free_token($3); free_token($3);
} | } |
K_SIZE TKN_EQUAL TKN_NUMBER K_SIZE TKN_EQUAL numexpr
{ {
current_mem->size = $3->value.number; current_mem->size = $3->value.number;
free_token($3); free_token($3);
} | } |
K_PAGE_SIZE TKN_EQUAL TKN_NUMBER K_PAGE_SIZE TKN_EQUAL numexpr
{ {
int ps = $3->value.number; int ps = $3->value.number;
if (ps <= 0) if (ps <= 0)
@ -1418,25 +1418,25 @@ mem_spec :
free_token($3); free_token($3);
} | } |
K_NUM_PAGES TKN_EQUAL TKN_NUMBER K_NUM_PAGES TKN_EQUAL numexpr
{ {
current_mem->num_pages = $3->value.number; current_mem->num_pages = $3->value.number;
free_token($3); free_token($3);
} | } |
K_OFFSET TKN_EQUAL TKN_NUMBER K_OFFSET TKN_EQUAL numexpr
{ {
current_mem->offset = $3->value.number; current_mem->offset = $3->value.number;
free_token($3); free_token($3);
} | } |
K_MIN_WRITE_DELAY TKN_EQUAL TKN_NUMBER K_MIN_WRITE_DELAY TKN_EQUAL numexpr
{ {
current_mem->min_write_delay = $3->value.number; current_mem->min_write_delay = $3->value.number;
free_token($3); free_token($3);
} | } |
K_MAX_WRITE_DELAY TKN_EQUAL TKN_NUMBER K_MAX_WRITE_DELAY TKN_EQUAL numexpr
{ {
current_mem->max_write_delay = $3->value.number; current_mem->max_write_delay = $3->value.number;
free_token($3); free_token($3);
@ -1456,44 +1456,44 @@ mem_spec :
free_token($4); free_token($4);
} | } |
K_READBACK_P1 TKN_EQUAL TKN_NUMBER K_READBACK_P1 TKN_EQUAL numexpr
{ {
current_mem->readback[0] = $3->value.number; current_mem->readback[0] = $3->value.number;
free_token($3); free_token($3);
} | } |
K_READBACK_P2 TKN_EQUAL TKN_NUMBER K_READBACK_P2 TKN_EQUAL numexpr
{ {
current_mem->readback[1] = $3->value.number; current_mem->readback[1] = $3->value.number;
free_token($3); free_token($3);
} | } |
K_MODE TKN_EQUAL TKN_NUMBER K_MODE TKN_EQUAL numexpr
{ {
current_mem->mode = $3->value.number; current_mem->mode = $3->value.number;
free_token($3); free_token($3);
} | } |
K_DELAY TKN_EQUAL TKN_NUMBER K_DELAY TKN_EQUAL numexpr
{ {
current_mem->delay = $3->value.number; current_mem->delay = $3->value.number;
free_token($3); free_token($3);
} | } |
K_BLOCKSIZE TKN_EQUAL TKN_NUMBER K_BLOCKSIZE TKN_EQUAL numexpr
{ {
current_mem->blocksize = $3->value.number; current_mem->blocksize = $3->value.number;
free_token($3); free_token($3);
} | } |
K_READSIZE TKN_EQUAL TKN_NUMBER K_READSIZE TKN_EQUAL numexpr
{ {
current_mem->readsize = $3->value.number; current_mem->readsize = $3->value.number;
free_token($3); free_token($3);
} | } |
K_POLLINDEX TKN_EQUAL TKN_NUMBER K_POLLINDEX TKN_EQUAL numexpr
{ {
current_mem->pollindex = $3->value.number; current_mem->pollindex = $3->value.number;
free_token($3); free_token($3);

View File

@ -1695,7 +1695,7 @@ The format of the programmer definition is as follows:
@smallexample @smallexample
programmer programmer
parent <id> # optional parent parent <id> # optional parent
id = <id1> [, <id2> [, <id3>] ...] ; # <idN> are quoted strings id = <id1> [, <id2> ... ] ; # <idN> are quoted strings
desc = <description> ; # quoted string desc = <description> ; # quoted string
type = <type>; # programmer type, quoted string type = <type>; # programmer type, quoted string
# supported types can be listed by "-c ?type" # supported types can be listed by "-c ?type"
@ -1742,7 +1742,8 @@ Known programming modes are
@end itemize @end itemize
@noindent @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 @noindent
Not all programmer types can handle a list of USB PIDs. Not all programmer types can handle a list of USB PIDs.
@ -1773,12 +1774,12 @@ part
devicecode = <num> ; # deprecated, use stk500_devcode devicecode = <num> ; # deprecated, use stk500_devcode
stk500_devcode = <num> ; # numeric stk500_devcode = <num> ; # numeric
avr910_devcode = <num> ; # numeric avr910_devcode = <num> ; # numeric
has_jtag = <yes/no> ; # part has JTAG i/f has_jtag = <yes/no> ; # part has JTAG i/f (deprecated, use prog_modes)
has_debugwire = <yes/no> ; # part has debugWire i/f has_debugwire = <yes/no> ; # part has debugWire i/f (deprecated, use prog_modes)
has_pdi = <yes/no> ; # part has PDI i/f has_pdi = <yes/no> ; # part has PDI i/f (deprecated, use prog_modes)
has_updi = <yes/no> ; # part has UPDI i/f has_updi = <yes/no> ; # part has UPDI i/f (deprecated, use prog_modes)
has_tpi = <yes/no> ; # part has TPI i/f has_tpi = <yes/no> ; # part has TPI i/f (deprecated, use prog_modes)
is_avr32 = <yes/no> ; # AVR32 part is_avr32 = <yes/no> ; # AVR32 part (deprecated, use prog_modes)
is_at90s1200 = <yes/no> ; # AT90S1200 part is_at90s1200 = <yes/no> ; # AT90S1200 part
signature = <num> <num> <num> ; # signature bytes signature = <num> <num> <num> ; # signature bytes
usbpid = <num> ; # DFU USB PID usbpid = <num> ; # DFU USB PID
@ -1791,7 +1792,7 @@ part
bs2 = <num> ; # pin name in hex, i.e., 0xA0 bs2 = <num> ; # pin name in hex, i.e., 0xA0
serial = <yes/no> ; # can use serial downloading serial = <yes/no> ; # can use serial downloading
parallel = <yes/no/pseudo> ; # can use par. programming 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> ; timeout = <num> ;
stabdelay = <num> ; stabdelay = <num> ;
cmdexedelay = <num> ; cmdexedelay = <num> ;
@ -1803,7 +1804,7 @@ part
postdelay = <num> ; postdelay = <num> ;
pollmethod = <num> ; pollmethod = <num> ;
hvspcmdexedelay = <num> ; hvspcmdexedelay = <num> ;
# STK500v2 HV programming parameters, from XML # STK500v2 HV programming parameters, from ATDFs
pp_controlstack = <num>, <num>, ... ; # PP only pp_controlstack = <num>, <num>, ... ; # PP only
hvsp_controlstack = <num>, <num>, ... ; # HVSP only hvsp_controlstack = <num>, <num>, ... ; # HVSP only
flash_instr = <num>, <num>, <num> ; flash_instr = <num>, <num>, <num> ;
@ -1825,7 +1826,7 @@ part
programfusepolltimeout = <num> ; programfusepolltimeout = <num> ;
programlockpulsewidth = <num> ; # PP only programlockpulsewidth = <num> ; # PP only
programlockpolltimeout = <num> ; programlockpolltimeout = <num> ;
# JTAG ICE mkII parameters, also from XML files # JTAG ICE mkII parameters, also from ATDF files
allowfullpagebitstream = <yes/no> ; allowfullpagebitstream = <yes/no> ;
enablepageprogramming = <yes/no> ; enablepageprogramming = <yes/no> ;
idr = <num> ; # IO addr of IDR (OCD) reg idr = <num> ; # IO addr of IDR (OCD) reg
@ -1851,7 +1852,7 @@ part
readback_p1 = <num> ; # byte value (first component) readback_p1 = <num> ; # byte value (first component)
readback_p2 = <num> ; # byte value (second component) readback_p2 = <num> ; # byte value (second component)
pwroff_after_write = <yes/no> ; # yes/no 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> ; # " delay = <num> ; # "
blocksize = <num> ; # " blocksize = <num> ; # "
readsize = <num> ; # " readsize = <num> ; # "
@ -1868,6 +1869,16 @@ part
; ;
@end smallexample @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 @menu
* Parent Part:: * Parent Part::
* Instruction Format:: * Instruction Format::
@ -1880,11 +1891,19 @@ part
@subsection Parent Part @subsection Parent Part
@noindent @noindent
Parts can also inherit parameters from previously defined parts Parts can also inherit parameters from previously defined parts using
using the following syntax. In this case specified integer and the following syntax. In this case specified integer and string values
string values override parameter values from the parent part. New override parameter values from the parent part. New memory definitions
memory definitions are added to the definitions inherited from the are added to the definitions inherited from the parent. If, however, a
parent. 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 @smallexample
part parent <id> # quoted string part parent <id> # quoted string

View File

@ -63,7 +63,7 @@ SIGN [+-]
%% %%
{SIGN}?{DIGIT}+ { yylval = new_number(yytext); return TKN_NUMBER; } {DIGIT}+ { yylval = new_number(yytext); return TKN_NUMBER; /* sign is treated in grammar */ }
{SIGN}?{DIGIT}+"."{DIGIT}* { yylval = new_number_real(yytext); return TKN_NUMBER_REAL; } {SIGN}?{DIGIT}+"."{DIGIT}* { yylval = new_number_real(yytext); return TKN_NUMBER_REAL; }
{SIGN}?"."{DIGIT}+ { yylval = new_number_real(yytext); return TKN_NUMBER_REAL; } {SIGN}?"."{DIGIT}+ { yylval = new_number_real(yytext); return TKN_NUMBER_REAL; }