Added OCDEN and JTAGEN fuse bit check in TDF validation script
This commit is contained in:
@@ -92,7 +92,8 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
|
||||
public ?int $ispReadLockPollIndex = null;
|
||||
|
||||
public ?FuseBitDescriptor $dwenFuseBitDescriptor = null;
|
||||
|
||||
public ?FuseBitDescriptor $ocdenFuseBitDescriptor = null;
|
||||
public ?FuseBitDescriptor $jtagenFuseBitDescriptor = null;
|
||||
|
||||
protected function init()
|
||||
{
|
||||
@@ -257,6 +258,16 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
|
||||
$this->dwenFuseBitDescriptor = new FuseBitDescriptor();
|
||||
$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;
|
||||
if (empty($portPeripheralModule)) {
|
||||
$failures[] = 'PORT peripheral module not found.';
|
||||
|
||||
Reference in New Issue
Block a user