Renamed Avr8Interface class to Avr8DebugInterface, in preparation for an AVR8 programming interface class

This commit is contained in:
Nav
2022-02-15 13:14:03 +00:00
parent d88e545496
commit f28ec0f162
14 changed files with 64 additions and 62 deletions

View File

@@ -1,6 +1,6 @@
#pragma once
#include "TargetInterfaces/Microchip/AVR/AVR8/Avr8Interface.hpp"
#include "TargetInterfaces/Microchip/AVR/AVR8/Avr8DebugInterface.hpp"
namespace Bloom
{
@@ -10,7 +10,8 @@ namespace Bloom
*
* Each debug tool must implement this interface. Note that target specific driver code should not be placed here.
* Each target family will expect the debug tool to provide an interface for that particular group of targets.
* For an example, see the Avr8Interface class and the DebugTool::getAvr8Interface().
* For an example, see the Avr8DebugInterface class and DebugTool::getAvr8DebugInterface(), for the family of AVR
* 8-bit targets.
*/
class DebugTool
{
@@ -39,16 +40,16 @@ namespace Bloom
virtual std::string getSerialNumber() = 0;
/**
* All debug tools that support AVR8 targets must provide an implementation of the Avr8Interface
* class, via this method.
* All debug tools that support debugging operations on AVR8 targets must provide an implementation of
* the Avr8DebugInterface class, via this function.
*
* For debug tools that do not support AVR8 targets, this method should return a nullptr.
* For debug tools that do not support debugging on AVR8 targets, this function should return a nullptr.
*
* Note: the caller of this method will not manage the lifetime of the returned Avr8Interface instance.
* Note: the caller of this function will not manage the lifetime of the returned Avr8DebugInterface instance.
*
* @return
*/
virtual DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8::Avr8Interface* getAvr8Interface() {
virtual DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8::Avr8DebugInterface* getAvr8DebugInterface() {
return nullptr;
};

View File

@@ -54,7 +54,7 @@ namespace Bloom::DebugToolDrivers
return this->edbgInterface;
}
TargetInterfaces::Microchip::Avr::Avr8::Avr8Interface* getAvr8Interface() override {
TargetInterfaces::Microchip::Avr::Avr8::Avr8DebugInterface* getAvr8DebugInterface() override {
return this->edbgAvr8Interface.get();
}

View File

@@ -40,7 +40,7 @@ namespace Bloom::DebugToolDrivers
return this->edbgInterface;
}
TargetInterfaces::Microchip::Avr::Avr8::Avr8Interface* getAvr8Interface() override {
TargetInterfaces::Microchip::Avr::Avr8::Avr8DebugInterface* getAvr8DebugInterface() override {
return this->edbgAvr8Interface.get();
}

View File

@@ -42,7 +42,7 @@ namespace Bloom::DebugToolDrivers
return this->edbgInterface;
}
TargetInterfaces::Microchip::Avr::Avr8::Avr8Interface* getAvr8Interface() override {
TargetInterfaces::Microchip::Avr::Avr8::Avr8DebugInterface* getAvr8DebugInterface() override {
return this->edbgAvr8Interface.get();
}

View File

@@ -48,7 +48,7 @@ namespace Bloom::DebugToolDrivers
return this->edbgInterface;
}
TargetInterfaces::Microchip::Avr::Avr8::Avr8Interface* getAvr8Interface() override {
TargetInterfaces::Microchip::Avr::Avr8::Avr8DebugInterface* getAvr8DebugInterface() override {
return this->edbgAvr8Interface.get();
}

View File

@@ -41,7 +41,7 @@ namespace Bloom::DebugToolDrivers
return this->edbgInterface;
}
TargetInterfaces::Microchip::Avr::Avr8::Avr8Interface* getAvr8Interface() override {
TargetInterfaces::Microchip::Avr::Avr8::Avr8DebugInterface* getAvr8DebugInterface() override {
return this->edbgAvr8Interface.get();
}

View File

@@ -40,7 +40,7 @@ namespace Bloom::DebugToolDrivers
return this->edbgInterface;
}
TargetInterfaces::Microchip::Avr::Avr8::Avr8Interface* getAvr8Interface() override {
TargetInterfaces::Microchip::Avr::Avr8::Avr8DebugInterface* getAvr8DebugInterface() override {
return this->edbgAvr8Interface.get();
}

View File

@@ -40,7 +40,7 @@ namespace Bloom::DebugToolDrivers
return this->edbgInterface;
}
TargetInterfaces::Microchip::Avr::Avr8::Avr8Interface* getAvr8Interface() override {
TargetInterfaces::Microchip::Avr::Avr8::Avr8DebugInterface* getAvr8DebugInterface() override {
return this->edbgAvr8Interface.get();
}

View File

@@ -40,7 +40,7 @@ namespace Bloom::DebugToolDrivers
return this->edbgInterface;
}
TargetInterfaces::Microchip::Avr::Avr8::Avr8Interface* getAvr8Interface() override {
TargetInterfaces::Microchip::Avr::Avr8::Avr8DebugInterface* getAvr8DebugInterface() override {
return this->edbgAvr8Interface.get();
}

View File

@@ -5,7 +5,7 @@
#include <thread>
#include <cassert>
#include "src/DebugToolDrivers/TargetInterfaces/Microchip/AVR/AVR8/Avr8Interface.hpp"
#include "src/DebugToolDrivers/TargetInterfaces/Microchip/AVR/AVR8/Avr8DebugInterface.hpp"
#include "src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/Avr8Generic.hpp"
#include "src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/EdbgInterface.hpp"
#include "src/Targets/Microchip/AVR/Target.hpp"
@@ -15,15 +15,15 @@
namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
{
/**
* The EdbgAvr8Interface implements the AVR8 Generic EDBG/CMSIS-DAP protocol, as an Avr8Interface.
* The EdbgAvr8Interface implements the AVR8 Generic EDBG/CMSIS-DAP protocol, as an Avr8DebugInterface.
*
* See the "AVR8 Generic Protocol" section in the DS50002630A document by Microchip, for more information on the
* protocol.
*
* This implementation should work with any Microchip EDBG based CMSIS-DAP debug tool (such as the Atmel-ICE,
* Power Debugger and the MPLAB SNAP debugger (in "AVR mode")).
* This implementation should work with any Microchip EDBG-based CMSIS-DAP debug tool (such as the Atmel-ICE,
* Power Debugger, the MPLAB SNAP debugger (in "AVR mode"), etc).
*/
class EdbgAvr8Interface: public TargetInterfaces::Microchip::Avr::Avr8::Avr8Interface
class EdbgAvr8Interface: public TargetInterfaces::Microchip::Avr::Avr8::Avr8DebugInterface
{
public:
explicit EdbgAvr8Interface(EdbgInterface& edbgInterface)

View File

@@ -14,26 +14,27 @@
namespace Bloom::DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8
{
/**
* Interfacing with an AVR8 target can vary significantly, depending on the debug tool being used.
* Interfacing with an AVR8 target for debugging operations can vary significantly, depending on the debug tool
* being used. Some debug tools employ different protocols.
*
* This class describes the interface required for interfacing with AVR8 targets.
* This class describes the interface required for interfacing with AVR8 targets, for debugging operations.
*
* Each debug tool that supports interfacing with AVR8 targets must provide an implementation
* of this interface class. For example, the Atmel-ICE provides the EdbgAvr8Interface implementation for
* interfacing with AVR8 targets. See Bloom::DebugToolDrivers::AtmelIce::getAvr8Interface() and
* Bloom::DebugTool::getAvr8Interface() for more on this.
* interfacing with AVR8 targets. See Bloom::DebugToolDrivers::AtmelIce::getAvr8DebugInterface() and
* Bloom::DebugTool::getAvr8DebugInterface() for more on this.
*/
class Avr8Interface
class Avr8DebugInterface
{
public:
Avr8Interface() = default;
virtual ~Avr8Interface() = default;
Avr8DebugInterface() = default;
virtual ~Avr8DebugInterface() = default;
Avr8Interface(const Avr8Interface& other) = default;
Avr8Interface(Avr8Interface&& other) = default;
Avr8DebugInterface(const Avr8DebugInterface& other) = default;
Avr8DebugInterface(Avr8DebugInterface&& other) = default;
Avr8Interface& operator = (const Avr8Interface& other) = default;
Avr8Interface& operator = (Avr8Interface&& other) = default;
Avr8DebugInterface& operator = (const Avr8DebugInterface& other) = default;
Avr8DebugInterface& operator = (Avr8DebugInterface&& other) = default;
/**
* Configures the interface. Any debug tool -> target interface specific configuration should take

View File

@@ -26,10 +26,10 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
Target::preActivationConfigure(targetConfig);
if (this->family.has_value()) {
this->avr8Interface->setFamily(this->family.value());
this->avr8DebugInterface->setFamily(this->family.value());
}
this->avr8Interface->configure(targetConfig);
this->avr8DebugInterface->configure(targetConfig);
}
void Avr8::postActivationConfigure() {
@@ -45,7 +45,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
* file (which it would, if the user specified the exact target name in their project config - see
* Avr8::getId() and TargetController::getSupportedTargets() for more).
*/
auto targetSignature = this->avr8Interface->getDeviceId();
auto targetSignature = this->avr8DebugInterface->getDeviceId();
auto tdSignature = this->targetDescriptionFile->getTargetSignature();
if (targetSignature != tdSignature) {
@@ -63,8 +63,8 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
throw Exception("Failed to resolve AVR8 family");
}
this->avr8Interface->setFamily(this->family.value());
this->avr8Interface->setTargetParameters(this->targetParameters.value());
this->avr8DebugInterface->setFamily(this->family.value());
this->avr8DebugInterface->setTargetParameters(this->targetParameters.value());
}
void Avr8::activate() {
@@ -72,19 +72,19 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
return;
}
this->avr8Interface->init();
this->avr8DebugInterface->init();
if (this->targetDescriptionFile.has_value()) {
this->avr8Interface->setTargetParameters(this->targetParameters.value());
this->avr8DebugInterface->setTargetParameters(this->targetParameters.value());
}
this->avr8Interface->activate();
this->avr8DebugInterface->activate();
this->activated = true;
}
void Avr8::deactivate() {
try {
this->avr8Interface->deactivate();
this->avr8DebugInterface->deactivate();
this->activated = false;
} catch (const Exception& exception) {
@@ -142,31 +142,31 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
}
void Avr8::run() {
this->avr8Interface->run();
this->avr8DebugInterface->run();
}
void Avr8::stop() {
this->avr8Interface->stop();
this->avr8DebugInterface->stop();
}
void Avr8::step() {
this->avr8Interface->step();
this->avr8DebugInterface->step();
}
void Avr8::reset() {
this->avr8Interface->reset();
this->avr8DebugInterface->reset();
}
void Avr8::setBreakpoint(std::uint32_t address) {
this->avr8Interface->setBreakpoint(address);
this->avr8DebugInterface->setBreakpoint(address);
}
void Avr8::removeBreakpoint(std::uint32_t address) {
this->avr8Interface->clearBreakpoint(address);
this->avr8DebugInterface->clearBreakpoint(address);
}
void Avr8::clearAllBreakpoints() {
this->avr8Interface->clearAllBreakpoints();
this->avr8DebugInterface->clearAllBreakpoints();
}
void Avr8::writeRegisters(TargetRegisters registers) {
@@ -194,7 +194,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
}
if (!registers.empty()) {
this->avr8Interface->writeRegisters(registers);
this->avr8DebugInterface->writeRegisters(registers);
}
}
@@ -215,7 +215,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
}
if (!descriptors.empty()) {
auto otherRegisters = this->avr8Interface->readRegisters(descriptors);
auto otherRegisters = this->avr8DebugInterface->readRegisters(descriptors);
registers.insert(registers.end(), otherRegisters.begin(), otherRegisters.end());
}
@@ -228,19 +228,19 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
std::uint32_t bytes,
const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges
) {
return this->avr8Interface->readMemory(memoryType, startAddress, bytes, excludedAddressRanges);
return this->avr8DebugInterface->readMemory(memoryType, startAddress, bytes, excludedAddressRanges);
}
void Avr8::writeMemory(TargetMemoryType memoryType, std::uint32_t startAddress, const TargetMemoryBuffer& buffer) {
this->avr8Interface->writeMemory(memoryType, startAddress, buffer);
this->avr8DebugInterface->writeMemory(memoryType, startAddress, buffer);
}
TargetState Avr8::getState() {
return this->avr8Interface->getTargetState();
return this->avr8DebugInterface->getTargetState();
}
std::uint32_t Avr8::getProgramCounter() {
return this->avr8Interface->getProgramCounter();
return this->avr8DebugInterface->getProgramCounter();
}
TargetRegister Avr8::getProgramCounterRegister() {
@@ -255,7 +255,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
}
void Avr8::setProgramCounter(std::uint32_t programCounter) {
this->avr8Interface->setProgramCounter(programCounter);
this->avr8DebugInterface->setProgramCounter(programCounter);
}
std::uint32_t Avr8::getStackPointer() {
@@ -614,7 +614,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
TargetSignature Avr8::getId() {
if (!this->id.has_value()) {
this->id = this->avr8Interface->getDeviceId();
this->id = this->avr8DebugInterface->getDeviceId();
}
return this->id.value();

View File

@@ -4,7 +4,7 @@
#include <queue>
#include <utility>
#include "src/DebugToolDrivers/TargetInterfaces/Microchip/AVR/AVR8/Avr8Interface.hpp"
#include "src/DebugToolDrivers/TargetInterfaces/Microchip/AVR/AVR8/Avr8DebugInterface.hpp"
#include "src/Targets/Microchip/AVR/Target.hpp"
#include "src/Targets/TargetRegister.hpp"
#include "src/DebugToolDrivers/DebugTool.hpp"
@@ -50,11 +50,11 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
* @return
*/
bool isDebugToolSupported(DebugTool* debugTool) override {
return debugTool->getAvr8Interface() != nullptr;
return debugTool->getAvr8DebugInterface() != nullptr;
}
void setDebugTool(DebugTool* debugTool) override {
this->avr8Interface = debugTool->getAvr8Interface();
this->avr8DebugInterface = debugTool->getAvr8DebugInterface();
};
/**
@@ -119,7 +119,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
) override;
protected:
DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8::Avr8Interface* avr8Interface = nullptr;
DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8::Avr8DebugInterface* avr8DebugInterface = nullptr;
std::string name;
std::optional<Family> family;
std::optional<TargetDescription::TargetDescriptionFile> targetDescriptionFile;

View File

@@ -96,9 +96,9 @@ namespace Bloom::Targets
* prevent Bloom from attempting to use the selected debug tool with the selected target. An InvalidConfig
* exception will be raised and Bloom will shutdown.
*
* For AVR8 targets, we simply check if the debug tool returns a valid Avr8Interface
* (via DebugTool::getAvr8Interface()). If it fails to do so, it would mean that the debug tool, or more so our
* debug tool driver, does not support AVR8 targets.
* For AVR8 targets, we simply check if the debug tool returns a valid Avr8DebugInterface
* (via DebugTool::getAvr8DebugInterface()). If it fails to do so, it would mean that the debug tool, or more
* so our debug tool driver, does not support AVR8 targets.
*
* @param debugTool
*