Implemented programming mode functions in EdbgAvr8Interface implementation
This commit is contained in:
@@ -0,0 +1,22 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Avr8GenericCommandFrame.hpp"
|
||||||
|
|
||||||
|
namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames::Avr8Generic
|
||||||
|
{
|
||||||
|
class EnterProgrammingMode: public Avr8GenericCommandFrame<std::array<unsigned char, 2>>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
EnterProgrammingMode() {
|
||||||
|
/*
|
||||||
|
* The enter programming mode command consists of 2 bytes:
|
||||||
|
* 1. Command ID (0x15)
|
||||||
|
* 2. Version (0x00)
|
||||||
|
*/
|
||||||
|
this->payload = {
|
||||||
|
0x15,
|
||||||
|
0x00
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Avr8GenericCommandFrame.hpp"
|
||||||
|
|
||||||
|
namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames::Avr8Generic
|
||||||
|
{
|
||||||
|
class LeaveProgrammingMode: public Avr8GenericCommandFrame<std::array<unsigned char, 2>>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LeaveProgrammingMode() {
|
||||||
|
/*
|
||||||
|
* The leave programming mode command consists of 2 bytes:
|
||||||
|
* 1. Command ID (0x16)
|
||||||
|
* 2. Version (0x00)
|
||||||
|
*/
|
||||||
|
this->payload = {
|
||||||
|
0x16,
|
||||||
|
0x00
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -34,6 +34,8 @@
|
|||||||
#include "src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AVR8Generic/SetXmegaSoftwareBreakpoint.hpp"
|
#include "src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AVR8Generic/SetXmegaSoftwareBreakpoint.hpp"
|
||||||
#include "src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AVR8Generic/ClearAllSoftwareBreakpoints.hpp"
|
#include "src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AVR8Generic/ClearAllSoftwareBreakpoints.hpp"
|
||||||
#include "src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AVR8Generic/ClearSoftwareBreakpoints.hpp"
|
#include "src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AVR8Generic/ClearSoftwareBreakpoints.hpp"
|
||||||
|
#include "src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AVR8Generic/EnterProgrammingMode.hpp"
|
||||||
|
#include "src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AVR8Generic/LeaveProgrammingMode.hpp"
|
||||||
|
|
||||||
// AVR events
|
// AVR events
|
||||||
#include "src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/Events/AVR8Generic/BreakEvent.hpp"
|
#include "src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/Events/AVR8Generic/BreakEvent.hpp"
|
||||||
@@ -676,6 +678,26 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
|
|||||||
return this->targetState;
|
return this->targetState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EdbgAvr8Interface::enableProgrammingMode() {
|
||||||
|
auto response = this->edbgInterface.sendAvrCommandFrameAndWaitForResponseFrame(
|
||||||
|
CommandFrames::Avr8Generic::EnterProgrammingMode()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.getResponseId() == Avr8ResponseId::FAILED) {
|
||||||
|
throw Avr8CommandFailure("Failed to enter programming mode on EDBG debug tool", response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void EdbgAvr8Interface::disableProgrammingMode() {
|
||||||
|
auto response = this->edbgInterface.sendAvrCommandFrameAndWaitForResponseFrame(
|
||||||
|
CommandFrames::Avr8Generic::LeaveProgrammingMode()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.getResponseId() == Avr8ResponseId::FAILED) {
|
||||||
|
throw Avr8CommandFailure("Failed to leave programming mode on EDBG debug tool", response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void EdbgAvr8Interface::setParameter(const Avr8EdbgParameter& parameter, const std::vector<unsigned char>& value) {
|
void EdbgAvr8Interface::setParameter(const Avr8EdbgParameter& parameter, const std::vector<unsigned char>& value) {
|
||||||
auto commandFrame = CommandFrames::Avr8Generic::SetParameter(parameter, value);
|
auto commandFrame = CommandFrames::Avr8Generic::SetParameter(parameter, value);
|
||||||
|
|
||||||
|
|||||||
@@ -250,6 +250,16 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
|
|||||||
*/
|
*/
|
||||||
Targets::TargetState getTargetState() override;
|
Targets::TargetState getTargetState() override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enters programming mode on the EDBG debug tool.
|
||||||
|
*/
|
||||||
|
void enableProgrammingMode() override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Leaves programming mode on the EDBG debug tool.
|
||||||
|
*/
|
||||||
|
void disableProgrammingMode() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* The AVR8 Generic protocol is a sub-protocol of the EDBG AVR protocol, which is served via CMSIS-DAP vendor
|
* The AVR8 Generic protocol is a sub-protocol of the EDBG AVR protocol, which is served via CMSIS-DAP vendor
|
||||||
|
|||||||
Reference in New Issue
Block a user