Confirmed that GPR and IO memory segments to not come after the SRAM segment, on AVR8 targets

This commit is contained in:
Nav
2024-10-26 19:24:08 +01:00
parent 8cf96ba5df
commit cb8e5f1d24

View File

@@ -40,22 +40,39 @@ class ValidationService extends \Targets\TargetDescriptionFiles\Services\Validat
$failures[] = 'Missing "internal_program_memory" memory segment'; $failures[] = 'Missing "internal_program_memory" memory segment';
} }
if ($tdf->getRamSegment() === null) { if (($gprSegment = $tdf->getGpRegistersMemorySegment()) === null) {
$failures[] = 'Missing "gp_registers" memory segment';
}
if (($ioSegment = $tdf->getIoMemorySegment()) === null) {
$failures[] = 'Missing IO memory segment';
}
if (($sramSegment = $tdf->getRamSegment()) === null) {
$failures[] = 'Missing "internal_ram" memory segment'; $failures[] = 'Missing "internal_ram" memory segment';
} else {
$sramEndAddress = $sramSegment->startAddress + $sramSegment->size - 1;
/*
* The GPR and IO segments must not come after the SRAM segment in the data address space.
*
* There are some places in Bloom's codebase where we have made this assumption, which is why we confirm
* it here as part of TDF validation.
*/
if ($gprSegment !== null && $gprSegment->startAddress > $sramEndAddress) {
$failures[] = 'The GPR memory segment comes after the SRAM segment';
}
if ($ioSegment !== null && $ioSegment->startAddress > $sramEndAddress) {
$failures[] = 'The IO memory segment comes after the SRAM segment';
}
} }
if ($tdf->getEepromSegment() === null) { if ($tdf->getEepromSegment() === null) {
$failures[] = 'Missing "internal_eeprom" memory segment'; $failures[] = 'Missing "internal_eeprom" memory segment';
} }
if ($tdf->getGpRegistersMemorySegment() === null) {
$failures[] = 'Missing "gp_registers" memory segment';
}
if ($tdf->getIoMemorySegment() === null) {
$failures[] = 'Missing IO memory segment';
}
if ($tdf->getSignaturesMemorySegment() === null) { if ($tdf->getSignaturesMemorySegment() === null) {
$failures[] = 'Missing "signatures" memory segment'; $failures[] = 'Missing "signatures" memory segment';
} }