Renamed TargetControllerConsole to TargetControllerService
This commit is contained in:
@@ -4,6 +4,9 @@ target_sources(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Application.cpp
|
||||
|
||||
# Services
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Services/TargetControllerService.cpp
|
||||
|
||||
# Helpers & other
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Logger/Logger.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Helpers/Paths.cpp
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Bloom::DebugServer::Gdb::AvrGdb
|
||||
DebugServer::Gdb::GdbRspDebugServer::init();
|
||||
|
||||
this->gdbTargetDescriptor = TargetDescriptor(
|
||||
this->targetControllerConsole.getTargetDescriptor()
|
||||
this->targetControllerService.getTargetDescriptor()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using ResponsePackets::ErrorResponsePacket;
|
||||
using ResponsePackets::OkResponsePacket;
|
||||
@@ -19,7 +19,7 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
: CommandPacket(rawPacket)
|
||||
{}
|
||||
|
||||
void FlashDone::handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) {
|
||||
void FlashDone::handle(DebugSession& debugSession, TargetControllerService& targetControllerService) {
|
||||
Logger::debug("Handling FlashDone packet");
|
||||
|
||||
try {
|
||||
@@ -29,9 +29,9 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
"Flushing " + std::to_string(programmingSession.buffer.size()) + " bytes to target's program memory"
|
||||
);
|
||||
|
||||
targetControllerConsole.enableProgrammingMode();
|
||||
targetControllerService.enableProgrammingMode();
|
||||
|
||||
targetControllerConsole.writeMemory(
|
||||
targetControllerService.writeMemory(
|
||||
Targets::TargetMemoryType::FLASH,
|
||||
programmingSession.startAddress,
|
||||
std::move(programmingSession.buffer)
|
||||
@@ -41,10 +41,10 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
}
|
||||
|
||||
Logger::warning("Program memory updated");
|
||||
targetControllerConsole.disableProgrammingMode();
|
||||
targetControllerService.disableProgrammingMode();
|
||||
|
||||
Logger::warning("Resetting target");
|
||||
targetControllerConsole.resetTarget();
|
||||
targetControllerService.resetTarget();
|
||||
Logger::info("Target reset complete");
|
||||
|
||||
debugSession.connection.writePacket(OkResponsePacket());
|
||||
@@ -54,7 +54,7 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
debugSession.programmingSession.reset();
|
||||
|
||||
try {
|
||||
targetControllerConsole.disableProgrammingMode();
|
||||
targetControllerService.disableProgrammingMode();
|
||||
|
||||
} catch (const Exception& exception) {
|
||||
Logger::error("Failed to disable programming mode - " + exception.getMessage());
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
|
||||
void handle(
|
||||
DebugSession& debugSession,
|
||||
TargetController::TargetControllerConsole& targetControllerConsole
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using ResponsePackets::ErrorResponsePacket;
|
||||
using ResponsePackets::OkResponsePacket;
|
||||
@@ -48,16 +48,16 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
}
|
||||
}
|
||||
|
||||
void FlashErase::handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) {
|
||||
void FlashErase::handle(DebugSession& debugSession, TargetControllerService& targetControllerService) {
|
||||
Logger::debug("Handling FlashErase packet");
|
||||
|
||||
try {
|
||||
targetControllerConsole.enableProgrammingMode();
|
||||
targetControllerService.enableProgrammingMode();
|
||||
|
||||
Logger::warning("Erasing entire chip, in preparation for programming");
|
||||
|
||||
// We don't erase a specific address range - we just erase the entire program memory.
|
||||
targetControllerConsole.eraseMemory(Targets::TargetMemoryType::FLASH);
|
||||
targetControllerService.eraseMemory(Targets::TargetMemoryType::FLASH);
|
||||
|
||||
debugSession.connection.writePacket(OkResponsePacket());
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
debugSession.programmingSession.reset();
|
||||
|
||||
try {
|
||||
targetControllerConsole.disableProgrammingMode();
|
||||
targetControllerService.disableProgrammingMode();
|
||||
|
||||
} catch (const Exception& exception) {
|
||||
Logger::error("Failed to disable programming mode - " + exception.getMessage());
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
|
||||
void handle(
|
||||
DebugSession& debugSession,
|
||||
TargetController::TargetControllerConsole& targetControllerConsole
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using ResponsePackets::ErrorResponsePacket;
|
||||
using ResponsePackets::OkResponsePacket;
|
||||
@@ -48,7 +48,7 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
this->buffer = Targets::TargetMemoryBuffer(colonIt + 1, this->data.end());
|
||||
}
|
||||
|
||||
void FlashWrite::handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) {
|
||||
void FlashWrite::handle(DebugSession& debugSession, TargetControllerService& targetControllerService) {
|
||||
Logger::debug("Handling FlashWrite packet");
|
||||
|
||||
try {
|
||||
@@ -91,7 +91,7 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
debugSession.programmingSession.reset();
|
||||
|
||||
try {
|
||||
targetControllerConsole.disableProgrammingMode();
|
||||
targetControllerService.disableProgrammingMode();
|
||||
|
||||
} catch (const Exception& exception) {
|
||||
Logger::error("Failed to disable programming mode - " + exception.getMessage());
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
|
||||
void handle(
|
||||
DebugSession& debugSession,
|
||||
TargetController::TargetControllerConsole& targetControllerConsole
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using ResponsePackets::ErrorResponsePacket;
|
||||
using ResponsePackets::ResponsePacket;
|
||||
@@ -62,7 +62,7 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
}
|
||||
}
|
||||
|
||||
void ReadMemory::handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) {
|
||||
void ReadMemory::handle(DebugSession& debugSession, TargetControllerService& targetControllerService) {
|
||||
Logger::debug("Handling ReadMemory packet");
|
||||
|
||||
try {
|
||||
@@ -136,7 +136,7 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
auto memoryBuffer = Targets::TargetMemoryBuffer();
|
||||
|
||||
if (bytesToRead > 0) {
|
||||
memoryBuffer = targetControllerConsole.readMemory(
|
||||
memoryBuffer = targetControllerService.readMemory(
|
||||
this->memoryType,
|
||||
this->startAddress,
|
||||
bytesToRead
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
|
||||
void handle(
|
||||
DebugSession& debugSession,
|
||||
TargetController::TargetControllerConsole& targetControllerConsole
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using ResponsePackets::ResponsePacket;
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
}
|
||||
}
|
||||
|
||||
void ReadMemoryMap::handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) {
|
||||
void ReadMemoryMap::handle(DebugSession& debugSession, TargetControllerService& targetControllerService) {
|
||||
Logger::debug("Handling ReadMemoryMap packet");
|
||||
|
||||
using Targets::TargetMemoryType;
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
|
||||
void handle(
|
||||
DebugSession& debugSession,
|
||||
TargetController::TargetControllerConsole& targetControllerConsole
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using ResponsePackets::ErrorResponsePacket;
|
||||
using ResponsePackets::OkResponsePacket;
|
||||
@@ -68,7 +68,7 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
}
|
||||
}
|
||||
|
||||
void WriteMemory::handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) {
|
||||
void WriteMemory::handle(DebugSession& debugSession, TargetControllerService& targetControllerService) {
|
||||
Logger::debug("Handling WriteMemory packet");
|
||||
|
||||
try {
|
||||
@@ -123,7 +123,7 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
);
|
||||
}
|
||||
|
||||
targetControllerConsole.writeMemory(
|
||||
targetControllerService.writeMemory(
|
||||
this->memoryType,
|
||||
this->startAddress,
|
||||
this->buffer
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||||
|
||||
void handle(
|
||||
DebugSession& debugSession,
|
||||
TargetController::TargetControllerConsole& targetControllerConsole
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using ResponsePackets::ErrorResponsePacket;
|
||||
using ResponsePackets::ResponsePacket;
|
||||
@@ -26,7 +26,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
: Monitor(std::move(monitorPacket))
|
||||
{}
|
||||
|
||||
void BloomVersion::handle(DebugSession& debugSession, TargetControllerConsole&) {
|
||||
void BloomVersion::handle(DebugSession& debugSession, TargetControllerService&) {
|
||||
Logger::debug("Handling BloomVersion packet");
|
||||
|
||||
debugSession.connection.writePacket(ResponsePacket(String::toHex(
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
|
||||
void handle(
|
||||
DebugSession& debugSession,
|
||||
TargetController::TargetControllerConsole& targetControllerConsole
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using ResponsePackets::ResponsePacket;
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
: Monitor(std::move(monitorPacket))
|
||||
{}
|
||||
|
||||
void BloomVersionMachine::handle(DebugSession& debugSession, TargetControllerConsole&) {
|
||||
void BloomVersionMachine::handle(DebugSession& debugSession, TargetControllerService&) {
|
||||
Logger::debug("Handling BloomVersionMachine packet");
|
||||
|
||||
debugSession.connection.writePacket(ResponsePacket(String::toHex(
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
|
||||
void handle(
|
||||
DebugSession& debugSession,
|
||||
TargetController::TargetControllerConsole& targetControllerConsole
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using ResponsePackets::ResponsePacket;
|
||||
using ResponsePackets::OkResponsePacket;
|
||||
@@ -23,7 +23,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
|
||||
using Exceptions::Exception;
|
||||
|
||||
void CommandPacket::handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) {
|
||||
void CommandPacket::handle(DebugSession& debugSession, TargetControllerService& targetControllerService) {
|
||||
const auto packetString = std::string(this->data.begin(), this->data.end());
|
||||
|
||||
if (packetString.empty()) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "src/DebugServer/Gdb/Packet.hpp"
|
||||
#include "src/DebugServer/Gdb/DebugSession.hpp"
|
||||
|
||||
#include "src/TargetController/TargetControllerConsole.hpp"
|
||||
#include "src/Services/TargetControllerService.hpp"
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
{
|
||||
@@ -44,11 +44,11 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
* @param debugSession
|
||||
* The current active debug session.
|
||||
*
|
||||
* @param targetControllerConsole
|
||||
* @param TargetControllerService
|
||||
*/
|
||||
virtual void handle(
|
||||
DebugSession& debugSession,
|
||||
TargetController::TargetControllerConsole& targetControllerConsole
|
||||
Services::TargetControllerService& targetControllerService
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using ResponsePackets::ErrorResponsePacket;
|
||||
using Exceptions::Exception;
|
||||
@@ -22,11 +22,11 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
}
|
||||
}
|
||||
|
||||
void ContinueExecution::handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) {
|
||||
void ContinueExecution::handle(DebugSession& debugSession, TargetControllerService& targetControllerService) {
|
||||
Logger::debug("Handling ContinueExecution packet");
|
||||
|
||||
try {
|
||||
targetControllerConsole.continueTargetExecution(this->fromProgramCounter);
|
||||
targetControllerService.continueTargetExecution(this->fromProgramCounter);
|
||||
debugSession.waitingForBreak = true;
|
||||
|
||||
} catch (const Exception& exception) {
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
|
||||
void handle(
|
||||
DebugSession& debugSession,
|
||||
TargetController::TargetControllerConsole& targetControllerConsole
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using ResponsePackets::OkResponsePacket;
|
||||
using ResponsePackets::ErrorResponsePacket;
|
||||
@@ -20,12 +20,12 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
: CommandPacket(rawPacket)
|
||||
{}
|
||||
|
||||
void Detach::handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) {
|
||||
void Detach::handle(DebugSession& debugSession, TargetControllerService& targetControllerService) {
|
||||
Logger::debug("Handling Detach packet");
|
||||
|
||||
try {
|
||||
if (Process::isManagedByClion()) {
|
||||
targetControllerConsole.suspendTargetController();
|
||||
targetControllerService.suspendTargetController();
|
||||
}
|
||||
|
||||
debugSession.connection.writePacket(OkResponsePacket());
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
|
||||
void handle(
|
||||
DebugSession& debugSession,
|
||||
TargetController::TargetControllerConsole& targetControllerConsole
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using ResponsePackets::ResponsePacket;
|
||||
using ResponsePackets::ErrorResponsePacket;
|
||||
@@ -34,7 +34,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
this->fillValue = Targets::TargetMemoryBuffer(fillValueByteArray.begin(), fillValueByteArray.end());
|
||||
}
|
||||
|
||||
void EepromFill::handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) {
|
||||
void EepromFill::handle(DebugSession& debugSession, TargetControllerService& targetControllerService) {
|
||||
Logger::debug("Handling EepromFill packet");
|
||||
|
||||
try {
|
||||
@@ -90,7 +90,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
const auto hexValues = String::toHex(data);
|
||||
Logger::debug("Filling EEPROM with values: " + hexValues);
|
||||
|
||||
targetControllerConsole.writeMemory(
|
||||
targetControllerService.writeMemory(
|
||||
Targets::TargetMemoryType::EEPROM,
|
||||
eepromDescriptor.addressRange.startAddress,
|
||||
std::move(data)
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
|
||||
void handle(
|
||||
DebugSession& debugSession,
|
||||
TargetController::TargetControllerConsole& targetControllerConsole
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using ResponsePackets::ResponsePacket;
|
||||
using ResponsePackets::ErrorResponsePacket;
|
||||
@@ -28,7 +28,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
, sendOutput(this->commandOptions.contains("out"))
|
||||
{}
|
||||
|
||||
void GenerateSvd::handle(DebugSession& debugSession, TargetControllerConsole&) {
|
||||
void GenerateSvd::handle(DebugSession& debugSession, TargetControllerService&) {
|
||||
Logger::debug("Handling GenerateSvd packet");
|
||||
|
||||
try {
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
|
||||
void handle(
|
||||
DebugSession& debugSession,
|
||||
TargetController::TargetControllerConsole& targetControllerConsole
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using ResponsePackets::ErrorResponsePacket;
|
||||
using ResponsePackets::ResponsePacket;
|
||||
@@ -25,7 +25,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
: Monitor(std::move(monitorPacket))
|
||||
{}
|
||||
|
||||
void HelpMonitorInfo::handle(DebugSession& debugSession, TargetControllerConsole&) {
|
||||
void HelpMonitorInfo::handle(DebugSession& debugSession, TargetControllerService&) {
|
||||
Logger::debug("Handling HelpMonitorInfo packet");
|
||||
|
||||
try {
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
|
||||
void handle(
|
||||
DebugSession& debugSession,
|
||||
TargetController::TargetControllerConsole& targetControllerConsole
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,17 +9,17 @@
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using ResponsePackets::TargetStopped;
|
||||
using ResponsePackets::ErrorResponsePacket;
|
||||
using Exceptions::Exception;
|
||||
|
||||
void InterruptExecution::handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) {
|
||||
void InterruptExecution::handle(DebugSession& debugSession, TargetControllerService& targetControllerService) {
|
||||
Logger::debug("Handling InterruptExecution packet");
|
||||
|
||||
try {
|
||||
targetControllerConsole.stopTargetExecution();
|
||||
targetControllerService.stopTargetExecution();
|
||||
debugSession.connection.writePacket(TargetStopped(Signal::INTERRUPTED));
|
||||
|
||||
} catch (const Exception& exception) {
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
|
||||
void handle(
|
||||
DebugSession& debugSession,
|
||||
TargetController::TargetControllerConsole& targetControllerConsole
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using ResponsePackets::EmptyResponsePacket;
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
this->commandOptions = this->extractCommandOptions(this->command);
|
||||
}
|
||||
|
||||
void Monitor::handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) {
|
||||
void Monitor::handle(DebugSession& debugSession, TargetControllerService& targetControllerService) {
|
||||
Logger::error("Unknown custom GDB command (\"" + this->command + "\") received.");
|
||||
debugSession.connection.writePacket(EmptyResponsePacket());
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
|
||||
void handle(
|
||||
DebugSession& debugSession,
|
||||
TargetController::TargetControllerConsole& targetControllerConsole
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using Targets::TargetRegister;
|
||||
using Targets::TargetRegisterDescriptors;
|
||||
@@ -32,7 +32,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
}
|
||||
}
|
||||
|
||||
void ReadRegisters::handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) {
|
||||
void ReadRegisters::handle(DebugSession& debugSession, TargetControllerService& targetControllerService) {
|
||||
Logger::debug("Handling ReadRegisters packet");
|
||||
|
||||
try {
|
||||
@@ -52,7 +52,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
}
|
||||
}
|
||||
|
||||
auto registerSet = targetControllerConsole.readRegisters(descriptors);
|
||||
auto registerSet = targetControllerService.readRegisters(descriptors);
|
||||
|
||||
/*
|
||||
* Sort each register by their respective GDB register number - this will leave us with a collection of
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
|
||||
void handle(
|
||||
DebugSession& debugSession,
|
||||
TargetController::TargetControllerConsole& targetControllerConsole
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using Targets::TargetBreakpoint;
|
||||
|
||||
@@ -50,11 +50,11 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveBreakpoint::handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) {
|
||||
void RemoveBreakpoint::handle(DebugSession& debugSession, TargetControllerService& targetControllerService) {
|
||||
Logger::debug("Removing breakpoint at address " + std::to_string(this->address));
|
||||
|
||||
try {
|
||||
targetControllerConsole.removeBreakpoint(TargetBreakpoint(this->address));
|
||||
targetControllerService.removeBreakpoint(TargetBreakpoint(this->address));
|
||||
debugSession.connection.writePacket(OkResponsePacket());
|
||||
|
||||
} catch (const Exception& exception) {
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
|
||||
void handle(
|
||||
DebugSession& debugSession,
|
||||
TargetController::TargetControllerConsole& targetControllerConsole
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using ResponsePackets::ErrorResponsePacket;
|
||||
using ResponsePackets::ResponsePacket;
|
||||
@@ -21,12 +21,12 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
: Monitor(std::move(monitorPacket))
|
||||
{}
|
||||
|
||||
void ResetTarget::handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) {
|
||||
void ResetTarget::handle(DebugSession& debugSession, TargetControllerService& targetControllerService) {
|
||||
Logger::debug("Handling ResetTarget packet");
|
||||
|
||||
try {
|
||||
Logger::warning("Resetting target");
|
||||
targetControllerConsole.resetTarget();
|
||||
targetControllerService.resetTarget();
|
||||
Logger::info("Target reset complete");
|
||||
|
||||
debugSession.connection.writePacket(ResponsePacket(String::toHex(
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
|
||||
void handle(
|
||||
DebugSession& debugSession,
|
||||
TargetController::TargetControllerConsole& targetControllerConsole
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using Targets::TargetBreakpoint;
|
||||
|
||||
@@ -50,11 +50,11 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
}
|
||||
}
|
||||
|
||||
void SetBreakpoint::handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) {
|
||||
void SetBreakpoint::handle(DebugSession& debugSession, TargetControllerService& targetControllerService) {
|
||||
Logger::debug("Handling SetBreakpoint packet");
|
||||
|
||||
try {
|
||||
targetControllerConsole.setBreakpoint(TargetBreakpoint(this->address));
|
||||
targetControllerService.setBreakpoint(TargetBreakpoint(this->address));
|
||||
debugSession.connection.writePacket(OkResponsePacket());
|
||||
|
||||
} catch (const Exception& exception) {
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
|
||||
void handle(
|
||||
DebugSession& debugSession,
|
||||
TargetController::TargetControllerConsole& targetControllerConsole
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using ResponsePackets::ErrorResponsePacket;
|
||||
|
||||
@@ -23,11 +23,11 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
}
|
||||
}
|
||||
|
||||
void StepExecution::handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) {
|
||||
void StepExecution::handle(DebugSession& debugSession, TargetControllerService& targetControllerService) {
|
||||
Logger::debug("Handling StepExecution packet");
|
||||
|
||||
try {
|
||||
targetControllerConsole.stepTargetExecution(this->fromProgramCounter);
|
||||
targetControllerService.stepTargetExecution(this->fromProgramCounter);
|
||||
debugSession.waitingForBreak = true;
|
||||
|
||||
} catch (const Exception& exception) {
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
|
||||
void handle(
|
||||
DebugSession& debugSession,
|
||||
TargetController::TargetControllerConsole& targetControllerConsole
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using ResponsePackets::SupportedFeaturesResponse;
|
||||
using ResponsePackets::ErrorResponsePacket;
|
||||
@@ -53,7 +53,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
}
|
||||
}
|
||||
|
||||
void SupportedFeaturesQuery::handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) {
|
||||
void SupportedFeaturesQuery::handle(DebugSession& debugSession, TargetControllerService& targetControllerService) {
|
||||
Logger::debug("Handling QuerySupport packet");
|
||||
|
||||
if (!this->isFeatureSupported(Feature::HARDWARE_BREAKPOINTS)
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
|
||||
void handle(
|
||||
DebugSession& debugSession,
|
||||
TargetController::TargetControllerConsole& targetControllerConsole
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
using Targets::TargetRegister;
|
||||
using Targets::TargetRegisterDescriptors;
|
||||
@@ -42,7 +42,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
std::reverse(this->registerValue.begin(), this->registerValue.end());
|
||||
}
|
||||
|
||||
void WriteRegister::handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) {
|
||||
void WriteRegister::handle(DebugSession& debugSession, TargetControllerService& targetControllerService) {
|
||||
Logger::debug("Handling WriteRegister packet");
|
||||
|
||||
try {
|
||||
@@ -72,7 +72,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
}
|
||||
}
|
||||
|
||||
targetControllerConsole.writeRegisters({
|
||||
targetControllerService.writeRegisters({
|
||||
TargetRegister(targetRegisterDescriptor, this->registerValue)
|
||||
});
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
|
||||
void handle(
|
||||
DebugSession& debugSession,
|
||||
TargetController::TargetControllerConsole& targetControllerConsole
|
||||
Services::TargetControllerService& targetControllerService
|
||||
) override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -160,29 +160,29 @@ namespace Bloom::DebugServer::Gdb
|
||||
* Before proceeding with a new debug session, we must ensure that the TargetController is able to
|
||||
* service it.
|
||||
*/
|
||||
if (!this->targetControllerConsole.isTargetControllerInService()) {
|
||||
if (!this->targetControllerService.isTargetControllerInService()) {
|
||||
// The TargetController is suspended - attempt to wake it up
|
||||
try {
|
||||
this->targetControllerConsole.resumeTargetController();
|
||||
this->targetControllerService.resumeTargetController();
|
||||
|
||||
} catch (Bloom::Exceptions::Exception& exception) {
|
||||
Logger::error("Failed to wake up TargetController - " + exception.getMessage());
|
||||
}
|
||||
|
||||
if (!this->targetControllerConsole.isTargetControllerInService()) {
|
||||
if (!this->targetControllerService.isTargetControllerInService()) {
|
||||
this->activeDebugSession.reset();
|
||||
throw DebugSessionInitialisationFailure("TargetController not in service");
|
||||
}
|
||||
}
|
||||
|
||||
this->targetControllerConsole.stopTargetExecution();
|
||||
this->targetControllerConsole.resetTarget();
|
||||
this->targetControllerService.stopTargetExecution();
|
||||
this->targetControllerService.resetTarget();
|
||||
}
|
||||
|
||||
const auto commandPacket = this->waitForCommandPacket();
|
||||
|
||||
if (commandPacket) {
|
||||
commandPacket->handle(this->activeDebugSession.value(), this->targetControllerConsole);
|
||||
commandPacket->handle(this->activeDebugSession.value(), this->targetControllerService);
|
||||
}
|
||||
|
||||
} catch (const ClientDisconnected&) {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "src/EventManager/EventListener.hpp"
|
||||
#include "src/Helpers/EpollInstance.hpp"
|
||||
#include "src/Helpers/EventFdNotifier.hpp"
|
||||
#include "src/TargetController/TargetControllerConsole.hpp"
|
||||
#include "src/Services/TargetControllerService.hpp"
|
||||
|
||||
#include "Connection.hpp"
|
||||
#include "TargetDescriptor.hpp"
|
||||
@@ -114,7 +114,7 @@ namespace Bloom::DebugServer::Gdb
|
||||
*
|
||||
* See documentation in src/DebugServer/Gdb/README.md for more on how GDB commands are processed.
|
||||
*/
|
||||
TargetController::TargetControllerConsole targetControllerConsole = TargetController::TargetControllerConsole();
|
||||
Services::TargetControllerService targetControllerService = Services::TargetControllerService();
|
||||
|
||||
/**
|
||||
* Listening socket address
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
|
||||
explicit SetBreakpoint(const RawPacket& rawPacket);
|
||||
|
||||
void handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) override;
|
||||
void handle(DebugSession& debugSession, TargetControllerService& targetControllerService) override;
|
||||
};
|
||||
```
|
||||
|
||||
@@ -67,15 +67,15 @@ Upon receiving a command packet from the GDB client, the command must be handled
|
||||
Each command packet class implements a `handle()` member function. This function is called upon receipt of the command
|
||||
and is expected to handle the command and deliver any necessary response to the client. Two parameters are passed to the
|
||||
`handle()` member function - a reference to the active `DebugSession` object, and a reference to a
|
||||
`TargetControllerConsole` object. The `DebugSession` object provides access to the current connection with the GDB
|
||||
client, as well as other debug session specific information. The `TargetControllerConsole` object provides an interface
|
||||
`TargetControllerService` object. The `DebugSession` object provides access to the current connection with the GDB
|
||||
client, as well as other debug session specific information. The `TargetControllerService` object provides an interface
|
||||
to the `TargetController`, for any GDB commands that need to interface with the connected target (see the
|
||||
[TargetController documentation](../../TargetController/README.md) for more on this).
|
||||
|
||||
Handling the `SetBreakpoint` command packet:
|
||||
|
||||
```c++
|
||||
void SetBreakpoint::handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) {
|
||||
void SetBreakpoint::handle(DebugSession& debugSession, TargetControllerService& targetControllerService) {
|
||||
/*
|
||||
* I know the breakpoint type (this->type) isn't used in here - this is because the current implementation only
|
||||
* supports software breakpoints, so we don't do anything with this->type, for now.
|
||||
@@ -84,7 +84,7 @@ void SetBreakpoint::handle(DebugSession& debugSession, TargetControllerConsole&
|
||||
Logger::debug("Handling SetBreakpoint packet");
|
||||
|
||||
try {
|
||||
targetControllerConsole.setBreakpoint(TargetBreakpoint(this->address));
|
||||
targetControllerServicesetBreakpoint(TargetBreakpoint(this->address));
|
||||
debugSession.connection.writePacket(OkResponsePacket());
|
||||
|
||||
} catch (const Exception& exception) {
|
||||
|
||||
@@ -206,7 +206,7 @@ namespace Bloom
|
||||
|
||||
this->checkBloomVersion();
|
||||
|
||||
this->mainWindow->init(this->targetControllerConsole.getTargetDescriptor());
|
||||
this->mainWindow->init(this->targetControllerService.getTargetDescriptor());
|
||||
this->mainWindow->show();
|
||||
}
|
||||
|
||||
@@ -322,7 +322,7 @@ namespace Bloom
|
||||
|
||||
void Insight::onTargetResetEvent(const Events::TargetReset& event) {
|
||||
try {
|
||||
if (this->targetControllerConsole.getTargetState() != TargetState::STOPPED) {
|
||||
if (this->targetControllerService.getTargetState() != TargetState::STOPPED) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "src/EventManager/EventListener.hpp"
|
||||
#include "src/EventManager/Events/Events.hpp"
|
||||
|
||||
#include "src/TargetController/TargetControllerConsole.hpp"
|
||||
#include "src/Services/TargetControllerService.hpp"
|
||||
#include "src/Targets/TargetState.hpp"
|
||||
|
||||
#include "InsightSignals.hpp"
|
||||
@@ -90,7 +90,7 @@ namespace Bloom
|
||||
this->insightProjectSettings
|
||||
);
|
||||
|
||||
TargetController::TargetControllerConsole targetControllerConsole = TargetController::TargetControllerConsole();
|
||||
Services::TargetControllerService targetControllerService = Services::TargetControllerService();
|
||||
|
||||
Targets::TargetState lastTargetState = Targets::TargetState::UNKNOWN;
|
||||
bool targetStepping = false;
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace Bloom
|
||||
auto* task = queuedTask.value();
|
||||
task->moveToThread(this->thread());
|
||||
task->setParent(this);
|
||||
task->execute(this->targetControllerConsole);
|
||||
task->execute(this->targetControllerService);
|
||||
|
||||
{
|
||||
const auto taskGroupsLock = InsightWorker::taskGroupsInExecution.acquireLock();
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "Tasks/InsightWorkerTask.hpp"
|
||||
|
||||
#include "src/Helpers/SyncSafe.hpp"
|
||||
#include "src/TargetController/TargetControllerConsole.hpp"
|
||||
#include "src/Services/TargetControllerService.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
@@ -41,7 +41,7 @@ namespace Bloom
|
||||
static inline SyncSafe<std::map<QueuedTaskId, InsightWorkerTask*>> queuedTasksById = {};
|
||||
static inline SyncSafe<TaskGroups> taskGroupsInExecution = {};
|
||||
|
||||
TargetController::TargetControllerConsole targetControllerConsole = TargetController::TargetControllerConsole();
|
||||
Services::TargetControllerService targetControllerService = Services::TargetControllerService();
|
||||
|
||||
void executeTasks();
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
CaptureMemorySnapshot::CaptureMemorySnapshot(
|
||||
const QString& name,
|
||||
@@ -28,12 +28,12 @@ namespace Bloom
|
||||
, data(data)
|
||||
{}
|
||||
|
||||
void CaptureMemorySnapshot::run(TargetControllerConsole& targetControllerConsole) {
|
||||
void CaptureMemorySnapshot::run(TargetControllerService& targetControllerService) {
|
||||
using Targets::TargetMemorySize;
|
||||
|
||||
Logger::info("Capturing snapshot");
|
||||
|
||||
const auto& targetDescriptor = targetControllerConsole.getTargetDescriptor();
|
||||
const auto& targetDescriptor = targetControllerService.getTargetDescriptor();
|
||||
const auto memoryDescriptorIt = targetDescriptor.memoryDescriptorsByType.find(this->memoryType);
|
||||
|
||||
if (memoryDescriptorIt == targetDescriptor.memoryDescriptorsByType.end()) {
|
||||
@@ -58,7 +58,7 @@ namespace Bloom
|
||||
);
|
||||
|
||||
for (std::uint32_t i = 0; i < readsRequired; i++) {
|
||||
auto dataSegment = targetControllerConsole.readMemory(
|
||||
auto dataSegment = targetControllerService.readMemory(
|
||||
this->memoryType,
|
||||
memoryDescriptor.addressRange.startAddress + static_cast<Targets::TargetMemoryAddress>(readSize * i),
|
||||
(memorySize - this->data->size()) >= readSize
|
||||
@@ -78,7 +78,7 @@ namespace Bloom
|
||||
std::move(this->description),
|
||||
this->memoryType,
|
||||
std::move(*this->data),
|
||||
targetControllerConsole.getProgramCounter(),
|
||||
targetControllerService.getProgramCounter(),
|
||||
std::move(this->focusedRegions),
|
||||
std::move(this->excludedRegions)
|
||||
);
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Bloom
|
||||
void memorySnapshotCaptured(MemorySnapshot snapshot);
|
||||
|
||||
protected:
|
||||
void run(TargetController::TargetControllerConsole& targetControllerConsole) override;
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
|
||||
private:
|
||||
QString name;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Bloom
|
||||
qRegisterMetaType<std::map<Targets::TargetMemoryAddress, Widgets::ByteItem*>>();
|
||||
}
|
||||
|
||||
void ConstructHexViewerByteItems::run(TargetController::TargetControllerConsole&) {
|
||||
void ConstructHexViewerByteItems::run(Services::TargetControllerService&) {
|
||||
const auto memorySize = this->memoryDescriptor.size();
|
||||
const auto startAddress = this->memoryDescriptor.addressRange.startAddress;
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Bloom
|
||||
void byteItems(std::map<Targets::TargetMemoryAddress, Widgets::ByteItem*> byteItemsByAddress);
|
||||
|
||||
protected:
|
||||
void run(TargetController::TargetControllerConsole&) override;
|
||||
void run(Services::TargetControllerService&) override;
|
||||
|
||||
private:
|
||||
std::map<Targets::TargetMemoryAddress, Widgets::ByteItem*> byteItemsByAddress;
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
void GetTargetDescriptor::run(TargetControllerConsole& targetControllerConsole) {
|
||||
emit this->targetDescriptor(targetControllerConsole.getTargetDescriptor());
|
||||
void GetTargetDescriptor::run(TargetControllerService& targetControllerService) {
|
||||
emit this->targetDescriptor(targetControllerService.getTargetDescriptor());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,6 @@ namespace Bloom
|
||||
void targetDescriptor(Targets::TargetDescriptor targetDescriptor);
|
||||
|
||||
protected:
|
||||
void run(TargetController::TargetControllerConsole& targetControllerConsole) override;
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
void GetTargetState::run(TargetControllerConsole& targetControllerConsole) {
|
||||
emit this->targetState(targetControllerConsole.getTargetState());
|
||||
void GetTargetState::run(TargetControllerService& targetControllerService) {
|
||||
emit this->targetState(targetControllerService.getTargetState());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,6 @@ namespace Bloom
|
||||
void targetState(Targets::TargetState state);
|
||||
|
||||
protected:
|
||||
void run(TargetController::TargetControllerConsole& targetControllerConsole) override;
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
void InsightWorkerTask::execute(TargetControllerConsole& targetControllerConsole) {
|
||||
void InsightWorkerTask::execute(TargetControllerService& targetControllerService) {
|
||||
try {
|
||||
this->state = InsightWorkerTaskState::STARTED;
|
||||
emit this->started();
|
||||
this->run(targetControllerConsole);
|
||||
this->run(targetControllerService);
|
||||
this->state = InsightWorkerTaskState::COMPLETED;
|
||||
emit this->completed();
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <QString>
|
||||
|
||||
#include "TaskGroup.hpp"
|
||||
#include "src/TargetController/TargetControllerConsole.hpp"
|
||||
#include "src/Services/TargetControllerService.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
@@ -29,7 +29,7 @@ namespace Bloom
|
||||
return TaskGroups();
|
||||
};
|
||||
|
||||
void execute(TargetController::TargetControllerConsole& targetControllerConsole);
|
||||
void execute(Services::TargetControllerService& targetControllerService);
|
||||
|
||||
signals:
|
||||
/**
|
||||
@@ -56,6 +56,6 @@ namespace Bloom
|
||||
void finished();
|
||||
|
||||
protected:
|
||||
virtual void run(TargetController::TargetControllerConsole& targetControllerConsole) = 0;
|
||||
virtual void run(Services::TargetControllerService& targetControllerService) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
void ReadProgramCounter::run(TargetControllerConsole& targetControllerConsole) {
|
||||
emit this->programCounterRead(targetControllerConsole.getProgramCounter());
|
||||
void ReadProgramCounter::run(TargetControllerService& targetControllerService) {
|
||||
emit this->programCounterRead(targetControllerService.getProgramCounter());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,6 @@ namespace Bloom
|
||||
void programCounterRead(Targets::TargetProgramCounter programCounter);
|
||||
|
||||
protected:
|
||||
void run(TargetController::TargetControllerConsole& targetControllerConsole) override;
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
void ReadStackPointer::run(TargetControllerConsole& targetControllerConsole) {
|
||||
emit this->stackPointerRead(targetControllerConsole.getStackPointer());
|
||||
void ReadStackPointer::run(TargetControllerService& targetControllerService) {
|
||||
emit this->stackPointerRead(targetControllerService.getStackPointer());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,6 @@ namespace Bloom
|
||||
void stackPointerRead(Targets::TargetStackPointer stackPointer);
|
||||
|
||||
protected:
|
||||
void run(TargetController::TargetControllerConsole& targetControllerConsole) override;
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
void ReadTargetMemory::run(TargetControllerConsole& targetControllerConsole) {
|
||||
void ReadTargetMemory::run(TargetControllerService& targetControllerService) {
|
||||
using Targets::TargetMemorySize;
|
||||
|
||||
const auto& targetDescriptor = targetControllerConsole.getTargetDescriptor();
|
||||
const auto& targetDescriptor = targetControllerService.getTargetDescriptor();
|
||||
const auto memoryDescriptorIt = targetDescriptor.memoryDescriptorsByType.find(this->memoryType);
|
||||
|
||||
if (memoryDescriptorIt == targetDescriptor.memoryDescriptorsByType.end()) {
|
||||
@@ -39,7 +39,7 @@ namespace Bloom
|
||||
Targets::TargetMemoryBuffer data;
|
||||
|
||||
for (std::uint32_t i = 0; i < readsRequired; i++) {
|
||||
auto dataSegment = targetControllerConsole.readMemory(
|
||||
auto dataSegment = targetControllerService.readMemory(
|
||||
this->memoryType,
|
||||
this->startAddress + static_cast<Targets::TargetMemoryAddress>(readSize * i),
|
||||
(this->size - data.size()) >= readSize
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Bloom
|
||||
void targetMemoryRead(Targets::TargetMemoryBuffer buffer);
|
||||
|
||||
protected:
|
||||
void run(TargetController::TargetControllerConsole& targetControllerConsole) override;
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
|
||||
private:
|
||||
Targets::TargetMemoryType memoryType;
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
void ReadTargetRegisters::run(TargetControllerConsole& targetControllerConsole) {
|
||||
emit this->targetRegistersRead(targetControllerConsole.readRegisters(this->descriptors));
|
||||
void ReadTargetRegisters::run(TargetControllerService& targetControllerService) {
|
||||
emit this->targetRegistersRead(targetControllerService.readRegisters(this->descriptors));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Bloom
|
||||
void targetRegistersRead(Targets::TargetRegisters registers);
|
||||
|
||||
protected:
|
||||
void run(TargetController::TargetControllerConsole& targetControllerConsole) override;
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
|
||||
private:
|
||||
Targets::TargetRegisterDescriptors descriptors;
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
void RefreshTargetPinStates::run(TargetControllerConsole& targetControllerConsole) {
|
||||
emit this->targetPinStatesRetrieved(targetControllerConsole.getPinStates(this->variantId));
|
||||
void RefreshTargetPinStates::run(TargetControllerService& targetControllerService) {
|
||||
emit this->targetPinStatesRetrieved(targetControllerService.getPinStates(this->variantId));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Bloom
|
||||
void targetPinStatesRetrieved(Bloom::Targets::TargetPinStateMapping pinStatesByNumber);
|
||||
|
||||
protected:
|
||||
void run(TargetController::TargetControllerConsole& targetControllerConsole) override;
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
|
||||
private:
|
||||
int variantId;
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
RetrieveMemorySnapshots::RetrieveMemorySnapshots(Targets::TargetMemoryType memoryType)
|
||||
: memoryType(memoryType)
|
||||
{}
|
||||
|
||||
void RetrieveMemorySnapshots::run(TargetControllerConsole& targetControllerConsole) {
|
||||
void RetrieveMemorySnapshots::run(TargetControllerService& targetControllerService) {
|
||||
emit this->memorySnapshotsRetrieved(this->getSnapshots(this->memoryType));
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Bloom
|
||||
void memorySnapshotsRetrieved(std::vector<MemorySnapshot> snapshots);
|
||||
|
||||
protected:
|
||||
void run(TargetController::TargetControllerConsole& targetControllerConsole) override;
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
|
||||
private:
|
||||
Targets::TargetMemoryType memoryType;
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
void SetTargetPinState::run(TargetControllerConsole& targetControllerConsole) {
|
||||
targetControllerConsole.setPinState(this->pinDescriptor, this->pinState);
|
||||
void SetTargetPinState::run(TargetControllerService& targetControllerService) {
|
||||
targetControllerService.setPinState(this->pinDescriptor, this->pinState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Bloom
|
||||
};
|
||||
|
||||
protected:
|
||||
void run(TargetController::TargetControllerConsole& targetControllerConsole) override;
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
|
||||
private:
|
||||
Targets::TargetPinDescriptor pinDescriptor;
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
void WriteTargetRegister::run(TargetControllerConsole& targetControllerConsole) {
|
||||
targetControllerConsole.writeRegisters({this->targetRegister});
|
||||
void WriteTargetRegister::run(TargetControllerService& targetControllerService) {
|
||||
targetControllerService.writeRegisters({this->targetRegister});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Bloom
|
||||
};
|
||||
|
||||
protected:
|
||||
void run(TargetController::TargetControllerConsole& targetControllerConsole) override;
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
|
||||
private:
|
||||
Targets::TargetRegister targetRegister;
|
||||
|
||||
@@ -1,55 +1,57 @@
|
||||
#include "TargetControllerConsole.hpp"
|
||||
#include "TargetControllerService.hpp"
|
||||
|
||||
// Commands
|
||||
#include "Commands/GetState.hpp"
|
||||
#include "Commands/Suspend.hpp"
|
||||
#include "Commands/Resume.hpp"
|
||||
#include "Commands/GetTargetDescriptor.hpp"
|
||||
#include "Commands/GetTargetState.hpp"
|
||||
#include "Commands/StopTargetExecution.hpp"
|
||||
#include "Commands/ResumeTargetExecution.hpp"
|
||||
#include "Commands/ResetTarget.hpp"
|
||||
#include "Commands/ReadTargetRegisters.hpp"
|
||||
#include "Commands/WriteTargetRegisters.hpp"
|
||||
#include "Commands/ReadTargetMemory.hpp"
|
||||
#include "Commands/WriteTargetMemory.hpp"
|
||||
#include "Commands/EraseTargetMemory.hpp"
|
||||
#include "Commands/StepTargetExecution.hpp"
|
||||
#include "Commands/SetBreakpoint.hpp"
|
||||
#include "Commands/RemoveBreakpoint.hpp"
|
||||
#include "Commands/SetTargetProgramCounter.hpp"
|
||||
#include "Commands/GetTargetPinStates.hpp"
|
||||
#include "Commands/SetTargetPinState.hpp"
|
||||
#include "Commands/GetTargetStackPointer.hpp"
|
||||
#include "Commands/GetTargetProgramCounter.hpp"
|
||||
#include "Commands/EnableProgrammingMode.hpp"
|
||||
#include "Commands/DisableProgrammingMode.hpp"
|
||||
#include "src/TargetController/Commands/GetState.hpp"
|
||||
#include "src/TargetController/Commands/Suspend.hpp"
|
||||
#include "src/TargetController/Commands/Resume.hpp"
|
||||
#include "src/TargetController/Commands/GetTargetDescriptor.hpp"
|
||||
#include "src/TargetController/Commands/GetTargetState.hpp"
|
||||
#include "src/TargetController/Commands/StopTargetExecution.hpp"
|
||||
#include "src/TargetController/Commands/ResumeTargetExecution.hpp"
|
||||
#include "src/TargetController/Commands/ResetTarget.hpp"
|
||||
#include "src/TargetController/Commands/ReadTargetRegisters.hpp"
|
||||
#include "src/TargetController/Commands/WriteTargetRegisters.hpp"
|
||||
#include "src/TargetController/Commands/ReadTargetMemory.hpp"
|
||||
#include "src/TargetController/Commands/WriteTargetMemory.hpp"
|
||||
#include "src/TargetController/Commands/EraseTargetMemory.hpp"
|
||||
#include "src/TargetController/Commands/StepTargetExecution.hpp"
|
||||
#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/GetTargetStackPointer.hpp"
|
||||
#include "src/TargetController/Commands/GetTargetProgramCounter.hpp"
|
||||
#include "src/TargetController/Commands/EnableProgrammingMode.hpp"
|
||||
#include "src/TargetController/Commands/DisableProgrammingMode.hpp"
|
||||
|
||||
namespace Bloom::TargetController
|
||||
namespace Bloom::Services
|
||||
{
|
||||
using Commands::GetState;
|
||||
using Commands::Suspend;
|
||||
using Commands::Resume;
|
||||
using Commands::GetTargetDescriptor;
|
||||
using Commands::GetTargetState;
|
||||
using Commands::StopTargetExecution;
|
||||
using Commands::ResumeTargetExecution;
|
||||
using Commands::ResetTarget;
|
||||
using Commands::ReadTargetRegisters;
|
||||
using Commands::WriteTargetRegisters;
|
||||
using Commands::ReadTargetMemory;
|
||||
using Commands::WriteTargetMemory;
|
||||
using Commands::EraseTargetMemory;
|
||||
using Commands::StepTargetExecution;
|
||||
using Commands::SetBreakpoint;
|
||||
using Commands::RemoveBreakpoint;
|
||||
using Commands::SetTargetProgramCounter;
|
||||
using Commands::GetTargetPinStates;
|
||||
using Commands::SetTargetPinState;
|
||||
using Commands::GetTargetStackPointer;
|
||||
using Commands::GetTargetProgramCounter;
|
||||
using Commands::EnableProgrammingMode;
|
||||
using Commands::DisableProgrammingMode;
|
||||
using TargetController::Commands::GetState;
|
||||
using TargetController::Commands::Suspend;
|
||||
using TargetController::Commands::Resume;
|
||||
using TargetController::Commands::GetTargetDescriptor;
|
||||
using TargetController::Commands::GetTargetState;
|
||||
using TargetController::Commands::StopTargetExecution;
|
||||
using TargetController::Commands::ResumeTargetExecution;
|
||||
using TargetController::Commands::ResetTarget;
|
||||
using TargetController::Commands::ReadTargetRegisters;
|
||||
using TargetController::Commands::WriteTargetRegisters;
|
||||
using TargetController::Commands::ReadTargetMemory;
|
||||
using TargetController::Commands::WriteTargetMemory;
|
||||
using TargetController::Commands::EraseTargetMemory;
|
||||
using TargetController::Commands::StepTargetExecution;
|
||||
using TargetController::Commands::SetBreakpoint;
|
||||
using TargetController::Commands::RemoveBreakpoint;
|
||||
using TargetController::Commands::SetTargetProgramCounter;
|
||||
using TargetController::Commands::GetTargetPinStates;
|
||||
using TargetController::Commands::SetTargetPinState;
|
||||
using TargetController::Commands::GetTargetStackPointer;
|
||||
using TargetController::Commands::GetTargetProgramCounter;
|
||||
using TargetController::Commands::EnableProgrammingMode;
|
||||
using TargetController::Commands::DisableProgrammingMode;
|
||||
|
||||
using TargetController::TargetControllerState;
|
||||
|
||||
using Targets::TargetDescriptor;
|
||||
using Targets::TargetState;
|
||||
@@ -71,14 +73,14 @@ namespace Bloom::TargetController
|
||||
using Targets::TargetPinState;
|
||||
using Targets::TargetPinStateMapping;
|
||||
|
||||
TargetControllerState TargetControllerConsole::getTargetControllerState() {
|
||||
TargetControllerState TargetControllerService::getTargetControllerState() {
|
||||
return this->commandManager.sendCommandAndWaitForResponse(
|
||||
std::make_unique<GetState>(),
|
||||
this->defaultTimeout
|
||||
)->state;
|
||||
}
|
||||
|
||||
bool TargetControllerConsole::isTargetControllerInService() noexcept {
|
||||
bool TargetControllerService::isTargetControllerInService() noexcept {
|
||||
try {
|
||||
return this->getTargetControllerState() == TargetControllerState::ACTIVE;
|
||||
|
||||
@@ -87,7 +89,7 @@ namespace Bloom::TargetController
|
||||
}
|
||||
}
|
||||
|
||||
void TargetControllerConsole::resumeTargetController() {
|
||||
void TargetControllerService::resumeTargetController() {
|
||||
this->commandManager.sendCommandAndWaitForResponse(
|
||||
std::make_unique<Resume>(),
|
||||
this->defaultTimeout
|
||||
@@ -95,7 +97,7 @@ namespace Bloom::TargetController
|
||||
return;
|
||||
}
|
||||
|
||||
void TargetControllerConsole::suspendTargetController() {
|
||||
void TargetControllerService::suspendTargetController() {
|
||||
this->commandManager.sendCommandAndWaitForResponse(
|
||||
std::make_unique<Suspend>(),
|
||||
this->defaultTimeout
|
||||
@@ -103,28 +105,28 @@ namespace Bloom::TargetController
|
||||
return;
|
||||
}
|
||||
|
||||
const TargetDescriptor& TargetControllerConsole::getTargetDescriptor() {
|
||||
const TargetDescriptor& TargetControllerService::getTargetDescriptor() {
|
||||
return this->commandManager.sendCommandAndWaitForResponse(
|
||||
std::make_unique<GetTargetDescriptor>(),
|
||||
this->defaultTimeout
|
||||
)->targetDescriptor;
|
||||
}
|
||||
|
||||
TargetState TargetControllerConsole::getTargetState() {
|
||||
TargetState TargetControllerService::getTargetState() {
|
||||
return this->commandManager.sendCommandAndWaitForResponse(
|
||||
std::make_unique<GetTargetState>(),
|
||||
this->defaultTimeout
|
||||
)->targetState;
|
||||
}
|
||||
|
||||
void TargetControllerConsole::stopTargetExecution() {
|
||||
void TargetControllerService::stopTargetExecution() {
|
||||
this->commandManager.sendCommandAndWaitForResponse(
|
||||
std::make_unique<StopTargetExecution>(),
|
||||
this->defaultTimeout
|
||||
);
|
||||
}
|
||||
|
||||
void TargetControllerConsole::continueTargetExecution(std::optional<TargetProgramCounter> fromAddress) {
|
||||
void TargetControllerService::continueTargetExecution(std::optional<TargetProgramCounter> fromAddress) {
|
||||
auto resumeExecutionCommand = std::make_unique<ResumeTargetExecution>();
|
||||
|
||||
if (fromAddress.has_value()) {
|
||||
@@ -137,7 +139,7 @@ namespace Bloom::TargetController
|
||||
);
|
||||
}
|
||||
|
||||
void TargetControllerConsole::stepTargetExecution(std::optional<TargetProgramCounter> fromAddress) {
|
||||
void TargetControllerService::stepTargetExecution(std::optional<TargetProgramCounter> fromAddress) {
|
||||
auto stepExecutionCommand = std::make_unique<StepTargetExecution>();
|
||||
|
||||
if (fromAddress.has_value()) {
|
||||
@@ -150,21 +152,21 @@ namespace Bloom::TargetController
|
||||
);
|
||||
}
|
||||
|
||||
TargetRegisters TargetControllerConsole::readRegisters(const TargetRegisterDescriptors& descriptors) {
|
||||
TargetRegisters TargetControllerService::readRegisters(const TargetRegisterDescriptors& descriptors) {
|
||||
return this->commandManager.sendCommandAndWaitForResponse(
|
||||
std::make_unique<ReadTargetRegisters>(descriptors),
|
||||
this->defaultTimeout
|
||||
)->registers;
|
||||
}
|
||||
|
||||
void TargetControllerConsole::writeRegisters(const TargetRegisters& registers) {
|
||||
void TargetControllerService::writeRegisters(const TargetRegisters& registers) {
|
||||
this->commandManager.sendCommandAndWaitForResponse(
|
||||
std::make_unique<WriteTargetRegisters>(registers),
|
||||
this->defaultTimeout
|
||||
);
|
||||
}
|
||||
|
||||
TargetMemoryBuffer TargetControllerConsole::readMemory(
|
||||
TargetMemoryBuffer TargetControllerService::readMemory(
|
||||
TargetMemoryType memoryType,
|
||||
TargetMemoryAddress startAddress,
|
||||
TargetMemorySize bytes,
|
||||
@@ -181,7 +183,7 @@ namespace Bloom::TargetController
|
||||
)->data;
|
||||
}
|
||||
|
||||
void TargetControllerConsole::writeMemory(
|
||||
void TargetControllerService::writeMemory(
|
||||
TargetMemoryType memoryType,
|
||||
TargetMemoryAddress startAddress,
|
||||
const TargetMemoryBuffer& buffer
|
||||
@@ -192,77 +194,77 @@ namespace Bloom::TargetController
|
||||
);
|
||||
}
|
||||
|
||||
void TargetControllerConsole::eraseMemory(Targets::TargetMemoryType memoryType) {
|
||||
void TargetControllerService::eraseMemory(Targets::TargetMemoryType memoryType) {
|
||||
this->commandManager.sendCommandAndWaitForResponse(
|
||||
std::make_unique<EraseTargetMemory>(memoryType),
|
||||
this->defaultTimeout
|
||||
);
|
||||
}
|
||||
|
||||
void TargetControllerConsole::setBreakpoint(TargetBreakpoint breakpoint) {
|
||||
void TargetControllerService::setBreakpoint(TargetBreakpoint breakpoint) {
|
||||
this->commandManager.sendCommandAndWaitForResponse(
|
||||
std::make_unique<SetBreakpoint>(breakpoint),
|
||||
this->defaultTimeout
|
||||
);
|
||||
}
|
||||
|
||||
void TargetControllerConsole::removeBreakpoint(TargetBreakpoint breakpoint) {
|
||||
void TargetControllerService::removeBreakpoint(TargetBreakpoint breakpoint) {
|
||||
this->commandManager.sendCommandAndWaitForResponse(
|
||||
std::make_unique<RemoveBreakpoint>(breakpoint),
|
||||
this->defaultTimeout
|
||||
);
|
||||
}
|
||||
|
||||
TargetProgramCounter TargetControllerConsole::getProgramCounter() {
|
||||
TargetProgramCounter TargetControllerService::getProgramCounter() {
|
||||
return this->commandManager.sendCommandAndWaitForResponse(
|
||||
std::make_unique<GetTargetProgramCounter>(),
|
||||
this->defaultTimeout
|
||||
)->programCounter;
|
||||
}
|
||||
|
||||
void TargetControllerConsole::setProgramCounter(TargetProgramCounter address) {
|
||||
void TargetControllerService::setProgramCounter(TargetProgramCounter address) {
|
||||
this->commandManager.sendCommandAndWaitForResponse(
|
||||
std::make_unique<SetTargetProgramCounter>(address),
|
||||
this->defaultTimeout
|
||||
);
|
||||
}
|
||||
|
||||
TargetPinStateMapping TargetControllerConsole::getPinStates(int variantId) {
|
||||
TargetPinStateMapping TargetControllerService::getPinStates(int variantId) {
|
||||
return this->commandManager.sendCommandAndWaitForResponse(
|
||||
std::make_unique<GetTargetPinStates>(variantId),
|
||||
this->defaultTimeout
|
||||
)->pinStatesByNumber;
|
||||
}
|
||||
|
||||
void TargetControllerConsole::setPinState(TargetPinDescriptor pinDescriptor, TargetPinState pinState) {
|
||||
void TargetControllerService::setPinState(TargetPinDescriptor pinDescriptor, TargetPinState pinState) {
|
||||
this->commandManager.sendCommandAndWaitForResponse(
|
||||
std::make_unique<SetTargetPinState>(pinDescriptor, pinState),
|
||||
this->defaultTimeout
|
||||
);
|
||||
}
|
||||
|
||||
TargetStackPointer TargetControllerConsole::getStackPointer() {
|
||||
TargetStackPointer TargetControllerService::getStackPointer() {
|
||||
return this->commandManager.sendCommandAndWaitForResponse(
|
||||
std::make_unique<GetTargetStackPointer>(),
|
||||
this->defaultTimeout
|
||||
)->stackPointer;
|
||||
}
|
||||
|
||||
void TargetControllerConsole::resetTarget() {
|
||||
void TargetControllerService::resetTarget() {
|
||||
this->commandManager.sendCommandAndWaitForResponse(
|
||||
std::make_unique<ResetTarget>(),
|
||||
this->defaultTimeout
|
||||
);
|
||||
}
|
||||
|
||||
void TargetControllerConsole::enableProgrammingMode() {
|
||||
void TargetControllerService::enableProgrammingMode() {
|
||||
this->commandManager.sendCommandAndWaitForResponse(
|
||||
std::make_unique<EnableProgrammingMode>(),
|
||||
this->defaultTimeout
|
||||
);
|
||||
}
|
||||
|
||||
void TargetControllerConsole::disableProgrammingMode() {
|
||||
void TargetControllerService::disableProgrammingMode() {
|
||||
this->commandManager.sendCommandAndWaitForResponse(
|
||||
std::make_unique<DisableProgrammingMode>(),
|
||||
this->defaultTimeout
|
||||
@@ -4,8 +4,8 @@
|
||||
#include <chrono>
|
||||
#include <optional>
|
||||
|
||||
#include "CommandManager.hpp"
|
||||
#include "TargetControllerState.hpp"
|
||||
#include "src/TargetController/CommandManager.hpp"
|
||||
#include "src/TargetController/TargetControllerState.hpp"
|
||||
|
||||
#include "src/Targets/TargetState.hpp"
|
||||
#include "src/Targets/TargetRegister.hpp"
|
||||
@@ -16,15 +16,15 @@
|
||||
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
namespace Bloom::TargetController
|
||||
namespace Bloom::Services
|
||||
{
|
||||
/**
|
||||
* The TargetControllerConsole provides an interface to the TargetController.
|
||||
* The TargetControllerService provides an interface to the TargetController.
|
||||
*/
|
||||
class TargetControllerConsole
|
||||
class TargetControllerService
|
||||
{
|
||||
public:
|
||||
TargetControllerConsole() = default;
|
||||
TargetControllerService() = default;
|
||||
|
||||
void setDefaultTimeout(std::chrono::milliseconds timeout) {
|
||||
this->defaultTimeout = timeout;
|
||||
@@ -39,7 +39,7 @@ namespace Bloom::TargetController
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
TargetControllerState getTargetControllerState();
|
||||
TargetController::TargetControllerState getTargetControllerState();
|
||||
|
||||
/**
|
||||
* Retrieves the TargetController state and checks if it's currently active.
|
||||
@@ -215,7 +215,7 @@ namespace Bloom::TargetController
|
||||
void disableProgrammingMode();
|
||||
|
||||
private:
|
||||
CommandManager commandManager = CommandManager();
|
||||
TargetController::CommandManager commandManager = TargetController::CommandManager();
|
||||
|
||||
std::chrono::milliseconds defaultTimeout = std::chrono::milliseconds(60000);
|
||||
};
|
||||
@@ -2,5 +2,4 @@ target_sources(
|
||||
Bloom
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TargetControllerComponent.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TargetControllerConsole.cpp
|
||||
)
|
||||
|
||||
@@ -18,9 +18,9 @@ All TargetController commands can be found in [src/TargetController/Commands](./
|
||||
[`Bloom::TargetController::Responses::Response`](./Responses/Response.hpp) base class.
|
||||
|
||||
**NOTE:** Components within Bloom do not typically concern themselves with the TargetController command-response
|
||||
mechanism. Instead, they use the `TargetControllerConsole` class, which encapsulates the command-response mechanism and
|
||||
mechanism. Instead, they use the `TargetControllerService` class, which encapsulates the command-response mechanism and
|
||||
provides a simplified means for interaction with the connected hardware. For more, see
|
||||
[The TargetControllerConsole class](#the-targetcontrollerconsole-class) section below.
|
||||
[The TargetControllerService class](#the-TargetControllerService-class) section below.
|
||||
|
||||
Commands can be sent to the TargetController via the [`Bloom::TargetController::CommandManager`](./CommandManager.hpp)
|
||||
class.
|
||||
@@ -53,26 +53,26 @@ until a timeout has been reached. Because it is a template function, it is able
|
||||
type at compile-time (see the `SuccessResponseType` alias in some command classes). If the TargetController responds
|
||||
with an error, or the timeout is reached, `CommandManager::sendCommandAndWaitForResponse()` will throw an exception.
|
||||
|
||||
#### The TargetControllerConsole class
|
||||
#### The TargetControllerService class
|
||||
|
||||
The `TargetControllerConsole` class encapsulates the TargetController's command-response mechanism and provides a
|
||||
The `TargetControllerService` class encapsulates the TargetController's command-response mechanism and provides a
|
||||
simplified means for other components to interact with the connected hardware. Iterating on the example above, to read
|
||||
memory from the target:
|
||||
|
||||
```c++
|
||||
auto tcConsole = TargetController::TargetControllerConsole();
|
||||
auto tcService = Services::TargetControllerService();
|
||||
|
||||
const auto data = tcConsole.readMemory(
|
||||
const auto data = tcService.readMemory(
|
||||
someMemoryType, // Flash, RAM, EEPROM, etc
|
||||
someStartAddress,
|
||||
someNumberOfBytes
|
||||
);
|
||||
```
|
||||
|
||||
The `TargetControllerConsole` class does not require any dependencies at construction. It can be constructed in
|
||||
The `TargetControllerService` class does not require any dependencies at construction. It can be constructed in
|
||||
different threads and used freely to gain access to the connected hardware, from any component within Bloom.
|
||||
|
||||
All components within Bloom should use the `TargetControllerConsole` class to interact with the connected hardware. They
|
||||
All components within Bloom should use the `TargetControllerService` class to interact with the connected hardware. They
|
||||
**should not** directly issue commands via the `Bloom::TargetController::CommandManager`, unless there is a very good
|
||||
reason to do so.
|
||||
|
||||
@@ -114,7 +114,7 @@ For more on TargetController suspension, see `TargetControllerComponent::suspend
|
||||
|
||||
When a component needs to write to the target's program memory, it must enable programming mode on the target. This can
|
||||
be done by issuing the `EnableProgrammingMode` command to the TargetController (see
|
||||
`TargetControllerConsole::enableProgrammingMode()`). Once programming mode has been enabled, the TargetController will
|
||||
`TargetControllerService::enableProgrammingMode()`). Once programming mode has been enabled, the TargetController will
|
||||
reject any subsequent commands that involve debug operations (such as `ResumeTargetExecution`, `ReadTargetRegisters`,
|
||||
etc), until programming mode has been disabled.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user