DWEN fuse bit field validation (in TDFs) for AVR8 debugWire targets
This commit is contained in:
@@ -6,6 +6,7 @@ use Bloom\BuildScripts\TargetDescriptionFiles\TargetDescriptionFile;
|
|||||||
|
|
||||||
require_once __DIR__ . "/../TargetDescriptionFile.php";
|
require_once __DIR__ . "/../TargetDescriptionFile.php";
|
||||||
require_once __DIR__ . "/Signature.php";
|
require_once __DIR__ . "/Signature.php";
|
||||||
|
require_once __DIR__ . "/FuseBitDescriptor.php";
|
||||||
|
|
||||||
class Avr8TargetDescriptionFile extends TargetDescriptionFile
|
class Avr8TargetDescriptionFile extends TargetDescriptionFile
|
||||||
{
|
{
|
||||||
@@ -85,6 +86,9 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
|
|||||||
public ?int $ispReadFusePollIndex = null;
|
public ?int $ispReadFusePollIndex = null;
|
||||||
public ?int $ispReadLockPollIndex = null;
|
public ?int $ispReadLockPollIndex = null;
|
||||||
|
|
||||||
|
public ?FuseBitDescriptor $dwenFuseBitDescriptor = null;
|
||||||
|
|
||||||
|
|
||||||
protected function init()
|
protected function init()
|
||||||
{
|
{
|
||||||
parent::init();
|
parent::init();
|
||||||
@@ -231,6 +235,19 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$fuseModule = $this->modulesByName['fuse'] ?? null;
|
||||||
|
if (!empty($fuseModule)) {
|
||||||
|
$fuseRegisterGroup = $fuseModule->registerGroupsMappedByName['fuse'] ?? null;
|
||||||
|
if (!empty($fuseRegisterGroup)) {
|
||||||
|
foreach ($fuseRegisterGroup->registersMappedByName as $fuseType => $fuseRegister) {
|
||||||
|
if (isset($fuseRegister->bitFieldsByName['dwen'])) {
|
||||||
|
$this->dwenFuseBitDescriptor = new FuseBitDescriptor();
|
||||||
|
$this->dwenFuseBitDescriptor->fuseType = $fuseType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$progAddressSpace = $this->addressSpacesById['prog'] ?? null;
|
$progAddressSpace = $this->addressSpacesById['prog'] ?? null;
|
||||||
if (!empty($progAddressSpace)) {
|
if (!empty($progAddressSpace)) {
|
||||||
$flashMemorySegment = $progAddressSpace->memorySegmentsByTypeAndName['flash']['flash']
|
$flashMemorySegment = $progAddressSpace->memorySegmentsByTypeAndName['flash']['flash']
|
||||||
@@ -580,6 +597,21 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
|
|||||||
if (is_null($this->ispReadLockPollIndex)) {
|
if (is_null($this->ispReadLockPollIndex)) {
|
||||||
$failures[] = 'Missing ispreadlock_pollindex ISP parameter.';
|
$failures[] = 'Missing ispreadlock_pollindex ISP parameter.';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($this->dwenFuseBitDescriptor)) {
|
||||||
|
$failures[] = 'Could not find DWEN fuse bit field for debugWire target.';
|
||||||
|
|
||||||
|
} else {
|
||||||
|
static $validFuseTypes = [
|
||||||
|
FuseBitDescriptor::FUSE_TYPE_LOW,
|
||||||
|
FuseBitDescriptor::FUSE_TYPE_HIGH,
|
||||||
|
FuseBitDescriptor::FUSE_TYPE_EXTENDED,
|
||||||
|
];
|
||||||
|
|
||||||
|
if (!in_array($this->dwenFuseBitDescriptor->fuseType, $validFuseTypes)) {
|
||||||
|
$failures[] = 'Invalid/unknown fuse byte type for DWEN fuse bit.';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_null($this->stackPointerRegisterLowAddress)) {
|
if (is_null($this->stackPointerRegisterLowAddress)) {
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
namespace Bloom\BuildScripts\TargetDescriptionFiles\Avr8;
|
||||||
|
|
||||||
|
class FuseBitDescriptor
|
||||||
|
{
|
||||||
|
const FUSE_TYPE_LOW = 'low';
|
||||||
|
const FUSE_TYPE_HIGH = 'high';
|
||||||
|
const FUSE_TYPE_EXTENDED = 'extended';
|
||||||
|
|
||||||
|
public ?string $fuseType = null;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user