Added OCDEN and JTAGEN fuse bit check in TDF validation script

This commit is contained in:
Nav
2023-05-07 16:52:09 +01:00
parent e5c78e7b3a
commit d3fdc37df0

View File

@@ -92,7 +92,8 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
public ?int $ispReadLockPollIndex = null; public ?int $ispReadLockPollIndex = null;
public ?FuseBitDescriptor $dwenFuseBitDescriptor = null; public ?FuseBitDescriptor $dwenFuseBitDescriptor = null;
public ?FuseBitDescriptor $ocdenFuseBitDescriptor = null;
public ?FuseBitDescriptor $jtagenFuseBitDescriptor = null;
protected function init() protected function init()
{ {
@@ -257,6 +258,16 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
$this->dwenFuseBitDescriptor = new FuseBitDescriptor(); $this->dwenFuseBitDescriptor = new FuseBitDescriptor();
$this->dwenFuseBitDescriptor->fuseType = $fuseType; $this->dwenFuseBitDescriptor->fuseType = $fuseType;
} }
if (isset($fuseRegister->bitFieldsByName['ocden'])) {
$this->ocdenFuseBitDescriptor = new FuseBitDescriptor();
$this->ocdenFuseBitDescriptor->fuseType = $fuseType;
}
if (isset($fuseRegister->bitFieldsByName['jtagen'])) {
$this->jtagenFuseBitDescriptor = new FuseBitDescriptor();
$this->jtagenFuseBitDescriptor->fuseType = $fuseType;
}
} }
} }
} }
@@ -831,6 +842,35 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
} }
} }
if (
in_array(Avr8TargetDescriptionFile::AVR8_PHYSICAL_INTERFACE_JTAG, $this->debugPhysicalInterfaces)
&& $this->family == self::AVR8_FAMILY_MEGA
) {
static $validFuseTypes = [
FuseBitDescriptor::FUSE_TYPE_LOW,
FuseBitDescriptor::FUSE_TYPE_HIGH,
FuseBitDescriptor::FUSE_TYPE_EXTENDED,
];
if (empty($this->ocdenFuseBitDescriptor)) {
$failures[] = 'Could not find OCDEN fuse bit field for JTAG target.';
} else {
if (!in_array($this->ocdenFuseBitDescriptor->fuseType, $validFuseTypes)) {
$failures[] = 'Invalid/unknown fuse byte type for OCDEN fuse bit.';
}
}
if (empty($this->jtagenFuseBitDescriptor)) {
$failures[] = 'Could not find JTAGEN fuse bit field for JTAG target.';
} else {
if (!in_array($this->jtagenFuseBitDescriptor->fuseType, $validFuseTypes)) {
$failures[] = 'Invalid/unknown fuse byte type for JTAGEN fuse bit.';
}
}
}
$portPeripheralModule = $this->peripheralModulesByName['port'] ?? null; $portPeripheralModule = $this->peripheralModulesByName['port'] ?? null;
if (empty($portPeripheralModule)) { if (empty($portPeripheralModule)) {
$failures[] = 'PORT peripheral module not found.'; $failures[] = 'PORT peripheral module not found.';