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 f9bf225b..1d2c4fab 100644 --- a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/EdbgAvr8Interface.cpp +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/EdbgAvr8Interface.cpp @@ -1546,20 +1546,22 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr ) { std::uint16_t alignTo = 1; - if ( - memoryType == Avr8MemoryType::FLASH_PAGE - || memoryType == Avr8MemoryType::SPM - || memoryType == Avr8MemoryType::APPL_FLASH - || memoryType == Avr8MemoryType::BOOT_FLASH - ) { - alignTo = this->targetParameters.flashPageSize.value(); - } - - if ( - memoryType == Avr8MemoryType::EEPROM_ATOMIC - || memoryType == Avr8MemoryType::EEPROM_PAGE - ) { - alignTo = this->targetParameters.eepromPageSize.value(); + switch (memoryType) { + case Avr8MemoryType::FLASH_PAGE: + case Avr8MemoryType::SPM: + case Avr8MemoryType::APPL_FLASH: + case Avr8MemoryType::BOOT_FLASH: { + alignTo = this->targetParameters.flashPageSize.value(); + break; + } + case Avr8MemoryType::EEPROM_ATOMIC: + case Avr8MemoryType::EEPROM_PAGE: { + alignTo = this->targetParameters.eepromPageSize.value(); + break; + } + default: { + break; + } } if (this->maximumMemoryAccessSizePerRequest.has_value() && alignTo > this->maximumMemoryAccessSizePerRequest) { @@ -1583,20 +1585,22 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr ) { std::uint16_t alignTo = 1; - if ( - memoryType == Avr8MemoryType::FLASH_PAGE - || memoryType == Avr8MemoryType::SPM - || memoryType == Avr8MemoryType::APPL_FLASH - || memoryType == Avr8MemoryType::BOOT_FLASH - ) { - alignTo = this->targetParameters.flashPageSize.value(); - } - - if ( - memoryType == Avr8MemoryType::EEPROM_ATOMIC - || memoryType == Avr8MemoryType::EEPROM_PAGE - ) { - alignTo = this->targetParameters.eepromPageSize.value(); + switch (memoryType) { + case Avr8MemoryType::FLASH_PAGE: + case Avr8MemoryType::SPM: + case Avr8MemoryType::APPL_FLASH: + case Avr8MemoryType::BOOT_FLASH: { + alignTo = this->targetParameters.flashPageSize.value(); + break; + } + case Avr8MemoryType::EEPROM_ATOMIC: + case Avr8MemoryType::EEPROM_PAGE: { + alignTo = this->targetParameters.eepromPageSize.value(); + break; + } + default: { + break; + } } if ((bytes % alignTo) != 0) { @@ -1794,7 +1798,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr throw Avr8CommandFailure("AVR8 Read memory command failed", responseFrame); } - const auto data = responseFrame.getMemoryBuffer(); + const auto data = responseFrame.getMemoryData(); if (data.size() != bytes) { throw Avr8CommandFailure("Unexpected number of bytes returned from EDBG debug tool"); diff --git a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/ResponseFrames/AVR8Generic/ReadMemory.hpp b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/ResponseFrames/AVR8Generic/ReadMemory.hpp index 7c71b4ef..a4c17379 100644 --- a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/ResponseFrames/AVR8Generic/ReadMemory.hpp +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/ResponseFrames/AVR8Generic/ReadMemory.hpp @@ -12,9 +12,9 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::ResponseFrame : Avr8GenericResponseFrame(avrResponses) {} - Targets::TargetMemoryBuffer getMemoryBuffer() const { + Targets::TargetMemoryBuffer getMemoryData() const { /* - * AVR8 data payloads are typically in little endian form, but this does not apply the data returned + * AVR8 data payloads are typically in little endian form, but this does not apply to the data returned * from the READ MEMORY commands. */ return std::vector( diff --git a/src/TargetController/Commands/WriteTargetMemory.hpp b/src/TargetController/Commands/WriteTargetMemory.hpp index 2eab22a3..0f494783 100644 --- a/src/TargetController/Commands/WriteTargetMemory.hpp +++ b/src/TargetController/Commands/WriteTargetMemory.hpp @@ -1,7 +1,6 @@ #pragma once #include "Command.hpp" -#include "src/TargetController/Responses/TargetMemoryRead.hpp" #include "src/Targets/TargetMemory.hpp"