- Additional target config options.

- Some tidying
This commit is contained in:
Nav
2025-01-07 22:38:11 +00:00
parent 7605d5e3a0
commit e98a73e687
11 changed files with 70 additions and 19 deletions

View File

@@ -217,7 +217,6 @@ namespace DebugServer::Gdb
);
this->targetControllerService.stopTargetExecution();
this->targetControllerService.resetTarget();
}
const auto commandPacketVariant = this->waitForCommandPacket();

View File

@@ -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)

View File

@@ -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 "

View File

@@ -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).
*/

View File

@@ -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;
}

View File

@@ -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();

View File

@@ -209,6 +209,7 @@ namespace Targets::Microchip::Avr8
this->activated = true;
if (this->targetConfig.signatureValidation) {
/*
* Validate the target signature.
*
@@ -219,12 +220,14 @@ namespace Targets::Microchip::Avr8
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 (\""
" (\"" + 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)."
};
}
}
}
void Avr8::deactivate() {
try {

View File

@@ -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);
}
}
}

View File

@@ -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);
};
}

View File

@@ -51,6 +51,8 @@ namespace Targets::RiscV
void RiscV::activate() {
this->riscVDebugInterface->activate();
this->stop();
this->reset();
}
void RiscV::deactivate() {

View File

@@ -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.