Move ordering of memory sections after reading config file

As suggested, sort the memory sections into order right after reading
the config file, so all consumers of the library will later see them
in the same order.
This commit is contained in:
Joerg Wunsch
2026-07-16 22:56:46 +02:00
parent c03ceb563d
commit fc7c89f1d4
2 changed files with 4 additions and 5 deletions

View File

@@ -378,6 +378,10 @@ part_def :
yywarning("revise fileio_mem_offset(), avrdude.conf entry or memory type assignment");
}
// Sort memories in canonical order
if(current_part->mem)
lsort(current_part->mem, avr_mem_cmp);
existing_part = locate_part(part_list, current_part->id);
if(existing_part) {
{ /* temporarily set lineno to lineno of part start */

View File

@@ -1184,11 +1184,6 @@ int main(int argc, char *argv[]) {
}
}
// Sort memories of all parts in canonical order
for(LNODEID ln1 = lfirst(part_list); ln1; ln1 = lnext(ln1))
if((p = ldata(ln1))->mem)
lsort(p->mem, avr_mem_cmp);
// Set bitclock from configuration files unless changed by command line
if(default_bitclock > 0 && bitclock == 0.0) {
bitclock = default_bitclock;