Add avrintel.[ch] to the project and warn if mcuid incompatible with avrintel.c
This commit is contained in:
parent
b0198a319f
commit
626a43b139
|
@ -252,6 +252,8 @@ add_executable(avrdude
|
|||
main.c
|
||||
term.c
|
||||
term.h
|
||||
avrintel.c
|
||||
avrintel.h
|
||||
developer_opts.c
|
||||
developer_opts.h
|
||||
developer_opts_private.h
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
# 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
|
||||
# mcuid = <num>; # unique id in 0..2039 for urclock programmer
|
||||
# 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
|
||||
# hvupdi_variant = <num> ; # numeric -1 (n/a) or 0..2
|
||||
|
@ -13169,6 +13169,7 @@ part
|
|||
part parent ".reduced_core_tiny"
|
||||
desc = "ATtiny4";
|
||||
id = "t4";
|
||||
mcuid = 0;
|
||||
n_interrupts = 10;
|
||||
signature = 0x1e 0x8f 0x0a;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -583,6 +583,7 @@ AVRPART *avr_new_part(void) {
|
|||
p->mem_alias = lcreat(NULL, 0);
|
||||
|
||||
// Default values
|
||||
p->mcuid = -1;
|
||||
p->hvupdi_variant = -1;
|
||||
memset(p->signature, 0xFF, 3);
|
||||
p->reset_disposition = RESET_DEDICATED;
|
||||
|
|
40
src/config.c
40
src/config.c
|
@ -31,6 +31,7 @@
|
|||
#include "avrdude.h"
|
||||
#include "libavrdude.h"
|
||||
#include "config.h"
|
||||
#include "avrintel.h"
|
||||
|
||||
#include "config_gram.h"
|
||||
|
||||
|
@ -834,3 +835,42 @@ void cfg_assign(char *sp, int strct, Component_t *cp, VALUE *v) {
|
|||
cp->name, cfg_strct_name(strct), cfg_comp_type(cp->type));
|
||||
}
|
||||
}
|
||||
|
||||
// Automatically assign an mcuid if known from avrintel.c table
|
||||
void cfg_update_mcuid(AVRPART *part) {
|
||||
// Don't assign an mcuid for template parts that has a space in desc
|
||||
if(!part->desc || *part->desc == 0 || strchr(part->desc, ' '))
|
||||
return;
|
||||
|
||||
// Don't assign an mcuid for template parts where id starts with "."
|
||||
if(!part->id || !*part->id || *part->id == '.')
|
||||
return;
|
||||
|
||||
// Don't assign an mcuid for 32-bit AVR parts
|
||||
if(part->prog_modes & PM_aWire)
|
||||
return;
|
||||
|
||||
// Find an entry that shares the same name
|
||||
for(int i=0; i < sizeof uP_table/sizeof *uP_table; i++) {
|
||||
if(strcasecmp(part->desc, uP_table[i].name) == 0) {
|
||||
if(part->mcuid != (int) uP_table[i].mcuid) {
|
||||
part->mcuid = uP_table[i].mcuid;
|
||||
yywarning("assigned mcuid = %d to part %s", part->mcuid, part->desc);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// None have the same name: an entry with part->mcuid is an error
|
||||
for(int i=0; i < sizeof uP_table/sizeof *uP_table; i++)
|
||||
if(part->mcuid == (int) uP_table[i].mcuid) {
|
||||
yywarning("mcuid %d is reserved for %s, use a free number >= %d",
|
||||
part->mcuid, uP_table[i].name, sizeof uP_table/sizeof *uP_table);
|
||||
return;
|
||||
}
|
||||
|
||||
// Range check
|
||||
if(part->mcuid < 0 || part->mcuid >= UB_N_MCU)
|
||||
yywarning("mcuid %d for %s is out of range [0..%d], use a free number >= %d",
|
||||
part->mcuid, part->desc, UB_N_MCU-1, sizeof uP_table/sizeof *uP_table);
|
||||
}
|
||||
|
|
|
@ -161,6 +161,7 @@ const char *cfg_strct_name(int strct);
|
|||
|
||||
void cfg_assign(char *sp, int strct, Component_t *cp, VALUE *v);
|
||||
|
||||
void cfg_update_mcuid(AVRPART *part);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -374,6 +374,8 @@ part_def :
|
|||
YYABORT;
|
||||
}
|
||||
|
||||
cfg_update_mcuid(current_part);
|
||||
|
||||
// Sanity checks for memory sizes and compute/override num_pages entry
|
||||
for (ln=lfirst(current_part->mem); ln; ln=lnext(ln)) {
|
||||
m = ldata(ln);
|
||||
|
|
|
@ -1766,7 +1766,7 @@ part
|
|||
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
|
||||
mcuid = <num>; # unique id in 0..2039 for urclock programmer
|
||||
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
|
||||
hvupdi_variant = <num> ; # numeric -1 (n/a) or 0..2
|
||||
|
|
Loading…
Reference in New Issue