Improve guessBootloaderStart() for modern AVR

This commit is contained in:
Stefan Rueger 2023-01-04 18:52:51 +00:00
parent 8b0c9988fc
commit fdcfb543fc
No known key found for this signature in database
GPG Key ID: B0B4F1FD86B1EC55
1 changed files with 3 additions and 0 deletions

View File

@ -318,6 +318,9 @@ static int guessBootStart(const PROGRAMMER *pgm, const AVRPART *p) {
int bootstart = 0; int bootstart = 0;
const AVR_Cache *cp = pgm->cp_flash; const AVR_Cache *cp = pgm->cp_flash;
if(p->prog_modes & PM_UPDI) // Modern AVRs put the bootloader at 0
return 0;
if(p->n_boot_sections > 0 && p->boot_section_size > 0) if(p->n_boot_sections > 0 && p->boot_section_size > 0)
bootstart = cp->size - (p->boot_section_size<<(p->n_boot_sections-1)); bootstart = cp->size - (p->boot_section_size<<(p->n_boot_sections-1));