Replaced project configuration format from JSON to YAML
This commit is contained in:
@@ -26,6 +26,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
|
||||
void Avr8::preActivationConfigure(const TargetConfig& targetConfig) {
|
||||
Target::preActivationConfigure(targetConfig);
|
||||
|
||||
// Extract AVR8 specific target config
|
||||
this->targetConfig = Avr8TargetConfig(targetConfig);
|
||||
|
||||
if (this->family.has_value()) {
|
||||
@@ -87,7 +88,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
|
||||
"Failed to validate connected target - target signature mismatch.\nThe target signature"
|
||||
" (\"" + targetSignature.toHex() + "\") does not match the AVR8 target description signature (\""
|
||||
+ tdSignature.toHex() + "\"). This will likely be due to an incorrect target name in the configuration"
|
||||
+ " file (bloom.json)."
|
||||
+ " file (bloom.yaml)."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "Avr8TargetConfig.hpp"
|
||||
|
||||
#include "src/Logger/Logger.hpp"
|
||||
#include "src/Helpers/String.hpp"
|
||||
#include "src/Exceptions/InvalidConfig.hpp"
|
||||
|
||||
namespace Bloom::Targets::Microchip::Avr::Avr8Bit
|
||||
@@ -8,12 +8,13 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
|
||||
Avr8TargetConfig::Avr8TargetConfig(const TargetConfig& targetConfig): TargetConfig(targetConfig) {
|
||||
using Bloom::Exceptions::InvalidConfig;
|
||||
|
||||
if (!targetConfig.jsonObject.contains("physicalInterface")) {
|
||||
const auto& targetNode = targetConfig.targetNode;
|
||||
|
||||
if (!targetNode["physicalInterface"]) {
|
||||
throw InvalidConfig("Missing physical interface config parameter for AVR8 target.");
|
||||
}
|
||||
|
||||
const auto physicalInterfaceName = targetConfig.jsonObject.value("physicalInterface").toString().toLower()
|
||||
.toStdString();
|
||||
const auto physicalInterfaceName = String::asciiToLower(targetNode["physicalInterface"].as<std::string>());
|
||||
|
||||
static const auto physicalInterfacesByName = Avr8TargetConfig::getPhysicalInterfacesByName();
|
||||
|
||||
@@ -23,26 +24,20 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
|
||||
|
||||
this->physicalInterface = physicalInterfacesByName.at(physicalInterfaceName);
|
||||
|
||||
if (targetConfig.jsonObject.contains("updateDwenFuseBit")) {
|
||||
this->updateDwenFuseBit = targetConfig.jsonObject.value("updateDwenFuseBit").toBool();
|
||||
if (targetNode["updateDwenFuseBit"]) {
|
||||
this->updateDwenFuseBit = targetNode["updateDwenFuseBit"].as<bool>();
|
||||
}
|
||||
|
||||
if (targetConfig.jsonObject.contains("cycleTargetPowerPostDwenUpdate")) {
|
||||
this->cycleTargetPowerPostDwenUpdate = targetConfig.jsonObject.value(
|
||||
"cycleTargetPowerPostDwenUpdate"
|
||||
).toBool();
|
||||
if (targetNode["cycleTargetPowerPostDwenUpdate"]) {
|
||||
this->cycleTargetPowerPostDwenUpdate = targetNode["cycleTargetPowerPostDwenUpdate"].as<bool>();
|
||||
}
|
||||
|
||||
if (targetConfig.jsonObject.contains("disableDebugWirePreDisconnect")) {
|
||||
this->disableDebugWireOnDeactivate = targetConfig.jsonObject.value(
|
||||
"disableDebugWirePreDisconnect"
|
||||
).toBool();
|
||||
if (targetNode["disableDebugWirePreDisconnect"]) {
|
||||
this->disableDebugWireOnDeactivate = targetNode["disableDebugWirePreDisconnect"].as<bool>();
|
||||
}
|
||||
|
||||
if (targetConfig.jsonObject.contains("targetPowerCycleDelay")) {
|
||||
this->targetPowerCycleDelay = std::chrono::milliseconds(targetConfig.jsonObject.value(
|
||||
"targetPowerCycleDelay"
|
||||
).toInt(static_cast<int>(this->targetPowerCycleDelay.count())));
|
||||
if (targetNode["targetPowerCycleDelay"]) {
|
||||
this->targetPowerCycleDelay = std::chrono::milliseconds(targetNode["targetPowerCycleDelay"].as<int>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
|
||||
#include "src/Helpers/Paths.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
@@ -46,7 +47,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit::TargetDescription
|
||||
if (targetName.has_value() && matchingDescriptionFiles.empty()) {
|
||||
throw Exception("Failed to resolve target description file for target \"" + targetName.value()
|
||||
+ "\" - target signature \"" + targetSignatureHex + "\" does not belong to target with name \"" +
|
||||
targetName.value() + "\". Please review your bloom.json configuration.");
|
||||
targetName.value() + "\". Please review your bloom.yaml configuration.");
|
||||
}
|
||||
|
||||
if (matchingDescriptionFiles.size() == 1) {
|
||||
|
||||
Reference in New Issue
Block a user