Added support for flash memory inspection

This commit is contained in:
Nav
2023-05-03 23:13:22 +01:00
parent da5db96f11
commit eca86fcb1a
18 changed files with 316 additions and 52 deletions

View File

@@ -4,6 +4,8 @@
#include <algorithm>
#include <numeric>
#include "src/Exceptions/Exception.hpp"
namespace Bloom
{
using Services::TargetControllerService;
@@ -11,6 +13,10 @@ namespace Bloom
void WriteTargetMemory::run(TargetControllerService& targetControllerService) {
using Targets::TargetMemorySize;
if (!this->memoryDescriptor.access.writeableDuringDebugSession) {
throw Exceptions::Exception("Invalid request - cannot write to this memory type during a debug session.");
}
/*
* To prevent locking up the TargetController for too long, we split the write operation into numerous
* operations.
@@ -20,7 +26,7 @@ namespace Bloom
*/
const auto maxBlockSize = std::max(
TargetMemorySize(256),
memoryDescriptor.pageSize.value_or(TargetMemorySize(0))
this->memoryDescriptor.pageSize.value_or(TargetMemorySize(0))
);
const TargetMemorySize totalBytesToWrite = std::accumulate(