Corrected EEARL/H register address extraction from AVR8 TDFs.

Some other bits of tidying
This commit is contained in:
Nav
2024-03-29 15:52:12 +00:00
parent b9d537e924
commit 779a5ad151
7 changed files with 109 additions and 100 deletions

View File

@@ -121,7 +121,7 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
$output->ocdRevision = $this->stringService->tryStringToInt(
$this->getPropertyValue('ocd', 'ocd_revision')
);
$output->ocdDataRegister = $this->stringService->tryStringToInt(
$output->ocdDataRegisterAddress = $this->stringService->tryStringToInt(
$this->getPropertyValue('ocd', 'ocd_datareg')
);
@@ -131,40 +131,40 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
$eepromAddressRegister = $eepromPeripheral->getRegister('eeprom', 'eear');
if ($eepromAddressRegister instanceof TargetRegister) {
$output->eepromAddressRegisterLow = $eepromAddressRegister->address;
$output->eepromAddressRegisterHigh = $eepromAddressRegister->size > 1
$output->eearAddressLow = $eepromAddressRegister->address;
$output->eearAddressHigh = $eepromAddressRegister->size > 1
? $eepromAddressRegister->address !== null
? $eepromAddressRegister->address >> 2
? $eepromAddressRegister->address >> 8
: null
: $eepromAddressRegister->address
;
} else {
$eepromAddressRegisterLow = $eepromPeripheral->getRegister('eeprom', 'eearl');
$eepromAddressRegisterHigh = $eepromPeripheral->getRegister('eeprom', 'eearh');
$eearAddressLow = $eepromPeripheral->getRegister('eeprom', 'eearl');
$eearAddressHigh = $eepromPeripheral->getRegister('eeprom', 'eearh');
if ($eepromAddressRegisterLow instanceof TargetRegister) {
$output->eepromAddressRegisterLow = $eepromAddressRegisterLow->address;
$output->eepromAddressRegisterHigh = $eepromAddressRegisterLow->size > 1
? $eepromAddressRegisterLow->address !== null
? $eepromAddressRegisterLow->address >> 2
if ($eearAddressLow instanceof TargetRegister) {
$output->eearAddressLow = $eearAddressLow->address;
$output->eearAddressHigh = $eearAddressLow->size > 1
? $eearAddressLow->address !== null
? $eearAddressLow->address >> 8
: null
: $eepromAddressRegisterLow->address;
: $eearAddressLow->address;
}
if ($eepromAddressRegisterHigh instanceof TargetRegister) {
$output->eepromAddressRegisterHigh = $eepromAddressRegisterHigh->address;
if ($eearAddressHigh instanceof TargetRegister) {
$output->eearAddressHigh = $eearAddressHigh->address;
}
}
$eepromDataRegister = $eepromPeripheral->getRegister('eeprom', 'eedr');
if ($eepromDataRegister instanceof TargetRegister) {
$output->eepromDataRegisterAddress = $eepromDataRegister->address;
$output->eedrAddress = $eepromDataRegister->address;
}
$eepromControlRegister = $eepromPeripheral->getRegister('eeprom', 'eecr');
if ($eepromControlRegister instanceof TargetRegister) {
$output->eepromControlRegisterAddress = $eepromControlRegister->address;
$output->eecrAddress = $eepromControlRegister->address;
}
}
@@ -175,7 +175,7 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
?? $cpuPeripheral->getRegister('cpu', 'spmcr');
if ($spmcsRegister instanceof TargetRegister) {
$output->spmcRegisterStartAddress = $spmcsRegister->address;
$output->spmcrAddress = $spmcsRegister->address;
}
$osccalRegister = $cpuPeripheral->getRegister('cpu', 'osccal')
@@ -189,7 +189,7 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
}
}
if ($output->spmcRegisterStartAddress === null) {
if ($output->spmcrAddress === null) {
$bootLoaderPeripheral = $this->getTargetPeripheral('boot_load');
if ($bootLoaderPeripheral instanceof TargetPeripheral) {
@@ -197,7 +197,7 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
?? $bootLoaderPeripheral->getRegister('boot_load', 'spmcsr');
if ($spmcsRegister instanceof TargetRegister) {
$output->spmcRegisterStartAddress = $spmcsRegister->address;
$output->spmcrAddress = $spmcsRegister->address;
}
}
}
@@ -274,7 +274,7 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
}
$output->ocdRevision = $this->stringService->tryStringToInt($this->getPropertyValue('ocd', 'ocd_revision'));
$output->ocdDataRegister = $this->stringService->tryStringToInt($this->getPropertyValue('ocd', 'ocd_datareg'));
$output->ocdDataRegisterAddress = $this->stringService->tryStringToInt($this->getPropertyValue('ocd', 'ocd_datareg'));
$eepromPeripheral = $this->getTargetPeripheral('eeprom');
@@ -282,8 +282,8 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
$eepromAddressRegister = $eepromPeripheral->getRegister('eeprom', 'eear');
if ($eepromAddressRegister instanceof TargetRegister) {
$output->eepromAddressRegisterLow = $eepromAddressRegister->address;
$output->eepromAddressRegisterHigh = $eepromAddressRegister->size > 1
$output->eearAddressLow = $eepromAddressRegister->address;
$output->eearAddressHigh = $eepromAddressRegister->size > 1
? $eepromAddressRegister->address !== null
? $eepromAddressRegister->address >> 2
: null
@@ -291,26 +291,26 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
;
} else {
$eepromAddressRegisterLow = $eepromPeripheral->getRegister('eeprom', 'eearl');
$eepromAddressRegisterHigh = $eepromPeripheral->getRegister('eeprom', 'eearh');
$eearAddressLow = $eepromPeripheral->getRegister('eeprom', 'eearl');
$eearAddressHigh = $eepromPeripheral->getRegister('eeprom', 'eearh');
if ($eepromAddressRegisterLow instanceof TargetRegister) {
$output->eepromAddressRegisterLow = $eepromAddressRegisterLow->address;
if ($eearAddressLow instanceof TargetRegister) {
$output->eearAddressLow = $eearAddressLow->address;
}
if ($eepromAddressRegisterHigh instanceof TargetRegister) {
$output->eepromAddressRegisterHigh = $eepromAddressRegisterHigh->address;
if ($eearAddressHigh instanceof TargetRegister) {
$output->eearAddressHigh = $eearAddressHigh->address;
}
}
$eepromDataRegister = $eepromPeripheral->getRegister('eeprom', 'eedr');
if ($eepromDataRegister instanceof TargetRegister) {
$output->eepromDataRegisterAddress = $eepromDataRegister->address;
$output->eedrAddress = $eepromDataRegister->address;
}
$eepromControlRegister = $eepromPeripheral->getRegister('eeprom', 'eecr');
if ($eepromControlRegister instanceof TargetRegister) {
$output->eepromControlRegisterAddress = $eepromControlRegister->address;
$output->eecrAddress = $eepromControlRegister->address;
}
}
@@ -321,7 +321,7 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
?? $cpuPeripheral->getRegister('cpu', 'spmcr');
if ($spmcsRegister instanceof TargetRegister) {
$output->spmcRegisterStartAddress = $spmcsRegister->address;
$output->spmcrAddress = $spmcsRegister->address;
}
$osccalRegister = $cpuPeripheral->getRegister('cpu', 'osccal')
@@ -335,7 +335,7 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
}
}
if ($output->spmcRegisterStartAddress === null) {
if ($output->spmcrAddress === null) {
$bootLoaderPeripheral = $this->getTargetPeripheral('boot_load');
if ($bootLoaderPeripheral instanceof TargetPeripheral) {
@@ -343,7 +343,7 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
?? $bootLoaderPeripheral->getRegister('boot_load', 'spmcsr');
if ($spmcsRegister instanceof TargetRegister) {
$output->spmcRegisterStartAddress = $spmcsRegister->address;
$output->spmcrAddress = $spmcsRegister->address;
}
}
}

View File

@@ -16,11 +16,11 @@ class DebugWireParameters
public ?int $eepromSize = null;
public ?int $eepromPageSize = null;
public ?int $ocdRevision = null;
public ?int $ocdDataRegister = null;
public ?int $eepromAddressRegisterHigh = null;
public ?int $eepromAddressRegisterLow = null;
public ?int $eepromControlRegisterAddress = null;
public ?int $eepromDataRegisterAddress = null;
public ?int $spmcRegisterStartAddress = null;
public ?int $ocdDataRegisterAddress = null;
public ?int $eearAddressHigh = null;
public ?int $eearAddressLow = null;
public ?int $eecrAddress = null;
public ?int $eedrAddress = null;
public ?int $spmcrAddress = null;
public ?int $osccalAddress = null;
}

View File

@@ -16,11 +16,11 @@ class JtagParameters
public ?int $eepromSize = null;
public ?int $eepromPageSize = null;
public ?int $ocdRevision = null;
public ?int $ocdDataRegister = null;
public ?int $eepromAddressRegisterHigh = null;
public ?int $eepromAddressRegisterLow = null;
public ?int $eepromControlRegisterAddress = null;
public ?int $eepromDataRegisterAddress = null;
public ?int $spmcRegisterStartAddress = null;
public ?int $ocdDataRegisterAddress = null;
public ?int $eearAddressHigh = null;
public ?int $eearAddressLow = null;
public ?int $eecrAddress = null;
public ?int $eedrAddress = null;
public ?int $spmcrAddress = null;
public ?int $osccalAddress = null;
}

View File

@@ -207,31 +207,31 @@ class ValidationService extends \Targets\TargetDescriptionFiles\Services\Validat
$failures[] = 'EEPROM page size exceeds 0xFF - corresponding EDBG device parameter size is 8 bits';
}
if ($parameters->eepromAddressRegisterHigh === null) {
if ($parameters->eearAddressHigh === null) {
$failures[] = 'Missing EEARH address';
} elseif ($parameters->eepromAddressRegisterHigh > 0xFF) {
} elseif ($parameters->eearAddressHigh > 0xFF) {
$failures[] = 'EEARH address size exceeds 0xFF - corresponding EDBG device parameter size is 8 bits';
}
if ($parameters->eepromAddressRegisterLow === null) {
if ($parameters->eearAddressLow === null) {
$failures[] = 'Missing EEARL address';
} elseif ($parameters->eepromAddressRegisterLow > 0xFF) {
} elseif ($parameters->eearAddressLow > 0xFF) {
$failures[] = 'EEARL address size exceeds 0xFF - corresponding EDBG device parameter size is 8 bits';
}
if ($parameters->eepromControlRegisterAddress === null) {
if ($parameters->eecrAddress === null) {
$failures[] = 'Missing EECR address';
} elseif ($parameters->eepromControlRegisterAddress > 0xFF) {
} elseif ($parameters->eecrAddress > 0xFF) {
$failures[] = 'EECR address size exceeds 0xFF - corresponding EDBG device parameter size is 8 bits';
}
if ($parameters->eepromDataRegisterAddress === null) {
if ($parameters->eedrAddress === null) {
$failures[] = 'Missing EEDR address';
} elseif ($parameters->eepromDataRegisterAddress > 0xFF) {
} elseif ($parameters->eedrAddress > 0xFF) {
$failures[] = 'EEDR address size exceeds 0xFF - corresponding EDBG device parameter size is 8 bits';
}
@@ -242,17 +242,17 @@ class ValidationService extends \Targets\TargetDescriptionFiles\Services\Validat
$failures[] = 'OCD revision size exceeds 0xFF - corresponding EDBG device parameter size is 8 bits';
}
if ($parameters->ocdDataRegister === null) {
if ($parameters->ocdDataRegisterAddress === null) {
$failures[] = 'Missing OCDR address';
} elseif ($parameters->ocdDataRegister > 0xFF) {
} elseif ($parameters->ocdDataRegisterAddress > 0xFF) {
$failures[] = 'OCDR address size exceeds 0xFF - corresponding EDBG device parameter size is 8 bits';
}
if ($parameters->spmcRegisterStartAddress === null) {
if ($parameters->spmcrAddress === null) {
$failures[] = 'Missing SPMCR start address';
} elseif ($parameters->spmcRegisterStartAddress > 0xFF) {
} elseif ($parameters->spmcrAddress > 0xFF) {
$failures[] = 'SPMCR address size exceeds 0xFF - corresponding EDBG device parameter size is 8 bits';
}
@@ -368,31 +368,31 @@ class ValidationService extends \Targets\TargetDescriptionFiles\Services\Validat
$failures[] = 'EEPROM page size exceeds 0xFF - corresponding EDBG device parameter size is 8 bits';
}
if ($parameters->eepromAddressRegisterHigh === null) {
if ($parameters->eearAddressHigh === null) {
$failures[] = 'Missing EEARH address';
} elseif ($parameters->eepromAddressRegisterHigh > 0xFF) {
} elseif ($parameters->eearAddressHigh > 0xFF) {
$failures[] = 'EEARH address size exceeds 0xFF - corresponding EDBG device parameter size is 8 bits';
}
if ($parameters->eepromAddressRegisterLow === null) {
if ($parameters->eearAddressLow === null) {
$failures[] = 'Missing EEARL address';
} elseif ($parameters->eepromAddressRegisterLow > 0xFF) {
} elseif ($parameters->eearAddressLow > 0xFF) {
$failures[] = 'EEARL address size exceeds 0xFF - corresponding EDBG device parameter size is 8 bits';
}
if ($parameters->eepromControlRegisterAddress === null) {
if ($parameters->eecrAddress === null) {
$failures[] = 'Missing EECR address';
} elseif ($parameters->eepromControlRegisterAddress > 0xFF) {
} elseif ($parameters->eecrAddress > 0xFF) {
$failures[] = 'EECR address size exceeds 0xFF - corresponding EDBG device parameter size is 8 bits';
}
if ($parameters->eepromDataRegisterAddress === null) {
if ($parameters->eedrAddress === null) {
$failures[] = 'Missing EEDR address';
} elseif ($parameters->eepromDataRegisterAddress > 0xFF) {
} elseif ($parameters->eedrAddress > 0xFF) {
$failures[] = 'EEDR address size exceeds 0xFF - corresponding EDBG device parameter size is 8 bits';
}
@@ -403,17 +403,17 @@ class ValidationService extends \Targets\TargetDescriptionFiles\Services\Validat
$failures[] = 'OCD revision size exceeds 0xFF - corresponding EDBG device parameter size is 8 bits';
}
if ($parameters->ocdDataRegister === null) {
if ($parameters->ocdDataRegisterAddress === null) {
$failures[] = 'Missing OCDR address';
} elseif ($parameters->ocdDataRegister > 0xFF) {
} elseif ($parameters->ocdDataRegisterAddress > 0xFF) {
$failures[] = 'OCDR address size exceeds 0xFF - corresponding EDBG device parameter size is 8 bits';
}
if ($parameters->spmcRegisterStartAddress === null) {
if ($parameters->spmcrAddress === null) {
$failures[] = 'Missing SPMCR start address';
} elseif ($parameters->spmcRegisterStartAddress > 0xFF) {
} elseif ($parameters->spmcrAddress > 0xFF) {
$failures[] = 'SPMCR address size exceeds 0xFF - corresponding EDBG device parameter size is 8 bits';
}