Added support for excluding address ranges from read memory events

This commit is contained in:
Nav
2021-12-25 20:57:03 +00:00
parent 9054b17bc7
commit 6f364a7009
10 changed files with 67 additions and 11 deletions

View File

@@ -556,7 +556,12 @@ void EdbgAvr8Interface::writeRegisters(const Targets::TargetRegisters& registers
}
}
TargetMemoryBuffer EdbgAvr8Interface::readMemory(TargetMemoryType memoryType, std::uint32_t startAddress, std::uint32_t bytes) {
TargetMemoryBuffer EdbgAvr8Interface::readMemory(
TargetMemoryType memoryType,
std::uint32_t startAddress,
std::uint32_t bytes,
const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges
) {
auto avr8MemoryType = Avr8MemoryType::SRAM;
switch (memoryType) {
@@ -579,9 +584,32 @@ TargetMemoryBuffer EdbgAvr8Interface::readMemory(TargetMemoryType memoryType, st
case TargetMemoryType::EEPROM: {
avr8MemoryType = Avr8MemoryType::EEPROM;
}
default: {
break;
}
}
return this->readMemory(avr8MemoryType, startAddress, bytes);
/*
* The internal readMemory() function accepts excluded addresses in the form of a set of addresses, as
* opposed to a set of address ranges.
*
* We will perform the conversion here.
*/
auto excludedAddresses = std::set<std::uint32_t>();
auto endAddress = startAddress + bytes - 1;
for (const auto& addressRange : excludedAddressRanges) {
if (addressRange.startAddress > endAddress) {
// This address range is outside of the range from which we will be reading
continue;
}
for (auto i = addressRange.startAddress; i <= addressRange.endAddress; i++) {
excludedAddresses.insert(i);
}
}
return this->readMemory(avr8MemoryType, startAddress, bytes, excludedAddresses);
}
void EdbgAvr8Interface::writeMemory(TargetMemoryType memoryType, std::uint32_t startAddress, const TargetMemoryBuffer& buffer) {
@@ -611,6 +639,9 @@ void EdbgAvr8Interface::writeMemory(TargetMemoryType memoryType, std::uint32_t s
case TargetMemoryType::EEPROM: {
avr8MemoryType = Avr8MemoryType::EEPROM;
}
default: {
break;
}
}
return this->writeMemory(avr8MemoryType, startAddress, buffer);

View File

@@ -218,7 +218,8 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
Targets::TargetMemoryBuffer readMemory(
Targets::TargetMemoryType memoryType,
std::uint32_t startAddress,
std::uint32_t bytes
std::uint32_t bytes,
const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges = {}
) override;
/**