Tidied structure of all classes within the entire code base
Also some other small bits of tidying
This commit is contained in:
@@ -8,12 +8,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
|
||||
{
|
||||
class AvrCommand: public Command
|
||||
{
|
||||
private:
|
||||
size_t fragmentNumber = 1;
|
||||
size_t fragmentCount = 1;
|
||||
|
||||
std::vector<unsigned char> commandPacket;
|
||||
|
||||
public:
|
||||
AvrCommand() {
|
||||
this->setCommandId(0x80);
|
||||
@@ -49,5 +43,11 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
|
||||
void setCommandPacket(const std::vector<unsigned char>& commandPacket) {
|
||||
this->commandPacket = commandPacket;
|
||||
}
|
||||
|
||||
private:
|
||||
size_t fragmentNumber = 1;
|
||||
size_t fragmentCount = 1;
|
||||
|
||||
std::vector<unsigned char> commandPacket;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -17,16 +17,16 @@ void AvrEvent::init(const std::vector<unsigned char>& rawResponse) {
|
||||
if (responseData.size() < 2) {
|
||||
// All AVR_EVT responses should consist of at least two bytes (excluding the AVR_EVT ID)
|
||||
throw Exception("Failed to construct AvrEvent object - AVR_EVT response "
|
||||
"returned no additional data.");
|
||||
"returned no additional data.");
|
||||
}
|
||||
|
||||
// Response size is two bytes, MSB
|
||||
auto responsePacketSize = static_cast<size_t>((responseData[0] << 8) | responseData[1]);
|
||||
auto responsePacketSize = static_cast<std::size_t>((responseData[0] << 8) | responseData[1]);
|
||||
|
||||
if (responseData.size() < 2) {
|
||||
// All AVR_EVT responses should consist of at least two bytes (excluding the AVR_EVT ID)
|
||||
throw Exception("Failed to construct AvrEvent object - AVR_EVT response "
|
||||
"contained invalid event data size.");
|
||||
"contained invalid event data size.");
|
||||
}
|
||||
|
||||
auto eventData = std::vector<unsigned char>();
|
||||
|
||||
@@ -22,16 +22,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
|
||||
|
||||
class AvrEvent: public Response
|
||||
{
|
||||
private:
|
||||
unsigned char eventId = 0;
|
||||
|
||||
std::vector<unsigned char> eventData;
|
||||
|
||||
protected:
|
||||
void setEventData(const std::vector<unsigned char>& eventData) {
|
||||
this->eventData = eventData;
|
||||
}
|
||||
|
||||
public:
|
||||
AvrEvent() = default;
|
||||
|
||||
@@ -59,5 +49,14 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
|
||||
[[nodiscard]] AvrEventId getEventId() const {
|
||||
return static_cast<AvrEventId>(this->eventId);
|
||||
}
|
||||
|
||||
protected:
|
||||
void setEventData(const std::vector<unsigned char>& eventData) {
|
||||
this->eventData = eventData;
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned char eventId = 0;
|
||||
std::vector<unsigned char> eventData;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#include "AvrResponse.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
using namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr;
|
||||
|
||||
@@ -9,25 +9,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
|
||||
{
|
||||
class AvrResponse: public Response
|
||||
{
|
||||
private:
|
||||
std::uint8_t fragmentNumber = 0;
|
||||
std::uint8_t fragmentCount = 0;
|
||||
|
||||
std::vector<unsigned char> responsePacket;
|
||||
|
||||
protected:
|
||||
void setFragmentNumber(std::uint8_t fragmentNumber) {
|
||||
this->fragmentNumber = fragmentNumber;
|
||||
}
|
||||
|
||||
void setFragmentCount(std::uint8_t fragmentCount) {
|
||||
this->fragmentCount = fragmentCount;
|
||||
}
|
||||
|
||||
void setResponsePacket(const std::vector<unsigned char>& responsePacket) {
|
||||
this->responsePacket = responsePacket;
|
||||
}
|
||||
|
||||
public:
|
||||
AvrResponse() = default;
|
||||
|
||||
@@ -55,5 +36,24 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
|
||||
[[nodiscard]] const std::vector<unsigned char>& getResponsePacket() const {
|
||||
return this->responsePacket;
|
||||
}
|
||||
|
||||
protected:
|
||||
void setFragmentNumber(std::uint8_t fragmentNumber) {
|
||||
this->fragmentNumber = fragmentNumber;
|
||||
}
|
||||
|
||||
void setFragmentCount(std::uint8_t fragmentCount) {
|
||||
this->fragmentCount = fragmentCount;
|
||||
}
|
||||
|
||||
void setResponsePacket(const std::vector<unsigned char>& responsePacket) {
|
||||
this->responsePacket = responsePacket;
|
||||
}
|
||||
|
||||
private:
|
||||
std::uint8_t fragmentNumber = 0;
|
||||
std::uint8_t fragmentCount = 0;
|
||||
|
||||
std::vector<unsigned char> responsePacket;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "src/DebugToolDrivers/Protocols/CMSIS-DAP/Command.hpp"
|
||||
|
||||
namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
|
||||
|
||||
@@ -6,9 +6,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
{
|
||||
class ActivatePhysical: public Avr8GenericCommandFrame
|
||||
{
|
||||
private:
|
||||
bool reset = false;
|
||||
|
||||
public:
|
||||
ActivatePhysical() = default;
|
||||
explicit ActivatePhysical(bool reset): reset(reset) {};
|
||||
@@ -31,6 +28,9 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
private:
|
||||
bool reset = false;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -6,9 +6,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
{
|
||||
class Attach: public Avr8GenericCommandFrame
|
||||
{
|
||||
private:
|
||||
bool breakAfterAttach = false;
|
||||
|
||||
public:
|
||||
Attach() = default;
|
||||
explicit Attach(bool breakAfterAttach): breakAfterAttach(breakAfterAttach) {};
|
||||
@@ -31,6 +28,9 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
private:
|
||||
bool breakAfterAttach = false;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,11 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
{
|
||||
class ClearAllSoftwareBreakpoints: public Avr8GenericCommandFrame
|
||||
{
|
||||
public:
|
||||
ClearAllSoftwareBreakpoints() {
|
||||
init();
|
||||
};
|
||||
|
||||
private:
|
||||
void init() {
|
||||
/*
|
||||
@@ -18,10 +23,5 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
payload[1] = 0x00;
|
||||
this->setPayload(payload);
|
||||
}
|
||||
|
||||
public:
|
||||
ClearAllSoftwareBreakpoints() {
|
||||
init();
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,9 +9,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
{
|
||||
class ClearSoftwareBreakpoints: public Avr8GenericCommandFrame
|
||||
{
|
||||
private:
|
||||
std::vector<std::uint32_t> addresses;
|
||||
|
||||
public:
|
||||
ClearSoftwareBreakpoints() = default;
|
||||
|
||||
@@ -43,5 +40,8 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<std::uint32_t> addresses;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,6 +6,11 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
{
|
||||
class DeactivatePhysical: public Avr8GenericCommandFrame
|
||||
{
|
||||
public:
|
||||
DeactivatePhysical() {
|
||||
init();
|
||||
};
|
||||
|
||||
private:
|
||||
void init() {
|
||||
/*
|
||||
@@ -18,10 +23,5 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
payload[1] = 0x00;
|
||||
this->setPayload(payload);
|
||||
}
|
||||
|
||||
public:
|
||||
DeactivatePhysical() {
|
||||
init();
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,6 +6,11 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
{
|
||||
class Detach: public Avr8GenericCommandFrame
|
||||
{
|
||||
public:
|
||||
Detach() {
|
||||
init();
|
||||
};
|
||||
|
||||
private:
|
||||
void init() {
|
||||
/*
|
||||
@@ -18,10 +23,5 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
payload[1] = 0x00;
|
||||
this->setPayload(payload);
|
||||
}
|
||||
|
||||
public:
|
||||
Detach() {
|
||||
init();
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,6 +6,11 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
{
|
||||
class DisableDebugWire: public Avr8GenericCommandFrame
|
||||
{
|
||||
public:
|
||||
DisableDebugWire() {
|
||||
init();
|
||||
};
|
||||
|
||||
private:
|
||||
void init() {
|
||||
/*
|
||||
@@ -18,10 +23,5 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
payload[1] = 0x00;
|
||||
this->setPayload(payload);
|
||||
}
|
||||
|
||||
public:
|
||||
DisableDebugWire() {
|
||||
init();
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,6 +7,13 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
{
|
||||
class GetDeviceId: public Avr8GenericCommandFrame
|
||||
{
|
||||
public:
|
||||
using ResponseFrameType = ResponseFrames::Avr8Generic::GetDeviceId;
|
||||
|
||||
GetDeviceId() {
|
||||
init();
|
||||
};
|
||||
|
||||
private:
|
||||
void init() {
|
||||
/*
|
||||
@@ -19,12 +26,5 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
payload[1] = 0x00;
|
||||
this->setPayload(payload);
|
||||
}
|
||||
|
||||
public:
|
||||
using ResponseFrameType = ResponseFrames::Avr8Generic::GetDeviceId;
|
||||
|
||||
GetDeviceId() {
|
||||
init();
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,10 +8,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
{
|
||||
class GetParameter: public Avr8GenericCommandFrame
|
||||
{
|
||||
private:
|
||||
Avr8EdbgParameter parameter;
|
||||
std::uint8_t size = 0;
|
||||
|
||||
public:
|
||||
GetParameter() = default;
|
||||
|
||||
@@ -49,5 +45,9 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
private:
|
||||
Avr8EdbgParameter parameter;
|
||||
std::uint8_t size = 0;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,6 +7,13 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
{
|
||||
class GetProgramCounter: public Avr8GenericCommandFrame
|
||||
{
|
||||
public:
|
||||
using ResponseFrameType = ResponseFrames::Avr8Generic::GetProgramCounter;
|
||||
|
||||
GetProgramCounter() {
|
||||
init();
|
||||
};
|
||||
|
||||
private:
|
||||
void init() {
|
||||
/*
|
||||
@@ -19,12 +26,5 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
payload[1] = 0x00;
|
||||
this->setPayload(payload);
|
||||
}
|
||||
|
||||
public:
|
||||
using ResponseFrameType = ResponseFrames::Avr8Generic::GetProgramCounter;
|
||||
|
||||
GetProgramCounter() {
|
||||
init();
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -10,12 +10,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
{
|
||||
class ReadMemory: public Avr8GenericCommandFrame
|
||||
{
|
||||
private:
|
||||
Avr8MemoryType type = Avr8MemoryType::SRAM;
|
||||
std::uint32_t address = 0;
|
||||
std::uint32_t bytes = 0;
|
||||
std::set<std::uint32_t> excludedAddresses;
|
||||
|
||||
public:
|
||||
using ResponseFrameType = ResponseFrames::Avr8Generic::ReadMemory;
|
||||
|
||||
@@ -38,5 +32,11 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
}
|
||||
|
||||
[[nodiscard]] std::vector<unsigned char> getPayload() const override;
|
||||
|
||||
private:
|
||||
Avr8MemoryType type = Avr8MemoryType::SRAM;
|
||||
std::uint32_t address = 0;
|
||||
std::uint32_t bytes = 0;
|
||||
std::set<std::uint32_t> excludedAddresses;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,9 +6,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
{
|
||||
class Reset: public Avr8GenericCommandFrame
|
||||
{
|
||||
private:
|
||||
bool stopAtMainAddress = false;
|
||||
|
||||
public:
|
||||
Reset() = default;
|
||||
explicit Reset(bool stopAtMainAddress): stopAtMainAddress(stopAtMainAddress) {};
|
||||
@@ -31,5 +28,8 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
private:
|
||||
bool stopAtMainAddress = false;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,6 +6,11 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
{
|
||||
class Run: public Avr8GenericCommandFrame
|
||||
{
|
||||
public:
|
||||
Run() {
|
||||
init();
|
||||
};
|
||||
|
||||
private:
|
||||
void init() {
|
||||
/*
|
||||
@@ -18,10 +23,5 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
payload[1] = 0x00;
|
||||
this->setPayload(payload);
|
||||
}
|
||||
|
||||
public:
|
||||
Run() {
|
||||
init();
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,9 +8,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
{
|
||||
class RunTo: public Avr8GenericCommandFrame
|
||||
{
|
||||
private:
|
||||
std::uint32_t address = 0;
|
||||
|
||||
public:
|
||||
RunTo() = default;
|
||||
|
||||
@@ -41,5 +38,8 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
private:
|
||||
std::uint32_t address = 0;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,10 +6,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
{
|
||||
class SetParameter: public Avr8GenericCommandFrame
|
||||
{
|
||||
private:
|
||||
Avr8EdbgParameter parameter;
|
||||
std::vector<unsigned char> value;
|
||||
|
||||
public:
|
||||
SetParameter() = default;
|
||||
|
||||
@@ -57,5 +53,9 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
private:
|
||||
Avr8EdbgParameter parameter;
|
||||
std::vector<unsigned char> value;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,9 +8,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
{
|
||||
class SetProgramCounter: public Avr8GenericCommandFrame
|
||||
{
|
||||
private:
|
||||
std::uint32_t programCounter = 0;
|
||||
|
||||
public:
|
||||
explicit SetProgramCounter(std::uint32_t programCounter): programCounter(programCounter) {}
|
||||
|
||||
@@ -31,5 +28,8 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
private:
|
||||
std::uint32_t programCounter = 0;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,9 +9,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
{
|
||||
class SetSoftwareBreakpoints: public Avr8GenericCommandFrame
|
||||
{
|
||||
private:
|
||||
std::vector<std::uint32_t> addresses;
|
||||
|
||||
public:
|
||||
SetSoftwareBreakpoints() = default;
|
||||
|
||||
@@ -43,5 +40,8 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<std::uint32_t> addresses;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,9 +8,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
{
|
||||
class SetXmegaSoftwareBreakpoint: public Avr8GenericCommandFrame
|
||||
{
|
||||
private:
|
||||
std::uint32_t address = 0;
|
||||
|
||||
public:
|
||||
SetXmegaSoftwareBreakpoint() = default;
|
||||
|
||||
@@ -40,5 +37,8 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
private:
|
||||
std::uint32_t address = 0;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,9 +6,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
{
|
||||
class Stop: public Avr8GenericCommandFrame
|
||||
{
|
||||
private:
|
||||
bool stopImmediately = true;
|
||||
|
||||
public:
|
||||
Stop() = default;
|
||||
explicit Stop(bool stopImmediately): stopImmediately(stopImmediately) {};
|
||||
@@ -31,5 +28,8 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
private:
|
||||
bool stopImmediately = true;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,11 +9,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
{
|
||||
class WriteMemory: public Avr8GenericCommandFrame
|
||||
{
|
||||
private:
|
||||
Avr8MemoryType type = Avr8MemoryType::SRAM;
|
||||
std::uint32_t address = 0;
|
||||
Targets::TargetMemoryBuffer buffer;
|
||||
|
||||
public:
|
||||
WriteMemory() = default;
|
||||
|
||||
@@ -62,5 +57,10 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
private:
|
||||
Avr8MemoryType type = Avr8MemoryType::SRAM;
|
||||
std::uint32_t address = 0;
|
||||
Targets::TargetMemoryBuffer buffer;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -14,24 +14,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
|
||||
{
|
||||
class AvrCommandFrame
|
||||
{
|
||||
private:
|
||||
unsigned char SOF = 0x0E;
|
||||
|
||||
unsigned char protocolVersion = 0x00;
|
||||
|
||||
/**
|
||||
* Incrementing from 0x00
|
||||
*/
|
||||
std::uint16_t sequenceId = 0;
|
||||
inline static std::uint16_t lastSequenceId = 0;
|
||||
|
||||
/**
|
||||
* Destination sub-protocol handler ID
|
||||
*/
|
||||
ProtocolHandlerId protocolHandlerID = ProtocolHandlerId::DISCOVERY;
|
||||
|
||||
std::vector<unsigned char> payload;
|
||||
|
||||
public:
|
||||
using ResponseFrameType = AvrResponseFrame;
|
||||
|
||||
@@ -102,6 +84,24 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
|
||||
* @return
|
||||
*/
|
||||
explicit virtual operator std::vector<unsigned char> () const;
|
||||
|
||||
private:
|
||||
unsigned char SOF = 0x0E;
|
||||
|
||||
unsigned char protocolVersion = 0x00;
|
||||
|
||||
/**
|
||||
* Incrementing from 0x00
|
||||
*/
|
||||
std::uint16_t sequenceId = 0;
|
||||
inline static std::uint16_t lastSequenceId = 0;
|
||||
|
||||
/**
|
||||
* Destination sub-protocol handler ID
|
||||
*/
|
||||
ProtocolHandlerId protocolHandlerID = ProtocolHandlerId::DISCOVERY;
|
||||
|
||||
std::vector<unsigned char> payload;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -21,9 +21,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
*/
|
||||
class Query: public DiscoveryCommandFrame
|
||||
{
|
||||
private:
|
||||
QueryContext context = QueryContext::COMMAND_HANDLERS;
|
||||
|
||||
public:
|
||||
Query(): DiscoveryCommandFrame() {}
|
||||
|
||||
@@ -45,5 +42,8 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
private:
|
||||
QueryContext context = QueryContext::COMMAND_HANDLERS;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,6 +9,11 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
*/
|
||||
class EndSession: public HouseKeepingCommandFrame
|
||||
{
|
||||
public:
|
||||
EndSession(): HouseKeepingCommandFrame() {
|
||||
this->init();
|
||||
}
|
||||
|
||||
private:
|
||||
void init() {
|
||||
/*
|
||||
@@ -21,10 +26,5 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
payload[2] = 0x00;
|
||||
this->setPayload(payload);
|
||||
}
|
||||
|
||||
public:
|
||||
EndSession(): HouseKeepingCommandFrame() {
|
||||
this->init();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,6 +9,11 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
*/
|
||||
class StartSession: public HouseKeepingCommandFrame
|
||||
{
|
||||
public:
|
||||
StartSession(): HouseKeepingCommandFrame() {
|
||||
this->init();
|
||||
}
|
||||
|
||||
private:
|
||||
void init() {
|
||||
/*
|
||||
@@ -20,10 +25,5 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
||||
payload[1] = 0x00;
|
||||
this->setPayload(payload);
|
||||
}
|
||||
|
||||
public:
|
||||
StartSession(): HouseKeepingCommandFrame() {
|
||||
this->init();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -25,6 +25,198 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
|
||||
*/
|
||||
class EdbgAvr8Interface: public TargetInterfaces::Microchip::Avr::Avr8::Avr8Interface
|
||||
{
|
||||
public:
|
||||
explicit EdbgAvr8Interface(EdbgInterface& edbgInterface)
|
||||
: edbgInterface(edbgInterface) {};
|
||||
|
||||
/**
|
||||
* Disables use of the masked read memory EDBG command. Masking will be performed at the driver-side.
|
||||
*
|
||||
* @param avoidMaskedMemoryRead
|
||||
*/
|
||||
void setAvoidMaskedMemoryRead(bool avoidMaskedMemoryRead) {
|
||||
this->avoidMaskedMemoryRead = avoidMaskedMemoryRead;
|
||||
}
|
||||
|
||||
/*
|
||||
* The public methods below implement the interface defined by the Avr8Interface class.
|
||||
* See the comments in that class for more info on the expected behaviour of each method.
|
||||
*/
|
||||
|
||||
/**
|
||||
* As already mentioned in numerous comments above, the EdbgAvr8Interface requires some configuration from
|
||||
* the user. This is supplied via the user's Bloom configuration.
|
||||
*
|
||||
* @param targetConfig
|
||||
*/
|
||||
void configure(const TargetConfig& targetConfig) override;
|
||||
|
||||
/**
|
||||
* Configures the target family. For some physical interfaces, the target family is required in order
|
||||
* properly configure the EDBG tool. See EdbgAvr8Interface::resolveConfigVariant() for more.
|
||||
*
|
||||
* @param family
|
||||
*/
|
||||
void setFamily(Targets::Microchip::Avr::Avr8Bit::Family family) override {
|
||||
this->family = family;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accepts target parameters from the AVR8 target instance and sends the necessary target parameters to the
|
||||
* debug tool.
|
||||
*
|
||||
* @param config
|
||||
*/
|
||||
void setTargetParameters(const Targets::Microchip::Avr::Avr8Bit::TargetParameters& config) override;
|
||||
|
||||
/**
|
||||
* Initialises the AVR8 Generic protocol interface by setting the appropriate parameters on the debug tool.
|
||||
*/
|
||||
void init() override;
|
||||
|
||||
/**
|
||||
* Issues the "stop" command to the debug tool, halting target execution.
|
||||
*/
|
||||
void stop() override;
|
||||
|
||||
/**
|
||||
* Issues the "run" command to the debug tool, resuming execution on the target.
|
||||
*/
|
||||
void run() override;
|
||||
|
||||
/**
|
||||
* Issues the "run to" command to the debug tool, resuming execution on the target, up to a specific byte
|
||||
* address. The target will dispatch an AVR BREAK event once it reaches the specified address.
|
||||
*
|
||||
* @param address
|
||||
* The (byte) address to run to.
|
||||
*/
|
||||
void runTo(std::uint32_t address) override;
|
||||
|
||||
/**
|
||||
* Issues the "step" command to the debug tool, stepping the execution on the target. The stepping can be
|
||||
* configured to step in, out or over. But currently we only support stepping in. The target will dispatch
|
||||
* an AVR BREAK event once it reaches the next instruction.
|
||||
*/
|
||||
void step() override;
|
||||
|
||||
/**
|
||||
* Issues the "reset" command to the debug tool, resetting target execution.
|
||||
*/
|
||||
void reset() override;
|
||||
|
||||
/**
|
||||
* Activates the physical interface and starts a debug session on the target (via attach()).
|
||||
*/
|
||||
void activate() override;
|
||||
|
||||
/**
|
||||
* Terminates any active debug session on the target and severs the connection between the debug tool and
|
||||
* the target (by deactivating the physical interface).
|
||||
*/
|
||||
void deactivate() override;
|
||||
|
||||
/**
|
||||
* Issues the "PC Read" command to the debug tool, to extract the current program counter.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
std::uint32_t getProgramCounter() override;
|
||||
|
||||
/**
|
||||
* Issues the "PC Write" command to the debug tool, setting the program counter on the target.
|
||||
*
|
||||
* @param programCounter
|
||||
* The byte address to set as the program counter.
|
||||
*/
|
||||
void setProgramCounter(std::uint32_t programCounter) override;
|
||||
|
||||
/**
|
||||
* Issues the "Get ID" command to the debug tool, to extract the signature from the target.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Targets::Microchip::Avr::TargetSignature getDeviceId() override;
|
||||
|
||||
/**
|
||||
* Issues the "Software Breakpoint Set" command to the debug tool, setting a software breakpoint at the given
|
||||
* byte address.
|
||||
*
|
||||
* @param address
|
||||
* The byte address to position the breakpoint.
|
||||
*/
|
||||
void setBreakpoint(std::uint32_t address) override;
|
||||
|
||||
/**
|
||||
* Issues the "Software Breakpoint Clear" command to the debug tool, clearing any breakpoint at the given
|
||||
* byte address.
|
||||
*
|
||||
* @param address
|
||||
* The byte address of the breakpoint to clear.
|
||||
*/
|
||||
void clearBreakpoint(std::uint32_t address) override;
|
||||
|
||||
/**
|
||||
* Issues the "Software Breakpoint Clear All" command to the debug tool, clearing all software breakpoints
|
||||
* that were set *in the current debug session*.
|
||||
*
|
||||
* If the debug session ended before any of the set breakpoints were cleared, this will *not* clear them.
|
||||
*/
|
||||
void clearAllBreakpoints() override;
|
||||
|
||||
/**
|
||||
* Reads registers from the target.
|
||||
*
|
||||
* @param descriptors
|
||||
* @return
|
||||
*/
|
||||
Targets::TargetRegisters readRegisters(const Targets::TargetRegisterDescriptors& descriptors) override;
|
||||
|
||||
/**
|
||||
* Writes registers to target.
|
||||
*
|
||||
* @param registers
|
||||
*/
|
||||
void writeRegisters(const Targets::TargetRegisters& registers) override;
|
||||
|
||||
/**
|
||||
* This is an overloaded method.
|
||||
*
|
||||
* Resolves the correct Avr8MemoryType from the given TargetMemoryType and calls readMemory().
|
||||
*
|
||||
* @param memoryType
|
||||
* @param startAddress
|
||||
* @param bytes
|
||||
* @return
|
||||
*/
|
||||
Targets::TargetMemoryBuffer readMemory(
|
||||
Targets::TargetMemoryType memoryType,
|
||||
std::uint32_t startAddress,
|
||||
std::uint32_t bytes
|
||||
) override;
|
||||
|
||||
/**
|
||||
* This is an overloaded method.
|
||||
*
|
||||
* Resolves the correct Avr8MemoryType from the given TargetMemoryType and calls writeMemory().
|
||||
*
|
||||
* @param memoryType
|
||||
* @param startAddress
|
||||
* @param buffer
|
||||
*/
|
||||
void writeMemory(
|
||||
Targets::TargetMemoryType memoryType,
|
||||
std::uint32_t startAddress,
|
||||
const Targets::TargetMemoryBuffer& buffer
|
||||
) override;
|
||||
|
||||
/**
|
||||
* Returns the current state of the target.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Targets::TargetState getTargetState() override;
|
||||
|
||||
private:
|
||||
/**
|
||||
* The AVR8 Generic protocol is a sub-protocol of the EDBG AVR protocol, which is served via CMSIS-DAP vendor
|
||||
@@ -459,197 +651,5 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
|
||||
* This should only be used when a BreakEvent is always expected.
|
||||
*/
|
||||
void waitForStoppedEvent();
|
||||
|
||||
public:
|
||||
explicit EdbgAvr8Interface(EdbgInterface& edbgInterface)
|
||||
: edbgInterface(edbgInterface) {};
|
||||
|
||||
/**
|
||||
* Disables use of the masked read memory EDBG command. Masking will be performed at the driver-side.
|
||||
*
|
||||
* @param avoidMaskedMemoryRead
|
||||
*/
|
||||
void setAvoidMaskedMemoryRead(bool avoidMaskedMemoryRead) {
|
||||
this->avoidMaskedMemoryRead = avoidMaskedMemoryRead;
|
||||
}
|
||||
|
||||
/*
|
||||
* The public methods below implement the interface defined by the Avr8Interface class.
|
||||
* See the comments in that class for more info on the expected behaviour of each method.
|
||||
*/
|
||||
|
||||
/**
|
||||
* As already mentioned in numerous comments above, the EdbgAvr8Interface requires some configuration from
|
||||
* the user. This is supplied via the user's Bloom configuration.
|
||||
*
|
||||
* @param targetConfig
|
||||
*/
|
||||
void configure(const TargetConfig& targetConfig) override;
|
||||
|
||||
/**
|
||||
* Configures the target family. For some physical interfaces, the target family is required in order
|
||||
* properly configure the EDBG tool. See EdbgAvr8Interface::resolveConfigVariant() for more.
|
||||
*
|
||||
* @param family
|
||||
*/
|
||||
void setFamily(Targets::Microchip::Avr::Avr8Bit::Family family) override {
|
||||
this->family = family;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accepts target parameters from the AVR8 target instance and sends the necessary target parameters to the
|
||||
* debug tool.
|
||||
*
|
||||
* @param config
|
||||
*/
|
||||
void setTargetParameters(const Targets::Microchip::Avr::Avr8Bit::TargetParameters& config) override;
|
||||
|
||||
/**
|
||||
* Initialises the AVR8 Generic protocol interface by setting the appropriate parameters on the debug tool.
|
||||
*/
|
||||
void init() override;
|
||||
|
||||
/**
|
||||
* Issues the "stop" command to the debug tool, halting target execution.
|
||||
*/
|
||||
void stop() override;
|
||||
|
||||
/**
|
||||
* Issues the "run" command to the debug tool, resuming execution on the target.
|
||||
*/
|
||||
void run() override;
|
||||
|
||||
/**
|
||||
* Issues the "run to" command to the debug tool, resuming execution on the target, up to a specific byte
|
||||
* address. The target will dispatch an AVR BREAK event once it reaches the specified address.
|
||||
*
|
||||
* @param address
|
||||
* The (byte) address to run to.
|
||||
*/
|
||||
void runTo(std::uint32_t address) override;
|
||||
|
||||
/**
|
||||
* Issues the "step" command to the debug tool, stepping the execution on the target. The stepping can be
|
||||
* configured to step in, out or over. But currently we only support stepping in. The target will dispatch
|
||||
* an AVR BREAK event once it reaches the next instruction.
|
||||
*/
|
||||
void step() override;
|
||||
|
||||
/**
|
||||
* Issues the "reset" command to the debug tool, resetting target execution.
|
||||
*/
|
||||
void reset() override;
|
||||
|
||||
/**
|
||||
* Activates the physical interface and starts a debug session on the target (via attach()).
|
||||
*/
|
||||
void activate() override;
|
||||
|
||||
/**
|
||||
* Terminates any active debug session on the target and severs the connection between the debug tool and
|
||||
* the target (by deactivating the physical interface).
|
||||
*/
|
||||
void deactivate() override;
|
||||
|
||||
/**
|
||||
* Issues the "PC Read" command to the debug tool, to extract the current program counter.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
std::uint32_t getProgramCounter() override;
|
||||
|
||||
/**
|
||||
* Issues the "PC Write" command to the debug tool, setting the program counter on the target.
|
||||
*
|
||||
* @param programCounter
|
||||
* The byte address to set as the program counter.
|
||||
*/
|
||||
void setProgramCounter(std::uint32_t programCounter) override;
|
||||
|
||||
/**
|
||||
* Issues the "Get ID" command to the debug tool, to extract the signature from the target.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Targets::Microchip::Avr::TargetSignature getDeviceId() override;
|
||||
|
||||
/**
|
||||
* Issues the "Software Breakpoint Set" command to the debug tool, setting a software breakpoint at the given
|
||||
* byte address.
|
||||
*
|
||||
* @param address
|
||||
* The byte address to position the breakpoint.
|
||||
*/
|
||||
void setBreakpoint(std::uint32_t address) override;
|
||||
|
||||
/**
|
||||
* Issues the "Software Breakpoint Clear" command to the debug tool, clearing any breakpoint at the given
|
||||
* byte address.
|
||||
*
|
||||
* @param address
|
||||
* The byte address of the breakpoint to clear.
|
||||
*/
|
||||
void clearBreakpoint(std::uint32_t address) override;
|
||||
|
||||
/**
|
||||
* Issues the "Software Breakpoint Clear All" command to the debug tool, clearing all software breakpoints
|
||||
* that were set *in the current debug session*.
|
||||
*
|
||||
* If the debug session ended before any of the set breakpoints were cleared, this will *not* clear them.
|
||||
*/
|
||||
void clearAllBreakpoints() override;
|
||||
|
||||
/**
|
||||
* Reads registers from the target.
|
||||
*
|
||||
* @param descriptors
|
||||
* @return
|
||||
*/
|
||||
Targets::TargetRegisters readRegisters(const Targets::TargetRegisterDescriptors& descriptors) override;
|
||||
|
||||
/**
|
||||
* Writes registers to target.
|
||||
*
|
||||
* @param registers
|
||||
*/
|
||||
void writeRegisters(const Targets::TargetRegisters& registers) override;
|
||||
|
||||
/**
|
||||
* This is an overloaded method.
|
||||
*
|
||||
* Resolves the correct Avr8MemoryType from the given TargetMemoryType and calls readMemory().
|
||||
*
|
||||
* @param memoryType
|
||||
* @param startAddress
|
||||
* @param bytes
|
||||
* @return
|
||||
*/
|
||||
Targets::TargetMemoryBuffer readMemory(
|
||||
Targets::TargetMemoryType memoryType,
|
||||
std::uint32_t startAddress,
|
||||
std::uint32_t bytes
|
||||
) override;
|
||||
|
||||
/**
|
||||
* This is an overloaded method.
|
||||
*
|
||||
* Resolves the correct Avr8MemoryType from the given TargetMemoryType and calls writeMemory().
|
||||
*
|
||||
* @param memoryType
|
||||
* @param startAddress
|
||||
* @param buffer
|
||||
*/
|
||||
void writeMemory(
|
||||
Targets::TargetMemoryType memoryType,
|
||||
std::uint32_t startAddress,
|
||||
const Targets::TargetMemoryBuffer& buffer
|
||||
) override;
|
||||
|
||||
/**
|
||||
* Returns the current state of the target.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Targets::TargetState getTargetState() override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#include "BreakEvent.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
using namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr;
|
||||
|
||||
@@ -9,12 +9,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
|
||||
{
|
||||
class BreakEvent: public AvrEvent
|
||||
{
|
||||
private:
|
||||
std::uint32_t programCounter = 0;
|
||||
Targets::TargetBreakCause breakCause = Targets::TargetBreakCause::UNKNOWN;
|
||||
|
||||
void init(const AvrEvent& event);
|
||||
|
||||
public:
|
||||
explicit BreakEvent(const AvrEvent& event) {
|
||||
this->init(event);
|
||||
@@ -27,5 +21,11 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
|
||||
[[nodiscard]] Targets::TargetBreakCause getBreakCause() const {
|
||||
return this->breakCause;
|
||||
}
|
||||
|
||||
private:
|
||||
std::uint32_t programCounter = 0;
|
||||
Targets::TargetBreakCause breakCause = Targets::TargetBreakCause::UNKNOWN;
|
||||
|
||||
void init(const AvrEvent& event);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,6 +7,27 @@ namespace Bloom::Exceptions
|
||||
{
|
||||
class Avr8CommandFailure: public TargetOperationFailure
|
||||
{
|
||||
public:
|
||||
explicit Avr8CommandFailure(const std::string& message): TargetOperationFailure(message) {
|
||||
this->message = message;
|
||||
}
|
||||
|
||||
explicit Avr8CommandFailure(const char* message): TargetOperationFailure(message) {
|
||||
this->message = std::string(message);
|
||||
}
|
||||
|
||||
explicit Avr8CommandFailure(
|
||||
const std::string& message,
|
||||
DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::ResponseFrames::Avr8Generic::Avr8GenericResponseFrame& responseFrame
|
||||
): TargetOperationFailure(message) {
|
||||
this->message = message;
|
||||
|
||||
auto responsePayload = responseFrame.getPayload();
|
||||
if (responsePayload.size() == 3 && this->failureCodeToDescription.contains(responsePayload[2])) {
|
||||
this->message += " - Failure reason: " + this->failureCodeToDescription.find(responsePayload[2])->second;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
static inline auto failureCodeToDescription = std::map<unsigned char, std::string>({
|
||||
{0x10, "debugWIRE physical error"},
|
||||
@@ -57,26 +78,5 @@ namespace Bloom::Exceptions
|
||||
{0x91, "Command has not been implemented"},
|
||||
{0xFF, "Unknown error reported by EDBG device"},
|
||||
});
|
||||
|
||||
public:
|
||||
explicit Avr8CommandFailure(const std::string& message): TargetOperationFailure(message) {
|
||||
this->message = message;
|
||||
}
|
||||
|
||||
explicit Avr8CommandFailure(const char* message): TargetOperationFailure(message) {
|
||||
this->message = std::string(message);
|
||||
}
|
||||
|
||||
explicit Avr8CommandFailure(
|
||||
const std::string& message,
|
||||
DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::ResponseFrames::Avr8Generic::Avr8GenericResponseFrame& responseFrame
|
||||
): TargetOperationFailure(message) {
|
||||
this->message = message;
|
||||
|
||||
auto responsePayload = responseFrame.getPayload();
|
||||
if (responsePayload.size() == 3 && this->failureCodeToDescription.contains(responsePayload[2])) {
|
||||
this->message += " - Failure reason: " + this->failureCodeToDescription.find(responsePayload[2])->second;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "Avr8GenericResponseFrame.hpp"
|
||||
|
||||
#include "src/Targets/Microchip/AVR/AVR8/PhysicalInterface.hpp"
|
||||
|
||||
namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::ResponseFrames::Avr8Generic
|
||||
|
||||
@@ -27,5 +27,4 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::ResponseFrame
|
||||
return static_cast<std::uint32_t>(payload[5] << 24 | payload[4] << 16 | payload[3] << 8 | payload[2]) * 2;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#include "AvrResponseFrame.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
using namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr;
|
||||
|
||||
@@ -13,40 +13,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
|
||||
{
|
||||
class AvrResponseFrame
|
||||
{
|
||||
private:
|
||||
unsigned char SOF = 0x0E;
|
||||
|
||||
/**
|
||||
* Incrementing from 0x00
|
||||
*/
|
||||
std::uint16_t sequenceID = 1;
|
||||
|
||||
/**
|
||||
* Destination sub-protocol handler ID
|
||||
*/
|
||||
ProtocolHandlerId protocolHandlerID = ProtocolHandlerId::AVR8_GENERIC;
|
||||
|
||||
std::vector<unsigned char> payload;
|
||||
|
||||
protected:
|
||||
virtual void initFromRawFrame(const std::vector<unsigned char>& rawFrame);
|
||||
|
||||
void setSequenceId(std::uint16_t sequenceId) {
|
||||
this->sequenceID = sequenceId;
|
||||
}
|
||||
|
||||
void setProtocolHandlerId(ProtocolHandlerId protocolHandlerId) {
|
||||
this->protocolHandlerID = protocolHandlerId;
|
||||
}
|
||||
|
||||
void setProtocolHandlerId(unsigned char protocolHandlerId) {
|
||||
this->protocolHandlerID = static_cast<ProtocolHandlerId>(protocolHandlerId);
|
||||
}
|
||||
|
||||
void setPayload(const std::vector<unsigned char>& payload) {
|
||||
this->payload = payload;
|
||||
}
|
||||
|
||||
public:
|
||||
explicit AvrResponseFrame() = default;
|
||||
|
||||
@@ -82,5 +48,39 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
|
||||
[[nodiscard]] virtual std::vector<unsigned char> getPayloadData() {
|
||||
return this->payload;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void initFromRawFrame(const std::vector<unsigned char>& rawFrame);
|
||||
|
||||
void setSequenceId(std::uint16_t sequenceId) {
|
||||
this->sequenceID = sequenceId;
|
||||
}
|
||||
|
||||
void setProtocolHandlerId(ProtocolHandlerId protocolHandlerId) {
|
||||
this->protocolHandlerID = protocolHandlerId;
|
||||
}
|
||||
|
||||
void setProtocolHandlerId(unsigned char protocolHandlerId) {
|
||||
this->protocolHandlerID = static_cast<ProtocolHandlerId>(protocolHandlerId);
|
||||
}
|
||||
|
||||
void setPayload(const std::vector<unsigned char>& payload) {
|
||||
this->payload = payload;
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned char SOF = 0x0E;
|
||||
|
||||
/**
|
||||
* Incrementing from 0x00
|
||||
*/
|
||||
std::uint16_t sequenceID = 1;
|
||||
|
||||
/**
|
||||
* Destination sub-protocol handler ID
|
||||
*/
|
||||
ProtocolHandlerId protocolHandlerID = ProtocolHandlerId::AVR8_GENERIC;
|
||||
|
||||
std::vector<unsigned char> payload;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#include "EdbgInterface.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
|
||||
#include "src/TargetController/Exceptions/DeviceCommunicationFailure.hpp"
|
||||
|
||||
@@ -39,11 +39,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg
|
||||
|
||||
Protocols::CmsisDap::Edbg::Avr::AvrResponse getAvrResponse();
|
||||
|
||||
virtual std::vector<Protocols::CmsisDap::Edbg::Avr::AvrResponse> requestAvrResponses();
|
||||
|
||||
virtual std::optional<Protocols::CmsisDap::Edbg::Avr::AvrEvent> requestAvrEvent();
|
||||
|
||||
|
||||
template<class CommandFrameType>
|
||||
typename CommandFrameType::ResponseFrameType sendAvrCommandFrameAndWaitForResponseFrame(
|
||||
const CommandFrameType& avrCommandFrame
|
||||
@@ -72,5 +67,10 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg
|
||||
responseFrame.initFromAvrResponses(responses);
|
||||
return responseFrame;
|
||||
}
|
||||
|
||||
virtual std::optional<Protocols::CmsisDap::Edbg::Avr::AvrEvent> requestAvrEvent();
|
||||
|
||||
private:
|
||||
virtual std::vector<Protocols::CmsisDap::Edbg::Avr::AvrResponse> requestAvrResponses();
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user