Replaced target architecture with target family in TDF build scripts
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace Bloom\BuildScripts;
|
||||
|
||||
use Bloom\BuildScripts\TargetDescriptionFiles\TargetDescriptionFile;
|
||||
use Bloom\BuildScripts\TargetDescriptionFiles\TargetFamily;
|
||||
|
||||
define('TDF_DIR_PATH', $argv[1] ?? null);
|
||||
define('MAPPING_TEMPLATE_PATH', $argv[2] ?? null);
|
||||
@@ -34,13 +35,16 @@ if (!file_exists(dirname(MAPPING_OUTPUT_PATH))) {
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/TargetDescriptionFiles/Factory.php';
|
||||
require_once __DIR__ . '/TargetDescriptionFiles/TargetFamily.php';
|
||||
|
||||
require_once __DIR__ . '/TargetDescriptionFiles/AVR8/Avr8TargetDescriptionFile.php';
|
||||
|
||||
$xmlFiles = TargetDescriptionFiles\Factory::findXmlFiles(TDF_DIR_PATH);
|
||||
print count($xmlFiles) . ' target descriptions files found in ' . TDF_DIR_PATH . PHP_EOL . PHP_EOL;
|
||||
|
||||
$targetFamiliesByArch = [
|
||||
TargetDescriptionFile::ARCHITECTURE_AVR8 => 'TargetFamily::AVR_8',
|
||||
$targetFamilyMapping = [
|
||||
TargetFamily::AVR_8->value => 'TargetFamily::AVR_8',
|
||||
TargetFamily::RISC_V->value => 'TargetFamily::RISC_V',
|
||||
];
|
||||
|
||||
const MAP_ENTRY_TEMPLATE = '{"@CONFIG_VALUE@", {"@TARGET_NAME@", "@CONFIG_VALUE@", @TARGET_FAMILY@, "@TDF_PATH@"}}';
|
||||
@@ -53,7 +57,7 @@ foreach ($xmlFiles as $xmlFile) {
|
||||
print 'Processing ' . $xmlFilePath . PHP_EOL;
|
||||
$targetDescriptionFile = TargetDescriptionFiles\Factory::loadTdfFromFile($xmlFilePath);
|
||||
|
||||
$relativeTdfPath = $targetDescriptionFile->targetArchitecture . '/'
|
||||
$relativeTdfPath = $targetDescriptionFile->targetFamily->value . '/'
|
||||
. strtoupper($targetDescriptionFile->targetName) . '.xml';
|
||||
|
||||
$entries[] = str_replace(
|
||||
@@ -61,7 +65,7 @@ foreach ($xmlFiles as $xmlFile) {
|
||||
[
|
||||
$targetDescriptionFile->configurationValue,
|
||||
$targetDescriptionFile->targetName,
|
||||
$targetFamiliesByArch[$targetDescriptionFile->targetArchitecture],
|
||||
$targetFamilyMapping[$targetDescriptionFile->targetFamily->value],
|
||||
$relativeTdfPath,
|
||||
],
|
||||
MAP_ENTRY_TEMPLATE
|
||||
|
||||
@@ -4,6 +4,8 @@ namespace Bloom\BuildScripts\TargetDescriptionFiles;
|
||||
use Bloom\BuildScripts\TargetDescriptionFiles\Avr8\Avr8TargetDescriptionFile;
|
||||
|
||||
require_once __DIR__ . "/TargetDescriptionFile.php";
|
||||
require_once __DIR__ . "/TargetFamily.php";
|
||||
|
||||
require_once __DIR__ . "/AVR8/Avr8TargetDescriptionFile.php";
|
||||
|
||||
class Factory
|
||||
@@ -18,7 +20,7 @@ class Factory
|
||||
{
|
||||
$tdf = new TargetDescriptionFile($filePath);
|
||||
|
||||
if ($tdf->targetArchitecture == TargetDescriptionFile::ARCHITECTURE_AVR8) {
|
||||
if ($tdf->targetFamily == TargetFamily::AVR_8) {
|
||||
return new Avr8TargetDescriptionFile($filePath);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,15 +15,12 @@ require_once __DIR__ . "/Pinout.php";
|
||||
|
||||
class TargetDescriptionFile
|
||||
{
|
||||
const ARCHITECTURE_AVR8 = 'AVR8';
|
||||
|
||||
public string $filePath;
|
||||
public ?SimpleXMLElement $xml = null;
|
||||
|
||||
public ?string $targetName = null;
|
||||
public ?TargetFamily $targetFamily = null;
|
||||
public ?string $configurationValue = null;
|
||||
public ?string $targetArchitecture = null;
|
||||
|
||||
/** @var string[] */
|
||||
public array $deviceAttributesByName = [];
|
||||
@@ -80,11 +77,6 @@ class TargetDescriptionFile
|
||||
if (!empty($this->deviceAttributesByName['family'])) {
|
||||
$this->targetFamily = TargetFamily::tryFrom($device['family']);
|
||||
}
|
||||
|
||||
if (!empty($this->deviceAttributesByName['architecture'])) {
|
||||
$this->targetArchitecture = stristr($device['architecture'], 'avr') !== false
|
||||
? self::ARCHITECTURE_AVR8 : $device['architecture'];
|
||||
}
|
||||
}
|
||||
|
||||
$this->loadVariants();
|
||||
@@ -474,10 +466,6 @@ class TargetDescriptionFile
|
||||
$failures[] = 'Missing/invalid target family';
|
||||
}
|
||||
|
||||
if (empty($this->targetArchitecture)) {
|
||||
$failures[] = 'Target architecture not found';
|
||||
}
|
||||
|
||||
if (empty($this->variants)) {
|
||||
$failures[] = 'Missing target variants';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user