From e05084ebda4ffd1eccf91f17efa84ea3927398cc Mon Sep 17 00:00:00 2001 From: Nav Date: Mon, 4 Apr 2022 17:20:35 +0100 Subject: [PATCH] Removed unnecessary restriction for XMEGA and UPDI enabled targets, where the flash page size must not exceed the maximum memory access size. This restriction is not necessary for XMEGA and UPDI targets because paged memory access is not required for those targets. --- .../EDBG/AVR/EdbgAvr8Interface.cpp | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/EdbgAvr8Interface.cpp b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/EdbgAvr8Interface.cpp index 88fd9d1d..2e7cb264 100644 --- a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/EdbgAvr8Interface.cpp +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/EdbgAvr8Interface.cpp @@ -78,17 +78,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr throw DeviceInitializationFailure("Failed to find status register size"); } - if (config.flashPageSize.has_value() && this->maximumMemoryAccessSizePerRequest.has_value() - && config.flashPageSize > this->maximumMemoryAccessSizePerRequest - ) { - throw DeviceInitializationFailure("Flash page size for target (" - + std::to_string(config.flashPageSize.value()) - + " bytes) exceeds maximum memory access size for EdbgAvr8Interface (" - + std::to_string(this->maximumMemoryAccessSizePerRequest.value()) - + " bytes)." - ); - } - if (this->configVariant == Avr8ConfigVariant::NONE) { auto configVariant = this->resolveConfigVariant(); @@ -102,6 +91,20 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr this->configVariant = configVariant.value(); } + if ( + this->configVariant != Avr8ConfigVariant::XMEGA + && this->configVariant != Avr8ConfigVariant::UPDI + && config.flashPageSize.has_value() && this->maximumMemoryAccessSizePerRequest.has_value() + && config.flashPageSize > this->maximumMemoryAccessSizePerRequest + ) { + throw DeviceInitializationFailure("Flash page size for target (" + + std::to_string(config.flashPageSize.value()) + + " bytes) exceeds maximum memory access size for EdbgAvr8Interface (" + + std::to_string(this->maximumMemoryAccessSizePerRequest.value()) + + " bytes)." + ); + } + switch (this->configVariant) { case Avr8ConfigVariant::DEBUG_WIRE: case Avr8ConfigVariant::MEGAJTAG: {