Implemented eraseMemory() member function in AVR8 class

This commit is contained in:
Nav
2022-12-11 18:18:39 +00:00
parent 190d734ca3
commit 83c273a22b
3 changed files with 36 additions and 1 deletions

View File

@@ -374,6 +374,29 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
this->avr8DebugInterface->writeMemory(memoryType, startAddress, buffer);
}
void Avr8::eraseMemory(TargetMemoryType memoryType) {
if (memoryType == TargetMemoryType::FLASH) {
return this->avr8DebugInterface->eraseProgramMemory();
}
/*
* Debug tools do not have to support the erasing of RAM or EEPROM memory. We just implement this as a
* write operation.
*/
this->writeMemory(
memoryType,
memoryType == TargetMemoryType::RAM
? this->targetParameters->ramStartAddress.value()
: this->targetParameters->eepromStartAddress.value(),
TargetMemoryBuffer(
memoryType == TargetMemoryType::RAM
? this->targetParameters->ramSize.value()
: this->targetParameters->eepromSize.value(),
0xFF
)
);
}
TargetState Avr8::getState() {
return this->avr8DebugInterface->getTargetState();
}

View File

@@ -111,6 +111,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
TargetMemoryAddress startAddress,
const TargetMemoryBuffer& buffer
) override;
void eraseMemory(TargetMemoryType memoryType) override;
TargetState getState() override;