Corrected flash memory access types used for JTAG sessions
This commit is contained in:
@@ -700,12 +700,10 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
|
|||||||
if (
|
if (
|
||||||
this->configVariant == Avr8ConfigVariant::DEBUG_WIRE
|
this->configVariant == Avr8ConfigVariant::DEBUG_WIRE
|
||||||
|| this->configVariant == Avr8ConfigVariant::UPDI
|
|| this->configVariant == Avr8ConfigVariant::UPDI
|
||||||
|
|| this->configVariant == Avr8ConfigVariant::MEGAJTAG
|
||||||
) {
|
) {
|
||||||
avr8MemoryType = Avr8MemoryType::FLASH_PAGE;
|
avr8MemoryType = Avr8MemoryType::FLASH_PAGE;
|
||||||
|
|
||||||
} else if (this->configVariant == Avr8ConfigVariant::MEGAJTAG) {
|
|
||||||
avr8MemoryType = this->programmingModeEnabled ? Avr8MemoryType::FLASH_PAGE : Avr8MemoryType::SPM;
|
|
||||||
|
|
||||||
} else if (this->configVariant == Avr8ConfigVariant::XMEGA) {
|
} else if (this->configVariant == Avr8ConfigVariant::XMEGA) {
|
||||||
const auto bootSectionStartAddress = this->targetParameters.bootSectionStartAddress.value();
|
const auto bootSectionStartAddress = this->targetParameters.bootSectionStartAddress.value();
|
||||||
if (startAddress >= bootSectionStartAddress) {
|
if (startAddress >= bootSectionStartAddress) {
|
||||||
@@ -1458,11 +1456,14 @@ 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: {
|
||||||
case Avr8MemoryType::SPM: {
|
|
||||||
alignTo = this->targetParameters.flashPageSize.value();
|
alignTo = this->targetParameters.flashPageSize.value();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case Avr8MemoryType::SPM: {
|
||||||
|
// Memory access via the SPM type must be word aligned.
|
||||||
|
alignTo = 2;
|
||||||
|
}
|
||||||
case Avr8MemoryType::APPL_FLASH:
|
case Avr8MemoryType::APPL_FLASH:
|
||||||
case Avr8MemoryType::BOOT_FLASH: {
|
case Avr8MemoryType::BOOT_FLASH: {
|
||||||
if (this->configVariant == Avr8ConfigVariant::UPDI) {
|
if (this->configVariant == Avr8ConfigVariant::UPDI) {
|
||||||
@@ -1499,11 +1500,14 @@ 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: {
|
||||||
case Avr8MemoryType::SPM: {
|
|
||||||
alignTo = this->targetParameters.flashPageSize.value();
|
alignTo = this->targetParameters.flashPageSize.value();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case Avr8MemoryType::SPM: {
|
||||||
|
// Memory access via the SPM type must be word aligned.
|
||||||
|
alignTo = 2;
|
||||||
|
}
|
||||||
case Avr8MemoryType::APPL_FLASH:
|
case Avr8MemoryType::APPL_FLASH:
|
||||||
case Avr8MemoryType::BOOT_FLASH: {
|
case Avr8MemoryType::BOOT_FLASH: {
|
||||||
if (this->configVariant == Avr8ConfigVariant::UPDI) {
|
if (this->configVariant == Avr8ConfigVariant::UPDI) {
|
||||||
@@ -1607,8 +1611,9 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
|
|||||||
type == Avr8MemoryType::FLASH_PAGE
|
type == Avr8MemoryType::FLASH_PAGE
|
||||||
|| type == Avr8MemoryType::APPL_FLASH
|
|| type == Avr8MemoryType::APPL_FLASH
|
||||||
|| type == Avr8MemoryType::BOOT_FLASH
|
|| type == Avr8MemoryType::BOOT_FLASH
|
||||||
|
|| (type == Avr8MemoryType::SPM && this->configVariant == Avr8ConfigVariant::MEGAJTAG)
|
||||||
) {
|
) {
|
||||||
// With the FLASH_PAGE, APPL_FLASH and BOOT_FLASH memory types, we can only read one page at a time.
|
// With the FLASH_PAGE, APPL_FLASH, BOOT_FLASH and SPM memory types, we can only read one page at a time.
|
||||||
const auto pageSize = this->targetParameters.flashPageSize.value();
|
const auto pageSize = this->targetParameters.flashPageSize.value();
|
||||||
|
|
||||||
if (bytes > pageSize) {
|
if (bytes > pageSize) {
|
||||||
|
|||||||
Reference in New Issue
Block a user