diff --git a/build/scripts/TargetDescriptionFiles/AVR8/Avr8TargetDescriptionFile.php b/build/scripts/TargetDescriptionFiles/AVR8/Avr8TargetDescriptionFile.php index 31290202..a81ddc75 100644 --- a/build/scripts/TargetDescriptionFiles/AVR8/Avr8TargetDescriptionFile.php +++ b/build/scripts/TargetDescriptionFiles/AVR8/Avr8TargetDescriptionFile.php @@ -10,6 +10,7 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile const AVR8_FAMILY_MEGA = 'MEGA'; const AVR8_FAMILY_TINY = 'TINY'; const AVR8_FAMILY_XMEGA = 'XMEGA'; + const AVR8_FAMILY_OTHER = 'OTHER'; const AVR8_PHYSICAL_INTERFACE_JTAG = 'JTAG'; const AVR8_PHYSICAL_INTERFACE_PDI = 'PDI'; @@ -75,6 +76,9 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile } else if (stristr($deviceAttributes['family'], 'mega') !== false) { $this->family = self::AVR8_FAMILY_MEGA; + + } else { + $this->family = self::AVR8_FAMILY_OTHER; } } @@ -94,7 +98,8 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile $progAddressSpace = $this->addressSpacesById['prog'] ?? null; if (!empty($progAddressSpace)) { $flashMemorySegment = $progAddressSpace->memorySegmentsByTypeAndName['flash']['flash'] - ?? $progAddressSpace->memorySegmentsByTypeAndName['flash']['app_section'] ?? null; + ?? $progAddressSpace->memorySegmentsByTypeAndName['flash']['app_section'] + ?? $progAddressSpace->memorySegmentsByTypeAndName['flash']['progmem'] ?? null; $bootSectionMemorySegment = $progAddressSpace->memorySegmentsByTypeAndName['flash']['boot_section_1'] ?? $progAddressSpace->memorySegmentsByTypeAndName['flash']['boot_section'] ?? null; diff --git a/src/Targets/TargetDescription/TargetDescriptionFile.cpp b/src/Targets/TargetDescription/TargetDescriptionFile.cpp index 6ea6d943..1d6d4a2a 100644 --- a/src/Targets/TargetDescription/TargetDescriptionFile.cpp +++ b/src/Targets/TargetDescription/TargetDescriptionFile.cpp @@ -369,11 +369,12 @@ std::optional TargetDescriptionFile::getFlashMemorySegment() cons auto& flashMemorySegments = programMemorySegments.find(MemorySegmentType::FLASH)->second; /* - * Some target descriptions describe the flash memory segments in the "APP_SECTION" segment, whereas - * others use the "FLASH" segment. + * In AVR8 TDFs, flash memory segments are typically named "APP_SECTION", "PROGMEM" or "FLASH". */ auto flashSegmentIt = flashMemorySegments.find("app_section") != flashMemorySegments.end() ? - flashMemorySegments.find("app_section") : flashMemorySegments.find("flash"); + flashMemorySegments.find("app_section") + : flashMemorySegments.find("progmem") != flashMemorySegments.end() + ? flashMemorySegments.find("progmem") : flashMemorySegments.find("flash"); if (flashSegmentIt != flashMemorySegments.end()) { return flashSegmentIt->second;