Corrected infinite recursion bug with EDBG Avr8 memory read implementation
This commit is contained in:
@@ -39,8 +39,11 @@ add_executable(Bloom
|
|||||||
src/SignalHandler/SignalHandler.cpp
|
src/SignalHandler/SignalHandler.cpp
|
||||||
src/DebugToolDrivers/USB/Interface.cpp
|
src/DebugToolDrivers/USB/Interface.cpp
|
||||||
src/DebugToolDrivers/USB/HID/HidInterface.cpp
|
src/DebugToolDrivers/USB/HID/HidInterface.cpp
|
||||||
|
|
||||||
src/DebugToolDrivers/Microchip/AtmelICE/AtmelIce.cpp
|
src/DebugToolDrivers/Microchip/AtmelICE/AtmelIce.cpp
|
||||||
src/DebugToolDrivers/Microchip/PowerDebugger/PowerDebugger.cpp
|
src/DebugToolDrivers/Microchip/PowerDebugger/PowerDebugger.cpp
|
||||||
|
src/DebugToolDrivers/Microchip/MplabSnap/MplabSnap.cpp
|
||||||
|
|
||||||
src/DebugToolDrivers/Protocols/CMSIS-DAP/Command.cpp
|
src/DebugToolDrivers/Protocols/CMSIS-DAP/Command.cpp
|
||||||
src/DebugToolDrivers/Protocols/CMSIS-DAP/Response.cpp
|
src/DebugToolDrivers/Protocols/CMSIS-DAP/Response.cpp
|
||||||
src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/AvrCommand.cpp
|
src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/AvrCommand.cpp
|
||||||
@@ -142,7 +145,8 @@ target_compile_options(
|
|||||||
PUBLIC -Wconversion
|
PUBLIC -Wconversion
|
||||||
PUBLIC -fno-sized-deallocation
|
PUBLIC -fno-sized-deallocation
|
||||||
PUBLIC $<$<CONFIG:DEBUG>:-g>
|
PUBLIC $<$<CONFIG:DEBUG>:-g>
|
||||||
PUBLIC $<$<CONFIG:DEBUG>:-Os>
|
PUBLIC $<$<CONFIG:DEBUG>:-O0>
|
||||||
|
# PUBLIC $<$<CONFIG:DEBUG>:-Os>
|
||||||
PUBLIC $<$<CONFIG:RELEASE>:-O2>
|
PUBLIC $<$<CONFIG:RELEASE>:-O2>
|
||||||
PUBLIC $<$<CONFIG:DEBUG>:-fno-inline>
|
PUBLIC $<$<CONFIG:DEBUG>:-fno-inline>
|
||||||
PUBLIC $<$<CONFIG:DEBUG>:-fkeep-static-functions>
|
PUBLIC $<$<CONFIG:DEBUG>:-fkeep-static-functions>
|
||||||
|
|||||||
@@ -3,3 +3,4 @@
|
|||||||
#include "DebugTool.hpp"
|
#include "DebugTool.hpp"
|
||||||
#include "src/DebugToolDrivers/Microchip/AtmelICE/AtmelIce.hpp"
|
#include "src/DebugToolDrivers/Microchip/AtmelICE/AtmelIce.hpp"
|
||||||
#include "src/DebugToolDrivers/Microchip/PowerDebugger/PowerDebugger.hpp"
|
#include "src/DebugToolDrivers/Microchip/PowerDebugger/PowerDebugger.hpp"
|
||||||
|
#include "src/DebugToolDrivers/Microchip/MplabSnap/MplabSnap.hpp"
|
||||||
|
|||||||
@@ -652,7 +652,11 @@ TargetState EdbgAvr8Interface::getTargetState() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TargetMemoryBuffer EdbgAvr8Interface::readMemory(Avr8MemoryType type, std::uint32_t address, std::uint32_t bytes) {
|
TargetMemoryBuffer EdbgAvr8Interface::readMemory(Avr8MemoryType type, std::uint32_t address, std::uint32_t bytes) {
|
||||||
if (type == Avr8MemoryType::FLASH_PAGE && this->targetParameters.flashPageSize.value_or(0) > 0) {
|
if (type == Avr8MemoryType::FLASH_PAGE) {
|
||||||
|
if (this->targetParameters.flashPageSize.value_or(0) < 1) {
|
||||||
|
throw Exception("Missing/invalid flash page size parameter");
|
||||||
|
}
|
||||||
|
|
||||||
// Flash reads must be done in pages
|
// Flash reads must be done in pages
|
||||||
auto pageSize = this->targetParameters.flashPageSize.value();
|
auto pageSize = this->targetParameters.flashPageSize.value();
|
||||||
|
|
||||||
@@ -744,11 +748,11 @@ TargetMemoryBuffer EdbgAvr8Interface::readMemory(Avr8MemoryType type, std::uint3
|
|||||||
|
|
||||||
return memoryBuffer;
|
return memoryBuffer;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
} else {
|
||||||
/*
|
/*
|
||||||
* EDBG AVR8 debug tools behave in a really weird way when responding with more than two packets
|
* EDBG AVR8 debug tools behave in a really weird way when responding with more than two packets
|
||||||
* for a single read memory command. The data they return in this case appears to be of little use.
|
* for a single read (non-flash) memory command. The data they return in this case appears to be of little use.
|
||||||
*
|
*
|
||||||
* To address this, we make sure we only issue read memory commands that will result in no more than two
|
* To address this, we make sure we only issue read memory commands that will result in no more than two
|
||||||
* response packets. For calls that require more than this, we simply split them into numerous calls.
|
* response packets. For calls that require more than this, we simply split them into numerous calls.
|
||||||
@@ -779,6 +783,7 @@ TargetMemoryBuffer EdbgAvr8Interface::readMemory(Avr8MemoryType type, std::uint3
|
|||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto commandFrame = CommandFrames::Avr8Generic::ReadMemory();
|
auto commandFrame = CommandFrames::Avr8Generic::ReadMemory();
|
||||||
commandFrame.setType(type);
|
commandFrame.setType(type);
|
||||||
|
|||||||
@@ -85,6 +85,12 @@ namespace Bloom
|
|||||||
return std::make_unique<PowerDebugger>();
|
return std::make_unique<PowerDebugger>();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"snap",
|
||||||
|
[]() -> std::unique_ptr<DebugTool> {
|
||||||
|
return std::make_unique<MplabSnap>();
|
||||||
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user