Tidying
This commit is contained in:
@@ -159,7 +159,7 @@ namespace Bloom
|
||||
void saveProjectSettings();
|
||||
|
||||
/**
|
||||
* Extracts the project config from the user's JSON config file and populates the following members:
|
||||
* Extracts the project config from the user's config file and populates the following members:
|
||||
* - this->projectConfig
|
||||
* - this->environmentConfig
|
||||
* - this->debugServerConfig
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace Bloom
|
||||
std::sort(
|
||||
output.begin(),
|
||||
output.end(),
|
||||
[](const SharedGenericEventPointer& a, const SharedGenericEventPointer& b) {
|
||||
[] (const SharedGenericEventPointer& a, const SharedGenericEventPointer& b) {
|
||||
return a->id < b->id;
|
||||
}
|
||||
);
|
||||
|
||||
@@ -77,16 +77,16 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
|
||||
if (this->targetConfig->physicalInterface == PhysicalInterface::JTAG) {
|
||||
throw InvalidConfig(
|
||||
"The JTAG physical interface cannot be used with an ambiguous target name"
|
||||
" - please specify the exact name of the target in your configuration file. "
|
||||
"See " + Paths::homeDomainName() + "/docs/supported-targets"
|
||||
" - please specify the exact name of the target in your configuration file. "
|
||||
"See " + Paths::homeDomainName() + "/docs/supported-targets"
|
||||
);
|
||||
}
|
||||
|
||||
if (this->targetConfig->physicalInterface == PhysicalInterface::UPDI) {
|
||||
throw InvalidConfig(
|
||||
"The UPDI physical interface cannot be used with an ambiguous target name"
|
||||
" - please specify the exact name of the target in your configuration file. "
|
||||
"See " + Paths::homeDomainName() + "/docs/supported-targets"
|
||||
" - please specify the exact name of the target in your configuration file. "
|
||||
"See " + Paths::homeDomainName() + "/docs/supported-targets"
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -97,7 +97,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
|
||||
) {
|
||||
Logger::warning(
|
||||
"The connected debug tool (or associated driver) does not provide any ISP interface. "
|
||||
"Bloom will be unable to update the DWEN fuse bit in the event of a debugWire activation failure."
|
||||
"Bloom will be unable to update the DWEN fuse bit in the event of a debugWire activation failure."
|
||||
);
|
||||
}
|
||||
|
||||
@@ -126,9 +126,9 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
|
||||
if (targetSignature != tdSignature) {
|
||||
throw Exception(
|
||||
"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.yaml)."
|
||||
" (\"" + 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.yaml)."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "Avr8TargetConfig.hpp"
|
||||
|
||||
#include "src/Helpers/String.hpp"
|
||||
#include "src/Helpers/Paths.hpp"
|
||||
#include "src/Exceptions/InvalidConfig.hpp"
|
||||
|
||||
namespace Bloom::Targets::Microchip::Avr::Avr8Bit
|
||||
@@ -16,13 +17,15 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
|
||||
|
||||
const auto physicalInterfaceName = String::asciiToLower(targetNode["physicalInterface"].as<std::string>());
|
||||
|
||||
static const auto physicalInterfacesByName = Avr8TargetConfig::getPhysicalInterfacesByName();
|
||||
|
||||
if (!physicalInterfacesByName.contains(physicalInterfaceName)) {
|
||||
throw InvalidConfig("Invalid physical interface config parameter for AVR8 target.");
|
||||
if (!Avr8TargetConfig::debugPhysicalInterfacesByConfigName.contains(physicalInterfaceName)) {
|
||||
throw InvalidConfig(
|
||||
"Invalid physical interface provided (\"" + physicalInterfaceName + "\") for AVR8 target. "
|
||||
"See " + Paths::homeDomainName() + "/docs/configuration/avr8-physical-interfaces for valid physical "
|
||||
"interface configuration values."
|
||||
);
|
||||
}
|
||||
|
||||
this->physicalInterface = physicalInterfacesByName.at(physicalInterfaceName);
|
||||
this->physicalInterface = Avr8TargetConfig::debugPhysicalInterfacesByConfigName.at(physicalInterfaceName);
|
||||
|
||||
if (targetNode["updateDwenFuseBit"]) {
|
||||
this->updateDwenFuseBit = targetNode["updateDwenFuseBit"].as<bool>();
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
|
||||
/**
|
||||
* Extending the generic TargetConfig struct to accommodate AVR8 target configuration parameters.
|
||||
*/
|
||||
class Avr8TargetConfig: public TargetConfig
|
||||
struct Avr8TargetConfig: public TargetConfig
|
||||
{
|
||||
public:
|
||||
/**
|
||||
@@ -70,14 +70,12 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
|
||||
explicit Avr8TargetConfig(const TargetConfig& targetConfig);
|
||||
|
||||
private:
|
||||
static inline auto getPhysicalInterfacesByName() {
|
||||
return std::map<std::string, PhysicalInterface>({
|
||||
{"debugwire", PhysicalInterface::DEBUG_WIRE}, // Deprecated - left here for backwards compatibility
|
||||
{"debug-wire", PhysicalInterface::DEBUG_WIRE},
|
||||
{"pdi", PhysicalInterface::PDI},
|
||||
{"jtag", PhysicalInterface::JTAG},
|
||||
{"updi", PhysicalInterface::UPDI},
|
||||
});
|
||||
};
|
||||
static inline auto debugPhysicalInterfacesByConfigName = std::map<std::string, PhysicalInterface>({
|
||||
{"debugwire", PhysicalInterface::DEBUG_WIRE}, // Deprecated - left here for backwards compatibility
|
||||
{"debug-wire", PhysicalInterface::DEBUG_WIRE},
|
||||
{"pdi", PhysicalInterface::PDI},
|
||||
{"jtag", PhysicalInterface::JTAG},
|
||||
{"updi", PhysicalInterface::UPDI},
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user