From 20155ee8ffd15bb150b681c3914286d9df81200e Mon Sep 17 00:00:00 2001 From: Nav Date: Sat, 22 Jan 2022 16:15:16 +0000 Subject: [PATCH] Disabling use of the masked memory read command in the EDBG driver, by default --- .../Microchip/MplabPickit4/MplabPickit4.cpp | 9 --------- src/DebugToolDrivers/Microchip/MplabSnap/MplabSnap.cpp | 10 ---------- .../Microchip/XplainedMini/XplainedMini.cpp | 1 - .../Microchip/XplainedNano/XplainedNano.cpp | 1 - .../Microchip/XplainedPro/XplainedPro.cpp | 4 ---- .../VendorSpecific/EDBG/AVR/EdbgAvr8Interface.hpp | 5 ++++- 6 files changed, 4 insertions(+), 26 deletions(-) diff --git a/src/DebugToolDrivers/Microchip/MplabPickit4/MplabPickit4.cpp b/src/DebugToolDrivers/Microchip/MplabPickit4/MplabPickit4.cpp index 72834420..6ded86e1 100644 --- a/src/DebugToolDrivers/Microchip/MplabPickit4/MplabPickit4.cpp +++ b/src/DebugToolDrivers/Microchip/MplabPickit4/MplabPickit4.cpp @@ -31,15 +31,6 @@ void MplabPickit4::init() { this->edbgAvr8Interface = std::make_unique(this->edbgInterface); - /* - * Like the MPLAB Snap, the PICkit 4 doesn't seem to operate correctly when actioning the masked memory read - * command. The data returned in response to the command appears to be completely incorrect. - * - * For the above reason, we avoid using the masked memory read command by implementing the masking on our end. - * See the EdbgAvr8Interface class for more. - */ - this->edbgAvr8Interface->setAvoidMaskedMemoryRead(true); - this->setInitialised(true); } diff --git a/src/DebugToolDrivers/Microchip/MplabSnap/MplabSnap.cpp b/src/DebugToolDrivers/Microchip/MplabSnap/MplabSnap.cpp index 48b00079..c87000db 100644 --- a/src/DebugToolDrivers/Microchip/MplabSnap/MplabSnap.cpp +++ b/src/DebugToolDrivers/Microchip/MplabSnap/MplabSnap.cpp @@ -30,16 +30,6 @@ void MplabSnap::init() { } this->edbgAvr8Interface = std::make_unique(this->edbgInterface); - - /* - * The MPLAB Snap doesn't seem to operate correctly when actioning the masked memory read command. The data - * returned in response to the command appears to be completely incorrect. It may be a bug in the firmware. - * - * For the above reason, we avoid using the masked memory read command by implementing the masking on our end. - * See the EdbgAvr8Interface class for more. - */ - this->edbgAvr8Interface->setAvoidMaskedMemoryRead(true); - this->setInitialised(true); } diff --git a/src/DebugToolDrivers/Microchip/XplainedMini/XplainedMini.cpp b/src/DebugToolDrivers/Microchip/XplainedMini/XplainedMini.cpp index 913c525a..aa54c8d2 100644 --- a/src/DebugToolDrivers/Microchip/XplainedMini/XplainedMini.cpp +++ b/src/DebugToolDrivers/Microchip/XplainedMini/XplainedMini.cpp @@ -30,7 +30,6 @@ void XplainedMini::init() { } this->edbgAvr8Interface = std::make_unique(this->edbgInterface); - this->edbgAvr8Interface->setAvoidMaskedMemoryRead(true); this->setInitialised(true); } diff --git a/src/DebugToolDrivers/Microchip/XplainedNano/XplainedNano.cpp b/src/DebugToolDrivers/Microchip/XplainedNano/XplainedNano.cpp index 2a05f895..96b1695b 100644 --- a/src/DebugToolDrivers/Microchip/XplainedNano/XplainedNano.cpp +++ b/src/DebugToolDrivers/Microchip/XplainedNano/XplainedNano.cpp @@ -30,7 +30,6 @@ void XplainedNano::init() { } this->edbgAvr8Interface = std::make_unique(this->edbgInterface); - this->edbgAvr8Interface->setAvoidMaskedMemoryRead(true); this->setInitialised(true); } diff --git a/src/DebugToolDrivers/Microchip/XplainedPro/XplainedPro.cpp b/src/DebugToolDrivers/Microchip/XplainedPro/XplainedPro.cpp index 0c2dcebb..7ced9319 100644 --- a/src/DebugToolDrivers/Microchip/XplainedPro/XplainedPro.cpp +++ b/src/DebugToolDrivers/Microchip/XplainedPro/XplainedPro.cpp @@ -39,10 +39,6 @@ void XplainedPro::init() { * This means we must enforce a hard limit on the number of bytes we attempt to access, per request. */ this->edbgAvr8Interface->setMaximumMemoryAccessSizePerRequest(256); - - // Masked read memory commands are not available on the Xplained Pro debug tool. - this->edbgAvr8Interface->setAvoidMaskedMemoryRead(true); - this->setInitialised(true); } diff --git a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/EdbgAvr8Interface.hpp b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/EdbgAvr8Interface.hpp index 711e8999..98375e07 100644 --- a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/EdbgAvr8Interface.hpp +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/EdbgAvr8Interface.hpp @@ -41,6 +41,9 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr * FLASH as invalid memory types, when using the masked memory read command. So any masked reads to non-SRAM * will result in driver-side masking, regardless of the value of this flag. * + * NOTE: We now avoid masked memory read commands by default, unless this flag is explicitly set to false. + * This means the default value of this->avoidMaskedMemoryRead is true. + * * @param avoidMaskedMemoryRead */ void setAvoidMaskedMemoryRead(bool avoidMaskedMemoryRead) { @@ -297,7 +300,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr /** * See the comment for EdbgAvr8Interface::setAvoidMaskedMemoryRead(). */ - bool avoidMaskedMemoryRead = false; + bool avoidMaskedMemoryRead = true; /** * See the comment for EdbgAvr8Interface::setMaximumMemoryAccessSizePerRequest().