Bypass cache flag in ReadMemory TC command

This commit is contained in:
Nav
2023-09-22 18:21:26 +01:00
parent 8c2fe4e619
commit fdb6dc006d
6 changed files with 16 additions and 1 deletions

View File

@@ -62,6 +62,7 @@ void CaptureMemorySnapshot::run(TargetControllerService& targetControllerService
(memorySize - this->data->size()) >= readSize
? readSize
: static_cast<Targets::TargetMemorySize>(memorySize - this->data->size()),
true,
{}
);

View File

@@ -43,6 +43,7 @@ void ReadTargetMemory::run(TargetControllerService& targetControllerService) {
(this->size - data.size()) >= readSize
? readSize
: static_cast<Targets::TargetMemorySize>(this->size - data.size()),
true,
this->excludedAddressRanges
);

View File

@@ -183,6 +183,7 @@ namespace Services
TargetMemoryType memoryType,
TargetMemoryAddress startAddress,
TargetMemorySize bytes,
bool bypassCache,
const std::set<TargetMemoryAddressRange>& excludedAddressRanges
) const {
return this->commandManager.sendCommandAndWaitForResponse(
@@ -190,6 +191,7 @@ namespace Services
memoryType,
startAddress,
bytes,
bypassCache,
excludedAddressRanges
),
this->defaultTimeout,

View File

@@ -109,6 +109,7 @@ namespace Services
* @param memoryType
* @param startAddress
* @param bytes
* @param bypassCache
* @param excludedAddressRanges
* @return
*/
@@ -116,6 +117,7 @@ namespace Services
Targets::TargetMemoryType memoryType,
Targets::TargetMemoryAddress startAddress,
Targets::TargetMemorySize bytes,
bool bypassCache = false,
const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges = {}
) const;

View File

@@ -21,17 +21,25 @@ namespace TargetController::Commands
Targets::TargetMemoryType memoryType;
Targets::TargetMemoryAddress startAddress;
Targets::TargetMemorySize bytes;
/**
* Currently, we only cache program memory. This flag has no effect when reading from other memories.
*/
bool bypassCache;
std::set<Targets::TargetMemoryAddressRange> excludedAddressRanges;
ReadTargetMemory(
Targets::TargetMemoryType memoryType,
Targets::TargetMemoryAddress startAddress,
Targets::TargetMemorySize bytes,
const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges
bool bypassCache = false,
const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges = {}
)
: memoryType(memoryType)
, startAddress(startAddress)
, bytes(bytes)
, bypassCache(bypassCache)
, excludedAddressRanges(excludedAddressRanges)
{};

View File

@@ -802,6 +802,7 @@ namespace TargetController
const auto& targetDescriptor = this->getTargetDescriptor();
if (
command.memoryType == targetDescriptor.programMemoryType
&& !command.bypassCache
&& this->environmentConfig.targetConfig.programMemoryCache
) {
assert(this->programMemoryCache);