- Refactored AVR8 constructor, moving TDF construction to the TargetControllerComponent
- The `TargetControllerComponent` now resolves the target via the new generated mapping approach - Added `TargetDescriptionFile` derived class - Removed obsolete JSON map processing code - Other bits of refactoring and tidying
This commit is contained in:
@@ -27,8 +27,11 @@ namespace Targets::RiscV
|
||||
using DebugModule::Registers::AbstractControlStatusRegister;
|
||||
using DebugModule::Registers::AbstractCommandRegister;
|
||||
|
||||
RiscV::RiscV(const TargetConfig& targetConfig)
|
||||
: name("CH32X035C8T6") // TODO: TDF
|
||||
RiscV::RiscV(
|
||||
const TargetConfig& targetConfig,
|
||||
TargetDescription::TargetDescriptionFile&& targetDescriptionFile
|
||||
)
|
||||
: targetDescriptionFile(targetDescriptionFile)
|
||||
, stackPointerRegisterDescriptor(
|
||||
RiscVRegisterDescriptor(
|
||||
TargetRegisterType::STACK_POINTER,
|
||||
@@ -107,10 +110,10 @@ namespace Targets::RiscV
|
||||
|
||||
TargetDescriptor RiscV::getDescriptor() {
|
||||
return TargetDescriptor(
|
||||
"TDF ID",
|
||||
this->targetDescriptionFile.getTargetId(),
|
||||
TargetFamily::RISC_V,
|
||||
this->name,
|
||||
"TDF VENDOR NAME",
|
||||
this->targetDescriptionFile.getTargetName(),
|
||||
this->targetDescriptionFile.getVendorName(),
|
||||
{
|
||||
{
|
||||
Targets::TargetMemoryType::FLASH,
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include "src/Targets/Target.hpp"
|
||||
#include "src/DebugToolDrivers/DebugTool.hpp"
|
||||
|
||||
#include "TargetDescription/TargetDescriptionFile.hpp"
|
||||
|
||||
#include "src/DebugToolDrivers/TargetInterfaces/RiscV/RiscVDebugInterface.hpp"
|
||||
#include "src/DebugToolDrivers/TargetInterfaces/RiscV/RiscVProgramInterface.hpp"
|
||||
|
||||
@@ -27,7 +29,10 @@ namespace Targets::RiscV
|
||||
class RiscV: public Target
|
||||
{
|
||||
public:
|
||||
explicit RiscV(const TargetConfig& targetConfig);
|
||||
explicit RiscV(
|
||||
const TargetConfig& targetConfig,
|
||||
TargetDescription::TargetDescriptionFile&& targetDescriptionFile
|
||||
);
|
||||
|
||||
/*
|
||||
* The functions below implement the Target interface for RISC-V targets.
|
||||
@@ -99,7 +104,8 @@ namespace Targets::RiscV
|
||||
bool programmingModeEnabled() override;
|
||||
|
||||
protected:
|
||||
std::string name;
|
||||
TargetDescription::TargetDescriptionFile targetDescriptionFile;
|
||||
|
||||
std::map<TargetRegisterDescriptorId, RiscVRegisterDescriptor> registerDescriptorsById;
|
||||
|
||||
RiscVRegisterDescriptor stackPointerRegisterDescriptor;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#include "TargetDescriptionFile.hpp"
|
||||
|
||||
#include <QString>
|
||||
|
||||
namespace Targets::RiscV::TargetDescription
|
||||
{
|
||||
TargetDescriptionFile::TargetDescriptionFile(const std::string& xmlFilePath)
|
||||
: Targets::TargetDescription::TargetDescriptionFile(xmlFilePath)
|
||||
{}
|
||||
|
||||
std::string TargetDescriptionFile::getTargetId() const {
|
||||
return this->deviceAttribute("id");
|
||||
}
|
||||
|
||||
std::string TargetDescriptionFile::getVendorName() const {
|
||||
return this->deviceAttribute("vendor");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include "src/Targets/TargetDescription/TargetDescriptionFile.hpp"
|
||||
|
||||
#include "src/Targets/RiscV/RiscVGeneric.hpp"
|
||||
|
||||
namespace Targets::RiscV::TargetDescription
|
||||
{
|
||||
/**
|
||||
* Represents an RISC-V TDF.
|
||||
*
|
||||
* For more information of TDFs, see src/Targets/TargetDescription/README.md
|
||||
*/
|
||||
class TargetDescriptionFile: public Targets::TargetDescription::TargetDescriptionFile
|
||||
{
|
||||
public:
|
||||
explicit TargetDescriptionFile(const std::string& xmlFilePath);
|
||||
|
||||
/**
|
||||
* Returns the RISC-V target ID from the TDF.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
[[nodiscard]] std::string getTargetId() const;
|
||||
|
||||
/**
|
||||
* Returns the RISC-V vendor name from the TDF.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
[[nodiscard]] std::string getVendorName() const;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user