2021-04-04 21:04:12 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
#include <optional>
|
|
|
|
|
|
2022-04-03 20:35:53 +01:00
|
|
|
#include "MemoryAccessCommandPacket.hpp"
|
2021-04-04 21:04:12 +01:00
|
|
|
|
2022-03-31 16:05:39 +01:00
|
|
|
namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
2021-04-04 21:04:12 +01:00
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* The WriteMemory class implements the structure for "M" packets. Upon receiving this packet, the server is
|
|
|
|
|
* expected to write data to the target's memory, at the specified start address.
|
|
|
|
|
*/
|
2022-04-03 20:35:53 +01:00
|
|
|
class WriteMemory: public MemoryAccessCommandPacket
|
2021-04-04 21:04:12 +01:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
/**
|
2022-04-03 20:35:53 +01:00
|
|
|
* Start address of the memory operation.
|
2021-04-04 21:04:12 +01:00
|
|
|
*/
|
2021-06-22 23:52:31 +01:00
|
|
|
std::uint32_t startAddress = 0;
|
2021-04-04 21:04:12 +01:00
|
|
|
|
2022-04-03 20:35:53 +01:00
|
|
|
/**
|
|
|
|
|
* The type of memory to read from.
|
|
|
|
|
*/
|
|
|
|
|
Targets::TargetMemoryType memoryType = Targets::TargetMemoryType::FLASH;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Data to write.
|
|
|
|
|
*/
|
2021-05-24 20:58:49 +01:00
|
|
|
Targets::TargetMemoryBuffer buffer;
|
2021-04-04 21:04:12 +01:00
|
|
|
|
2022-04-08 23:39:51 +01:00
|
|
|
explicit WriteMemory(const RawPacketType& rawPacket);
|
2021-04-04 21:04:12 +01:00
|
|
|
|
2022-04-09 15:57:24 +01:00
|
|
|
void handle(
|
|
|
|
|
DebugSession& debugSession,
|
|
|
|
|
TargetController::TargetControllerConsole& targetControllerConsole
|
|
|
|
|
) override;
|
2021-04-04 21:04:12 +01:00
|
|
|
};
|
|
|
|
|
}
|