Added TargetMemoryAddress, TargetMemorySize, TargetProgramCounter and TargetStackPointer aliases

This commit is contained in:
Nav
2022-09-06 17:16:49 +01:00
parent 620e6dc06a
commit 46d8ce1854
46 changed files with 234 additions and 174 deletions

View File

@@ -20,7 +20,7 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
/** /**
* Start address of the memory operation. * Start address of the memory operation.
*/ */
std::uint32_t startAddress = 0; Targets::TargetMemoryAddress startAddress = 0;
/** /**
* The type of memory to read from. * The type of memory to read from.
@@ -30,7 +30,7 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
/** /**
* Number of bytes to read. * Number of bytes to read.
*/ */
std::uint32_t bytes = 0; Targets::TargetMemorySize bytes = 0;
explicit ReadMemory(const RawPacketType& rawPacket, const Gdb::TargetDescriptor& gdbTargetDescriptor); explicit ReadMemory(const RawPacketType& rawPacket, const Gdb::TargetDescriptor& gdbTargetDescriptor);

View File

@@ -20,7 +20,7 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
/** /**
* Start address of the memory operation. * Start address of the memory operation.
*/ */
std::uint32_t startAddress = 0; Targets::TargetMemoryAddress startAddress = 0;
/** /**
* The type of memory to read from. * The type of memory to read from.

View File

@@ -16,7 +16,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
: CommandPacket(rawPacket) : CommandPacket(rawPacket)
{ {
if (this->data.size() > 1) { if (this->data.size() > 1) {
this->fromProgramCounter = static_cast<std::uint32_t>( this->fromProgramCounter = static_cast<Targets::TargetProgramCounter>(
std::stoi(std::string(this->data.begin(), this->data.end()), nullptr, 16) std::stoi(std::string(this->data.begin(), this->data.end()), nullptr, 16)
); );
} }

View File

@@ -5,6 +5,8 @@
#include "CommandPacket.hpp" #include "CommandPacket.hpp"
#include "src/Targets/TargetMemory.hpp"
namespace Bloom::DebugServer::Gdb::CommandPackets namespace Bloom::DebugServer::Gdb::CommandPackets
{ {
/** /**
@@ -22,7 +24,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
* *
* Although the packet *can* contain this address, it is not required, hence the std::optional type. * Although the packet *can* contain this address, it is not required, hence the std::optional type.
*/ */
std::optional<std::uint32_t> fromProgramCounter; std::optional<Targets::TargetProgramCounter> fromProgramCounter;
explicit ContinueExecution(const RawPacketType& rawPacket); explicit ContinueExecution(const RawPacketType& rawPacket);

View File

@@ -7,6 +7,8 @@
#include "CommandPacket.hpp" #include "CommandPacket.hpp"
#include "src/DebugServer/Gdb/BreakpointType.hpp" #include "src/DebugServer/Gdb/BreakpointType.hpp"
#include "src/Targets/TargetMemory.hpp"
namespace Bloom::DebugServer::Gdb::CommandPackets namespace Bloom::DebugServer::Gdb::CommandPackets
{ {
/** /**
@@ -24,7 +26,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
/** /**
* Address at which the breakpoint should be located. * Address at which the breakpoint should be located.
*/ */
std::uint32_t address = 0; Targets::TargetMemoryAddress address = 0;
explicit RemoveBreakpoint(const RawPacketType& rawPacket); explicit RemoveBreakpoint(const RawPacketType& rawPacket);

View File

@@ -7,6 +7,8 @@
#include "CommandPacket.hpp" #include "CommandPacket.hpp"
#include "src/DebugServer/Gdb/BreakpointType.hpp" #include "src/DebugServer/Gdb/BreakpointType.hpp"
#include "src/Targets/TargetMemory.hpp"
namespace Bloom::DebugServer::Gdb::CommandPackets namespace Bloom::DebugServer::Gdb::CommandPackets
{ {
/** /**
@@ -24,7 +26,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
/** /**
* Address at which the breakpoint should be located. * Address at which the breakpoint should be located.
*/ */
std::uint32_t address = 0; Targets::TargetMemoryAddress address = 0;
explicit SetBreakpoint(const RawPacketType& rawPacket); explicit SetBreakpoint(const RawPacketType& rawPacket);

View File

@@ -17,7 +17,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
: CommandPacket(rawPacket) : CommandPacket(rawPacket)
{ {
if (this->data.size() > 1) { if (this->data.size() > 1) {
this->fromProgramCounter = static_cast<std::uint32_t>( this->fromProgramCounter = static_cast<Targets::TargetProgramCounter>(
std::stoi(std::string(this->data.begin(), this->data.end()), nullptr, 16) std::stoi(std::string(this->data.begin(), this->data.end()), nullptr, 16)
); );
} }

View File

@@ -5,6 +5,8 @@
#include "CommandPacket.hpp" #include "CommandPacket.hpp"
#include "src/Targets/TargetMemory.hpp"
namespace Bloom::DebugServer::Gdb::CommandPackets namespace Bloom::DebugServer::Gdb::CommandPackets
{ {
/** /**
@@ -17,7 +19,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
/** /**
* The address from which to begin the step. * The address from which to begin the step.
*/ */
std::optional<std::size_t> fromProgramCounter; std::optional<Targets::TargetProgramCounter> fromProgramCounter;
explicit StepExecution(const RawPacketType& rawPacket); explicit StepExecution(const RawPacketType& rawPacket);

View File

@@ -74,6 +74,9 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
using Bloom::Targets::TargetState; using Bloom::Targets::TargetState;
using Bloom::Targets::TargetMemoryType; using Bloom::Targets::TargetMemoryType;
using Bloom::Targets::TargetMemoryBuffer; using Bloom::Targets::TargetMemoryBuffer;
using Bloom::Targets::TargetMemoryAddress;
using Bloom::Targets::TargetMemorySize;
using Bloom::Targets::TargetProgramCounter;
using Bloom::Targets::TargetRegister; using Bloom::Targets::TargetRegister;
using Bloom::Targets::TargetRegisterDescriptor; using Bloom::Targets::TargetRegisterDescriptor;
using Bloom::Targets::TargetRegisterDescriptors; using Bloom::Targets::TargetRegisterDescriptors;
@@ -219,7 +222,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
this->targetState = TargetState::RUNNING; this->targetState = TargetState::RUNNING;
} }
void EdbgAvr8Interface::runTo(std::uint32_t address) { void EdbgAvr8Interface::runTo(TargetProgramCounter address) {
this->clearEvents(); this->clearEvents();
auto response = this->edbgInterface.sendAvrCommandFrameAndWaitForResponseFrame( auto response = this->edbgInterface.sendAvrCommandFrameAndWaitForResponseFrame(
RunTo(address) RunTo(address)
@@ -319,7 +322,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
} }
} }
std::uint32_t EdbgAvr8Interface::getProgramCounter() { TargetProgramCounter EdbgAvr8Interface::getProgramCounter() {
if (this->targetState != TargetState::STOPPED) { if (this->targetState != TargetState::STOPPED) {
this->stop(); this->stop();
} }
@@ -335,7 +338,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
return response.extractProgramCounter(); return response.extractProgramCounter();
} }
void EdbgAvr8Interface::setProgramCounter(std::uint32_t programCounter) { void EdbgAvr8Interface::setProgramCounter(TargetProgramCounter programCounter) {
if (this->targetState != TargetState::STOPPED) { if (this->targetState != TargetState::STOPPED) {
this->stop(); this->stop();
} }
@@ -366,7 +369,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
* TODO: Currently, we're assuming the signature will always only ever be three bytes in size, but we may * TODO: Currently, we're assuming the signature will always only ever be three bytes in size, but we may
* want to consider pulling the size from the TDF. * want to consider pulling the size from the TDF.
*/ */
auto signatureMemory = this->readMemory( const auto signatureMemory = this->readMemory(
Avr8MemoryType::SRAM, Avr8MemoryType::SRAM,
this->targetParameters.signatureSegmentStartAddress.value(), this->targetParameters.signatureSegmentStartAddress.value(),
3 3
@@ -390,7 +393,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
return response.extractSignature(this->targetConfig->physicalInterface); return response.extractSignature(this->targetConfig->physicalInterface);
} }
void EdbgAvr8Interface::setBreakpoint(std::uint32_t address) { void EdbgAvr8Interface::setBreakpoint(TargetMemoryAddress address) {
auto response = this->edbgInterface.sendAvrCommandFrameAndWaitForResponseFrame( auto response = this->edbgInterface.sendAvrCommandFrameAndWaitForResponseFrame(
SetSoftwareBreakpoints({address}) SetSoftwareBreakpoints({address})
); );
@@ -400,7 +403,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
} }
} }
void EdbgAvr8Interface::clearBreakpoint(std::uint32_t address) { void EdbgAvr8Interface::clearBreakpoint(TargetMemoryAddress address) {
auto response = this->edbgInterface.sendAvrCommandFrameAndWaitForResponseFrame( auto response = this->edbgInterface.sendAvrCommandFrameAndWaitForResponseFrame(
ClearSoftwareBreakpoints({address}) ClearSoftwareBreakpoints({address})
); );
@@ -444,10 +447,12 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
auto descriptorsByType = std::map<TargetRegisterType, std::set<const TargetRegisterDescriptor*>>(); auto descriptorsByType = std::map<TargetRegisterType, std::set<const TargetRegisterDescriptor*>>();
/* /*
* An address range is just an std::pair of integers - the first being the start address, the second being the * An address range is just an std::pair of addresses - the first being the start address, the second being
* end address. * the end address.
*
* TODO: Can't we just use the TargetMemoryAddressRange struct here? Review
*/ */
using AddressRange = std::pair<std::uint32_t, std::uint32_t>; using AddressRange = std::pair<TargetMemoryAddress, TargetMemoryAddress>;
auto addressRangeByType = std::map<TargetRegisterType, AddressRange>(); auto addressRangeByType = std::map<TargetRegisterType, AddressRange>();
for (const auto& descriptor : descriptors) { for (const auto& descriptor : descriptors) {
@@ -519,7 +524,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
* *
* See CommandFrames::Avr8Generic::ReadMemory(); and the Microchip EDBG documentation for more. * See CommandFrames::Avr8Generic::ReadMemory(); and the Microchip EDBG documentation for more.
*/ */
auto excludedAddresses = std::set<std::uint32_t>(); auto excludedAddresses = std::set<TargetMemoryAddress>();
if (memoryType == Avr8MemoryType::SRAM && this->targetParameters.ocdDataRegister.has_value()) { if (memoryType == Avr8MemoryType::SRAM && this->targetParameters.ocdDataRegister.has_value()) {
excludedAddresses.insert( excludedAddresses.insert(
this->targetParameters.ocdDataRegister.value() this->targetParameters.ocdDataRegister.value()
@@ -608,8 +613,8 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
TargetMemoryBuffer EdbgAvr8Interface::readMemory( TargetMemoryBuffer EdbgAvr8Interface::readMemory(
TargetMemoryType memoryType, TargetMemoryType memoryType,
std::uint32_t startAddress, TargetMemoryAddress startAddress,
std::uint32_t bytes, TargetMemorySize bytes,
const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges
) { ) {
if ( if (
@@ -667,7 +672,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
* *
* We will perform the conversion here. * We will perform the conversion here.
*/ */
auto excludedAddresses = std::set<std::uint32_t>(); auto excludedAddresses = std::set<TargetMemoryAddress>();
auto endAddress = startAddress + bytes - 1; auto endAddress = startAddress + bytes - 1;
for (const auto& addressRange : excludedAddressRanges) { for (const auto& addressRange : excludedAddressRanges) {
@@ -686,7 +691,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
void EdbgAvr8Interface::writeMemory( void EdbgAvr8Interface::writeMemory(
TargetMemoryType memoryType, TargetMemoryType memoryType,
std::uint32_t startAddress, TargetMemoryAddress startAddress,
const TargetMemoryBuffer& buffer const TargetMemoryBuffer& buffer
) { ) {
auto avr8MemoryType = Avr8MemoryType::SRAM; auto avr8MemoryType = Avr8MemoryType::SRAM;
@@ -1459,7 +1464,10 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
; ;
} }
std::uint32_t EdbgAvr8Interface::alignMemoryAddress(Avr8MemoryType memoryType, std::uint32_t address) { TargetMemoryAddress EdbgAvr8Interface::alignMemoryAddress(
Avr8MemoryType memoryType,
TargetMemoryAddress address
) {
std::uint16_t alignTo = 1; std::uint16_t alignTo = 1;
// We don't have to align to the page size in all cases. We may only need to align to the word size (2 bytes). // We don't have to align to the page size in all cases. We may only need to align to the word size (2 bytes).
@@ -1497,7 +1505,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
} }
if ((address % alignTo) != 0) { if ((address % alignTo) != 0) {
return static_cast<std::uint32_t>(std::floor( return static_cast<TargetMemoryAddress>(std::floor(
static_cast<float>(address) / static_cast<float>(alignTo) static_cast<float>(address) / static_cast<float>(alignTo)
) * alignTo); ) * alignTo);
} }
@@ -1505,7 +1513,10 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
return address; return address;
} }
std::uint32_t EdbgAvr8Interface::alignMemoryBytes(Avr8MemoryType memoryType, std::uint32_t bytes) { TargetMemorySize EdbgAvr8Interface::alignMemoryBytes(
Avr8MemoryType memoryType,
TargetMemorySize bytes
) {
std::uint16_t alignTo = 1; std::uint16_t alignTo = 1;
// We don't have to align to the page size in all cases. We may only need to align to the word size (2 bytes). // We don't have to align to the page size in all cases. We may only need to align to the word size (2 bytes).
@@ -1537,7 +1548,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
} }
if ((bytes % alignTo) != 0) { if ((bytes % alignTo) != 0) {
return static_cast<std::uint32_t>(std::ceil( return static_cast<TargetMemorySize>(std::ceil(
static_cast<float>(bytes) / static_cast<float>(alignTo) static_cast<float>(bytes) / static_cast<float>(alignTo)
) * alignTo); ) * alignTo);
} }
@@ -1547,9 +1558,9 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
TargetMemoryBuffer EdbgAvr8Interface::readMemory( TargetMemoryBuffer EdbgAvr8Interface::readMemory(
Avr8MemoryType type, Avr8MemoryType type,
std::uint32_t startAddress, TargetMemoryAddress startAddress,
std::uint32_t bytes, TargetMemorySize bytes,
const std::set<std::uint32_t>& excludedAddresses const std::set<TargetMemoryAddress>& excludedAddresses
) { ) {
if (!excludedAddresses.empty() && (this->avoidMaskedMemoryRead || type != Avr8MemoryType::SRAM)) { if (!excludedAddresses.empty() && (this->avoidMaskedMemoryRead || type != Avr8MemoryType::SRAM)) {
/* /*
@@ -1632,12 +1643,12 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
// bytes should always be a multiple of pageSize (given the code above) // bytes should always be a multiple of pageSize (given the code above)
assert(bytes % pageSize == 0); assert(bytes % pageSize == 0);
int pagesRequired = static_cast<int>(bytes / pageSize); int pagesRequired = static_cast<int>(bytes / pageSize);
TargetMemoryBuffer memoryBuffer; auto memoryBuffer = Targets::TargetMemoryBuffer();
for (auto i = 0; i < pagesRequired; i++) { for (auto i = 0; i < pagesRequired; i++) {
auto pageBuffer = this->readMemory( auto pageBuffer = this->readMemory(
type, type,
startAddress + static_cast<std::uint32_t>(pageSize * i), startAddress + static_cast<TargetMemoryAddress>(pageSize * i),
pageSize pageSize
); );
std::move(pageBuffer.begin(), pageBuffer.end(), std::back_inserter(memoryBuffer)); std::move(pageBuffer.begin(), pageBuffer.end(), std::back_inserter(memoryBuffer));
@@ -1655,17 +1666,17 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
if (this->maximumMemoryAccessSizePerRequest.has_value() && bytes > this->maximumMemoryAccessSizePerRequest) { if (this->maximumMemoryAccessSizePerRequest.has_value() && bytes > this->maximumMemoryAccessSizePerRequest) {
auto maximumRequestSize = this->maximumMemoryAccessSizePerRequest.value(); auto maximumRequestSize = this->maximumMemoryAccessSizePerRequest.value();
auto totalReadsRequired = std::ceil(static_cast<float>(bytes) / static_cast<float>(maximumRequestSize)); auto totalReadsRequired = std::ceil(static_cast<float>(bytes) / static_cast<float>(maximumRequestSize));
auto output = std::vector<unsigned char>(); auto output = Targets::TargetMemoryBuffer();
output.reserve(bytes); output.reserve(bytes);
for (float i = 1; i <= totalReadsRequired; i++) { for (float i = 1; i <= totalReadsRequired; i++) {
const auto bytesToRead = static_cast<std::uint32_t>( const auto bytesToRead = static_cast<TargetMemorySize>(
(bytes - output.size()) > maximumRequestSize ? maximumRequestSize : bytes - output.size() (bytes - output.size()) > maximumRequestSize ? maximumRequestSize : bytes - output.size()
); );
auto data = this->readMemory( auto data = this->readMemory(
type, type,
static_cast<std::uint32_t>(startAddress + output.size()), static_cast<TargetMemoryAddress>(startAddress + output.size()),
bytesToRead, bytesToRead,
excludedAddresses excludedAddresses
); );
@@ -1704,16 +1715,16 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
* This call to readMemory() will result in more than two response packets, so split it into multiple * This call to readMemory() will result in more than two response packets, so split it into multiple
* calls that will result in no more than two response packets per call. * calls that will result in no more than two response packets per call.
*/ */
auto output = std::vector<unsigned char>(); auto output = TargetMemoryBuffer();
for (float i = 1; i <= totalReadsRequired; i++) { for (float i = 1; i <= totalReadsRequired; i++) {
auto bytesToRead = static_cast<std::uint32_t>( auto bytesToRead = static_cast<TargetMemorySize>(
(bytes - output.size()) > (singlePacketSize * 2) ? (singlePacketSize * 2) (bytes - output.size()) > (singlePacketSize * 2) ? (singlePacketSize * 2)
: bytes - output.size() : bytes - output.size()
); );
auto data = this->readMemory( auto data = this->readMemory(
type, type,
static_cast<std::uint32_t>(startAddress + output.size()), static_cast<TargetMemoryAddress>(startAddress + output.size()),
bytesToRead, bytesToRead,
excludedAddresses excludedAddresses
); );
@@ -1740,8 +1751,12 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
return response.getMemoryBuffer(); return response.getMemoryBuffer();
} }
void EdbgAvr8Interface::writeMemory(Avr8MemoryType type, std::uint32_t startAddress, const TargetMemoryBuffer& buffer) { void EdbgAvr8Interface::writeMemory(
const auto bytes = static_cast<std::uint32_t>(buffer.size()); Avr8MemoryType type,
TargetMemoryAddress startAddress,
const TargetMemoryBuffer& buffer
) {
const auto bytes = static_cast<TargetMemorySize>(buffer.size());
if (this->alignmentRequired(type)) { if (this->alignmentRequired(type)) {
const auto alignedStartAddress = this->alignMemoryAddress(type, startAddress); const auto alignedStartAddress = this->alignMemoryAddress(type, startAddress);

View File

@@ -8,6 +8,7 @@
#include "src/DebugToolDrivers/TargetInterfaces/Microchip/AVR/AVR8/Avr8DebugInterface.hpp" #include "src/DebugToolDrivers/TargetInterfaces/Microchip/AVR/AVR8/Avr8DebugInterface.hpp"
#include "src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/Avr8Generic.hpp" #include "src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/Avr8Generic.hpp"
#include "src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/EdbgInterface.hpp" #include "src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/EdbgInterface.hpp"
#include "src/Targets/TargetMemory.hpp"
#include "src/Targets/Microchip/AVR/Target.hpp" #include "src/Targets/Microchip/AVR/Target.hpp"
#include "src/Targets/Microchip/AVR/AVR8/Family.hpp" #include "src/Targets/Microchip/AVR/AVR8/Family.hpp"
#include "src/Targets/Microchip/AVR/AVR8/PhysicalInterface.hpp" #include "src/Targets/Microchip/AVR/AVR8/PhysicalInterface.hpp"
@@ -65,7 +66,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
* *
* @param maximumSize * @param maximumSize
*/ */
void setMaximumMemoryAccessSizePerRequest(std::uint32_t maximumSize) { void setMaximumMemoryAccessSizePerRequest(Targets::TargetMemorySize maximumSize) {
this->maximumMemoryAccessSizePerRequest = maximumSize; this->maximumMemoryAccessSizePerRequest = maximumSize;
} }
@@ -122,7 +123,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
* @param address * @param address
* The (byte) address to run to. * The (byte) address to run to.
*/ */
void runTo(std::uint32_t address) override; void runTo(Targets::TargetProgramCounter address) override;
/** /**
* Issues the "step" command to the debug tool, stepping the execution on the target. The stepping can be * Issues the "step" command to the debug tool, stepping the execution on the target. The stepping can be
@@ -152,7 +153,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
* *
* @return * @return
*/ */
std::uint32_t getProgramCounter() override; Targets::TargetProgramCounter getProgramCounter() override;
/** /**
* Issues the "PC Write" command to the debug tool, setting the program counter on the target. * Issues the "PC Write" command to the debug tool, setting the program counter on the target.
@@ -160,7 +161,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
* @param programCounter * @param programCounter
* The byte address to set as the program counter. * The byte address to set as the program counter.
*/ */
void setProgramCounter(std::uint32_t programCounter) override; void setProgramCounter(Targets::TargetProgramCounter programCounter) override;
/** /**
* Issues the "Get ID" command to the debug tool, to extract the signature from the target. * Issues the "Get ID" command to the debug tool, to extract the signature from the target.
@@ -176,7 +177,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
* @param address * @param address
* The byte address to position the breakpoint. * The byte address to position the breakpoint.
*/ */
void setBreakpoint(std::uint32_t address) override; void setBreakpoint(Targets::TargetMemoryAddress address) override;
/** /**
* Issues the "Software Breakpoint Clear" command to the debug tool, clearing any breakpoint at the given * Issues the "Software Breakpoint Clear" command to the debug tool, clearing any breakpoint at the given
@@ -185,7 +186,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
* @param address * @param address
* The byte address of the breakpoint to clear. * The byte address of the breakpoint to clear.
*/ */
void clearBreakpoint(std::uint32_t address) override; void clearBreakpoint(Targets::TargetMemoryAddress address) override;
/** /**
* Issues the "Software Breakpoint Clear All" command to the debug tool, clearing all software breakpoints * Issues the "Software Breakpoint Clear All" command to the debug tool, clearing all software breakpoints
@@ -222,8 +223,8 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
*/ */
Targets::TargetMemoryBuffer readMemory( Targets::TargetMemoryBuffer readMemory(
Targets::TargetMemoryType memoryType, Targets::TargetMemoryType memoryType,
std::uint32_t startAddress, Targets::TargetMemoryAddress startAddress,
std::uint32_t bytes, Targets::TargetMemorySize bytes,
const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges = {} const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges = {}
) override; ) override;
@@ -238,7 +239,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
*/ */
void writeMemory( void writeMemory(
Targets::TargetMemoryType memoryType, Targets::TargetMemoryType memoryType,
std::uint32_t startAddress, Targets::TargetMemoryAddress startAddress,
const Targets::TargetMemoryBuffer& buffer const Targets::TargetMemoryBuffer& buffer
) override; ) override;
@@ -321,7 +322,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
/** /**
* See the comment for EdbgAvr8Interface::setMaximumMemoryAccessSizePerRequest(). * See the comment for EdbgAvr8Interface::setMaximumMemoryAccessSizePerRequest().
*/ */
std::optional<std::uint32_t> maximumMemoryAccessSizePerRequest; std::optional<Targets::TargetMemorySize> maximumMemoryAccessSizePerRequest;
/** /**
* We keep record of the current target state for caching purposes. We'll only refresh the target state if the * We keep record of the current target state for caching purposes. We'll only refresh the target state if the
@@ -492,7 +493,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
* @param address * @param address
* @return * @return
*/ */
std::uint32_t alignMemoryAddress(Avr8MemoryType memoryType, std::uint32_t address); Targets::TargetMemoryAddress alignMemoryAddress(Avr8MemoryType memoryType, Targets::TargetMemoryAddress address);
/** /**
* Aligns a number of bytes used to address memory, for a given memory type's page size. * Aligns a number of bytes used to address memory, for a given memory type's page size.
@@ -501,7 +502,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
* @param bytes * @param bytes
* @return * @return
*/ */
std::uint32_t alignMemoryBytes(Avr8MemoryType memoryType, std::uint32_t bytes); Targets::TargetMemorySize alignMemoryBytes(Avr8MemoryType memoryType, Targets::TargetMemorySize bytes);
/** /**
* Reads memory on the target. * Reads memory on the target.
@@ -527,9 +528,9 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
*/ */
Targets::TargetMemoryBuffer readMemory( Targets::TargetMemoryBuffer readMemory(
Avr8MemoryType type, Avr8MemoryType type,
std::uint32_t startAddress, Targets::TargetMemoryAddress startAddress,
std::uint32_t bytes, Targets::TargetMemorySize bytes,
const std::set<std::uint32_t>& excludedAddresses = {} const std::set<Targets::TargetMemoryAddress>& excludedAddresses = {}
); );
/** /**
@@ -543,7 +544,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
* @param address * @param address
* @param buffer * @param buffer
*/ */
void writeMemory(Avr8MemoryType type, std::uint32_t address, const Targets::TargetMemoryBuffer& buffer); void writeMemory(Avr8MemoryType type, Targets::TargetMemoryAddress address, const Targets::TargetMemoryBuffer& buffer);
/** /**
* Fetches the current target state. * Fetches the current target state.

View File

@@ -3,6 +3,9 @@
#include <cstdint> #include <cstdint>
#include "Avr8GenericResponseFrame.hpp" #include "Avr8GenericResponseFrame.hpp"
#include "src/Targets/TargetMemory.hpp"
#include "src/Exceptions/Exception.hpp" #include "src/Exceptions/Exception.hpp"
namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::ResponseFrames::Avr8Generic namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::ResponseFrames::Avr8Generic
@@ -13,7 +16,7 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::ResponseFrame
GetProgramCounter() = default; GetProgramCounter() = default;
explicit GetProgramCounter(const std::vector<AvrResponse>& avrResponses): Avr8GenericResponseFrame(avrResponses) {} explicit GetProgramCounter(const std::vector<AvrResponse>& avrResponses): Avr8GenericResponseFrame(avrResponses) {}
std::uint32_t extractProgramCounter() { Targets::TargetProgramCounter extractProgramCounter() {
/* /*
* The payload for the PC Read command should always consist of six bytes. Thr first two being the * The payload for the PC Read command should always consist of six bytes. Thr first two being the
* command ID and version, the other four being the PC. The four PC bytes are little-endian. * command ID and version, the other four being the PC. The four PC bytes are little-endian.
@@ -24,7 +27,9 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::ResponseFrame
"frame - unexpected payload size."); "frame - unexpected payload size.");
} }
return static_cast<std::uint32_t>(payload[5] << 24 | payload[4] << 16 | payload[3] << 8 | payload[2]) * 2; return static_cast<Targets::TargetProgramCounter>(
payload[5] << 24 | payload[4] << 16 | payload[3] << 8 | payload[2]
) * 2;
} }
}; };
} }

View File

@@ -81,7 +81,7 @@ namespace Bloom::DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8
/** /**
* Continue execution up to a specific byte address. * Continue execution up to a specific byte address.
*/ */
virtual void runTo(std::uint32_t address) = 0; virtual void runTo(Targets::TargetProgramCounter address) = 0;
/** /**
* Step execution on teh AVR8 target. * Step execution on teh AVR8 target.
@@ -122,14 +122,14 @@ namespace Bloom::DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8
* *
* @param address * @param address
*/ */
virtual void setBreakpoint(std::uint32_t address) = 0; virtual void setBreakpoint(Targets::TargetMemoryAddress address) = 0;
/** /**
* Should remove a software breakpoint at a given address. * Should remove a software breakpoint at a given address.
* *
* @param address * @param address
*/ */
virtual void clearBreakpoint(std::uint32_t address) = 0; virtual void clearBreakpoint(Targets::TargetMemoryAddress address) = 0;
/** /**
* Should remove all software and hardware breakpoints on the target. * Should remove all software and hardware breakpoints on the target.
@@ -141,14 +141,14 @@ namespace Bloom::DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8
* *
* @return * @return
*/ */
virtual std::uint32_t getProgramCounter() = 0; virtual Targets::TargetProgramCounter getProgramCounter() = 0;
/** /**
* Should update the program counter value on the target. * Should update the program counter value on the target.
* *
* @param programCounter * @param programCounter
*/ */
virtual void setProgramCounter(std::uint32_t programCounter) = 0; virtual void setProgramCounter(Targets::TargetProgramCounter programCounter) = 0;
/** /**
* Should read the requested registers from the target. * Should read the requested registers from the target.
@@ -178,8 +178,8 @@ namespace Bloom::DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8
*/ */
virtual Targets::TargetMemoryBuffer readMemory( virtual Targets::TargetMemoryBuffer readMemory(
Targets::TargetMemoryType memoryType, Targets::TargetMemoryType memoryType,
std::uint32_t startAddress, Targets::TargetMemoryAddress startAddress,
std::uint32_t bytes, Targets::TargetMemorySize bytes,
const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges = {} const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges = {}
) = 0; ) = 0;
@@ -192,7 +192,7 @@ namespace Bloom::DebugToolDrivers::TargetInterfaces::Microchip::Avr::Avr8
*/ */
virtual void writeMemory( virtual void writeMemory(
Targets::TargetMemoryType memoryType, Targets::TargetMemoryType memoryType,
std::uint32_t startAddress, Targets::TargetMemoryAddress startAddress,
const Targets::TargetMemoryBuffer& buffer const Targets::TargetMemoryBuffer& buffer
) = 0; ) = 0;

View File

@@ -14,13 +14,13 @@ namespace Bloom::Events
static inline const std::string name = "MemoryWrittenToTarget"; static inline const std::string name = "MemoryWrittenToTarget";
Targets::TargetMemoryType memoryType; Targets::TargetMemoryType memoryType;
std::uint32_t startAddress; Targets::TargetMemoryAddress startAddress;
std::uint32_t size; Targets::TargetMemorySize size;
MemoryWrittenToTarget( MemoryWrittenToTarget(
Targets::TargetMemoryType memoryType, Targets::TargetMemoryType memoryType,
std::uint32_t startAddress, Targets::TargetMemoryAddress startAddress,
std::uint32_t size Targets::TargetMemorySize size
) )
: memoryType(memoryType) : memoryType(memoryType)
, startAddress(startAddress) , startAddress(startAddress)

View File

@@ -4,7 +4,9 @@
#include <string> #include <string>
#include "Event.hpp" #include "Event.hpp"
#include "src/Targets/Target.hpp"
#include "src/Targets/TargetBreakpoint.hpp"
#include "src/Targets/TargetMemory.hpp"
namespace Bloom::Events namespace Bloom::Events
{ {
@@ -13,11 +15,14 @@ namespace Bloom::Events
public: public:
static constexpr EventType type = EventType::TARGET_EXECUTION_STOPPED; static constexpr EventType type = EventType::TARGET_EXECUTION_STOPPED;
static inline const std::string name = "TargetExecutionStopped"; static inline const std::string name = "TargetExecutionStopped";
std::uint32_t programCounter;
Targets::TargetProgramCounter programCounter;
Targets::TargetBreakCause breakCause; Targets::TargetBreakCause breakCause;
TargetExecutionStopped(std::uint32_t programCounter, Targets::TargetBreakCause breakCause) : TargetExecutionStopped(Targets::TargetProgramCounter programCounter, Targets::TargetBreakCause breakCause)
programCounter(programCounter), breakCause(breakCause) {} : programCounter(programCounter)
, breakCause(breakCause)
{}
[[nodiscard]] EventType getType() const override { [[nodiscard]] EventType getType() const override {
return TargetExecutionStopped::type; return TargetExecutionStopped::type;

View File

@@ -2,6 +2,8 @@
#include "InsightWorkerTask.hpp" #include "InsightWorkerTask.hpp"
#include "src/Targets/TargetMemory.hpp"
namespace Bloom namespace Bloom
{ {
class ReadProgramCounter: public InsightWorkerTask class ReadProgramCounter: public InsightWorkerTask
@@ -12,7 +14,7 @@ namespace Bloom
ReadProgramCounter() = default; ReadProgramCounter() = default;
signals: signals:
void programCounterRead(std::uint32_t programCounter); void programCounterRead(Targets::TargetProgramCounter programCounter);
protected: protected:
void run(TargetController::TargetControllerConsole& targetControllerConsole) override; void run(TargetController::TargetControllerConsole& targetControllerConsole) override;

View File

@@ -2,6 +2,8 @@
#include "InsightWorkerTask.hpp" #include "InsightWorkerTask.hpp"
#include "src/Targets/TargetMemory.hpp"
namespace Bloom namespace Bloom
{ {
class ReadStackPointer: public InsightWorkerTask class ReadStackPointer: public InsightWorkerTask
@@ -12,7 +14,7 @@ namespace Bloom
ReadStackPointer() = default; ReadStackPointer() = default;
signals: signals:
void stackPointerRead(std::uint32_t stackPointer); void stackPointerRead(Targets::TargetStackPointer stackPointer);
protected: protected:
void run(TargetController::TargetControllerConsole& targetControllerConsole) override; void run(TargetController::TargetControllerConsole& targetControllerConsole) override;

View File

@@ -25,10 +25,10 @@ namespace Bloom
for (auto i = 0; i < readsRequired; i++) { for (auto i = 0; i < readsRequired; i++) {
auto dataSegment = targetControllerConsole.readMemory( auto dataSegment = targetControllerConsole.readMemory(
this->memoryType, this->memoryType,
this->startAddress + static_cast<std::uint32_t>(readSize * i), this->startAddress + static_cast<Targets::TargetMemoryAddress>(readSize * i),
(this->size - data.size()) >= readSize (this->size - data.size()) >= readSize
? readSize ? readSize
: static_cast<std::uint32_t>(this->size - data.size()), : static_cast<Targets::TargetMemorySize>(this->size - data.size()),
this->excludedAddressRanges this->excludedAddressRanges
); );

View File

@@ -15,8 +15,8 @@ namespace Bloom
public: public:
ReadTargetMemory( ReadTargetMemory(
Targets::TargetMemoryType memoryType, Targets::TargetMemoryType memoryType,
std::uint32_t startAddress, Targets::TargetMemoryAddress startAddress,
std::uint32_t size, Targets::TargetMemorySize size,
const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges = {} const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges = {}
) )
: memoryType(memoryType) : memoryType(memoryType)
@@ -32,8 +32,8 @@ namespace Bloom
private: private:
Targets::TargetMemoryType memoryType; Targets::TargetMemoryType memoryType;
std::uint32_t startAddress; Targets::TargetMemoryAddress startAddress;
std::uint32_t size; Targets::TargetMemorySize size;
std::set<Targets::TargetMemoryAddressRange> excludedAddressRanges; std::set<Targets::TargetMemoryAddressRange> excludedAddressRanges;
}; };
} }

View File

@@ -13,7 +13,8 @@
#include "src/Logger/Logger.hpp" #include "src/Logger/Logger.hpp"
#include "src/Exceptions/Exception.hpp" #include "src/Exceptions/Exception.hpp"
#include "src/Helpers/Paths.hpp" #include "src/Helpers/Paths.hpp"
#include "src/Targets/TargetDescriptor.hpp"
#include "src/Targets/TargetMemory.hpp"
#include "src/Insight/InsightWorker/Tasks/ReadProgramCounter.hpp" #include "src/Insight/InsightWorker/Tasks/ReadProgramCounter.hpp"
@@ -896,7 +897,7 @@ namespace Bloom
readProgramCounterTask, readProgramCounterTask,
&ReadProgramCounter::programCounterRead, &ReadProgramCounter::programCounterRead,
this, this,
[this] (std::uint32_t programCounter) { [this] (Targets::TargetProgramCounter programCounter) {
this->programCounterValueLabel->setText( this->programCounterValueLabel->setText(
"0x" + QString::number(programCounter, 16).toUpper() + " (" + QString::number(programCounter) + ")" "0x" + QString::number(programCounter, 16).toUpper() + " (" + QString::number(programCounter) + ")"
); );

View File

@@ -7,8 +7,8 @@
namespace Bloom::Widgets namespace Bloom::Widgets
{ {
AnnotationItem::AnnotationItem( AnnotationItem::AnnotationItem(
std::uint32_t startAddress, Targets::TargetMemoryAddress startAddress,
std::size_t size, Targets::TargetMemorySize size,
QString labelText, QString labelText,
AnnotationItemPosition position AnnotationItemPosition position
): ):

View File

@@ -3,6 +3,8 @@
#include <QGraphicsItem> #include <QGraphicsItem>
#include <cstdint> #include <cstdint>
#include "src/Targets/TargetMemory.hpp"
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/FocusedMemoryRegion.hpp" #include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/FocusedMemoryRegion.hpp"
namespace Bloom::Widgets namespace Bloom::Widgets
@@ -22,14 +24,14 @@ namespace Bloom::Widgets
const int width; const int width;
const int height; const int height;
const std::uint32_t startAddress; const Targets::TargetMemoryAddress startAddress;
const std::uint32_t endAddress; const Targets::TargetMemoryAddress endAddress;
const std::size_t size; const Targets::TargetMemorySize size;
AnnotationItemPosition position = AnnotationItemPosition::TOP; AnnotationItemPosition position = AnnotationItemPosition::TOP;
AnnotationItem( AnnotationItem(
std::uint32_t startAddress, Targets::TargetMemoryAddress startAddress,
std::size_t size, Targets::TargetMemorySize size,
QString labelText, QString labelText,
AnnotationItemPosition position AnnotationItemPosition position
); );

View File

@@ -6,8 +6,8 @@ namespace Bloom::Widgets
{ {
ByteItem::ByteItem( ByteItem::ByteItem(
std::size_t byteIndex, std::size_t byteIndex,
std::uint32_t address, Targets::TargetMemoryAddress address,
std::optional<std::uint32_t>& currentStackPointer, std::optional<Targets::TargetStackPointer>& currentStackPointer,
ByteItem** hoveredByteItem, ByteItem** hoveredByteItem,
AnnotationItem** hoveredAnnotationItem, AnnotationItem** hoveredAnnotationItem,
std::set<ByteItem*>& highlightedByteItems, std::set<ByteItem*>& highlightedByteItems,

View File

@@ -7,6 +7,8 @@
#include <optional> #include <optional>
#include <set> #include <set>
#include "src/Targets/TargetMemory.hpp"
#include "HexViewerWidgetSettings.hpp" #include "HexViewerWidgetSettings.hpp"
#include "AnnotationItem.hpp" #include "AnnotationItem.hpp"
@@ -25,7 +27,7 @@ namespace Bloom::Widgets
static constexpr int BOTTOM_MARGIN = 5; static constexpr int BOTTOM_MARGIN = 5;
std::size_t byteIndex; std::size_t byteIndex;
std::uint32_t address = 0x00; Targets::TargetMemoryAddress address = 0x00;
QString addressHex; QString addressHex;
QString relativeAddressHex; QString relativeAddressHex;
@@ -40,8 +42,8 @@ namespace Bloom::Widgets
ByteItem( ByteItem(
std::size_t byteIndex, std::size_t byteIndex,
std::uint32_t address, Targets::TargetMemoryAddress address,
std::optional<std::uint32_t>& currentStackPointer, std::optional<Targets::TargetStackPointer>& currentStackPointer,
ByteItem** hoveredByteItem, ByteItem** hoveredByteItem,
AnnotationItem** hoveredAnnotationItem, AnnotationItem** hoveredAnnotationItem,
std::set<ByteItem*>& highlightedByteItems, std::set<ByteItem*>& highlightedByteItems,
@@ -71,7 +73,7 @@ namespace Bloom::Widgets
ByteItem** hoveredByteItem; ByteItem** hoveredByteItem;
AnnotationItem** hoveredAnnotationItem; AnnotationItem** hoveredAnnotationItem;
std::optional<std::uint32_t>& currentStackPointer; std::optional<Targets::TargetStackPointer>& currentStackPointer;
std::set<ByteItem*>& highlightedByteItems; std::set<ByteItem*>& highlightedByteItems;
const QColor* getBackgroundColor(); const QColor* getBackgroundColor();

View File

@@ -36,7 +36,7 @@ namespace Bloom::Widgets
} }
void ByteItemContainerGraphicsView::scrollToByteItemAtAddress(std::uint32_t address) { void ByteItemContainerGraphicsView::scrollToByteItemAtAddress(Targets::TargetMemoryAddress address) {
this->centerOn(this->scene->getByteItemPositionByAddress(address)); this->centerOn(this->scene->getByteItemPositionByAddress(address));
} }

View File

@@ -34,7 +34,7 @@ namespace Bloom::Widgets
return this->scene; return this->scene;
} }
void scrollToByteItemAtAddress(std::uint32_t address); void scrollToByteItemAtAddress(Targets::TargetMemoryAddress address);
protected: protected:
bool event(QEvent* event) override; bool event(QEvent* event) override;

View File

@@ -32,7 +32,7 @@ namespace Bloom::Widgets
// Construct ByteWidget objects // Construct ByteWidget objects
const auto memorySize = this->targetMemoryDescriptor.size(); const auto memorySize = this->targetMemoryDescriptor.size();
const auto startAddress = this->targetMemoryDescriptor.addressRange.startAddress; const auto startAddress = this->targetMemoryDescriptor.addressRange.startAddress;
for (std::uint32_t i = 0; i < memorySize; i++) { for (Targets::TargetMemorySize i = 0; i < memorySize; i++) {
const auto address = startAddress + i; const auto address = startAddress + i;
auto* byteWidget = new ByteItem( auto* byteWidget = new ByteItem(

View File

@@ -53,13 +53,13 @@ namespace Bloom::Widgets
); );
void updateValues(const Targets::TargetMemoryBuffer& buffer); void updateValues(const Targets::TargetMemoryBuffer& buffer);
void updateStackPointer(std::uint32_t stackPointer); void updateStackPointer(Targets::TargetStackPointer stackPointer);
void setHighlightedAddresses(const std::set<std::uint32_t>& highlightedAddresses); void setHighlightedAddresses(const std::set<Targets::TargetMemoryAddress>& highlightedAddresses);
void refreshRegions(); void refreshRegions();
void adjustSize(bool forced = false); void adjustSize(bool forced = false);
void setEnabled(bool enabled); void setEnabled(bool enabled);
void invalidateChildItemCaches(); void invalidateChildItemCaches();
QPointF getByteItemPositionByAddress(std::uint32_t address); QPointF getByteItemPositionByAddress(Targets::TargetMemoryAddress address);
signals: signals:
void byteWidgetsAdjusted(); void byteWidgetsAdjusted();
@@ -81,11 +81,11 @@ namespace Bloom::Widgets
ByteItem* hoveredByteWidget = nullptr; ByteItem* hoveredByteWidget = nullptr;
AnnotationItem* hoveredAnnotationItem = nullptr; AnnotationItem* hoveredAnnotationItem = nullptr;
std::optional<std::uint32_t> currentStackPointer; std::optional<Targets::TargetStackPointer> currentStackPointer;
Targets::TargetMemoryBuffer lastValueBuffer; Targets::TargetMemoryBuffer lastValueBuffer;
std::map<std::uint32_t, ByteItem*> byteItemsByAddress; std::map<Targets::TargetMemoryAddress, ByteItem*> byteItemsByAddress;
std::vector<AnnotationItem*> annotationItems; std::vector<AnnotationItem*> annotationItems;
std::vector<ValueAnnotationItem*> valueAnnotationItems; std::vector<ValueAnnotationItem*> valueAnnotationItems;
std::map<std::size_t, std::vector<ByteItem*>> byteItemsByRowIndex; std::map<std::size_t, std::vector<ByteItem*>> byteItemsByRowIndex;

View File

@@ -173,7 +173,7 @@ namespace Bloom::Widgets
this->byteItemGraphicsScene->refreshRegions(); this->byteItemGraphicsScene->refreshRegions();
} }
void HexViewerWidget::setStackPointer(std::uint32_t stackPointer) { void HexViewerWidget::setStackPointer(Targets::TargetStackPointer stackPointer) {
this->byteItemGraphicsScene->updateStackPointer(stackPointer); this->byteItemGraphicsScene->updateStackPointer(stackPointer);
} }

View File

@@ -39,7 +39,7 @@ namespace Bloom::Widgets
void updateValues(const Targets::TargetMemoryBuffer& buffer); void updateValues(const Targets::TargetMemoryBuffer& buffer);
void refreshRegions(); void refreshRegions();
void setStackPointer(std::uint32_t stackPointer); void setStackPointer(Targets::TargetStackPointer stackPointer);
protected: protected:
void resizeEvent(QResizeEvent* event) override; void resizeEvent(QResizeEvent* event) override;

View File

@@ -241,7 +241,7 @@ namespace Bloom::Widgets
readStackPointerTask, readStackPointerTask,
&ReadStackPointer::stackPointerRead, &ReadStackPointer::stackPointerRead,
this, this,
[this] (std::uint32_t stackPointer) { [this] (Targets::TargetStackPointer stackPointer) {
this->hexViewerWidget->setStackPointer(stackPointer); this->hexViewerWidget->setStackPointer(stackPointer);
} }
); );

View File

@@ -19,14 +19,14 @@ namespace Bloom::TargetController::Commands
static inline const std::string name = "ReadTargetMemory"; static inline const std::string name = "ReadTargetMemory";
Targets::TargetMemoryType memoryType; Targets::TargetMemoryType memoryType;
std::uint32_t startAddress; Targets::TargetMemoryAddress startAddress;
std::uint32_t bytes; Targets::TargetMemorySize bytes;
std::set<Targets::TargetMemoryAddressRange> excludedAddressRanges; std::set<Targets::TargetMemoryAddressRange> excludedAddressRanges;
ReadTargetMemory( ReadTargetMemory(
Targets::TargetMemoryType memoryType, Targets::TargetMemoryType memoryType,
std::uint32_t startAddress, Targets::TargetMemoryAddress startAddress,
std::uint32_t bytes, Targets::TargetMemorySize bytes,
const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges
) )
: memoryType(memoryType) : memoryType(memoryType)

View File

@@ -4,6 +4,8 @@
#include "Command.hpp" #include "Command.hpp"
#include "src/Targets/TargetMemory.hpp"
namespace Bloom::TargetController::Commands namespace Bloom::TargetController::Commands
{ {
class ResumeTargetExecution: public Command class ResumeTargetExecution: public Command
@@ -12,10 +14,10 @@ namespace Bloom::TargetController::Commands
static constexpr CommandType type = CommandType::RESUME_TARGET_EXECUTION; static constexpr CommandType type = CommandType::RESUME_TARGET_EXECUTION;
static inline const std::string name = "ResumeTargetExecution"; static inline const std::string name = "ResumeTargetExecution";
std::optional<std::uint32_t> fromProgramCounter; std::optional<Targets::TargetProgramCounter> fromProgramCounter;
ResumeTargetExecution() = default; ResumeTargetExecution() = default;
explicit ResumeTargetExecution(std::uint32_t fromProgramCounter) explicit ResumeTargetExecution(Targets::TargetProgramCounter fromProgramCounter)
: fromProgramCounter(fromProgramCounter) : fromProgramCounter(fromProgramCounter)
{}; {};

View File

@@ -5,6 +5,7 @@
#include "Command.hpp" #include "Command.hpp"
#include "src/Targets/TargetBreakpoint.hpp" #include "src/Targets/TargetBreakpoint.hpp"
#include "src/Targets/TargetMemory.hpp"
namespace Bloom::TargetController::Commands namespace Bloom::TargetController::Commands
{ {
@@ -14,9 +15,9 @@ namespace Bloom::TargetController::Commands
static constexpr CommandType type = CommandType::SET_TARGET_PROGRAM_COUNTER; static constexpr CommandType type = CommandType::SET_TARGET_PROGRAM_COUNTER;
static inline const std::string name = "SetTargetProgramCounter"; static inline const std::string name = "SetTargetProgramCounter";
std::uint32_t address = 0; Targets::TargetProgramCounter address = 0;
explicit SetTargetProgramCounter(std::uint32_t address) explicit SetTargetProgramCounter(Targets::TargetProgramCounter address)
: address(address) : address(address)
{}; {};

View File

@@ -4,6 +4,8 @@
#include "Command.hpp" #include "Command.hpp"
#include "src/Targets/TargetMemory.hpp"
namespace Bloom::TargetController::Commands namespace Bloom::TargetController::Commands
{ {
class StepTargetExecution: public Command class StepTargetExecution: public Command
@@ -12,10 +14,10 @@ namespace Bloom::TargetController::Commands
static constexpr CommandType type = CommandType::STEP_TARGET_EXECUTION; static constexpr CommandType type = CommandType::STEP_TARGET_EXECUTION;
static inline const std::string name = "StepTargetExecution"; static inline const std::string name = "StepTargetExecution";
std::optional<std::uint32_t> fromProgramCounter; std::optional<Targets::TargetProgramCounter> fromProgramCounter;
StepTargetExecution() = default; StepTargetExecution() = default;
explicit StepTargetExecution(std::uint32_t fromProgramCounter) explicit StepTargetExecution(Targets::TargetProgramCounter fromProgramCounter)
: fromProgramCounter(fromProgramCounter) : fromProgramCounter(fromProgramCounter)
{}; {};

View File

@@ -14,12 +14,12 @@ namespace Bloom::TargetController::Commands
static inline const std::string name = "WriteTargetMemory"; static inline const std::string name = "WriteTargetMemory";
Targets::TargetMemoryType memoryType; Targets::TargetMemoryType memoryType;
std::uint32_t startAddress; Targets::TargetMemoryAddress startAddress;
Targets::TargetMemoryBuffer buffer; Targets::TargetMemoryBuffer buffer;
WriteTargetMemory( WriteTargetMemory(
Targets::TargetMemoryType memoryType, Targets::TargetMemoryType memoryType,
std::uint32_t startAddress, Targets::TargetMemoryAddress startAddress,
const Targets::TargetMemoryBuffer& buffer const Targets::TargetMemoryBuffer& buffer
) )
: memoryType(memoryType) : memoryType(memoryType)

View File

@@ -4,6 +4,8 @@
#include "Response.hpp" #include "Response.hpp"
#include "src/Targets/TargetMemory.hpp"
namespace Bloom::TargetController::Responses namespace Bloom::TargetController::Responses
{ {
class TargetProgramCounter: public Response class TargetProgramCounter: public Response
@@ -11,9 +13,9 @@ namespace Bloom::TargetController::Responses
public: public:
static constexpr ResponseType type = ResponseType::TARGET_PROGRAM_COUNTER; static constexpr ResponseType type = ResponseType::TARGET_PROGRAM_COUNTER;
std::uint32_t programCounter; Targets::TargetProgramCounter programCounter;
explicit TargetProgramCounter(std::uint32_t programCounter) explicit TargetProgramCounter(Targets::TargetProgramCounter programCounter)
: programCounter(programCounter) : programCounter(programCounter)
{} {}

View File

@@ -4,6 +4,8 @@
#include "Response.hpp" #include "Response.hpp"
#include "src/Targets/TargetMemory.hpp"
namespace Bloom::TargetController::Responses namespace Bloom::TargetController::Responses
{ {
class TargetStackPointer: public Response class TargetStackPointer: public Response
@@ -11,9 +13,9 @@ namespace Bloom::TargetController::Responses
public: public:
static constexpr ResponseType type = ResponseType::TARGET_STACK_POINTER; static constexpr ResponseType type = ResponseType::TARGET_STACK_POINTER;
std::uint32_t stackPointer; Targets::TargetStackPointer stackPointer;
explicit TargetStackPointer(std::uint32_t stackPointer) explicit TargetStackPointer(Targets::TargetStackPointer stackPointer)
: stackPointer(stackPointer) : stackPointer(stackPointer)
{} {}

View File

@@ -648,8 +648,8 @@ namespace Bloom::TargetController
} }
TargetRegisterDescriptors TargetControllerComponent::getRegisterDescriptorsWithinAddressRange( TargetRegisterDescriptors TargetControllerComponent::getRegisterDescriptorsWithinAddressRange(
std::uint32_t startAddress, Targets::TargetMemoryAddress startAddress,
std::uint32_t endAddress, Targets::TargetMemoryAddress endAddress,
Targets::TargetMemoryType memoryType Targets::TargetMemoryType memoryType
) { ) {
auto output = TargetRegisterDescriptors(); auto output = TargetRegisterDescriptors();

View File

@@ -279,8 +279,8 @@ namespace Bloom::TargetController
* @return * @return
*/ */
Targets::TargetRegisterDescriptors getRegisterDescriptorsWithinAddressRange( Targets::TargetRegisterDescriptors getRegisterDescriptorsWithinAddressRange(
std::uint32_t startAddress, Targets::TargetMemoryAddress startAddress,
std::uint32_t endAddress, Targets::TargetMemoryAddress endAddress,
Targets::TargetMemoryType memoryType Targets::TargetMemoryType memoryType
); );

View File

@@ -52,8 +52,12 @@ namespace Bloom::TargetController
using Targets::TargetRegisterDescriptors; using Targets::TargetRegisterDescriptors;
using Targets::TargetMemoryType; using Targets::TargetMemoryType;
using Targets::TargetMemoryAddress;
using Targets::TargetMemorySize;
using Targets::TargetMemoryAddressRange; using Targets::TargetMemoryAddressRange;
using Targets::TargetMemoryBuffer; using Targets::TargetMemoryBuffer;
using Targets::TargetProgramCounter;
using Targets::TargetStackPointer;
using Targets::TargetBreakpoint; using Targets::TargetBreakpoint;
@@ -98,7 +102,7 @@ namespace Bloom::TargetController
); );
} }
void TargetControllerConsole::continueTargetExecution(std::optional<std::uint32_t> fromAddress) { void TargetControllerConsole::continueTargetExecution(std::optional<TargetProgramCounter> fromAddress) {
auto resumeExecutionCommand = std::make_unique<ResumeTargetExecution>(); auto resumeExecutionCommand = std::make_unique<ResumeTargetExecution>();
if (fromAddress.has_value()) { if (fromAddress.has_value()) {
@@ -111,7 +115,7 @@ namespace Bloom::TargetController
); );
} }
void TargetControllerConsole::stepTargetExecution(std::optional<std::uint32_t> fromAddress) { void TargetControllerConsole::stepTargetExecution(std::optional<TargetProgramCounter> fromAddress) {
auto stepExecutionCommand = std::make_unique<StepTargetExecution>(); auto stepExecutionCommand = std::make_unique<StepTargetExecution>();
if (fromAddress.has_value()) { if (fromAddress.has_value()) {
@@ -140,8 +144,8 @@ namespace Bloom::TargetController
TargetMemoryBuffer TargetControllerConsole::readMemory( TargetMemoryBuffer TargetControllerConsole::readMemory(
TargetMemoryType memoryType, TargetMemoryType memoryType,
std::uint32_t startAddress, TargetMemoryAddress startAddress,
std::uint32_t bytes, TargetMemorySize bytes,
const std::set<TargetMemoryAddressRange>& excludedAddressRanges const std::set<TargetMemoryAddressRange>& excludedAddressRanges
) { ) {
return this->commandManager.sendCommandAndWaitForResponse( return this->commandManager.sendCommandAndWaitForResponse(
@@ -157,7 +161,7 @@ namespace Bloom::TargetController
void TargetControllerConsole::writeMemory( void TargetControllerConsole::writeMemory(
TargetMemoryType memoryType, TargetMemoryType memoryType,
std::uint32_t startAddress, TargetMemoryAddress startAddress,
const TargetMemoryBuffer& buffer const TargetMemoryBuffer& buffer
) { ) {
this->commandManager.sendCommandAndWaitForResponse( this->commandManager.sendCommandAndWaitForResponse(
@@ -180,14 +184,14 @@ namespace Bloom::TargetController
); );
} }
std::uint32_t TargetControllerConsole::getProgramCounter() { TargetProgramCounter TargetControllerConsole::getProgramCounter() {
return this->commandManager.sendCommandAndWaitForResponse( return this->commandManager.sendCommandAndWaitForResponse(
std::make_unique<GetTargetProgramCounter>(), std::make_unique<GetTargetProgramCounter>(),
this->defaultTimeout this->defaultTimeout
)->programCounter; )->programCounter;
} }
void TargetControllerConsole::setProgramCounter(std::uint32_t address) { void TargetControllerConsole::setProgramCounter(TargetProgramCounter address) {
this->commandManager.sendCommandAndWaitForResponse( this->commandManager.sendCommandAndWaitForResponse(
std::make_unique<SetTargetProgramCounter>(address), std::make_unique<SetTargetProgramCounter>(address),
this->defaultTimeout this->defaultTimeout
@@ -208,7 +212,7 @@ namespace Bloom::TargetController
); );
} }
std::uint32_t TargetControllerConsole::getStackPointer() { TargetStackPointer TargetControllerConsole::getStackPointer() {
return this->commandManager.sendCommandAndWaitForResponse( return this->commandManager.sendCommandAndWaitForResponse(
std::make_unique<GetTargetStackPointer>(), std::make_unique<GetTargetStackPointer>(),
this->defaultTimeout this->defaultTimeout

View File

@@ -73,14 +73,14 @@ namespace Bloom::TargetController
* *
* @param fromAddress * @param fromAddress
*/ */
void continueTargetExecution(std::optional<std::uint32_t> fromAddress); void continueTargetExecution(std::optional<Targets::TargetProgramCounter> fromAddress);
/** /**
* Requests the TargetController to step execution on the target. * Requests the TargetController to step execution on the target.
* *
* @param fromAddress * @param fromAddress
*/ */
void stepTargetExecution(std::optional<std::uint32_t> fromAddress); void stepTargetExecution(std::optional<Targets::TargetProgramCounter> fromAddress);
/** /**
* Requests the TargetController to read register values from the target. * Requests the TargetController to read register values from the target.
@@ -110,8 +110,8 @@ namespace Bloom::TargetController
*/ */
Targets::TargetMemoryBuffer readMemory( Targets::TargetMemoryBuffer readMemory(
Targets::TargetMemoryType memoryType, Targets::TargetMemoryType memoryType,
std::uint32_t startAddress, Targets::TargetMemoryAddress startAddress,
std::uint32_t bytes, Targets::TargetMemorySize bytes,
const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges = {} const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges = {}
); );
@@ -124,7 +124,7 @@ namespace Bloom::TargetController
*/ */
void writeMemory( void writeMemory(
Targets::TargetMemoryType memoryType, Targets::TargetMemoryType memoryType,
std::uint32_t startAddress, Targets::TargetMemoryAddress startAddress,
const Targets::TargetMemoryBuffer& buffer const Targets::TargetMemoryBuffer& buffer
); );
@@ -147,14 +147,14 @@ namespace Bloom::TargetController
* *
* @return * @return
*/ */
std::uint32_t getProgramCounter(); Targets::TargetProgramCounter getProgramCounter();
/** /**
* Sets the target's program counter to the given address. * Sets the target's program counter to the given address.
* *
* @param address * @param address
*/ */
void setProgramCounter(std::uint32_t address); void setProgramCounter(Targets::TargetProgramCounter address);
/** /**
* Retrieves the pin states for a particular target variant. * Retrieves the pin states for a particular target variant.
@@ -176,7 +176,7 @@ namespace Bloom::TargetController
* *
* @return * @return
*/ */
std::uint32_t getStackPointer(); Targets::TargetStackPointer getStackPointer();
/** /**
* Triggers a reset on the target. The target will be held in a stopped state. * Triggers a reset on the target. The target will be held in a stopped state.

View File

@@ -90,8 +90,8 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
void step() override; void step() override;
void reset() override; void reset() override;
void setBreakpoint(std::uint32_t address) override; void setBreakpoint(TargetProgramCounter address) override;
void removeBreakpoint(std::uint32_t address) override; void removeBreakpoint(TargetProgramCounter address) override;
void clearAllBreakpoints() override; void clearAllBreakpoints() override;
void writeRegisters(TargetRegisters registers) override; void writeRegisters(TargetRegisters registers) override;
@@ -99,23 +99,23 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
TargetMemoryBuffer readMemory( TargetMemoryBuffer readMemory(
TargetMemoryType memoryType, TargetMemoryType memoryType,
std::uint32_t startAddress, TargetMemoryAddress startAddress,
std::uint32_t bytes, TargetMemorySize bytes,
const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges = {} const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges = {}
) override; ) override;
void writeMemory( void writeMemory(
TargetMemoryType memoryType, TargetMemoryType memoryType,
std::uint32_t startAddress, TargetMemoryAddress startAddress,
const TargetMemoryBuffer& buffer const TargetMemoryBuffer& buffer
) override; ) override;
TargetState getState() override; TargetState getState() override;
std::uint32_t getProgramCounter() override; TargetProgramCounter getProgramCounter() override;
TargetRegister getProgramCounterRegister(); TargetRegister getProgramCounterRegister();
void setProgramCounter(std::uint32_t programCounter) override; void setProgramCounter(TargetProgramCounter programCounter) override;
std::uint32_t getStackPointer() override; TargetStackPointer getStackPointer() override;
std::map<int, TargetPinState> getPinStates(int variantId) override; std::map<int, TargetPinState> getPinStates(int variantId) override;
void setPinState( void setPinState(
@@ -186,6 +186,6 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
* @param address * @param address
* @return * @return
*/ */
ProgramMemorySection getProgramMemorySectionFromAddress(std::uint32_t address); ProgramMemorySection getProgramMemorySectionFromAddress(TargetMemoryAddress address);
}; };
} }

View File

@@ -202,14 +202,14 @@ namespace Bloom::Targets
* *
* @param address * @param address
*/ */
virtual void setBreakpoint(std::uint32_t address) = 0; virtual void setBreakpoint(TargetMemoryAddress address) = 0;
/** /**
* Should remove a breakpoint at the given address. * Should remove a breakpoint at the given address.
* *
* @param address * @param address
*/ */
virtual void removeBreakpoint(std::uint32_t address) = 0; virtual void removeBreakpoint(TargetMemoryAddress address) = 0;
/** /**
* Should clear all breakpoints on the target. * Should clear all breakpoints on the target.
@@ -246,8 +246,8 @@ namespace Bloom::Targets
*/ */
virtual TargetMemoryBuffer readMemory( virtual TargetMemoryBuffer readMemory(
TargetMemoryType memoryType, TargetMemoryType memoryType,
std::uint32_t startAddress, TargetMemoryAddress startAddress,
std::uint32_t bytes, TargetMemorySize bytes,
const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges = {} const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges = {}
) = 0; ) = 0;
@@ -258,7 +258,7 @@ namespace Bloom::Targets
* @param startAddress * @param startAddress
* @param buffer * @param buffer
*/ */
virtual void writeMemory(TargetMemoryType memoryType, std::uint32_t startAddress, const TargetMemoryBuffer& buffer) = 0; virtual void writeMemory(TargetMemoryType memoryType, TargetMemoryAddress startAddress, const TargetMemoryBuffer& buffer) = 0;
/** /**
* Should return the current state of the target. * Should return the current state of the target.
@@ -272,21 +272,21 @@ namespace Bloom::Targets
* *
* @return * @return
*/ */
virtual std::uint32_t getProgramCounter() = 0; virtual TargetProgramCounter getProgramCounter() = 0;
/** /**
* Should update the program counter on the target. * Should update the program counter on the target.
* *
* @param programCounter * @param programCounter
*/ */
virtual void setProgramCounter(std::uint32_t programCounter) = 0; virtual void setProgramCounter(TargetProgramCounter programCounter) = 0;
/** /**
* Should fetch the current stack pointer value. * Should fetch the current stack pointer value.
* *
* @return * @return
*/ */
virtual std::uint32_t getStackPointer() = 0; virtual TargetStackPointer getStackPointer() = 0;
/** /**
* Should get the current pin states for each pin on the target, mapped by pin number * Should get the current pin states for each pin on the target, mapped by pin number

View File

@@ -2,6 +2,8 @@
#include <cstdint> #include <cstdint>
#include "TargetMemory.hpp"
namespace Bloom::Targets namespace Bloom::Targets
{ {
enum class TargetBreakCause: int enum class TargetBreakCause: int
@@ -10,18 +12,16 @@ namespace Bloom::Targets
UNKNOWN, UNKNOWN,
}; };
using TargetBreakpointAddress = std::uint32_t;
struct TargetBreakpoint struct TargetBreakpoint
{ {
/** /**
* Byte address of the breakpoint. * Byte address of the breakpoint.
*/ */
TargetBreakpointAddress address = 0; TargetMemoryAddress address = 0;
bool disabled = false; bool disabled = false;
TargetBreakpoint() = default; TargetBreakpoint() = default;
explicit TargetBreakpoint(TargetBreakpointAddress address): address(address) {}; explicit TargetBreakpoint(TargetMemoryAddress address): address(address) {};
}; };
} }

View File

@@ -6,6 +6,12 @@
namespace Bloom::Targets namespace Bloom::Targets
{ {
using TargetMemoryAddress = std::uint32_t;
using TargetMemorySize = std::uint32_t;
using TargetProgramCounter = TargetMemoryAddress;
using TargetStackPointer = TargetMemoryAddress;
using TargetMemoryBuffer = std::vector<unsigned char>;
enum class TargetMemoryEndianness: std::uint8_t enum class TargetMemoryEndianness: std::uint8_t
{ {
BIG, BIG,
@@ -22,11 +28,11 @@ namespace Bloom::Targets
struct TargetMemoryAddressRange struct TargetMemoryAddressRange
{ {
std::uint32_t startAddress = 0; TargetMemoryAddress startAddress = 0;
std::uint32_t endAddress = 0; TargetMemoryAddress endAddress = 0;
TargetMemoryAddressRange() = default; TargetMemoryAddressRange() = default;
TargetMemoryAddressRange(std::uint32_t startAddress, std::uint32_t endAddress) TargetMemoryAddressRange(TargetMemoryAddress startAddress, TargetMemoryAddress endAddress)
: startAddress(startAddress) : startAddress(startAddress)
, endAddress(endAddress) , endAddress(endAddress)
{}; {};
@@ -46,7 +52,7 @@ namespace Bloom::Targets
; ;
} }
[[nodiscard]] bool contains(std::uint32_t address) const { [[nodiscard]] bool contains(TargetMemoryAddress address) const {
return address >= this->startAddress && address <= this->endAddress; return address >= this->startAddress && address <= this->endAddress;
} }
@@ -75,10 +81,8 @@ namespace Bloom::Targets
return this->type == rhs.type && this->addressRange == rhs.addressRange; return this->type == rhs.type && this->addressRange == rhs.addressRange;
} }
[[nodiscard]] std::uint32_t size() const { [[nodiscard]] TargetMemorySize size() const {
return (this->addressRange.endAddress - this->addressRange.startAddress) + 1; return (this->addressRange.endAddress - this->addressRange.startAddress) + 1;
} }
}; };
using TargetMemoryBuffer = std::vector<unsigned char>;
} }

View File

@@ -25,8 +25,8 @@ namespace Bloom::Targets
struct TargetRegisterDescriptor struct TargetRegisterDescriptor
{ {
public: public:
std::optional<std::uint32_t> startAddress; std::optional<TargetMemoryAddress> startAddress;
std::uint32_t size = 0; TargetMemorySize size = 0;
TargetRegisterType type = TargetRegisterType::OTHER; TargetRegisterType type = TargetRegisterType::OTHER;
TargetMemoryType memoryType = TargetMemoryType::OTHER; TargetMemoryType memoryType = TargetMemoryType::OTHER;