Adjusted AVR8 TDF processing build script to extract all physical interfaces (as opposed to just debug-capable physical interfaces)

This commit is contained in:
Nav
2022-10-05 20:57:08 +01:00
parent 15d9dbe5e4
commit f5d75f2ea6

View File

@@ -18,6 +18,7 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
const AVR8_FAMILY_DD = 'DD'; const AVR8_FAMILY_DD = 'DD';
const AVR8_FAMILY_OTHER = 'OTHER'; const AVR8_FAMILY_OTHER = 'OTHER';
const AVR8_PHYSICAL_INTERFACE_ISP = 'ISP';
const AVR8_PHYSICAL_INTERFACE_JTAG = 'JTAG'; const AVR8_PHYSICAL_INTERFACE_JTAG = 'JTAG';
const AVR8_PHYSICAL_INTERFACE_PDI = 'PDI'; const AVR8_PHYSICAL_INTERFACE_PDI = 'PDI';
const AVR8_PHYSICAL_INTERFACE_UPDI = 'UPDI'; const AVR8_PHYSICAL_INTERFACE_UPDI = 'UPDI';
@@ -25,7 +26,8 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
public ?Signature $signature = null; public ?Signature $signature = null;
public ?string $family = null; public ?string $family = null;
public array $debugPhysicalInterface = []; public array $physicalInterfaces = [];
public array $debugPhysicalInterfaces = [];
// Target params // Target params
public ?int $bootSectionStartAddress = null; public ?int $bootSectionStartAddress = null;
@@ -125,19 +127,27 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
} }
} }
if (isset($this->physicalInterfacesByName['isp'])) {
$this->physicalInterfaces[] = self::AVR8_PHYSICAL_INTERFACE_ISP;
}
if (isset($this->physicalInterfacesByName['debugwire'])) { if (isset($this->physicalInterfacesByName['debugwire'])) {
$this->debugPhysicalInterface[] = self::AVR8_PHYSICAL_INTERFACE_DEBUG_WIRE; $this->debugPhysicalInterfaces[] = self::AVR8_PHYSICAL_INTERFACE_DEBUG_WIRE;
$this->physicalInterfaces[] = self::AVR8_PHYSICAL_INTERFACE_DEBUG_WIRE;
} }
if (isset($this->physicalInterfacesByName['updi'])) { if (isset($this->physicalInterfacesByName['updi'])) {
$this->debugPhysicalInterface[] = self::AVR8_PHYSICAL_INTERFACE_UPDI; $this->debugPhysicalInterfaces[] = self::AVR8_PHYSICAL_INTERFACE_UPDI;
$this->physicalInterfaces[] = self::AVR8_PHYSICAL_INTERFACE_UPDI;
} else if (isset($this->physicalInterfacesByName['pdi'])) { } else if (isset($this->physicalInterfacesByName['pdi'])) {
$this->debugPhysicalInterface[] = self::AVR8_PHYSICAL_INTERFACE_PDI; $this->debugPhysicalInterfaces[] = self::AVR8_PHYSICAL_INTERFACE_PDI;
$this->physicalInterfaces[] = self::AVR8_PHYSICAL_INTERFACE_PDI;
} }
if (isset($this->physicalInterfacesByName['jtag'])) { if (isset($this->physicalInterfacesByName['jtag'])) {
$this->debugPhysicalInterface[] = self::AVR8_PHYSICAL_INTERFACE_JTAG; $this->debugPhysicalInterfaces[] = self::AVR8_PHYSICAL_INTERFACE_JTAG;
$this->physicalInterfaces[] = self::AVR8_PHYSICAL_INTERFACE_JTAG;
} }
$signaturePropertyGroup = $this->propertyGroupsByName['signatures'] ?? null; $signaturePropertyGroup = $this->propertyGroupsByName['signatures'] ?? null;
@@ -490,7 +500,7 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
} }
} }
if (in_array(Avr8TargetDescriptionFile::AVR8_PHYSICAL_INTERFACE_UPDI, $this->debugPhysicalInterface)) { if (in_array(Avr8TargetDescriptionFile::AVR8_PHYSICAL_INTERFACE_UPDI, $this->debugPhysicalInterfaces)) {
if (isset($this->peripheralModulesByName['nvmctrl'])) { if (isset($this->peripheralModulesByName['nvmctrl'])) {
$nvmModule = $this->peripheralModulesByName['nvmctrl']; $nvmModule = $this->peripheralModulesByName['nvmctrl'];
@@ -558,7 +568,7 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
$failures[] = "Missing or incomplete AVR signature."; $failures[] = "Missing or incomplete AVR signature.";
} }
if (is_null($this->debugPhysicalInterface)) { if (is_null($this->debugPhysicalInterfaces)) {
$failures[] = 'Target does not support any known AVR8 debug interface - the TDF will need to be deleted.' $failures[] = 'Target does not support any known AVR8 debug interface - the TDF will need to be deleted.'
. ' Aborting validation.'; . ' Aborting validation.';
return $failures; return $failures;
@@ -568,7 +578,7 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
$failures[] = 'Unknown AVR8 family'; $failures[] = 'Unknown AVR8 family';
} }
if (in_array(self::AVR8_PHYSICAL_INTERFACE_DEBUG_WIRE, $this->debugPhysicalInterface)) { if (in_array(self::AVR8_PHYSICAL_INTERFACE_DEBUG_WIRE, $this->debugPhysicalInterfaces)) {
if (!isset($this->physicalInterfacesByName['isp'])) { if (!isset($this->physicalInterfacesByName['isp'])) {
$failures[] = 'Missing ISP interface for debugWire target.'; $failures[] = 'Missing ISP interface for debugWire target.';
} }
@@ -678,9 +688,9 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
$failures[] = 'Missing eeprom page size.'; $failures[] = 'Missing eeprom page size.';
} }
if (in_array(self::AVR8_PHYSICAL_INTERFACE_DEBUG_WIRE, $this->debugPhysicalInterface) if (in_array(self::AVR8_PHYSICAL_INTERFACE_DEBUG_WIRE, $this->debugPhysicalInterfaces)
|| ( || (
in_array(self::AVR8_PHYSICAL_INTERFACE_JTAG, $this->debugPhysicalInterface) in_array(self::AVR8_PHYSICAL_INTERFACE_JTAG, $this->debugPhysicalInterfaces)
&& $this->family == self::AVR8_FAMILY_MEGA && $this->family == self::AVR8_FAMILY_MEGA
) )
) { ) {
@@ -701,7 +711,7 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
} }
} }
if (in_array(self::AVR8_PHYSICAL_INTERFACE_PDI, $this->debugPhysicalInterface)) { if (in_array(self::AVR8_PHYSICAL_INTERFACE_PDI, $this->debugPhysicalInterfaces)) {
if (is_null($this->appSectionPdiOffset)) { if (is_null($this->appSectionPdiOffset)) {
$failures[] = 'Missing app section PDI offset.'; $failures[] = 'Missing app section PDI offset.';
} }
@@ -739,7 +749,7 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
} }
} }
if (in_array(Avr8TargetDescriptionFile::AVR8_PHYSICAL_INTERFACE_UPDI, $this->debugPhysicalInterface)) { if (in_array(Avr8TargetDescriptionFile::AVR8_PHYSICAL_INTERFACE_UPDI, $this->debugPhysicalInterfaces)) {
if (is_null($this->nvmModuleBaseAddress)) { if (is_null($this->nvmModuleBaseAddress)) {
$failures[] = 'Missing NVM base address.'; $failures[] = 'Missing NVM base address.';
} }