Merge pull request #2199 from stefanrueger/test-memory

Provide special `test` memory
This commit is contained in:
Stefan Rueger
2026-08-31 10:02:31 +02:00
committed by GitHub
3 changed files with 370 additions and 349 deletions

View File

@@ -788,21 +788,31 @@ multiple memories. The special memory
expands to all memories that a part has while
.Ar all
expands to all memories with exception of sub-memories.
.Ar test
expands to a list of writable memories plus signature; this is
particularly useful for testing AVRDUDE and its -c programmers.
.Ar etc
is the same as
.Ar all ;
this can be used to change the order in which memories are written to
or read from file, eg,
.Ar signature,etc
is a list of all memories such that the
expands to a list of all memories such that the
.Ar signature
memory comes first. It is possible to remove a memory from the list so far
by preceding a minus or backslash, eg,
.Ar all,-calibration .
The available memory types are device-dependent, the actual configuration
The available memories are device-dependent; the actual memory configuration
can be viewed with the
.Cm part
command in terminal mode.
command in terminal mode. The expansion of memory lists depends in subtle
ways on the actually used -c programmer or on the chosen programming mode:
for example, the
.Ar usersig
memories of classic parts cannot be handled by ISP programming, so in
those cases above lists would not include the
.Ar usersig
memory, while it would be included in other programming constellations.
.Pp
Typically, a device's memory configuration at least contains
the memories

File diff suppressed because it is too large Load Diff

View File

@@ -283,6 +283,13 @@ static int is_backup_mem(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *
mem_is_in_fuses(mem)? mem_is_fuses(mem) || !avr_locate_fuses(p): is_interesting_mem(pgm, p, mem);
}
// Whether a memory should be included in a test:... file: writeable memories plus signature
static int is_test_mem(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem) {
return
mem_is_readonly(mem)? mem_is_signature(mem):
is_interesting_mem(pgm, p, mem);
}
// Add (not == 0) or subtract (not == 1) a memory from list
static int memadd(AVRMEM **mlist, int nm, int not, AVRMEM *m) {
for(int i = 0; i < nm; i++)
@@ -297,8 +304,8 @@ static int memadd(AVRMEM **mlist, int nm, int not, AVRMEM *m) {
}
/*
* Generate a memory list from string mstr, part p and intended programming
* modes pm; then put number of memories into *np.
* Generate a memory list from string mstr, programmer pgm, and part p; then
* put number of memories into *np.
*
* Memory list can be sth like ee,fl,all,-cal,efuse. -mem or /mem removes it
* from the list. Normal use is to pass NULL for dry and let the function write
@@ -326,6 +333,10 @@ AVRMEM **memory_list(const char *mstr, const PROGRAMMER *pgm, const AVRPART *p,
for(LNODEID lm = lfirst(p->mem); lm; lm = lnext(lm))
if(is_backup_mem(pgm, p, (m = ldata(lm))))
nm = memadd(umemlist, nm, not, m);
} else if(str_eq(s, "test")) {
for(LNODEID lm = lfirst(p->mem); lm; lm = lnext(lm))
if(is_test_mem(pgm, p, (m = ldata(lm))))
nm = memadd(umemlist, nm, not, m);
} else if(!*s) { // Ignore empty list elements
} else {
if(dry) {