Grouped the buffers from GDB's flash write packets so that we only flush once we have the full buffer.
This fixes an issue with GDB programming, where it was sending misaligned buffers and program memory wasn't being properly updated.
This commit is contained in:
@@ -23,12 +23,35 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
Logger::debug("Handling FlashDone packet");
|
||||
|
||||
try {
|
||||
if (debugSession.programmingSession.has_value()) {
|
||||
const auto& programmingSession = debugSession.programmingSession.value();
|
||||
|
||||
targetControllerConsole.enableProgrammingMode();
|
||||
|
||||
targetControllerConsole.writeMemory(
|
||||
Targets::TargetMemoryType::FLASH,
|
||||
programmingSession.startAddress,
|
||||
std::move(programmingSession.buffer)
|
||||
);
|
||||
|
||||
debugSession.programmingSession.reset();
|
||||
}
|
||||
|
||||
targetControllerConsole.disableProgrammingMode();
|
||||
|
||||
debugSession.connection.writePacket(OkResponsePacket());
|
||||
|
||||
} catch (const Exception& exception) {
|
||||
Logger::error("Failed to disabling programming mode - " + exception.getMessage());
|
||||
Logger::error("Failed to handle FlashDone packet - " + exception.getMessage());
|
||||
debugSession.programmingSession.reset();
|
||||
|
||||
try {
|
||||
targetControllerConsole.disableProgrammingMode();
|
||||
|
||||
} catch (const Exception& exception) {
|
||||
Logger::error("Failed to disable programming mode - " + exception.getMessage());
|
||||
}
|
||||
|
||||
debugSession.connection.writePacket(ErrorResponsePacket());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user