Massive refactor to accommodate RISC-V targets

- Refactored entire codebase (excluding the Insight component) to accommodate multiple target architectures (no longer specific to AVR)
- Deleted 'generate SVD' GDB monitor command - I will eventually move this functionality to the Bloom website
- Added unit size property to address spaces
- Many other changes which I couldn't be bothered to describe here
This commit is contained in:
Nav
2024-07-23 21:14:22 +01:00
parent 2986934485
commit 6cdbfbe950
331 changed files with 8815 additions and 8565 deletions

View File

@@ -43,7 +43,7 @@ namespace TargetController
Logger::debug(
"Timed out whilst waiting for TargetController to respond to " + CommandType::name + " command"
);
throw Exceptions::Exception("Command timed out");
throw Exceptions::Exception{"Command timed out"};
}
auto& response = optionalResponse.value();
@@ -55,7 +55,7 @@ namespace TargetController
"TargetController returned error in response to " + CommandType::name + " command (ID: "
+ std::to_string(commandId) + "). Error: " + errorResponse->errorMessage
);
throw Exceptions::Exception(errorResponse->errorMessage);
throw Exceptions::Exception{errorResponse->errorMessage};
}
Logger::debug(

View File

@@ -24,8 +24,9 @@ namespace TargetController::Commands
SET_BREAKPOINT,
REMOVE_BREAKPOINT,
SET_TARGET_PROGRAM_COUNTER,
GET_TARGET_PIN_STATES,
SET_TARGET_PIN_STATE,
SET_TARGET_STACK_POINTER,
GET_TARGET_GPIO_PIN_STATES,
SET_TARGET_GPIO_PIN_STATE,
GET_TARGET_STACK_POINTER,
GET_TARGET_PROGRAM_COUNTER,
ENABLE_PROGRAMMING_MODE,

View File

@@ -2,7 +2,9 @@
#include "Command.hpp"
#include "src/Targets/TargetMemory.hpp"
#include "src/Targets/TargetAddressSpaceDescriptor.hpp"
#include "src/Targets/TargetMemorySegmentDescriptor.hpp"
#include "src/Targets/TargetMemorySegmentType.hpp"
namespace TargetController::Commands
{
@@ -12,10 +14,15 @@ namespace TargetController::Commands
static constexpr CommandType type = CommandType::ERASE_TARGET_MEMORY;
static const inline std::string name = "EraseTargetMemory";
Targets::TargetMemoryType memoryType;
const Targets::TargetAddressSpaceDescriptor& addressSpaceDescriptor;
const Targets::TargetMemorySegmentDescriptor& memorySegmentDescriptor;
EraseTargetMemory(Targets::TargetMemoryType memoryType)
: memoryType(memoryType)
EraseTargetMemory(
const Targets::TargetAddressSpaceDescriptor& addressSpaceDescriptor,
const Targets::TargetMemorySegmentDescriptor& memorySegmentDescriptor
)
: addressSpaceDescriptor(addressSpaceDescriptor)
, memorySegmentDescriptor(memorySegmentDescriptor)
{};
[[nodiscard]] CommandType getType() const override {
@@ -27,7 +34,7 @@ namespace TargetController::Commands
}
[[nodiscard]] bool requiresDebugMode() const override {
return this->memoryType == Targets::TargetMemoryType::RAM;
return this->memorySegmentDescriptor.type == Targets::TargetMemorySegmentType::RAM;
}
};
}

View File

@@ -0,0 +1,31 @@
#pragma once
#include "Command.hpp"
#include "src/TargetController/Responses/TargetGpioPinStates.hpp"
namespace TargetController::Commands
{
class GetTargetGpioPinStates: public Command
{
public:
using SuccessResponseType = Responses::TargetGpioPinStates;
static constexpr CommandType type = CommandType::GET_TARGET_GPIO_PIN_STATES;
static const inline std::string name = "GetTargetGpioPinStates";
const Targets::TargetPinoutDescriptor& pinoutDescriptor;
explicit GetTargetGpioPinStates(const Targets::TargetPinoutDescriptor& pinoutDescriptor)
: pinoutDescriptor(pinoutDescriptor)
{};
[[nodiscard]] CommandType getType() const override {
return GetTargetGpioPinStates::type;
}
[[nodiscard]] bool requiresStoppedTargetState() const override {
return true;
}
};
}

View File

@@ -1,31 +0,0 @@
#pragma once
#include "Command.hpp"
#include "src/TargetController/Responses/TargetPinStates.hpp"
namespace TargetController::Commands
{
class GetTargetPinStates: public Command
{
public:
using SuccessResponseType = Responses::TargetPinStates;
static constexpr CommandType type = CommandType::GET_TARGET_PIN_STATES;
static const inline std::string name = "GetTargetPinStates";
int variantId = 0;
explicit GetTargetPinStates(int variantId)
: variantId(variantId)
{};
[[nodiscard]] CommandType getType() const override {
return GetTargetPinStates::type;
}
[[nodiscard]] bool requiresStoppedTargetState() const override {
return true;
}
};
}

View File

@@ -6,6 +6,9 @@
#include "Command.hpp"
#include "src/TargetController/Responses/TargetMemoryRead.hpp"
#include "src/Targets/TargetAddressSpaceDescriptor.hpp"
#include "src/Targets/TargetMemorySegmentDescriptor.hpp"
#include "src/Targets/TargetMemorySegmentType.hpp"
#include "src/Targets/TargetMemory.hpp"
namespace TargetController::Commands
@@ -18,7 +21,8 @@ namespace TargetController::Commands
static constexpr CommandType type = CommandType::READ_TARGET_MEMORY;
static const inline std::string name = "ReadTargetMemory";
Targets::TargetMemoryType memoryType;
const Targets::TargetAddressSpaceDescriptor& addressSpaceDescriptor;
const Targets::TargetMemorySegmentDescriptor& memorySegmentDescriptor;
Targets::TargetMemoryAddress startAddress;
Targets::TargetMemorySize bytes;
@@ -30,13 +34,15 @@ namespace TargetController::Commands
std::set<Targets::TargetMemoryAddressRange> excludedAddressRanges;
ReadTargetMemory(
Targets::TargetMemoryType memoryType,
const Targets::TargetAddressSpaceDescriptor& addressSpaceDescriptor,
const Targets::TargetMemorySegmentDescriptor& memorySegmentDescriptor,
Targets::TargetMemoryAddress startAddress,
Targets::TargetMemorySize bytes,
bool bypassCache = false,
const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges = {}
)
: memoryType(memoryType)
: addressSpaceDescriptor(addressSpaceDescriptor)
, memorySegmentDescriptor(memorySegmentDescriptor)
, startAddress(startAddress)
, bytes(bytes)
, bypassCache(bypassCache)
@@ -52,7 +58,7 @@ namespace TargetController::Commands
}
[[nodiscard]] bool requiresDebugMode() const override {
return this->memoryType == Targets::TargetMemoryType::RAM;
return this->memorySegmentDescriptor.type == Targets::TargetMemorySegmentType::RAM;
}
};
}

View File

@@ -15,10 +15,10 @@ namespace TargetController::Commands
static constexpr CommandType type = CommandType::READ_TARGET_REGISTERS;
static const inline std::string name = "ReadTargetRegisters";
std::set<Targets::TargetRegisterDescriptorId> descriptorIds;
const Targets::TargetRegisterDescriptors descriptors;
explicit ReadTargetRegisters(const std::set<Targets::TargetRegisterDescriptorId>& descriptorIds)
: descriptorIds(descriptorIds)
explicit ReadTargetRegisters(const Targets::TargetRegisterDescriptors& descriptors)
: descriptors(descriptors)
{};
[[nodiscard]] CommandType getType() const override {

View File

@@ -1,7 +1,5 @@
#pragma once
#include <optional>
#include "Command.hpp"
#include "src/Targets/TargetMemory.hpp"
@@ -14,14 +12,7 @@ namespace TargetController::Commands
static constexpr CommandType type = CommandType::RESUME_TARGET_EXECUTION;
static const inline std::string name = "ResumeTargetExecution";
std::optional<Targets::TargetMemoryAddress> fromAddress;
std::optional<Targets::TargetMemoryAddress> toAddress;
ResumeTargetExecution() = default;
ResumeTargetExecution(Targets::TargetMemoryAddress fromAddress, Targets::TargetMemoryAddress toAddress)
: fromAddress(fromAddress)
, toAddress(toAddress)
{};
[[nodiscard]] CommandType getType() const override {
return ResumeTargetExecution::type;

View File

@@ -3,28 +3,29 @@
#include "Command.hpp"
#include "src/Targets/TargetPinDescriptor.hpp"
#include "src/Targets/TargetGpioPinState.hpp"
namespace TargetController::Commands
{
class SetTargetPinState: public Command
class SetTargetGpioPinState: public Command
{
public:
static constexpr CommandType type = CommandType::SET_TARGET_PIN_STATE;
static const inline std::string name = "SetTargetPinState";
static constexpr CommandType type = CommandType::SET_TARGET_GPIO_PIN_STATE;
static const inline std::string name = "SetTargetGpioPinState";
Targets::TargetPinDescriptor pinDescriptor;
Targets::TargetPinState pinState;
const Targets::TargetPinDescriptor& pinDescriptor;
Targets::TargetGpioPinState state;
SetTargetPinState(
SetTargetGpioPinState(
const Targets::TargetPinDescriptor& pinDescriptor,
const Targets::TargetPinState& pinState
const Targets::TargetGpioPinState& state
)
: pinDescriptor(pinDescriptor)
, pinState(pinState)
, state(state)
{};
[[nodiscard]] CommandType getType() const override {
return SetTargetPinState::type;
return SetTargetGpioPinState::type;
}
[[nodiscard]] bool requiresStoppedTargetState() const override {

View File

@@ -14,7 +14,7 @@ namespace TargetController::Commands
static constexpr CommandType type = CommandType::SET_TARGET_PROGRAM_COUNTER;
static const inline std::string name = "SetTargetProgramCounter";
Targets::TargetMemoryAddress address = 0;
Targets::TargetMemoryAddress address;
explicit SetTargetProgramCounter(Targets::TargetMemoryAddress address)
: address(address)

View File

@@ -0,0 +1,31 @@
#pragma once
#include <cstdint>
#include "Command.hpp"
#include "src/Targets/TargetMemory.hpp"
namespace TargetController::Commands
{
class SetTargetStackPointer: public Command
{
public:
static constexpr CommandType type = CommandType::SET_TARGET_STACK_POINTER;
static const inline std::string name = "SetTargetStackPointer";
Targets::TargetStackPointer stackPointer;
explicit SetTargetStackPointer(Targets::TargetStackPointer stackPointer)
: stackPointer(stackPointer)
{};
[[nodiscard]] CommandType getType() const override {
return SetTargetStackPointer::type;
}
[[nodiscard]] bool requiresStoppedTargetState() const override {
return true;
}
};
}

View File

@@ -14,13 +14,6 @@ namespace TargetController::Commands
static constexpr CommandType type = CommandType::STEP_TARGET_EXECUTION;
static const inline std::string name = "StepTargetExecution";
std::optional<Targets::TargetMemoryAddress> fromProgramCounter;
StepTargetExecution() = default;
explicit StepTargetExecution(Targets::TargetMemoryAddress fromProgramCounter)
: fromProgramCounter(fromProgramCounter)
{};
[[nodiscard]] CommandType getType() const override {
return StepTargetExecution::type;
}

View File

@@ -2,6 +2,9 @@
#include "Command.hpp"
#include "src/Targets/TargetAddressSpaceDescriptor.hpp"
#include "src/Targets/TargetMemorySegmentDescriptor.hpp"
#include "src/Targets/TargetMemorySegmentType.hpp"
#include "src/Targets/TargetMemory.hpp"
namespace TargetController::Commands
@@ -12,18 +15,21 @@ namespace TargetController::Commands
static constexpr CommandType type = CommandType::WRITE_TARGET_MEMORY;
static const inline std::string name = "WriteTargetMemory";
Targets::TargetMemoryType memoryType;
const Targets::TargetAddressSpaceDescriptor& addressSpaceDescriptor;
const Targets::TargetMemorySegmentDescriptor& memorySegmentDescriptor;
Targets::TargetMemoryAddress startAddress;
Targets::TargetMemoryBuffer buffer;
WriteTargetMemory(
Targets::TargetMemoryType memoryType,
const Targets::TargetAddressSpaceDescriptor& addressSpaceDescriptor,
const Targets::TargetMemorySegmentDescriptor& memorySegmentDescriptor,
Targets::TargetMemoryAddress startAddress,
const Targets::TargetMemoryBuffer& buffer
Targets::TargetMemoryBuffer&& buffer
)
: memoryType(memoryType)
: addressSpaceDescriptor(addressSpaceDescriptor)
, memorySegmentDescriptor(memorySegmentDescriptor)
, startAddress(startAddress)
, buffer(buffer)
, buffer(std::move(buffer))
{};
[[nodiscard]] CommandType getType() const override {
@@ -35,7 +41,7 @@ namespace TargetController::Commands
}
[[nodiscard]] bool requiresDebugMode() const override {
return this->memoryType == Targets::TargetMemoryType::RAM;
return this->memorySegmentDescriptor.type == Targets::TargetMemorySegmentType::RAM;
}
};
}

View File

@@ -2,7 +2,7 @@
#include "Command.hpp"
#include "src/Targets/TargetRegister.hpp"
#include "src/Targets/TargetRegisterDescriptor.hpp"
namespace TargetController::Commands
{
@@ -12,9 +12,9 @@ namespace TargetController::Commands
static constexpr CommandType type = CommandType::WRITE_TARGET_REGISTERS;
static const inline std::string name = "WriteTargetRegisters";
Targets::TargetRegisters registers;
Targets::TargetRegisterDescriptorAndValuePairs registers;
explicit WriteTargetRegisters(const Targets::TargetRegisters& registers)
explicit WriteTargetRegisters(const Targets::TargetRegisterDescriptorAndValuePairs& registers)
: registers(registers)
{};

View File

@@ -7,12 +7,8 @@ namespace Exceptions
class DeviceCommunicationFailure: public DeviceFailure
{
public:
explicit DeviceCommunicationFailure(const std::string& message): DeviceFailure(message) {
this->message = message;
}
explicit DeviceCommunicationFailure(const char* message): DeviceFailure(message) {
this->message = std::string(message);
}
explicit DeviceCommunicationFailure(const std::string& message)
: DeviceFailure(message)
{}
};
}

View File

@@ -7,12 +7,8 @@ namespace Exceptions
class DeviceFailure: public Exception
{
public:
explicit DeviceFailure(const std::string& message): Exception(message) {
this->message = message;
}
explicit DeviceFailure(const char* message): Exception(message) {
this->message = std::string(message);
}
explicit DeviceFailure(const std::string& message)
: Exception(message)
{}
};
}

View File

@@ -7,12 +7,8 @@ namespace Exceptions
class DeviceInitializationFailure: public DeviceFailure
{
public:
explicit DeviceInitializationFailure(const std::string& message): DeviceFailure(message) {
this->message = message;
}
explicit DeviceInitializationFailure(const char* message): DeviceFailure(message) {
this->message = std::string(message);
}
explicit DeviceInitializationFailure(const std::string& message)
: DeviceFailure(message)
{}
};
}

View File

@@ -7,12 +7,8 @@ namespace Exceptions
class DeviceNotFound: public Exception
{
public:
explicit DeviceNotFound(const std::string& message): Exception(message) {
this->message = message;
}
explicit DeviceNotFound(const char* message): Exception(message) {
this->message = std::string(message);
}
explicit DeviceNotFound(const std::string& message)
: Exception(message)
{}
};
}

View File

@@ -10,9 +10,5 @@ namespace Exceptions
explicit TargetOperationFailure(const std::string& message)
: Exception(message)
{}
explicit TargetOperationFailure(const char* message)
: Exception(message)
{}
};
}

View File

@@ -13,7 +13,7 @@ namespace TargetController::Responses
TARGET_REGISTERS_READ,
TARGET_MEMORY_READ,
TARGET_STATE,
TARGET_PIN_STATES,
TARGET_GPIO_PIN_STATES,
TARGET_STACK_POINTER,
TARGET_PROGRAM_COUNTER,
BREAKPOINT,

View File

@@ -0,0 +1,29 @@
#pragma once
#include <vector>
#include "Response.hpp"
#include "src/Targets/TargetPinDescriptor.hpp"
#include "src/Targets/TargetGpioPinState.hpp"
#include "src/Helpers/Pair.hpp"
namespace TargetController::Responses
{
class TargetGpioPinStates: public Response
{
public:
static constexpr ResponseType type = ResponseType::TARGET_GPIO_PIN_STATES;
Targets::TargetGpioPinDescriptorAndStatePairs gpioPinStates;
explicit TargetGpioPinStates(const Targets::TargetGpioPinDescriptorAndStatePairs& gpioPinStates)
: gpioPinStates(gpioPinStates)
{}
[[nodiscard]] ResponseType getType() const override {
return TargetGpioPinStates::type;
}
};
}

View File

@@ -13,8 +13,8 @@ namespace TargetController::Responses
Targets::TargetMemoryBuffer data;
explicit TargetMemoryRead(const Targets::TargetMemoryBuffer& data)
: data(data)
explicit TargetMemoryRead(Targets::TargetMemoryBuffer&& data)
: data(std::move(data))
{}
[[nodiscard]] ResponseType getType() const override {

View File

@@ -1,24 +0,0 @@
#pragma once
#include "Response.hpp"
#include "src/Targets/TargetPinDescriptor.hpp"
namespace TargetController::Responses
{
class TargetPinStates: public Response
{
public:
static constexpr ResponseType type = ResponseType::TARGET_PIN_STATES;
Targets::TargetPinStateMapping pinStatesByNumber;
explicit TargetPinStates(const Targets::TargetPinStateMapping& pinStatesByNumber)
: pinStatesByNumber(pinStatesByNumber)
{}
[[nodiscard]] ResponseType getType() const override {
return TargetPinStates::type;
}
};
}

View File

@@ -2,7 +2,8 @@
#include "Response.hpp"
#include "src/Targets/TargetRegister.hpp"
#include "src/Targets/TargetRegisterDescriptor.hpp"
#include "src/Targets/TargetMemory.hpp"
namespace TargetController::Responses
{
@@ -11,10 +12,12 @@ namespace TargetController::Responses
public:
static constexpr ResponseType type = ResponseType::TARGET_REGISTERS_READ;
Targets::TargetRegisters registers;
Targets::TargetRegisterDescriptorAndValuePairs registers;
explicit TargetRegistersRead(const Targets::TargetRegisters& registers)
: registers(registers)
explicit TargetRegistersRead(
Targets::TargetRegisterDescriptorAndValuePairs&& registers
)
: registers(std::move(registers))
{}
[[nodiscard]] ResponseType getType() const override {

View File

@@ -11,9 +11,9 @@ namespace TargetController::Responses
public:
static constexpr ResponseType type = ResponseType::TARGET_STATE;
Targets::TargetState targetState;
const Targets::TargetState& targetState;
explicit TargetState(Targets::TargetState targetState)
explicit TargetState(const Targets::TargetState& targetState)
: targetState(targetState)
{}

File diff suppressed because it is too large Load Diff

View File

@@ -38,8 +38,9 @@
#include "Commands/SetBreakpoint.hpp"
#include "Commands/RemoveBreakpoint.hpp"
#include "Commands/SetTargetProgramCounter.hpp"
#include "Commands/GetTargetPinStates.hpp"
#include "Commands/SetTargetPinState.hpp"
#include "Commands/SetTargetStackPointer.hpp"
#include "Commands/GetTargetGpioPinStates.hpp"
#include "Commands/SetTargetGpioPinState.hpp"
#include "Commands/GetTargetStackPointer.hpp"
#include "Commands/GetTargetProgramCounter.hpp"
#include "Commands/EnableProgrammingMode.hpp"
@@ -52,7 +53,7 @@
#include "Responses/TargetState.hpp"
#include "Responses/TargetRegistersRead.hpp"
#include "Responses/TargetMemoryRead.hpp"
#include "Responses/TargetPinStates.hpp"
#include "Responses/TargetGpioPinStates.hpp"
#include "Responses/TargetStackPointer.hpp"
#include "Responses/TargetProgramCounter.hpp"
#include "Responses/Breakpoint.hpp"
@@ -120,8 +121,8 @@ namespace TargetController
std::map<Commands::CommandIdType, std::unique_ptr<Responses::Response>>
> responsesByCommandId;
static inline ConditionVariableNotifier notifier = ConditionVariableNotifier();
static inline std::condition_variable responsesByCommandIdCv = std::condition_variable();
static inline ConditionVariableNotifier notifier = {};
static inline std::condition_variable responsesByCommandIdCv = {};
static inline std::atomic<TargetControllerState> state = TargetControllerState::INACTIVE;
@@ -145,27 +146,13 @@ namespace TargetController
EventListenerPointer eventListener = std::make_shared<EventListener>("TargetControllerEventListener");
/**
* We keep record of the last known execution state of the target. When the connected target reports a
* different state to what's stored in lastTargetState, a state change (TargetExecutionStopped/TargetExecutionResumed)
* event is emitted.
*/
Targets::TargetState lastTargetState = Targets::TargetState::UNKNOWN;
std::unique_ptr<const Targets::TargetDescriptor> targetDescriptor = nullptr;
std::unique_ptr<Targets::TargetState> targetState = nullptr;
/**
* Target descriptor cache.
* Target register descriptors mapped by the address space key
*/
std::optional<const Targets::TargetDescriptor> targetDescriptor;
/**
* Target register descriptors mapped by the memory type on which the register is stored.
*/
std::map<Targets::TargetMemoryType, Targets::TargetRegisterDescriptors> registerDescriptorsByMemoryType;
/**
* Memory address ranges for target registers, mapped by the register memory type.
*/
std::map<Targets::TargetMemoryType, Targets::TargetMemoryAddressRange> registerAddressRangeByMemoryType;
std::map<std::string, Targets::TargetRegisterDescriptors> registerDescriptorsByAddressSpaceKey;
/**
* The TargetController keeps track of all installed breakpoints.
@@ -174,14 +161,15 @@ namespace TargetController
std::map<Targets::TargetMemoryAddress, Targets::TargetBreakpoint> hardwareBreakpointsByAddress;
/**
* The target's program memory cache.
* The target's program memory cache
*
* If program caching is enabled, all program memory reads will be serviced by the cache, if we have the data.
*
* We use std::unique_ptr here due to delayed construction (we construct this after activating the target
* and obtaining the target descriptor).
* Most targets only have a single program memory, which resides on a single address space. But some may have
* multiple program memories, residing on multiple address spaces. We have a single cache (TargetMemoryCache
* object) for each address space.
*/
std::unique_ptr<Targets::TargetMemoryCache> programMemoryCache = nullptr;
std::map<std::string, Targets::TargetMemoryCache> programMemoryCachesByAddressSpaceKey;
/**
* Registers a handler function for a particular command type.
@@ -192,14 +180,12 @@ namespace TargetController
*/
template<class CommandType>
void registerCommandHandler(std::function<std::unique_ptr<Responses::Response>(CommandType&)> callback) {
this->commandHandlersByCommandType.insert(
std::pair(
CommandType::type,
[callback] (Commands::Command& command) {
// Downcast the command to the expected type
return callback(dynamic_cast<CommandType&>(command));
}
)
this->commandHandlersByCommandType.emplace(
CommandType::type,
[callback] (Commands::Command& command) {
// Downcast the command to the expected type
return callback(dynamic_cast<CommandType&>(command));
}
);
}
@@ -283,34 +269,48 @@ namespace TargetController
void endActiveAtomicSession();
/**
* Extracts address ranges and groups target register descriptors.
*/
void loadRegisterDescriptors();
void refreshExecutionState();
/**
* Resolves the descriptors of all target registers found within the given address range and memory type.
*
* @param startAddress
* @param endAddress
* @param memoryType
* @return
*/
Targets::TargetRegisterDescriptors getRegisterDescriptorsWithinAddressRange(
Targets::TargetMemoryAddress startAddress,
Targets::TargetMemoryAddress endAddress,
Targets::TargetMemoryType memoryType
void updateTargetState(const Targets::TargetState& newState);
void stopTarget();
void resumeTarget();
void stepTarget();
void resetTarget();
Targets::TargetRegisterDescriptorAndValuePairs readTargetRegisters(
const Targets::TargetRegisterDescriptors& descriptors
);
/**
* Should fire any events queued on the target.
*/
void fireTargetEvents();
void writeTargetRegisters(const Targets::TargetRegisterDescriptorAndValuePairs& registers);
/**
* Triggers a target reset and emits a TargetReset event.
*/
void resetTarget();
Targets::TargetMemoryBuffer readTargetMemory(
const Targets::TargetAddressSpaceDescriptor& addressSpaceDescriptor,
const Targets::TargetMemorySegmentDescriptor& memorySegmentDescriptor,
Targets::TargetMemoryAddress startAddress,
Targets::TargetMemorySize bytes,
const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges,
bool bypassCache
);
void writeTargetMemory(
const Targets::TargetAddressSpaceDescriptor& addressSpaceDescriptor,
const Targets::TargetMemorySegmentDescriptor& memorySegmentDescriptor,
Targets::TargetMemoryAddress startAddress,
const Targets::TargetMemoryBuffer& buffer
);
void eraseTargetMemory(
const Targets::TargetAddressSpaceDescriptor& addressSpaceDescriptor,
const Targets::TargetMemorySegmentDescriptor& memorySegmentDescriptor
);
void setBreakpoint(const Targets::TargetBreakpoint& breakpoint);
void removeBreakpoint(const Targets::TargetBreakpoint& breakpoint);
/**
* Puts the target into programming mode and disables command handlers for debug commands (commands that serve
@@ -324,11 +324,15 @@ namespace TargetController
void disableProgrammingMode();
/**
* Returns a cached instance of the target's TargetDescriptor.
* Fetches the program memory cache object for the given address space. If the address space has no associated
* cache object, one will be created.
*
* @param addressSpaceDescriptor
* @return
*/
const Targets::TargetDescriptor& getTargetDescriptor();
Targets::TargetMemoryCache& getProgramMemoryCache(
const Targets::TargetAddressSpaceDescriptor& addressSpaceDescriptor
);
/**
* Invokes a shutdown.
@@ -364,8 +368,11 @@ namespace TargetController
std::unique_ptr<Responses::Breakpoint> handleSetBreakpoint(Commands::SetBreakpoint& command);
std::unique_ptr<Responses::Response> handleRemoveBreakpoint(Commands::RemoveBreakpoint& command);
std::unique_ptr<Responses::Response> handleSetProgramCounter(Commands::SetTargetProgramCounter& command);
std::unique_ptr<Responses::TargetPinStates> handleGetTargetPinStates(Commands::GetTargetPinStates& command);
std::unique_ptr<Responses::Response> handleSetTargetPinState(Commands::SetTargetPinState& command);
std::unique_ptr<Responses::Response> handleSetStackPointer(Commands::SetTargetStackPointer& command);
std::unique_ptr<Responses::TargetGpioPinStates> handleGetTargetGpioPinStates(
Commands::GetTargetGpioPinStates& command
);
std::unique_ptr<Responses::Response> handleSetTargetGpioPinState(Commands::SetTargetGpioPinState& command);
std::unique_ptr<Responses::TargetStackPointer> handleGetTargetStackPointer(
Commands::GetTargetStackPointer& command
);