mirror of
https://github.com/mariusgreuel/avrdude.git
synced 2025-12-16 02:31:06 +00:00
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:
@@ -63,7 +63,7 @@ static struct {
|
||||
const char *mcu, *var, *value;
|
||||
} ptinj[] = {
|
||||
// Add triples here, eg, {"ATmega328P", "mcuid", "999"},
|
||||
{NULL, NULL, NULL},
|
||||
{NULL, NULL, NULL},
|
||||
};
|
||||
|
||||
static struct {
|
||||
@@ -134,7 +134,7 @@ static void printallopcodes(const AVRPART *p, const char *d, OPCODE * const *opa
|
||||
|
||||
|
||||
// Programming modes
|
||||
static char *prog_modes(const AVRPART *p) {
|
||||
static char *prog_modes_str_flags(const AVRPART *p) {
|
||||
static char type[1024];
|
||||
|
||||
*type = 0;
|
||||
@@ -194,6 +194,34 @@ static char *prog_modes(const AVRPART *p) {
|
||||
return type + (*type == '|');
|
||||
}
|
||||
|
||||
static char *prog_modes_str(int pm) {
|
||||
static char type[1024];
|
||||
|
||||
strcpy(type, "0");
|
||||
if(pm & PM_SPM)
|
||||
strcat(type, " | PM_SPM");
|
||||
if(pm & PM_TPI)
|
||||
strcat(type, " | PM_TPI");
|
||||
if(pm & PM_ISP)
|
||||
strcat(type, " | PM_ISP");
|
||||
if(pm & PM_PDI)
|
||||
strcat(type, " | PM_PDI");
|
||||
if(pm & PM_UPDI)
|
||||
strcat(type, " | PM_UPDI");
|
||||
if(pm & PM_HVSP)
|
||||
strcat(type, " | PM_HVSP");
|
||||
if(pm & PM_HVPP)
|
||||
strcat(type, " | PM_HVPP");
|
||||
if(pm & PM_debugWIRE)
|
||||
strcat(type, " | PM_debugWIRE");
|
||||
if(pm & PM_JTAG)
|
||||
strcat(type, " | PM_JTAG");
|
||||
if(pm & PM_aWire)
|
||||
strcat(type, " | PM_aWire");
|
||||
|
||||
return type + (type[1] == 0? 0: 4);
|
||||
}
|
||||
|
||||
|
||||
// Check whether address bits are where they should be in ISP commands
|
||||
static void checkaddr(int memsize, int pagesize, int opnum, const OPCODE *op, const AVRPART *p, const AVRMEM *m) {
|
||||
@@ -573,6 +601,10 @@ static void dev_part_strct(const AVRPART *p, bool tsv, const AVRPART *base, bool
|
||||
_if_partout_str(strcmp, descstr, desc);
|
||||
_if_partout_str(strcmp, cfg_escape(p->id), id);
|
||||
_if_partout_str(strcmp, cfg_escape(p->family_id), family_id);
|
||||
_if_partout_str(intcmp, cfg_strdup("dev_part_strct()", prog_modes_str(p->prog_modes)), prog_modes);
|
||||
_if_partout(intcmp, "%d", mcuid);
|
||||
_if_partout(intcmp, "%d", n_interrupts);
|
||||
_if_partout(intcmp, "%d", n_page_erase);
|
||||
_if_partout(intcmp, "%d", hvupdi_variant);
|
||||
_if_partout(intcmp, "0x%02x", stk500_devcode);
|
||||
_if_partout(intcmp, "0x%02x", avr910_devcode);
|
||||
@@ -1032,7 +1064,7 @@ void dev_output_part_defs(char *partdesc) {
|
||||
nfuses,
|
||||
ok,
|
||||
p->flags,
|
||||
prog_modes(p),
|
||||
prog_modes_str_flags(p),
|
||||
p->config_file, p->lineno
|
||||
);
|
||||
}
|
||||
@@ -1189,6 +1221,7 @@ static void dev_pgm_strct(const PROGRAMMER *pgm, bool tsv, const PROGRAMMER *bas
|
||||
_if_pgmout_str(strcmp, cfg_escape(pgm->desc), desc);
|
||||
if(!base || base->initpgm != pgm->initpgm)
|
||||
_pgmout_fmt("type", "\"%s\"", locate_programmer_type_id(pgm->initpgm));
|
||||
_if_pgmout_str(intcmp, cfg_strdup("dev_pgm_strct()", prog_modes_str(pgm->prog_modes)), prog_modes);
|
||||
if(!base || base->conntype != pgm->conntype)
|
||||
_pgmout_fmt("connection_type", "%s", connstr(pgm->conntype));
|
||||
_if_pgmout(intcmp, "%d", baudrate);
|
||||
|
||||
Reference in New Issue
Block a user