Removed unnecessary flash page alignment for UPDI flash access

This commit is contained in:
Nav
2022-06-05 21:03:28 +01:00
parent a2cb89385e
commit ec987d430e

View File

@@ -1457,7 +1457,9 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
// We don't have to align to the page size in all cases. We may only need to align to the word size (2 bytes). // We don't have to align to the page size in all cases. We may only need to align to the word size (2 bytes).
switch (memoryType) { switch (memoryType) {
case Avr8MemoryType::FLASH_PAGE: { case Avr8MemoryType::FLASH_PAGE: {
alignTo = this->targetParameters.flashPageSize.value(); alignTo = (this->configVariant == Avr8ConfigVariant::UPDI)
? 2
: this->targetParameters.flashPageSize.value();
break; break;
} }
case Avr8MemoryType::SPM: { case Avr8MemoryType::SPM: {
@@ -1501,7 +1503,9 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
// We don't have to align to the page size in all cases. We may only need to align to the word size (2 bytes). // We don't have to align to the page size in all cases. We may only need to align to the word size (2 bytes).
switch (memoryType) { switch (memoryType) {
case Avr8MemoryType::FLASH_PAGE: { case Avr8MemoryType::FLASH_PAGE: {
alignTo = this->targetParameters.flashPageSize.value(); alignTo = (this->configVariant == Avr8ConfigVariant::UPDI)
? 2
: this->targetParameters.flashPageSize.value();
break; break;
} }
case Avr8MemoryType::SPM: { case Avr8MemoryType::SPM: {
@@ -1720,6 +1724,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
excludedAddresses excludedAddresses
) )
); );
if (response.getResponseId() == Avr8ResponseId::FAILED) { if (response.getResponseId() == Avr8ResponseId::FAILED) {
throw Avr8CommandFailure("AVR8 Read memory command failed", response); throw Avr8CommandFailure("AVR8 Read memory command failed", response);
} }
@@ -1785,8 +1790,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
if (response.getResponseId() == Avr8ResponseId::FAILED) { if (response.getResponseId() == Avr8ResponseId::FAILED) {
throw Avr8CommandFailure("AVR8 Write memory command failed", response); throw Avr8CommandFailure("AVR8 Write memory command failed", response);
} }
}
} }
void EdbgAvr8Interface::refreshTargetState() { void EdbgAvr8Interface::refreshTargetState() {