- Additional target config options.
- Some tidying
This commit is contained in:
@@ -217,7 +217,6 @@ namespace DebugServer::Gdb
|
||||
);
|
||||
|
||||
this->targetControllerService.stopTargetExecution();
|
||||
this->targetControllerService.resetTarget();
|
||||
}
|
||||
|
||||
const auto commandPacketVariant = this->waitForCommandPacket();
|
||||
|
||||
@@ -119,6 +119,11 @@ namespace DebugToolDrivers::Microchip::Protocols::Edbg::Avr
|
||||
this->setParameter(Avr8EdbgParameters::JTAG_DAISY_CHAIN_SETTINGS, std::uint32_t{0});
|
||||
}
|
||||
|
||||
this->setParameter(
|
||||
Avr8EdbgParameters::RUN_TIMERS_WHILST_STOPPED,
|
||||
static_cast<std::uint8_t>(this->session.targetConfig.stopAllTimers ? 0 : 1)
|
||||
);
|
||||
|
||||
this->setParameter(
|
||||
Avr8EdbgParameters::CONFIG_VARIANT,
|
||||
static_cast<std::uint8_t>(this->session.configVariant)
|
||||
|
||||
@@ -194,6 +194,10 @@ TargetConfig::TargetConfig(const YAML::Node& targetNode) {
|
||||
|
||||
this->physicalInterface = physicalInterfaceIt->second;
|
||||
|
||||
if (targetNode["resume_on_startup"]) {
|
||||
this->resumeOnStartup = targetNode["resume_on_startup"].as<bool>(this->resumeOnStartup);
|
||||
}
|
||||
|
||||
if (targetNode["variantName"]) {
|
||||
Logger::warning(
|
||||
"The 'variantName' target configuration parameter was removed in v2.0.0. Please use the "
|
||||
|
||||
@@ -52,6 +52,11 @@ struct TargetConfig
|
||||
*/
|
||||
Targets::TargetPhysicalInterface physicalInterface;
|
||||
|
||||
/**
|
||||
* Determines whether Bloom will resume target execution after activation.
|
||||
*/
|
||||
bool resumeOnStartup = false;
|
||||
|
||||
/**
|
||||
* Determines whether Bloom will make use of the target's hardware breakpoint resources (if available).
|
||||
*/
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "src/Services/StringService.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
#include "Exceptions/TargetOperationFailure.hpp"
|
||||
|
||||
#include "src/Exceptions/FatalErrorException.hpp"
|
||||
#include "src/Exceptions/InvalidConfig.hpp"
|
||||
|
||||
@@ -584,6 +586,18 @@ namespace TargetController
|
||||
} else {
|
||||
Logger::warning("Hardware breakpoints have been disabled");
|
||||
}
|
||||
|
||||
if (
|
||||
this->targetState->executionState == TargetExecutionState::STOPPED
|
||||
&& this->environmentConfig.targetConfig.resumeOnStartup
|
||||
) {
|
||||
try {
|
||||
this->resumeTarget();
|
||||
|
||||
} catch (const Exceptions::TargetOperationFailure& exception) {
|
||||
Logger::error("Failed to resume target execution on startup - error: " + exception.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TargetControllerComponent::releaseHardware() {
|
||||
@@ -628,11 +642,11 @@ namespace TargetController
|
||||
TargetControllerComponent::notifier.notify();
|
||||
}
|
||||
|
||||
void TargetControllerComponent::refreshExecutionState(bool forceRefresh) {
|
||||
void TargetControllerComponent::refreshExecutionState(bool forceUpdate) {
|
||||
auto newState = *(this->targetState);
|
||||
newState.executionState = this->target->getExecutionState();
|
||||
|
||||
if (!forceRefresh && newState.executionState == this->targetState->executionState) {
|
||||
if (!forceUpdate && newState.executionState == this->targetState->executionState) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ namespace TargetController
|
||||
void startAtomicSession();
|
||||
void endActiveAtomicSession();
|
||||
|
||||
void refreshExecutionState(bool forceRefresh = false);
|
||||
void refreshExecutionState(bool forceUpdate = false);
|
||||
void updateTargetState(const Targets::TargetState& newState);
|
||||
|
||||
void stopTarget();
|
||||
|
||||
@@ -209,20 +209,23 @@ namespace Targets::Microchip::Avr8
|
||||
|
||||
this->activated = true;
|
||||
|
||||
/*
|
||||
* Validate the target signature.
|
||||
*
|
||||
* The signature obtained from the device should match what we loaded from the target description file.
|
||||
*/
|
||||
const auto targetSignature = this->avr8DebugInterface->getDeviceId();
|
||||
if (this->targetConfig.signatureValidation) {
|
||||
/*
|
||||
* Validate the target signature.
|
||||
*
|
||||
* The signature obtained from the device should match what we loaded from the target description file.
|
||||
*/
|
||||
const auto targetSignature = this->avr8DebugInterface->getDeviceId();
|
||||
|
||||
if (targetSignature != this->signature) {
|
||||
throw Exception{
|
||||
"Failed to validate connected target - target signature mismatch.\nThe target signature"
|
||||
" (\"" + targetSignature.toHex() + "\") does not match the AVR8 target description signature (\""
|
||||
+ this->signature.toHex() + "\"). This will likely be due to an incorrect target name in the "
|
||||
+ "configuration file (bloom.yaml)."
|
||||
};
|
||||
if (targetSignature != this->signature) {
|
||||
throw Exception{
|
||||
"Failed to validate connected target - target signature mismatch.\nThe target signature"
|
||||
" (\"" + targetSignature.toHex() +
|
||||
"\") does not match the AVR8 target description signature (\""
|
||||
+ this->signature.toHex() + "\"). This will likely be due to an incorrect target name in the "
|
||||
+ "configuration file (bloom.yaml)."
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,5 +38,13 @@ namespace Targets::Microchip::Avr8
|
||||
if (targetNode["preserve_eeprom"]) {
|
||||
this->preserveEeprom = targetNode["preserve_eeprom"].as<bool>(this->preserveEeprom);
|
||||
}
|
||||
|
||||
if (targetNode["signature_validation"]) {
|
||||
this->signatureValidation = targetNode["signature_validation"].as<bool>(this->signatureValidation);
|
||||
}
|
||||
|
||||
if (targetNode["stop_all_timers"]) {
|
||||
this->stopAllTimers = targetNode["stop_all_timers"].as<bool>(this->stopAllTimers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +79,17 @@ namespace Targets::Microchip::Avr8
|
||||
*/
|
||||
bool preserveEeprom = true;
|
||||
|
||||
/**
|
||||
* Determines whether Bloom will check for an AVR signature mismatch between the signature in the TDF and the
|
||||
* connected target signature.
|
||||
*/
|
||||
bool signatureValidation = true;
|
||||
|
||||
/**
|
||||
* Determines whether Bloom will stop all timer peripherals on the target, when target execution is stopped.
|
||||
*/
|
||||
bool stopAllTimers = true;
|
||||
|
||||
explicit Avr8TargetConfig(const TargetConfig& targetConfig);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -51,6 +51,8 @@ namespace Targets::RiscV
|
||||
|
||||
void RiscV::activate() {
|
||||
this->riscVDebugInterface->activate();
|
||||
this->stop();
|
||||
this->reset();
|
||||
}
|
||||
|
||||
void RiscV::deactivate() {
|
||||
|
||||
@@ -53,8 +53,8 @@ namespace Targets
|
||||
virtual void setDebugTool(DebugTool* debugTool) = 0;
|
||||
|
||||
/**
|
||||
* This function should attempt to establish a connection with the target, and put it in a state where
|
||||
* debugging can be performed.
|
||||
* This function should attempt to establish a connection with the target, halt execution, and put it in a
|
||||
* state where debugging can be performed.
|
||||
*
|
||||
* If an exception is thrown from this function, the TargetController will treat it as a fatal error, and thus
|
||||
* will shutdown, along with the rest of Bloom.
|
||||
|
||||
Reference in New Issue
Block a user