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:
Nav
2022-09-17 20:12:26 +01:00
parent 65bdcd62d3
commit 18fb3b56ce
5 changed files with 130 additions and 8 deletions

View 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)
{};
};
}