Removed all using declarations and directives from header files

This commit is contained in:
Nav
2021-05-24 20:58:49 +01:00
parent d39ca609bc
commit ce480a996c
96 changed files with 415 additions and 473 deletions

View File

@@ -4,8 +4,6 @@
namespace Bloom
{
using DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8::Avr8Interface;
/**
* 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.
@@ -53,7 +51,7 @@ namespace Bloom
*
* @return
*/
virtual Avr8Interface* getAvr8Interface() {
virtual DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8::Avr8Interface* getAvr8Interface() {
return nullptr;
};

View File

@@ -14,10 +14,6 @@
namespace Bloom::DebugToolDrivers
{
using namespace Protocols::CmsisDap;
using Protocols::CmsisDap::Edbg::EdbgInterface;
using Protocols::CmsisDap::Edbg::Avr::EdbgAvr8Interface;
/**
* The Atmel-ICE device is an EDBG (Embedded Debugger) device. It implements the CMSIS-DAP layer as well
* as an Atmel Data Gateway Interface (DGI).
@@ -53,13 +49,13 @@ namespace Bloom::DebugToolDrivers
* Any non-EDBG CMSIS-DAP commands for the Atmel-ICE can be sent through the EdbgInterface (as the
* EdbgInterface extends the CmsisDapInterface).
*/
EdbgInterface edbgInterface = EdbgInterface();
Protocols::CmsisDap::Edbg::EdbgInterface edbgInterface = Protocols::CmsisDap::Edbg::EdbgInterface();
/**
* The Atmel-ICE employs the EDBG AVR8 Generic protocol, for debugging AVR8 targets. This protocol is
* implemented in EdbgAvr8Interface. See the EdbgAvr8Interface class for more information.
*/
std::unique_ptr<EdbgAvr8Interface> edbgAvr8Interface = nullptr;
std::unique_ptr<Protocols::CmsisDap::Edbg::Avr::EdbgAvr8Interface> edbgAvr8Interface = nullptr;
bool sessionStarted = false;
@@ -70,13 +66,15 @@ namespace Bloom::DebugToolDrivers
AtmelIce(): UsbDevice(AtmelIce::USB_VENDOR_ID, AtmelIce::USB_PRODUCT_ID) {}
void init() override;
void close() override;
EdbgInterface& getEdbgInterface() {
Protocols::CmsisDap::Edbg::EdbgInterface& getEdbgInterface() {
return this->edbgInterface;
}
Avr8Interface* getAvr8Interface() override {
TargetInterfaces::Microchip::Avr::Avr8::Avr8Interface* getAvr8Interface() override {
return this->edbgAvr8Interface.get();
}

View File

@@ -14,10 +14,6 @@
namespace Bloom::DebugToolDrivers
{
using namespace Protocols::CmsisDap;
using Protocols::CmsisDap::Edbg::EdbgInterface;
using Protocols::CmsisDap::Edbg::Avr::EdbgAvr8Interface;
/**
* The MPLAB Snap device is a hybrid device - that is, it can present itself as an "MPLAB Snap ICD" device, as well
* as an EDBG (Embedded Debugger) device. The device switches between these two modes via a firmware update, issued
@@ -39,13 +35,13 @@ namespace Bloom::DebugToolDrivers
class MplabSnap: public DebugTool, public Usb::UsbDevice
{
private:
EdbgInterface edbgInterface = EdbgInterface();
Protocols::CmsisDap::Edbg::EdbgInterface edbgInterface = Protocols::CmsisDap::Edbg::EdbgInterface();
/**
* The MPLAB Snap employs the EDBG AVR8 Generic protocol, for debugging AVR8 targets. This protocol is
* implemented in EdbgAvr8Interface. See the EdbgAvr8Interface class for more information.
*/
std::unique_ptr<EdbgAvr8Interface> edbgAvr8Interface = nullptr;
std::unique_ptr<Protocols::CmsisDap::Edbg::Avr::EdbgAvr8Interface> edbgAvr8Interface = nullptr;
bool sessionStarted = false;
@@ -56,13 +52,15 @@ namespace Bloom::DebugToolDrivers
MplabSnap(): UsbDevice(MplabSnap::USB_VENDOR_ID, MplabSnap::USB_PRODUCT_ID) {}
void init() override;
void close() override;
EdbgInterface& getEdbgInterface() {
Protocols::CmsisDap::Edbg::EdbgInterface& getEdbgInterface() {
return this->edbgInterface;
}
Avr8Interface* getAvr8Interface() override {
TargetInterfaces::Microchip::Avr::Avr8::Avr8Interface* getAvr8Interface() override {
return this->edbgAvr8Interface.get();
}

View File

@@ -2,9 +2,11 @@
#include "src/Exceptions/Exception.hpp"
using namespace Bloom::DebugToolDrivers;
using namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr;
using namespace Protocols::CmsisDap::Edbg::Avr;
using namespace Bloom::Exceptions;
using Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::EdbgAvr8Interface;
void PowerDebugger::init() {
UsbDevice::init();
@@ -48,10 +50,10 @@ void PowerDebugger::close() {
std::string PowerDebugger::getSerialNumber() {
auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame(
CommandFrames::Discovery::Query(Discovery::QueryContext::SERIAL_NUMBER)
CommandFrames::Discovery::Query(CommandFrames::Discovery::QueryContext::SERIAL_NUMBER)
);
if (response.getResponseId() != Discovery::ResponseId::OK) {
if (response.getResponseId() != CommandFrames::Discovery::ResponseId::OK) {
throw Exception("Failed to fetch serial number from device - invalid Discovery Protocol response ID.");
}
@@ -64,7 +66,7 @@ void PowerDebugger::startSession() {
CommandFrames::HouseKeeping::StartSession()
);
if (response.getResponseId() == HouseKeeping::ResponseId::FAILED) {
if (response.getResponseId() == CommandFrames::HouseKeeping::ResponseId::FAILED) {
// Failed response returned!
throw Exception("Failed to start session with the Power Debugger - device returned failed response ID");
}
@@ -77,7 +79,7 @@ void PowerDebugger::endSession() {
CommandFrames::HouseKeeping::EndSession()
);
if (response.getResponseId() == HouseKeeping::ResponseId::FAILED) {
if (response.getResponseId() == CommandFrames::HouseKeeping::ResponseId::FAILED) {
// Failed response returned!
throw Exception("Failed to end session with the Power Debugger - device returned failed response ID");
}

View File

@@ -14,13 +14,6 @@
namespace Bloom::DebugToolDrivers
{
using namespace Protocols::CmsisDap;
using namespace Protocols::CmsisDap::Edbg::Avr::CommandFrames;
using namespace Protocols::CmsisDap::Edbg::Avr::CommandFrames::Discovery;
using namespace Protocols::CmsisDap::Edbg::Avr::CommandFrames::HouseKeeping;
using Protocols::CmsisDap::Edbg::EdbgInterface;
using Protocols::CmsisDap::Edbg::Avr::EdbgAvr8Interface;
/**
* The Power Debugger device is very similar to the Atmel-ICE. It implements the CMSIS-DAP layer as well
* as an Atmel Data Gateway Interface (DGI).
@@ -43,12 +36,12 @@ namespace Bloom::DebugToolDrivers
* Any non-EDBG CMSIS-DAP commands for the Power Debugger can be sent through the EDBGInterface (as the
* EdbgInterface extends the CmsisDapInterface).
*/
EdbgInterface edbgInterface = EdbgInterface();
Protocols::CmsisDap::Edbg::EdbgInterface edbgInterface = Protocols::CmsisDap::Edbg::EdbgInterface();
/**
* The Power Debugger employs the EDBG AVR8Generic protocol for interfacing with AVR8 targets.
*/
std::unique_ptr<EdbgAvr8Interface> edbgAvr8Interface;
std::unique_ptr<Protocols::CmsisDap::Edbg::Avr::EdbgAvr8Interface> edbgAvr8Interface;
bool sessionStarted = false;
@@ -59,13 +52,15 @@ namespace Bloom::DebugToolDrivers
PowerDebugger(): UsbDevice(PowerDebugger::USB_VENDOR_ID, PowerDebugger::USB_PRODUCT_ID) {}
void init() override;
void close() override;
EdbgInterface& getEdbgInterface() {
Protocols::CmsisDap::Edbg::EdbgInterface& getEdbgInterface() {
return this->edbgInterface;
}
Avr8Interface* getAvr8Interface() override {
TargetInterfaces::Microchip::Avr::Avr8::Avr8Interface* getAvr8Interface() override {
return this->edbgAvr8Interface.get();
}

View File

@@ -8,8 +8,6 @@
#include "src/DebugToolDrivers/Protocols/CMSIS-DAP/Command.hpp"
#include "src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/AvrCommand.hpp"
using namespace Bloom::DebugToolDrivers;
namespace Bloom::DebugToolDrivers::Protocols::CmsisDap
{
/**

View File

@@ -7,8 +7,6 @@
namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
{
using Edbg::ProtocolHandlerId;
enum class AvrEventId : unsigned char
{
AVR8_BREAK_EVENT = 0x40,

View File

@@ -7,9 +7,6 @@
namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames::Avr8Generic
{
using namespace DebugToolDrivers::Protocols::CmsisDap;
using namespace DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr;
class Avr8GenericCommandFrame: public AvrCommandFrame
{
public:

View File

@@ -7,8 +7,6 @@
namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames::Avr8Generic
{
using namespace Exceptions;
class ReadMemory: public Avr8GenericCommandFrame
{
private:

View File

@@ -4,8 +4,6 @@
namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames::Avr8Generic
{
using namespace Exceptions;
class SetParameter: public Avr8GenericCommandFrame
{
private:

View File

@@ -6,8 +6,6 @@
namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames::Avr8Generic
{
using namespace Exceptions;
class SetProgramCounter: public Avr8GenericCommandFrame
{
private:

View File

@@ -7,15 +7,12 @@
namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames::Avr8Generic
{
using namespace Exceptions;
using Bloom::Targets::TargetMemoryBuffer;
class WriteMemory: public Avr8GenericCommandFrame
{
private:
Avr8MemoryType type;
std::uint32_t address = 0;
TargetMemoryBuffer buffer;
Targets::TargetMemoryBuffer buffer;
public:
WriteMemory() = default;
@@ -28,7 +25,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
this->address = address;
}
void setBuffer(const TargetMemoryBuffer& buffer) {
void setBuffer(const Targets::TargetMemoryBuffer& buffer) {
this->buffer = buffer;
}

View File

@@ -12,9 +12,6 @@
namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
{
using namespace Edbg;
using namespace DebugToolDrivers::Protocols::CmsisDap;
class AvrCommandFrame
{
private:

View File

@@ -5,7 +5,6 @@
namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames::Discovery
{
using namespace DebugToolDrivers::Protocols::CmsisDap;
/**
* Discovery commands can only return two responses; A LIST response and a failure.
*/

View File

@@ -33,13 +33,17 @@
// AVR events
#include "src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/Events/AVR8Generic/BreakEvent.hpp"
using namespace Bloom::Targets::Microchip::Avr;
using namespace Bloom::Targets::Microchip::Avr::Avr8Bit;
using namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr;
using namespace Bloom::Exceptions;
using Bloom::Targets::TargetState;
using Bloom::Targets::TargetMemoryType;
using Bloom::Targets::TargetMemoryBuffer;
using Bloom::Targets::TargetRegister;
using Bloom::Targets::TargetRegisters;
using Bloom::Targets::TargetRegisterType;
using Bloom::Targets::TargetRegisters;
void EdbgAvr8Interface::setParameter(const Avr8EdbgParameter& parameter, const std::vector<unsigned char>& value) {
auto commandFrame = CommandFrames::Avr8Generic::SetParameter(parameter, value);

View File

@@ -13,16 +13,6 @@
namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
{
using namespace DebugToolDrivers;
using namespace Targets;
using namespace Targets::Microchip::Avr;
using Protocols::CmsisDap::Edbg::EdbgInterface;
using Targets::Microchip::Avr::Avr8Bit::Family;
using Targets::TargetRegister;
using Targets::TargetRegisterMap;
using Targets::TargetMemoryBuffer;
inline bool operator==(unsigned char rawId, Avr8ResponseId id) {
return static_cast<unsigned char>(id) == rawId;
}
@@ -40,7 +30,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
* 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")).
*/
class EdbgAvr8Interface: public Avr8Interface
class EdbgAvr8Interface: public TargetInterfaces::Microchip::Avr::Avr8::Avr8Interface
{
private:
/**
@@ -78,7 +68,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
* For the EdbgAvr8Interface, we send the required parameters to the debug tool immediately upon receiving
* them. See EdbgAvr8Interface::setTargetParameters().
*/
Avr8Bit::TargetParameters targetParameters;
Targets::Microchip::Avr::Avr8Bit::TargetParameters targetParameters;
/**
* We keep record of the current target state for caching purposes. We'll only refresh the target state if the
@@ -87,7 +77,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
*
* @TODO: Review this. Is the above assumption correct? Always? Explore the option of polling the target state.
*/
TargetState targetState = TargetState::UNKNOWN;
Targets::TargetState targetState = Targets::TargetState::UNKNOWN;
/**
* Upon configuration, the physical interface must be activated on the debug tool. We keep record of this to
@@ -256,7 +246,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
*
* @return
*/
TargetMemoryBuffer readMemory(Avr8MemoryType type, std::uint32_t address, std::uint32_t bytes);
Targets::TargetMemoryBuffer readMemory(Avr8MemoryType type, std::uint32_t address, std::uint32_t bytes);
/**
* Writes memory to the target.
@@ -269,7 +259,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
* @param address
* @param buffer
*/
void writeMemory(Avr8MemoryType type, std::uint32_t address, TargetMemoryBuffer buffer);
void writeMemory(Avr8MemoryType type, std::uint32_t address, Targets::TargetMemoryBuffer buffer);
/**
* Fetches the current target state.
@@ -354,7 +344,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
*
* @param config
*/
virtual void setTargetParameters(const Avr8Bit::TargetParameters& config) override;
virtual void setTargetParameters(const Targets::Microchip::Avr::Avr8Bit::TargetParameters& config) override;
/**
* Initialises the AVR8 Generic protocol interface by setting the appropriate parameters on the debug tool.
@@ -415,28 +405,28 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
*
* @return
*/
virtual TargetRegister getStackPointerRegister() override;
virtual Targets::TargetRegister getStackPointerRegister() override;
/**
* Reads the status register from the target.
*
* @return
*/
virtual TargetRegister getStatusRegister() override;
virtual Targets::TargetRegister getStatusRegister() override;
/**
* Updates the stack pointer register on ther target.
*
* @param stackPointerRegister
*/
virtual void setStackPointerRegister(const TargetRegister& stackPointerRegister) override;
virtual void setStackPointerRegister(const Targets::TargetRegister& stackPointerRegister) override;
/**
* Updates the status register on the target.
*
* @param statusRegister
*/
virtual void setStatusRegister(const TargetRegister& statusRegister) override;
virtual void setStatusRegister(const Targets::TargetRegister& statusRegister) override;
/**
* Issues the "PC Write" command to the debug tool, setting the program counter on the target.
@@ -451,7 +441,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
*
* @return
*/
virtual TargetSignature getDeviceId() override;
virtual Targets::Microchip::Avr::TargetSignature getDeviceId() override;
/**
* Issues the "Software Breakpoint Set" command to the debug tool, setting a software breakpoint at the given
@@ -485,14 +475,14 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
* @param registerIds
* @return
*/
virtual TargetRegisters readGeneralPurposeRegisters(std::set<std::size_t> registerIds) override;
virtual Targets::TargetRegisters readGeneralPurposeRegisters(std::set<std::size_t> registerIds) override;
/**
* Writes general purpose registers to target.
*
* @param registers
*/
virtual void writeGeneralPurposeRegisters(const TargetRegisters& registers) override;
virtual void writeGeneralPurposeRegisters(const Targets::TargetRegisters& registers) override;
/**
* This is an overloaded method.
@@ -504,7 +494,11 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
* @param bytes
* @return
*/
virtual TargetMemoryBuffer readMemory(TargetMemoryType memoryType, std::uint32_t startAddress, std::uint32_t bytes) override;
virtual Targets::TargetMemoryBuffer readMemory(
Targets::TargetMemoryType memoryType,
std::uint32_t startAddress,
std::uint32_t bytes
) override;
/**
* This is an overloaded method.
@@ -515,13 +509,17 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
* @param startAddress
* @param buffer
*/
virtual void writeMemory(TargetMemoryType memoryType, std::uint32_t startAddress, const TargetMemoryBuffer& buffer) override;
virtual void writeMemory(
Targets::TargetMemoryType memoryType,
std::uint32_t startAddress,
const Targets::TargetMemoryBuffer& buffer
) override;
/**
* Returns the current state of the target.
*
* @return
*/
virtual TargetState getTargetState() override;
virtual Targets::TargetState getTargetState() override;
};
}

View File

@@ -4,6 +4,7 @@
#include "src/Exceptions/Exception.hpp"
using namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr;
using namespace Bloom::Targets;
using namespace Bloom::Exceptions;
void BreakEvent::init(const AvrEvent& event) {

View File

@@ -7,13 +7,11 @@
namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
{
using Targets::TargetBreakCause;
class BreakEvent: public AvrEvent
{
private:
std::uint32_t programCounter;
TargetBreakCause breakCause;
Targets::TargetBreakCause breakCause;
void init(const AvrEvent& event);
@@ -26,7 +24,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
return this->programCounter;
}
TargetBreakCause getBreakCause() {
Targets::TargetBreakCause getBreakCause() {
return this->breakCause;
}
};

View File

@@ -5,7 +5,6 @@
namespace Bloom::Exceptions
{
using Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::ResponseFrames::Avr8Generic::Avr8GenericResponseFrame;
class Avr8CommandFailure: public Exception
{
private:
@@ -68,8 +67,10 @@ namespace Bloom::Exceptions
this->message = std::string(message);
}
explicit Avr8CommandFailure(const std::string& message, Avr8GenericResponseFrame& responseFrame)
: Exception(message) {
explicit Avr8CommandFailure(
const std::string& message,
DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::ResponseFrames::Avr8Generic::Avr8GenericResponseFrame& responseFrame
): Exception(message) {
this->message = message;
auto responsePayload = responseFrame.getPayload();

View File

@@ -5,15 +5,13 @@
namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::ResponseFrames::Avr8Generic
{
using namespace Targets::Microchip::Avr;
class GetDeviceId: public Avr8GenericResponseFrame
{
public:
GetDeviceId(const std::vector<AvrResponse>& AvrResponses): Avr8GenericResponseFrame(AvrResponses) {}
GetDeviceId() {}
TargetSignature extractSignature(Avr8PhysicalInterface physicalInterface) {
Targets::Microchip::Avr::TargetSignature extractSignature(Avr8PhysicalInterface physicalInterface) {
auto payloadData = this->getPayloadData();
switch (physicalInterface) {
@@ -22,14 +20,14 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::ResponseFrame
* When using the DebugWire physical interface, the get device ID command will return
* four bytes, where the first can be ignored.
*/
return TargetSignature(payloadData[1], payloadData[2], payloadData[3]);
return Targets::Microchip::Avr::TargetSignature(payloadData[1], payloadData[2], payloadData[3]);
}
case Avr8PhysicalInterface::PDI:
case Avr8PhysicalInterface::PDI_1W: {
/*
* When using the PDI physical interface, the signature is returned in LSB format.
*/
return TargetSignature(payloadData[3], payloadData[2], payloadData[1]);
return Targets::Microchip::Avr::TargetSignature(payloadData[3], payloadData[2], payloadData[1]);
}
case Avr8PhysicalInterface::JTAG: {
/*
@@ -54,14 +52,18 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::ResponseFrame
(payloadData[0] << 24) | (payloadData[1] << 16) | (payloadData[2] << 8) | (payloadData[3])
);
return TargetSignature(
return Targets::Microchip::Avr::TargetSignature(
0x1E,
static_cast<unsigned char>((jtagId << 4) >> 24),
static_cast<unsigned char>((jtagId << 12) >> 24)
);
}
default: {
return TargetSignature(payloadData[0], payloadData[1], payloadData[2]);
return Targets::Microchip::Avr::TargetSignature(
payloadData[0],
payloadData[1],
payloadData[2]
);
}
}
}

View File

@@ -7,8 +7,6 @@
namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::ResponseFrames::Avr8Generic
{
using namespace Bloom::Exceptions;
class GetProgramCounter: public Avr8GenericResponseFrame
{
public:
@@ -22,7 +20,8 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::ResponseFrame
*/
auto& payload = this->getPayload();
if (payload.size() != 6) {
throw Exception("Failed to extract PC from payload of PC read command response frame - unexpected payload size.");
throw Exceptions::Exception("Failed to extract PC from payload of PC read command response "
"frame - unexpected payload size.");
}
return static_cast<std::uint32_t>(payload[5] << 24 | payload[4] << 16 | payload[3] << 8 | payload[2]) * 2;

View File

@@ -5,16 +5,13 @@
namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::ResponseFrames::Avr8Generic
{
using namespace Bloom::Exceptions;
using Bloom::Targets::TargetMemoryBuffer;
class ReadMemory: public Avr8GenericResponseFrame
{
public:
ReadMemory(const std::vector<AvrResponse>& AVRResponses): Avr8GenericResponseFrame(AVRResponses) {}
ReadMemory() {}
TargetMemoryBuffer getMemoryBuffer() {
Targets::TargetMemoryBuffer getMemoryBuffer() {
/*
* AVR8 data payloads are typically in little endian form, but this does not apply the data returned
* from the READ MEMORY commands.

View File

@@ -11,8 +11,6 @@
namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
{
using namespace Edbg;
class AvrResponseFrame
{
private:

View File

@@ -4,8 +4,9 @@
#include "EdbgInterface.hpp"
using namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr;
using namespace Bloom::DebugToolDrivers;
using namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg;
using namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr;
using namespace Bloom::Exceptions;
Protocols::CmsisDap::Response EdbgInterface::sendAvrCommandFrameAndWaitForResponse(

View File

@@ -14,9 +14,6 @@
namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg
{
using namespace Protocols::CmsisDap::Edbg::Avr;
using namespace Exceptions;
/**
* The EdbgInterface class implements the EDBG sub-protocol, which takes the form of numerous CMSIS-DAP vendor
* commands.
@@ -52,12 +49,12 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg
const CommandFrameType& avrCommandFrame
) {
static_assert(
std::is_base_of<AvrCommandFrame, CommandFrameType>::value,
std::is_base_of<Protocols::CmsisDap::Edbg::Avr::AvrCommandFrame, CommandFrameType>::value,
"AVR Command must be base of AvrCommandFrame."
);
static_assert(
std::is_base_of<AvrResponseFrame, typename CommandFrameType::ResponseFrameType>::value,
std::is_base_of<Protocols::CmsisDap::Edbg::Avr::AvrResponseFrame, typename CommandFrameType::ResponseFrameType>::value,
"AVR Command must specify a valid response frame type, derived from AvrResponseFrame."
);
@@ -65,7 +62,8 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg
if (response.getData()[0] != 0x01) {
// The last response packet should always acknowledge receipt of the AvrCommandFrame
throw Exception("Failed to send AvrCommandFrame to device - device did not acknowledge receipt.");
throw Exceptions::Exception("Failed to send AvrCommandFrame to device "
"- device did not acknowledge receipt.");
}
auto responses = this->requestAvrResponses();

View File

@@ -12,17 +12,6 @@
namespace Bloom::DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8
{
using namespace Bloom;
using namespace Targets::Microchip::Avr;
using Targets::TargetState;
using Targets::TargetRegisterMap;
using Targets::TargetMemoryBuffer;
using Targets::TargetMemoryType;
using Targets::TargetRegister;
using Targets::TargetRegisters;
using Targets::Microchip::Avr::TargetSignature;
/**
* Interfacing with an AVR8 target can vary significantly, depending on the debug tool being used.
*
@@ -52,7 +41,7 @@ namespace Bloom::DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8
*
* @param config
*/
virtual void setTargetParameters(const Avr8Bit::TargetParameters& config) = 0;
virtual void setTargetParameters(const Targets::Microchip::Avr::Avr8Bit::TargetParameters& config) = 0;
/**
* Should initialise the interface between the debug tool and the AVR8 target.
@@ -102,7 +91,7 @@ namespace Bloom::DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8
*
* @return
*/
virtual TargetSignature getDeviceId() = 0;
virtual Targets::Microchip::Avr::TargetSignature getDeviceId() = 0;
/**
* Should set a software breakpoint at a given address.
@@ -135,14 +124,14 @@ namespace Bloom::DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8
*
* @return
*/
virtual TargetRegister getStackPointerRegister() = 0;
virtual Targets::TargetRegister getStackPointerRegister() = 0;
/**
* Should retrieve the current status register value from the target.
*
* @return
*/
virtual TargetRegister getStatusRegister() = 0;
virtual Targets::TargetRegister getStatusRegister() = 0;
/**
* Should update the program counter value on the target.
@@ -156,14 +145,14 @@ namespace Bloom::DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8
*
* @param stackPointerRegister
*/
virtual void setStackPointerRegister(const TargetRegister& stackPointerRegister) = 0;
virtual void setStackPointerRegister(const Targets::TargetRegister& stackPointerRegister) = 0;
/**
* Should update the status register value on the target.
*
* @param statusRegister
*/
virtual void setStatusRegister(const TargetRegister& statusRegister) = 0;
virtual void setStatusRegister(const Targets::TargetRegister& statusRegister) = 0;
/**
* Should read the requested general purpose register from the target.
@@ -173,14 +162,14 @@ namespace Bloom::DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8
*
* @return
*/
virtual TargetRegisters readGeneralPurposeRegisters(std::set<size_t> registerIds) = 0;
virtual Targets::TargetRegisters readGeneralPurposeRegisters(std::set<size_t> registerIds) = 0;
/**
* Should update the value of general purpose registers.
*
* @param registers
*/
virtual void writeGeneralPurposeRegisters(const TargetRegisters& registers) = 0;
virtual void writeGeneralPurposeRegisters(const Targets::TargetRegisters& registers) = 0;
/**
* Should read memory from the target, for the given memory type.
@@ -190,7 +179,11 @@ namespace Bloom::DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8
* @param bytes
* @return
*/
virtual TargetMemoryBuffer readMemory(TargetMemoryType memoryType, std::uint32_t startAddress, std::uint32_t bytes) = 0;
virtual Targets::TargetMemoryBuffer readMemory(
Targets::TargetMemoryType memoryType,
std::uint32_t startAddress,
std::uint32_t bytes
) = 0;
/**
* Should write memory to the target, for a given memory type.
@@ -199,13 +192,17 @@ namespace Bloom::DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8
* @param startAddress
* @param buffer
*/
virtual void writeMemory(TargetMemoryType memoryType, std::uint32_t startAddress, const TargetMemoryBuffer& buffer) = 0;
virtual void writeMemory(
Targets::TargetMemoryType memoryType,
std::uint32_t startAddress,
const Targets::TargetMemoryBuffer& buffer
) = 0;
/**
* Should obtain the current target state.
*
* @return
*/
virtual TargetState getTargetState() = 0;
virtual Targets::TargetState getTargetState() = 0;
};
}