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

@@ -2,24 +2,10 @@
namespace Services
{
using Targets::Microchip::Avr::Avr8Bit::OpcodeDecoder::Decoder;
Decoder::InstructionMapping Avr8InstructionService::fetchInstructions(
const Targets::TargetMemoryAddressRange& addressRange,
const Targets::TargetDescriptor& targetDescriptor,
TargetControllerService& targetControllerService
) {
const auto programMemory = targetControllerService.readMemory(
targetDescriptor.programMemoryType,
addressRange.startAddress,
addressRange.endAddress - addressRange.startAddress
);
return Decoder::decode(addressRange.startAddress, programMemory);
}
using Targets::Microchip::Avr8::OpcodeDecoder::Decoder;
std::optional<Targets::TargetMemoryAddress> Avr8InstructionService::resolveProgramDestinationAddress(
const Targets::Microchip::Avr::Avr8Bit::OpcodeDecoder::Instruction& instruction,
const Targets::Microchip::Avr8::OpcodeDecoder::Instruction& instruction,
Targets::TargetMemoryAddress instructionAddress,
const Decoder::InstructionMapping& instructions
) {

View File

@@ -4,31 +4,14 @@
#include "src/Targets/TargetDescriptor.hpp"
#include "src/Targets/TargetMemory.hpp"
#include "src/Targets/Microchip/AVR/AVR8/OpcodeDecoder/Instruction.hpp"
#include "src/Targets/Microchip/AVR/AVR8/OpcodeDecoder/Decoder.hpp"
#include "src/Targets/Microchip/AVR8/OpcodeDecoder/Instruction.hpp"
#include "src/Targets/Microchip/AVR8/OpcodeDecoder/Decoder.hpp"
namespace Services
{
class Avr8InstructionService
{
public:
/**
* Fetches opcodes from the target's program memory and attempts to decodes them.
*
* @param addressRange
* @param targetDescriptor
* @param targetControllerService
*
* @return
* A mapping of std::optional<Instruction>, mapped by their byte address in program memory. The address will
* map to std::nullopt if we failed to decode the opcode at that address.
*/
static Targets::Microchip::Avr::Avr8Bit::OpcodeDecoder::Decoder::InstructionMapping fetchInstructions(
const Targets::TargetMemoryAddressRange& addressRange,
const Targets::TargetDescriptor& targetDescriptor,
TargetControllerService& targetControllerService
);
/**
* For instructions that can change program flow, this function will attempt to figure out where, in program
* memory, the instruction may jump to.
@@ -62,9 +45,9 @@ namespace Services
* Otherwise, std::nullopt.
*/
static std::optional<Targets::TargetMemoryAddress> resolveProgramDestinationAddress(
const Targets::Microchip::Avr::Avr8Bit::OpcodeDecoder::Instruction& instruction,
const Targets::Microchip::Avr8::OpcodeDecoder::Instruction& instruction,
Targets::TargetMemoryAddress instructionAddress,
const Targets::Microchip::Avr::Avr8Bit::OpcodeDecoder::Decoder::InstructionMapping& instructions
const Targets::Microchip::Avr8::OpcodeDecoder::Decoder::InstructionMapping& instructions
);
};
}

View File

@@ -20,7 +20,7 @@ namespace Services
* @return
*/
static QDateTime currentDateTime() {
const auto lock = std::unique_lock(DateTimeService::systemClockMutex);
const auto lock = std::unique_lock{DateTimeService::systemClockMutex};
return QDateTime::currentDateTime();
}
@@ -30,7 +30,7 @@ namespace Services
* @return
*/
static QDate currentDate() {
const auto lock = std::unique_lock(DateTimeService::systemClockMutex);
const auto lock = std::unique_lock{DateTimeService::systemClockMutex};
return QDateTime::currentDateTime().date();
}
@@ -43,7 +43,7 @@ namespace Services
* @return
*/
static QString getTimeZoneAbbreviation(const QDateTime& dateTime) {
const auto lock = std::unique_lock(DateTimeService::systemClockMutex);
const auto lock = std::unique_lock{DateTimeService::systemClockMutex};
return dateTime.timeZoneAbbreviation();
}

View File

@@ -10,12 +10,12 @@
namespace Services
{
std::string PathService::applicationDirPath() {
auto pathCharArray = std::array<char, PATH_MAX>();
auto pathCharArray = std::array<char, PATH_MAX>{};
if (::readlink("/proc/self/exe", pathCharArray.data(), PATH_MAX) < 0) {
throw Exceptions::Exception("Failed to obtain application directory path.");
throw Exceptions::Exception{"Failed to obtain application directory path."};
}
return std::filesystem::path(std::string(pathCharArray.begin(), pathCharArray.end())).parent_path();
return std::filesystem::path{std::string{pathCharArray.begin(), pathCharArray.end()}}.parent_path();
}
}

View File

@@ -56,7 +56,7 @@ namespace Services
*
* @return
*/
static std::string targetDescriptionDirPath() {
static std::string targetDescriptionFilesDirPath() {
return PathService::resourcesDirPath() + "/TargetDescriptionFiles";
}

View File

@@ -9,11 +9,11 @@
namespace Services
{
::pid_t ProcessService::getProcessId() {
return getpid();
return ::getpid();
}
::pid_t ProcessService::getParentProcessId() {
return getppid();
return ::getppid();
}
::uid_t ProcessService::getEffectiveUserId(std::optional<::pid_t> processId) {
@@ -24,9 +24,9 @@ namespace Services
const auto processInfo = ProcessService::getProcessInfo(processId.value());
if (!processInfo) {
throw Exceptions::Exception(
throw Exceptions::Exception{
"Failed to fetch process info for process ID " + std::to_string(processId.value())
);
};
}
return static_cast<::uid_t>(processInfo->euid);
@@ -41,7 +41,7 @@ namespace Services
processId = ProcessService::getProcessId();
}
static auto cachedResultsByProcessId = std::map<::pid_t, bool>();
static auto cachedResultsByProcessId = std::map<::pid_t, bool>{};
const auto cachedResultIt = cachedResultsByProcessId.find(*processId);
if (cachedResultIt != cachedResultsByProcessId.end()) {
@@ -59,7 +59,7 @@ namespace Services
auto pid = processInfo->ppid;
while (const auto processInfo = ProcessService::getProcessInfo(pid)) {
const auto commandLine = std::string(*(processInfo->cmdline));
const auto commandLine = std::string{*(processInfo->cmdline)};
if (commandLine.find("clion") != std::string::npos) {
cachedResultsByProcessId[*processId] = true;
@@ -74,11 +74,11 @@ namespace Services
}
ProcessService::Proc ProcessService::getProcessInfo(::pid_t processId) {
const auto proc = std::unique_ptr<::PROCTAB, decltype(&::closeproc)>(
const auto proc = std::unique_ptr<::PROCTAB, decltype(&::closeproc)>{
::openproc(PROC_FILLSTAT | PROC_FILLARG | PROC_PID, &processId),
::closeproc
);
};
return Proc(::readproc(proc.get(), NULL), ::freeproc);
return {::readproc(proc.get(), NULL), ::freeproc};
}
}

View File

@@ -5,6 +5,7 @@
#include <sstream>
#include <iomanip>
#include <ranges>
#include <functional>
namespace Services
{
@@ -39,19 +40,19 @@ namespace Services
}
std::string StringService::toHex(std::uint32_t value) {
auto stream = std::stringstream();
auto stream = std::stringstream{};
stream << std::hex << std::setfill('0') << std::setw(8) << static_cast<unsigned int>(value);
return stream.str();
}
std::string StringService::toHex(unsigned char value) {
auto stream = std::stringstream();
auto stream = std::stringstream{};
stream << std::hex << std::setfill('0') << std::setw(2) << static_cast<unsigned int>(value);
return stream.str();
}
std::string StringService::toHex(const std::vector<unsigned char>& data) {
auto stream = std::stringstream();
auto stream = std::stringstream{};
stream << std::hex << std::setfill('0');
for (const auto& byte : data) {
@@ -62,7 +63,7 @@ namespace Services
}
std::string StringService::toHex(const std::string& data) {
std::stringstream stream;
auto stream = std::stringstream{};
stream << std::hex << std::setfill('0');
for (const auto& byte : data) {
@@ -72,20 +73,36 @@ namespace Services
return stream.str();
}
std::uint64_t StringService::toUint64(const std::string& str) {
return static_cast<std::uint64_t>(std::stoul(str, nullptr, 0));
std::vector<unsigned char> StringService::dataFromHex(const std::string& hexData) {
auto output = std::vector<unsigned char>{};
for (auto i = 0; i < hexData.size(); i += 2) {
const auto hexByte = std::string{(hexData.begin() + i), (hexData.begin() + i + 2)};
output.push_back(static_cast<unsigned char>(std::stoi(hexByte, nullptr, 16)));
}
return output;
}
std::uint32_t StringService::toUint32(const std::string& str) {
return static_cast<std::uint32_t>(StringService::toUint64(str));
std::uint64_t StringService::toUint64(const std::string& str, int base) {
return static_cast<std::uint64_t>(std::stoul(str, nullptr, base));
}
std::uint16_t StringService::toUint16(const std::string& str) {
return static_cast<std::uint16_t>(StringService::toUint64(str));
std::uint32_t StringService::toUint32(const std::string& str, int base) {
return static_cast<std::uint32_t>(StringService::toUint64(str, base));
}
std::uint8_t StringService::toUint8(const std::string& str) {
return static_cast<std::uint8_t>(StringService::toUint64(str));
std::uint16_t StringService::toUint16(const std::string& str, int base) {
return static_cast<std::uint16_t>(StringService::toUint64(str, base));
}
std::uint8_t StringService::toUint8(const std::string& str, int base) {
return static_cast<std::uint8_t>(StringService::toUint64(str, base));
}
std::size_t StringService::hash(const std::string& str) {
static const auto hash = std::hash<std::string>{};
return hash(str);
}
std::vector<std::string_view> StringService::split(std::string_view str, char delimiter) {

View File

@@ -22,10 +22,14 @@ namespace Services
static std::string toHex(const std::vector<unsigned char>& data);
static std::string toHex(const std::string& data);
static std::uint64_t toUint64(const std::string& str);
static std::uint32_t toUint32(const std::string& str);
static std::uint16_t toUint16(const std::string& str);
static std::uint8_t toUint8(const std::string& str);
static std::vector<unsigned char> dataFromHex(const std::string& hexData);
static std::uint64_t toUint64(const std::string& str, int base = 0);
static std::uint32_t toUint32(const std::string& str, int base = 0);
static std::uint16_t toUint16(const std::string& str, int base = 0);
static std::uint8_t toUint8(const std::string& str, int base = 0);
static std::size_t hash(const std::string& str);
static std::vector<std::string_view> split(std::string_view str, char delimiter);
};

View File

@@ -17,8 +17,9 @@
#include "src/TargetController/Commands/SetBreakpoint.hpp"
#include "src/TargetController/Commands/RemoveBreakpoint.hpp"
#include "src/TargetController/Commands/SetTargetProgramCounter.hpp"
#include "src/TargetController/Commands/GetTargetPinStates.hpp"
#include "src/TargetController/Commands/SetTargetPinState.hpp"
#include "src/TargetController/Commands/SetTargetStackPointer.hpp"
#include "src/TargetController/Commands/GetTargetGpioPinStates.hpp"
#include "src/TargetController/Commands/SetTargetGpioPinState.hpp"
#include "src/TargetController/Commands/GetTargetStackPointer.hpp"
#include "src/TargetController/Commands/GetTargetProgramCounter.hpp"
#include "src/TargetController/Commands/EnableProgrammingMode.hpp"
@@ -45,8 +46,9 @@ namespace Services
using TargetController::Commands::SetBreakpoint;
using TargetController::Commands::RemoveBreakpoint;
using TargetController::Commands::SetTargetProgramCounter;
using TargetController::Commands::GetTargetPinStates;
using TargetController::Commands::SetTargetPinState;
using TargetController::Commands::SetTargetStackPointer;
using TargetController::Commands::GetTargetGpioPinStates;
using TargetController::Commands::SetTargetGpioPinState;
using TargetController::Commands::GetTargetStackPointer;
using TargetController::Commands::GetTargetProgramCounter;
using TargetController::Commands::EnableProgrammingMode;
@@ -56,10 +58,12 @@ namespace Services
using Targets::TargetDescriptor;
using Targets::TargetState;
using Targets::TargetRegisters;
using Targets::TargetRegisterDescriptor;
using Targets::TargetRegisterDescriptors;
using Targets::TargetRegisterDescriptorAndValuePairs;
using Targets::TargetMemoryType;
using Targets::TargetAddressSpaceDescriptor;
using Targets::TargetMemorySegmentDescriptor;
using Targets::TargetMemoryAddress;
using Targets::TargetMemorySize;
using Targets::TargetMemoryAddressRange;
@@ -68,9 +72,10 @@ namespace Services
using Targets::TargetBreakpoint;
using Targets::TargetPinoutDescriptor;
using Targets::TargetPinDescriptor;
using Targets::TargetPinState;
using Targets::TargetPinStateMapping;
using Targets::TargetGpioPinState;
using Targets::TargetGpioPinDescriptorAndStatePairs;
TargetControllerService::AtomicSession::AtomicSession(TargetControllerService& targetControllerService)
: targetControllerService(targetControllerService)
@@ -90,7 +95,7 @@ namespace Services
} catch (const std::exception& exception) {
Logger::error(
"Failed to end atomic session (ID: " + std::to_string(this->sessionId) + ") - "
+ std::string(exception.what())
+ std::string{exception.what()}
);
}
@@ -102,7 +107,7 @@ namespace Services
}
}
const TargetDescriptor& TargetControllerService::getTargetDescriptor() const {
const Targets::TargetDescriptor& TargetControllerService::getTargetDescriptor() const {
return this->commandManager.sendCommandAndWaitForResponse(
std::make_unique<GetTargetDescriptor>(),
this->defaultTimeout,
@@ -126,52 +131,41 @@ namespace Services
);
}
void TargetControllerService::continueTargetExecution(
std::optional<TargetMemoryAddress> fromAddress,
std::optional<Targets::TargetMemoryAddress> toAddress
) const {
auto resumeExecutionCommand = std::make_unique<ResumeTargetExecution>();
if (fromAddress.has_value()) {
resumeExecutionCommand->fromAddress = fromAddress.value();
}
if (toAddress.has_value()) {
resumeExecutionCommand->toAddress = toAddress.value();
}
void TargetControllerService::resumeTargetExecution() const {
this->commandManager.sendCommandAndWaitForResponse(
std::move(resumeExecutionCommand),
std::make_unique<ResumeTargetExecution>(),
this->defaultTimeout,
this->activeAtomicSessionId
);
}
void TargetControllerService::stepTargetExecution(std::optional<TargetMemoryAddress> fromAddress) const {
auto stepExecutionCommand = std::make_unique<StepTargetExecution>();
if (fromAddress.has_value()) {
stepExecutionCommand->fromProgramCounter = fromAddress.value();
}
void TargetControllerService::stepTargetExecution() const {
this->commandManager.sendCommandAndWaitForResponse(
std::move(stepExecutionCommand),
std::make_unique<StepTargetExecution>(),
this->defaultTimeout,
this->activeAtomicSessionId
);
}
TargetRegisters TargetControllerService::readRegisters(
const Targets::TargetRegisterDescriptorIds& descriptorIds
TargetRegisterDescriptorAndValuePairs TargetControllerService::readRegisters(
const TargetRegisterDescriptors& descriptors
) const {
return this->commandManager.sendCommandAndWaitForResponse(
std::make_unique<ReadTargetRegisters>(descriptorIds),
std::make_unique<ReadTargetRegisters>(descriptors),
this->defaultTimeout,
this->activeAtomicSessionId
)->registers;
}
void TargetControllerService::writeRegisters(const TargetRegisters& registers) const {
TargetMemoryBuffer TargetControllerService::readRegister(const TargetRegisterDescriptor& descriptor) const {
return this->commandManager.sendCommandAndWaitForResponse(
std::make_unique<ReadTargetRegisters>(TargetRegisterDescriptors{&descriptor}),
this->defaultTimeout,
this->activeAtomicSessionId
)->registers.at(0).second;
}
void TargetControllerService::writeRegisters(const TargetRegisterDescriptorAndValuePairs& registers) const {
this->commandManager.sendCommandAndWaitForResponse(
std::make_unique<WriteTargetRegisters>(registers),
this->defaultTimeout,
@@ -179,8 +173,20 @@ namespace Services
);
}
void TargetControllerService::writeRegister(
const TargetRegisterDescriptor& descriptor,
const TargetMemoryBuffer& value
) const {
this->commandManager.sendCommandAndWaitForResponse(
std::make_unique<WriteTargetRegisters>(TargetRegisterDescriptorAndValuePairs{{descriptor, value}}),
this->defaultTimeout,
this->activeAtomicSessionId
);
}
TargetMemoryBuffer TargetControllerService::readMemory(
TargetMemoryType memoryType,
const TargetAddressSpaceDescriptor& addressSpaceDescriptor,
const TargetMemorySegmentDescriptor& memorySegmentDescriptor,
TargetMemoryAddress startAddress,
TargetMemorySize bytes,
bool bypassCache,
@@ -188,7 +194,8 @@ namespace Services
) const {
return this->commandManager.sendCommandAndWaitForResponse(
std::make_unique<ReadTargetMemory>(
memoryType,
addressSpaceDescriptor,
memorySegmentDescriptor,
startAddress,
bytes,
bypassCache,
@@ -200,20 +207,29 @@ namespace Services
}
void TargetControllerService::writeMemory(
TargetMemoryType memoryType,
const TargetAddressSpaceDescriptor& addressSpaceDescriptor,
const TargetMemorySegmentDescriptor& memorySegmentDescriptor,
TargetMemoryAddress startAddress,
const TargetMemoryBuffer& buffer
Targets::TargetMemoryBuffer&& buffer
) const {
this->commandManager.sendCommandAndWaitForResponse(
std::make_unique<WriteTargetMemory>(memoryType, startAddress, buffer),
std::make_unique<WriteTargetMemory>(
addressSpaceDescriptor,
memorySegmentDescriptor,
startAddress,
std::move(buffer)
),
this->defaultTimeout,
this->activeAtomicSessionId
);
}
void TargetControllerService::eraseMemory(Targets::TargetMemoryType memoryType) const {
void TargetControllerService::eraseMemory(
const TargetAddressSpaceDescriptor& addressSpaceDescriptor,
const TargetMemorySegmentDescriptor& memorySegmentDescriptor
) const {
this->commandManager.sendCommandAndWaitForResponse(
std::make_unique<EraseTargetMemory>(memoryType),
std::make_unique<EraseTargetMemory>(addressSpaceDescriptor, memorySegmentDescriptor),
this->defaultTimeout,
this->activeAtomicSessionId
);
@@ -254,17 +270,22 @@ namespace Services
);
}
TargetPinStateMapping TargetControllerService::getPinStates(int variantId) const {
TargetGpioPinDescriptorAndStatePairs TargetControllerService::getGpioPinStates(
const TargetPinoutDescriptor& pinoutDescriptor
) const {
return this->commandManager.sendCommandAndWaitForResponse(
std::make_unique<GetTargetPinStates>(variantId),
std::make_unique<GetTargetGpioPinStates>(pinoutDescriptor),
this->defaultTimeout,
this->activeAtomicSessionId
)->pinStatesByNumber;
)->gpioPinStates;
}
void TargetControllerService::setPinState(TargetPinDescriptor pinDescriptor, TargetPinState pinState) const {
void TargetControllerService::setGpioPinState(
const TargetPinDescriptor& pinDescriptor,
const TargetGpioPinState& state
) const {
this->commandManager.sendCommandAndWaitForResponse(
std::make_unique<SetTargetPinState>(pinDescriptor, pinState),
std::make_unique<SetTargetGpioPinState>(pinDescriptor, state),
this->defaultTimeout,
this->activeAtomicSessionId
);
@@ -278,6 +299,14 @@ namespace Services
)->stackPointer;
}
void TargetControllerService::setStackPointer(TargetStackPointer stackPointer) const {
this->commandManager.sendCommandAndWaitForResponse(
std::make_unique<SetTargetStackPointer>(stackPointer),
this->defaultTimeout,
this->activeAtomicSessionId
);
}
void TargetControllerService::resetTarget() const {
this->commandManager.sendCommandAndWaitForResponse(
std::make_unique<ResetTarget>(),
@@ -311,7 +340,7 @@ namespace Services
}
TargetControllerService::AtomicSession TargetControllerService::makeAtomicSession() {
return AtomicSession(*this);
return AtomicSession{*this};
}
TargetController::AtomicSessionIdType TargetControllerService::startAtomicSession() {

View File

@@ -2,6 +2,7 @@
#include <cstdint>
#include <chrono>
#include <memory>
#include <optional>
#include <functional>
@@ -9,12 +10,16 @@
#include "src/TargetController/AtomicSession.hpp"
#include "src/Targets/TargetState.hpp"
#include "src/Targets/TargetAddressSpaceDescriptor.hpp"
#include "src/Targets/TargetMemorySegmentDescriptor.hpp"
#include "src/Targets/TargetPeripheralDescriptor.hpp"
#include "src/Targets/TargetRegisterGroupDescriptor.hpp"
#include "src/Targets/TargetRegisterDescriptor.hpp"
#include "src/Targets/TargetRegister.hpp"
#include "src/Targets/TargetPinoutDescriptor.hpp"
#include "src/Targets/TargetPinDescriptor.hpp"
#include "src/Targets/TargetGpioPinState.hpp"
#include "src/Targets/TargetMemory.hpp"
#include "src/Targets/TargetBreakpoint.hpp"
#include "src/Targets/TargetVariant.hpp"
#include "src/Targets/TargetPinDescriptor.hpp"
#include "src/Exceptions/Exception.hpp"
@@ -71,43 +76,58 @@ namespace Services
void stopTargetExecution() const;
/**
* Requests the TargetController to continue execution on the target.
*
* @param fromAddress
* Requests the TargetController to resume execution on the target.
*/
void continueTargetExecution(
std::optional<Targets::TargetMemoryAddress> fromAddress,
std::optional<Targets::TargetMemoryAddress> toAddress
) const;
void resumeTargetExecution() const;
/**
* Requests the TargetController to step execution on the target.
*
* @param fromAddress
*/
void stepTargetExecution(std::optional<Targets::TargetMemoryAddress> fromAddress) const;
void stepTargetExecution() const;
/**
* Requests the TargetController to read register values from the target.
*
* @param descriptorIds
* Descriptor IDs of the registers to read.
* @param descriptors
* Descriptors of the registers to read.
*
* @return
*/
Targets::TargetRegisters readRegisters(const Targets::TargetRegisterDescriptorIds& descriptorIds) const;
Targets::TargetRegisterDescriptorAndValuePairs readRegisters(
const Targets::TargetRegisterDescriptors& descriptors
) const;
/**
* Requests the TargetController to read a single register value from the target.
*
* @param descriptor
* @return
*/
Targets::TargetMemoryBuffer readRegister(const Targets::TargetRegisterDescriptor& descriptor) const;
/**
* Requests the TargetController to write register values to the target.
*
* @param registers
*/
void writeRegisters(const Targets::TargetRegisters& registers) const;
void writeRegisters(const Targets::TargetRegisterDescriptorAndValuePairs& registers) const;
/**
* Requests the TargetController to write to a single register on the target.
*
* @param descriptor
* @param value
*/
void writeRegister(
const Targets::TargetRegisterDescriptor& descriptor,
const Targets::TargetMemoryBuffer& value
) const;
/**
* Requests the TargetController to read memory from the target.
*
* @param memoryType
* @param addressSpaceDescriptor
* @param memorySegmentDescriptor
* @param startAddress
* @param bytes
* @param bypassCache
@@ -115,7 +135,8 @@ namespace Services
* @return
*/
Targets::TargetMemoryBuffer readMemory(
Targets::TargetMemoryType memoryType,
const Targets::TargetAddressSpaceDescriptor& addressSpaceDescriptor,
const Targets::TargetMemorySegmentDescriptor& memorySegmentDescriptor,
Targets::TargetMemoryAddress startAddress,
Targets::TargetMemorySize bytes,
bool bypassCache = false,
@@ -125,22 +146,28 @@ namespace Services
/**
* Requests the TargetController to write memory to the target.
*
* @param memoryType
* @param addressSpaceDescriptor
* @param memorySegmentDescriptor
* @param startAddress
* @param buffer
*/
void writeMemory(
Targets::TargetMemoryType memoryType,
const Targets::TargetAddressSpaceDescriptor& addressSpaceDescriptor,
const Targets::TargetMemorySegmentDescriptor& memorySegmentDescriptor,
Targets::TargetMemoryAddress startAddress,
const Targets::TargetMemoryBuffer& buffer
Targets::TargetMemoryBuffer&& buffer
) const;
/**
* Requests the TargetController to erase the given target memory type.
* Requests the TargetController to erase the given target memory segment.
*
* @param memoryType
* @param addressSpaceDescriptor
* @param memorySegmentDescriptor
*/
void eraseMemory(Targets::TargetMemoryType memoryType) const;
void eraseMemory(
const Targets::TargetAddressSpaceDescriptor& addressSpaceDescriptor,
const Targets::TargetMemorySegmentDescriptor& memorySegmentDescriptor
) const;
/**
* Requests the TargetController to set a breakpoint on the target.
@@ -180,17 +207,22 @@ namespace Services
/**
* Retrieves the pin states for a particular target variant.
*
* @param variantId
* @param pinoutDescriptor
*/
Targets::TargetPinStateMapping getPinStates(int variantId) const;
Targets::TargetGpioPinDescriptorAndStatePairs getGpioPinStates(
const Targets::TargetPinoutDescriptor& pinoutDescriptor
) const;
/**
* Updates the pin state on the target, for a specific pin.
*
* @param pinDescriptor
* @param pinState
* @param state
*/
void setPinState(Targets::TargetPinDescriptor pinDescriptor, Targets::TargetPinState pinState) const;
void setGpioPinState(
const Targets::TargetPinDescriptor& pinDescriptor,
const Targets::TargetGpioPinState& state
) const;
/**
* Retrieves the current stack pointer value from the target.
@@ -199,6 +231,13 @@ namespace Services
*/
Targets::TargetStackPointer getStackPointer() const;
/**
* Sets the target's stack pointer to the given value.
*
* @param stackPointer
*/
void setStackPointer(Targets::TargetStackPointer stackPointer) const;
/**
* Triggers a reset on the target. The target will be held in a stopped state.
*/

View File

@@ -4,7 +4,6 @@
#include <map>
#include <cstdint>
#include <optional>
#include <functional>
#include "src/Targets/BriefTargetDescriptor.hpp"
@@ -36,7 +35,9 @@ namespace Services
private:
/**
* This mapping contains brief target descriptor objects for every target supported by Bloom, mapped by their
* configuration value. The contents is generated by a build script and stored in an ASCII text file, located
* configuration value.
*
* The contents of this mapping is generated by a build script and stored in an ASCII text file, located
* at GENERATED_BRIEF_TARGET_DESCRIPTOR_MAPPING_PATH.
*
* See build/scripts/GenerateBriefTargetDescriptors.php and the root CMakeLists.txt for more.