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

@@ -127,8 +127,8 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
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,8 +70,7 @@ 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},
@@ -79,5 +78,4 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
{"updi", PhysicalInterface::UPDI}, {"updi", PhysicalInterface::UPDI},
}); });
}; };
};
} }