This commit is contained in:
Nav
2022-08-04 21:08:41 +01:00
parent 6bea419e1b
commit c88395b8eb
5 changed files with 26 additions and 25 deletions

View File

@@ -159,7 +159,7 @@ namespace Bloom
void saveProjectSettings(); 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->projectConfig
* - this->environmentConfig * - this->environmentConfig
* - this->debugServerConfig * - this->debugServerConfig

View File

@@ -92,7 +92,7 @@ namespace Bloom
std::sort( std::sort(
output.begin(), output.begin(),
output.end(), output.end(),
[](const SharedGenericEventPointer& a, const SharedGenericEventPointer& b) { [] (const SharedGenericEventPointer& a, const SharedGenericEventPointer& b) {
return a->id < b->id; return a->id < b->id;
} }
); );

View File

@@ -77,16 +77,16 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
if (this->targetConfig->physicalInterface == PhysicalInterface::JTAG) { if (this->targetConfig->physicalInterface == PhysicalInterface::JTAG) {
throw InvalidConfig( throw InvalidConfig(
"The JTAG physical interface cannot be used with an ambiguous target name" "The JTAG physical interface cannot be used with an ambiguous target name"
" - please specify the exact name of the target in your configuration file. " " - please specify the exact name of the target in your configuration file. "
"See " + Paths::homeDomainName() + "/docs/supported-targets" "See " + Paths::homeDomainName() + "/docs/supported-targets"
); );
} }
if (this->targetConfig->physicalInterface == PhysicalInterface::UPDI) { if (this->targetConfig->physicalInterface == PhysicalInterface::UPDI) {
throw InvalidConfig( throw InvalidConfig(
"The UPDI physical interface cannot be used with an ambiguous target name" "The UPDI physical interface cannot be used with an ambiguous target name"
" - please specify the exact name of the target in your configuration file. " " - please specify the exact name of the target in your configuration file. "
"See " + Paths::homeDomainName() + "/docs/supported-targets" "See " + Paths::homeDomainName() + "/docs/supported-targets"
); );
} }
} }
@@ -97,7 +97,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
) { ) {
Logger::warning( Logger::warning(
"The connected debug tool (or associated driver) does not provide any ISP interface. " "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) { if (targetSignature != tdSignature) {
throw Exception( throw Exception(
"Failed to validate connected target - target signature mismatch.\nThe target signature" "Failed to validate connected target - target signature mismatch.\nThe target signature"
" (\"" + targetSignature.toHex() + "\") does not match the AVR8 target description 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" + tdSignature.toHex() + "\"). This will likely be due to an incorrect target name in the "
+ " file (bloom.yaml)." + "configuration file (bloom.yaml)."
); );
} }
} }

View File

@@ -1,6 +1,7 @@
#include "Avr8TargetConfig.hpp" #include "Avr8TargetConfig.hpp"
#include "src/Helpers/String.hpp" #include "src/Helpers/String.hpp"
#include "src/Helpers/Paths.hpp"
#include "src/Exceptions/InvalidConfig.hpp" #include "src/Exceptions/InvalidConfig.hpp"
namespace Bloom::Targets::Microchip::Avr::Avr8Bit 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>()); const auto physicalInterfaceName = String::asciiToLower(targetNode["physicalInterface"].as<std::string>());
static const auto physicalInterfacesByName = Avr8TargetConfig::getPhysicalInterfacesByName(); if (!Avr8TargetConfig::debugPhysicalInterfacesByConfigName.contains(physicalInterfaceName)) {
throw InvalidConfig(
if (!physicalInterfacesByName.contains(physicalInterfaceName)) { "Invalid physical interface provided (\"" + physicalInterfaceName + "\") for AVR8 target. "
throw InvalidConfig("Invalid physical interface config parameter 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"]) { if (targetNode["updateDwenFuseBit"]) {
this->updateDwenFuseBit = targetNode["updateDwenFuseBit"].as<bool>(); this->updateDwenFuseBit = targetNode["updateDwenFuseBit"].as<bool>();

View File

@@ -13,7 +13,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
/** /**
* Extending the generic TargetConfig struct to accommodate AVR8 target configuration parameters. * Extending the generic TargetConfig struct to accommodate AVR8 target configuration parameters.
*/ */
class Avr8TargetConfig: public TargetConfig struct Avr8TargetConfig: public TargetConfig
{ {
public: public:
/** /**
@@ -70,14 +70,12 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
explicit Avr8TargetConfig(const TargetConfig& targetConfig); explicit Avr8TargetConfig(const TargetConfig& targetConfig);
private: private:
static inline auto getPhysicalInterfacesByName() { static inline auto debugPhysicalInterfacesByConfigName = std::map<std::string, PhysicalInterface>({
return std::map<std::string, PhysicalInterface>({ {"debugwire", PhysicalInterface::DEBUG_WIRE}, // Deprecated - left here for backwards compatibility
{"debugwire", PhysicalInterface::DEBUG_WIRE}, // Deprecated - left here for backwards compatibility {"debug-wire", PhysicalInterface::DEBUG_WIRE},
{"debug-wire", PhysicalInterface::DEBUG_WIRE}, {"pdi", PhysicalInterface::PDI},
{"pdi", PhysicalInterface::PDI}, {"jtag", PhysicalInterface::JTAG},
{"jtag", PhysicalInterface::JTAG}, {"updi", PhysicalInterface::UPDI},
{"updi", PhysicalInterface::UPDI}, });
});
};
}; };
} }