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:
29
src/DebugServer/Gdb/ProgrammingSession.hpp
Normal file
29
src/DebugServer/Gdb/ProgrammingSession.hpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
|
||||
namespace Bloom::DebugServer::Gdb
|
||||
{
|
||||
/**
|
||||
* A programming session is created upon receiving the first FlashWrite (vFlashWrite) packet from GDB.
|
||||
*
|
||||
* The programming session holds the start address and a single buffer, which contains the sum of the numerous
|
||||
* buffers received by GDB (via multiple FlashWrite packets). Upon receiving a FlashDone (vFlashDone) packet, we
|
||||
* write the whole buffer to the target's program memory and then destroy the programming session.
|
||||
*
|
||||
* See FlashWrite::handle() and FlashDone::handle() for more.
|
||||
*/
|
||||
struct ProgrammingSession
|
||||
{
|
||||
Targets::TargetMemoryAddress startAddress = 0x00;
|
||||
Targets::TargetMemoryBuffer buffer;
|
||||
|
||||
ProgrammingSession(
|
||||
Targets::TargetMemoryAddress startAddress,
|
||||
const Targets::TargetMemoryBuffer& initialBuffer
|
||||
)
|
||||
: startAddress(startAddress)
|
||||
, buffer(initialBuffer)
|
||||
{};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user