2021-04-04 21:04:12 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
2022-02-15 13:14:03 +00:00
|
|
|
#include "TargetInterfaces/Microchip/AVR/AVR8/Avr8DebugInterface.hpp"
|
2021-04-04 21:04:12 +01:00
|
|
|
|
|
|
|
|
namespace Bloom
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* A debug tool can be any device that provides access to the connected target. Debug tools are usually connected
|
|
|
|
|
* to the host machine via USB.
|
|
|
|
|
*
|
|
|
|
|
* 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.
|
2022-02-15 13:14:03 +00:00
|
|
|
* For an example, see the Avr8DebugInterface class and DebugTool::getAvr8DebugInterface(), for the family of AVR
|
|
|
|
|
* 8-bit targets.
|
2021-04-04 21:04:12 +01:00
|
|
|
*/
|
|
|
|
|
class DebugTool
|
|
|
|
|
{
|
|
|
|
|
public:
|
2022-01-11 21:12:25 +00:00
|
|
|
DebugTool() = default;
|
2021-10-06 21:12:31 +01:00
|
|
|
virtual ~DebugTool() = default;
|
2021-04-04 21:04:12 +01:00
|
|
|
|
2022-01-11 21:12:25 +00:00
|
|
|
DebugTool(const DebugTool& other) = default;
|
|
|
|
|
DebugTool(DebugTool&& other) = default;
|
|
|
|
|
|
|
|
|
|
DebugTool& operator = (const DebugTool& other) = default;
|
|
|
|
|
DebugTool& operator = (DebugTool&& other) = default;
|
|
|
|
|
|
2021-04-12 19:43:42 +01:00
|
|
|
/**
|
|
|
|
|
* Should establish a connection to the device and prepare it for a debug session.
|
|
|
|
|
*/
|
2021-04-04 21:04:12 +01:00
|
|
|
virtual void init() = 0;
|
|
|
|
|
|
2021-04-12 19:43:42 +01:00
|
|
|
/**
|
|
|
|
|
* Should disconnect from the device after performing any tasks required to formally end the debug session.
|
|
|
|
|
*/
|
2021-04-04 21:04:12 +01:00
|
|
|
virtual void close() = 0;
|
|
|
|
|
|
|
|
|
|
virtual std::string getName() = 0;
|
|
|
|
|
|
|
|
|
|
virtual std::string getSerialNumber() = 0;
|
|
|
|
|
|
|
|
|
|
/**
|
2022-02-15 13:14:03 +00:00
|
|
|
* All debug tools that support debugging operations on AVR8 targets must provide an implementation of
|
|
|
|
|
* the Avr8DebugInterface class, via this function.
|
2021-04-04 21:04:12 +01:00
|
|
|
*
|
2022-02-15 13:14:03 +00:00
|
|
|
* For debug tools that do not support debugging on AVR8 targets, this function should return a nullptr.
|
2021-04-04 21:04:12 +01:00
|
|
|
*
|
2022-02-15 13:14:03 +00:00
|
|
|
* Note: the caller of this function will not manage the lifetime of the returned Avr8DebugInterface instance.
|
2021-04-12 19:43:42 +01:00
|
|
|
*
|
2021-04-04 21:04:12 +01:00
|
|
|
* @return
|
|
|
|
|
*/
|
2022-02-15 13:14:03 +00:00
|
|
|
virtual DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8::Avr8DebugInterface* getAvr8DebugInterface() {
|
2021-04-04 21:04:12 +01:00
|
|
|
return nullptr;
|
|
|
|
|
};
|
|
|
|
|
|
2021-10-06 21:12:31 +01:00
|
|
|
[[nodiscard]] bool isInitialised() const {
|
|
|
|
|
return this->initialised;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void setInitialised(bool initialised) {
|
|
|
|
|
this->initialised = initialised;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
bool initialised = false;
|
2021-04-04 21:04:12 +01:00
|
|
|
};
|
|
|
|
|
}
|