Added TargetFamily to TargetDescriptor and comparability check in AVR GDB debug server
This commit is contained in:
@@ -14,6 +14,7 @@ namespace DebugServer
|
|||||||
|
|
||||||
DebugServerComponent::DebugServerComponent(const DebugServerConfig& debugServerConfig)
|
DebugServerComponent::DebugServerComponent(const DebugServerConfig& debugServerConfig)
|
||||||
: debugServerConfig(debugServerConfig)
|
: debugServerConfig(debugServerConfig)
|
||||||
|
, targetDescriptor((Services::TargetControllerService()).getTargetDescriptor())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void DebugServerComponent::run() {
|
void DebugServerComponent::run() {
|
||||||
@@ -42,8 +43,13 @@ namespace DebugServer
|
|||||||
{
|
{
|
||||||
"avr-gdb-rsp",
|
"avr-gdb-rsp",
|
||||||
[this] () -> std::unique_ptr<ServerInterface> {
|
[this] () -> std::unique_ptr<ServerInterface> {
|
||||||
|
if (this->targetDescriptor.family != Targets::TargetFamily::AVR8) {
|
||||||
|
throw Exceptions::Exception("The AVR GDB RSP server is only compatible with AVR8 targets.");
|
||||||
|
}
|
||||||
|
|
||||||
return std::make_unique<DebugServer::Gdb::AvrGdb::AvrGdbRsp>(
|
return std::make_unique<DebugServer::Gdb::AvrGdb::AvrGdbRsp>(
|
||||||
this->debugServerConfig,
|
this->debugServerConfig,
|
||||||
|
this->targetDescriptor,
|
||||||
*(this->eventListener.get()),
|
*(this->eventListener.get()),
|
||||||
this->interruptEventNotifier
|
this->interruptEventNotifier
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -7,12 +7,16 @@
|
|||||||
|
|
||||||
#include "src/Helpers/Thread.hpp"
|
#include "src/Helpers/Thread.hpp"
|
||||||
#include "src/ProjectConfig.hpp"
|
#include "src/ProjectConfig.hpp"
|
||||||
|
|
||||||
#include "src/Helpers/EventFdNotifier.hpp"
|
#include "src/Helpers/EventFdNotifier.hpp"
|
||||||
#include "src/EventManager/EventListener.hpp"
|
#include "src/EventManager/EventListener.hpp"
|
||||||
#include "src/EventManager/Events/Events.hpp"
|
#include "src/EventManager/Events/Events.hpp"
|
||||||
|
|
||||||
#include "ServerInterface.hpp"
|
#include "ServerInterface.hpp"
|
||||||
|
|
||||||
|
#include "src/Services/TargetControllerService.hpp"
|
||||||
|
#include "src/Targets/TargetDescriptor.hpp"
|
||||||
|
|
||||||
namespace DebugServer
|
namespace DebugServer
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -47,6 +51,11 @@ namespace DebugServer
|
|||||||
*/
|
*/
|
||||||
DebugServerConfig debugServerConfig;
|
DebugServerConfig debugServerConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current target descriptor.
|
||||||
|
*/
|
||||||
|
Targets::TargetDescriptor targetDescriptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This EventFdNotifier is injected into this->eventListener. It can be used by server implementations to
|
* This EventFdNotifier is injected into this->eventListener. It can be used by server implementations to
|
||||||
* interrupt blocking I/O calls upon an event being triggered. For more, see the "Servicing events" section in
|
* interrupt blocking I/O calls upon an event being triggered. For more, see the "Servicing events" section in
|
||||||
|
|||||||
@@ -26,11 +26,12 @@ namespace DebugServer::Gdb::AvrGdb
|
|||||||
|
|
||||||
AvrGdbRsp::AvrGdbRsp(
|
AvrGdbRsp::AvrGdbRsp(
|
||||||
const DebugServerConfig& debugServerConfig,
|
const DebugServerConfig& debugServerConfig,
|
||||||
|
const Targets::TargetDescriptor& targetDescriptor,
|
||||||
EventListener& eventListener,
|
EventListener& eventListener,
|
||||||
EventFdNotifier& eventNotifier
|
EventFdNotifier& eventNotifier
|
||||||
)
|
)
|
||||||
: GdbRspDebugServer(debugServerConfig, eventListener, eventNotifier)
|
: GdbRspDebugServer(debugServerConfig, eventListener, eventNotifier)
|
||||||
, gdbTargetDescriptor(TargetDescriptor(this->targetControllerService.getTargetDescriptor()))
|
, gdbTargetDescriptor(targetDescriptor)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
DebugSession* AvrGdbRsp::startDebugSession(Connection&& connection) {
|
DebugSession* AvrGdbRsp::startDebugSession(Connection&& connection) {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ namespace DebugServer::Gdb::AvrGdb
|
|||||||
public:
|
public:
|
||||||
AvrGdbRsp(
|
AvrGdbRsp(
|
||||||
const DebugServerConfig& debugServerConfig,
|
const DebugServerConfig& debugServerConfig,
|
||||||
|
const Targets::TargetDescriptor& targetDescriptor,
|
||||||
EventListener& eventListener,
|
EventListener& eventListener,
|
||||||
EventFdNotifier& eventNotifier
|
EventFdNotifier& eventNotifier
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -268,6 +268,7 @@ namespace Targets::Microchip::Avr::Avr8Bit
|
|||||||
TargetDescriptor Avr8::getDescriptor() {
|
TargetDescriptor Avr8::getDescriptor() {
|
||||||
auto descriptor = TargetDescriptor(
|
auto descriptor = TargetDescriptor(
|
||||||
this->signature.toHex(),
|
this->signature.toHex(),
|
||||||
|
TargetFamily::AVR8,
|
||||||
this->name,
|
this->name,
|
||||||
"Microchip",
|
"Microchip",
|
||||||
this->targetMemoryDescriptorsByType,
|
this->targetMemoryDescriptorsByType,
|
||||||
|
|||||||
@@ -14,10 +14,17 @@
|
|||||||
|
|
||||||
namespace Targets
|
namespace Targets
|
||||||
{
|
{
|
||||||
|
enum class TargetFamily: std::uint8_t
|
||||||
|
{
|
||||||
|
AVR8,
|
||||||
|
RISC_V,
|
||||||
|
};
|
||||||
|
|
||||||
struct TargetDescriptor
|
struct TargetDescriptor
|
||||||
{
|
{
|
||||||
std::string name;
|
|
||||||
std::string id;
|
std::string id;
|
||||||
|
TargetFamily family;
|
||||||
|
std::string name;
|
||||||
std::string vendorName;
|
std::string vendorName;
|
||||||
std::map<TargetMemoryType, TargetMemoryDescriptor> memoryDescriptorsByType;
|
std::map<TargetMemoryType, TargetMemoryDescriptor> memoryDescriptorsByType;
|
||||||
std::map<TargetRegisterDescriptorId, TargetRegisterDescriptor> registerDescriptorsById;
|
std::map<TargetRegisterDescriptorId, TargetRegisterDescriptor> registerDescriptorsById;
|
||||||
@@ -28,6 +35,7 @@ namespace Targets
|
|||||||
|
|
||||||
TargetDescriptor(
|
TargetDescriptor(
|
||||||
const std::string& id,
|
const std::string& id,
|
||||||
|
TargetFamily family,
|
||||||
const std::string& name,
|
const std::string& name,
|
||||||
const std::string& vendorName,
|
const std::string& vendorName,
|
||||||
const std::map<TargetMemoryType, TargetMemoryDescriptor>& memoryDescriptorsByType,
|
const std::map<TargetMemoryType, TargetMemoryDescriptor>& memoryDescriptorsByType,
|
||||||
@@ -36,8 +44,9 @@ namespace Targets
|
|||||||
const std::vector<TargetVariant>& variants,
|
const std::vector<TargetVariant>& variants,
|
||||||
TargetMemoryType programMemoryType
|
TargetMemoryType programMemoryType
|
||||||
)
|
)
|
||||||
: name(name)
|
: id(id)
|
||||||
, id(id)
|
, family(family)
|
||||||
|
, name(name)
|
||||||
, vendorName(vendorName)
|
, vendorName(vendorName)
|
||||||
, memoryDescriptorsByType(memoryDescriptorsByType)
|
, memoryDescriptorsByType(memoryDescriptorsByType)
|
||||||
, registerDescriptorsById(registerDescriptorsById)
|
, registerDescriptorsById(registerDescriptorsById)
|
||||||
|
|||||||
Reference in New Issue
Block a user