Added EraseTargetMemory TC command
This commit is contained in:
@@ -37,6 +37,7 @@ namespace Bloom::TargetController
|
||||
using Commands::WriteTargetRegisters;
|
||||
using Commands::ReadTargetMemory;
|
||||
using Commands::WriteTargetMemory;
|
||||
using Commands::EraseTargetMemory;
|
||||
using Commands::StepTargetExecution;
|
||||
using Commands::SetBreakpoint;
|
||||
using Commands::RemoveBreakpoint;
|
||||
@@ -220,6 +221,10 @@ namespace Bloom::TargetController
|
||||
std::bind(&TargetControllerComponent::handleWriteTargetMemory, this, std::placeholders::_1)
|
||||
);
|
||||
|
||||
this->registerCommandHandler<EraseTargetMemory>(
|
||||
std::bind(&TargetControllerComponent::handleEraseTargetMemory, this, std::placeholders::_1)
|
||||
);
|
||||
|
||||
this->registerCommandHandler<StepTargetExecution>(
|
||||
std::bind(&TargetControllerComponent::handleStepTargetExecution, this, std::placeholders::_1)
|
||||
);
|
||||
@@ -930,6 +935,21 @@ namespace Bloom::TargetController
|
||||
return std::make_unique<Response>();
|
||||
}
|
||||
|
||||
std::unique_ptr<Response> TargetControllerComponent::handleEraseTargetMemory(EraseTargetMemory& command) {
|
||||
const auto& targetDescriptor = this->getTargetDescriptor();
|
||||
|
||||
if (
|
||||
command.memoryType == this->getTargetDescriptor().programMemoryType
|
||||
&& !this->target->programmingModeEnabled()
|
||||
) {
|
||||
throw Exception("Cannot erase program memory - programming mode not enabled.");
|
||||
}
|
||||
|
||||
this->target->eraseMemory(command.memoryType);
|
||||
|
||||
return std::make_unique<Response>();
|
||||
}
|
||||
|
||||
std::unique_ptr<Response> TargetControllerComponent::handleStepTargetExecution(StepTargetExecution& command) {
|
||||
if (command.fromProgramCounter.has_value()) {
|
||||
this->target->setProgramCounter(command.fromProgramCounter.value());
|
||||
|
||||
Reference in New Issue
Block a user