From 0e61f337395b5941ce901b5f41f5f896472dd30b Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Sun, 16 Jun 2024 15:38:59 +0100 Subject: [PATCH] Remove 'in sigrow' attribute from some signature/calibration memories --- src/avr.c | 4 ++-- src/config_gram.y | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/avr.c b/src/avr.c index c8b1600a..10a40981 100644 --- a/src/avr.c +++ b/src/avr.c @@ -1569,8 +1569,8 @@ Memtable avr_mem_order[100] = { {"lockbits", MEM_LOCK}, {"prodsig", MEM_SIGROW | MEM_IN_SIGROW | MEM_READONLY}, {"sigrow", MEM_SIGROW | MEM_IN_SIGROW | MEM_READONLY}, - {"signature", MEM_SIGNATURE | MEM_IN_SIGROW | MEM_READONLY}, - {"calibration", MEM_CALIBRATION | MEM_IN_SIGROW | MEM_READONLY}, + {"signature", MEM_SIGNATURE | MEM_IN_SIGROW | MEM_READONLY}, // Not in SIGROW in Classic/XMEGA parts + {"calibration", MEM_CALIBRATION | MEM_IN_SIGROW | MEM_READONLY}, // Not in SIGROW in Classic parts {"tempsense", MEM_TEMPSENSE | MEM_IN_SIGROW | MEM_READONLY}, {"sernum", MEM_SERNUM | MEM_IN_SIGROW | MEM_READONLY}, {"osccal16", MEM_OSCCAL16 | MEM_IN_SIGROW | MEM_READONLY}, diff --git a/src/config_gram.y b/src/config_gram.y index 8b9c2875..c0b4f26f 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -367,8 +367,19 @@ part_def : m->num_pages = m->size / m->page_size; } + // Remove MEM_IN_SIGROW attribute from classic calibration and classic/XMEGA signature mem + if(!(current_part->prog_modes & (PM_PDI|PM_UPDI))) { + if(mem_is_signature(m)) + m->type &= ~MEM_IN_SIGROW; + if(mem_is_calibration(m)) + m->type &= ~MEM_IN_SIGROW; + } else if(current_part->prog_modes & PM_PDI) { + if(mem_is_signature(m)) + m->type &= ~MEM_IN_SIGROW; + } if(fileio_mem_offset(current_part, m) == -1U) yywarning("revise fileio_mem_offset(), avrdude.conf entry or memory type assignment"); + } existing_part = locate_part(part_list, current_part->id);