Prepare for new components in avrdude.conf incl prog_modes

- Add prog_modes to part and programmer definitions; prog_mode is a bitwise
   or of programming modes
     + PM_SPM: Bootloaders, self-programming with SPM/NVM Controllers
     + PM_TPI: t4, t5, t9, t10, t20, t40, t102, t104
     + PM_ISP: SPI programming for In-System Programming (typ 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: some classic parts, some xmega
     + PM_aWire: AVR32 parts
 - Add mcuid, a unique id in 0..2039, to part definition for urclock programmer
 - Add n_interrupts, the number of interrupts, to part definition
 - Add n_page_erase to part definition (# of pages erased during NVM erase)

 - Implement a simple calculator in config_gram.y so numeric values can be
   expressed as simple expressions such as PM_SPM | PM_UPDI

 - Introduce a new method of assigning simple components to the grammar without
   touching config_gram.y via an eligible-component list in config.c; numeric
   expressions on the rhs of an assignment resolve to integer values

 - Update documentation in avrdude.conf.in and avrdude.texi
This commit is contained in:
Stefan Rueger
2022-08-30 02:08:15 +01:00
parent cddf2943eb
commit ed2b8342df
8 changed files with 542 additions and 142 deletions

View File

@@ -37,13 +37,48 @@ typedef struct {
} COMMENT;
enum { V_NONE, V_NUM, V_NUM_REAL, V_STR };
enum { // Which structures a component can occur in
COMP_CONFIG_MAIN,
COMP_PROGRAMMER,
COMP_AVRPART,
COMP_AVRMEM,
};
enum { // Component types in structure
COMP_INT,
COMP_SHORT,
COMP_CHAR,
COMP_STRING,
COMP_CHAR_ARRAY, // This and below are not yet implemented
COMP_INT_LISTID,
COMP_STRING_LISTID,
COMP_OPCODE,
COMP_PIN, // Pins may never be implemented
COMP_PIN_LIST
};
typedef struct { // Description of a component in a structure
const char *name; // Component name
int strct; // Structure, eg, COMP_AVRPART
int offset, size, type; // Location, size and type within structure
} Component_t;
enum { // Value types for VALUE struct
V_NONE,
V_NUM,
V_NUM_REAL,
V_STR,
V_COMPONENT,
};
typedef struct value_t {
int type;
union {
int number;
double number_real;
char * string;
Component_t *comp;
};
} VALUE;
@@ -59,6 +94,7 @@ extern FILE * yyin;
extern PROGRAMMER * current_prog;
extern AVRPART * current_part;
extern AVRMEM * current_mem;
int current_strct;
extern int cfg_lineno;
extern char * cfg_infile;
extern LISTID string_list;
@@ -87,15 +123,17 @@ void free_token(TOKEN *tkn);
void free_tokens(int n, ...);
TOKEN *number(const char *text);
TOKEN *new_number(const char *text);
TOKEN *number_real(const char *text);
TOKEN *new_number_real(const char *text);
TOKEN *hexnumber(const char *text);
TOKEN *new_hexnumber(const char *text);
TOKEN *string(const char *text);
TOKEN *new_constant(const char *text);
TOKEN *keyword(int primary);
TOKEN *new_string(const char *text);
TOKEN *new_keyword(int primary);
void print_token(TOKEN *tkn);
@@ -115,6 +153,15 @@ LISTID cfg_move_comments(void);
void cfg_pop_comms(void);
Component_t *cfg_comp_search(const char *name, int strct);
const char *cfg_v_type(int type);
const char *cfg_strct_name(int strct);
void cfg_assign(char *sp, int strct, Component_t *cp, VALUE *v);
#ifdef __cplusplus
}
#endif