2021-04-04 21:04:12 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
2022-04-27 21:27:59 +01:00
|
|
|
#include <atomic>
|
2021-04-04 21:04:12 +01:00
|
|
|
#include <memory>
|
2022-04-17 23:55:34 +01:00
|
|
|
#include <queue>
|
|
|
|
|
#include <condition_variable>
|
|
|
|
|
#include <optional>
|
|
|
|
|
#include <chrono>
|
2021-04-04 21:04:12 +01:00
|
|
|
#include <map>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <functional>
|
|
|
|
|
#include <QJsonObject>
|
|
|
|
|
#include <QJsonArray>
|
|
|
|
|
|
|
|
|
|
#include "src/Helpers/Thread.hpp"
|
2023-06-02 00:16:58 +01:00
|
|
|
#include "src/Helpers/Synchronised.hpp"
|
2022-04-17 23:55:34 +01:00
|
|
|
#include "src/Helpers/ConditionVariableNotifier.hpp"
|
|
|
|
|
|
2022-05-02 13:38:03 +01:00
|
|
|
#include "TargetControllerState.hpp"
|
2023-06-01 22:13:07 +01:00
|
|
|
#include "AtomicSession.hpp"
|
2022-05-02 13:38:03 +01:00
|
|
|
|
2022-04-17 23:55:34 +01:00
|
|
|
// Commands
|
|
|
|
|
#include "Commands/Command.hpp"
|
2023-06-01 22:13:07 +01:00
|
|
|
#include "Commands/StartAtomicSession.hpp"
|
|
|
|
|
#include "Commands/EndAtomicSession.hpp"
|
2023-05-26 01:02:51 +01:00
|
|
|
#include "Commands/Shutdown.hpp"
|
2022-05-01 18:30:58 +01:00
|
|
|
#include "Commands/GetTargetDescriptor.hpp"
|
2022-04-28 21:02:45 +01:00
|
|
|
#include "Commands/GetTargetState.hpp"
|
2022-04-18 18:50:23 +01:00
|
|
|
#include "Commands/StopTargetExecution.hpp"
|
2022-04-19 21:12:59 +01:00
|
|
|
#include "Commands/ResumeTargetExecution.hpp"
|
2022-04-23 17:41:02 +01:00
|
|
|
#include "Commands/ResetTarget.hpp"
|
2022-04-24 16:41:40 +01:00
|
|
|
#include "Commands/ReadTargetRegisters.hpp"
|
2022-04-24 17:37:58 +01:00
|
|
|
#include "Commands/WriteTargetRegisters.hpp"
|
2022-04-24 18:55:19 +01:00
|
|
|
#include "Commands/ReadTargetMemory.hpp"
|
2022-04-30 01:30:57 +01:00
|
|
|
#include "Commands/WriteTargetMemory.hpp"
|
2022-12-11 23:25:15 +00:00
|
|
|
#include "Commands/EraseTargetMemory.hpp"
|
2022-04-29 22:12:09 +01:00
|
|
|
#include "Commands/StepTargetExecution.hpp"
|
2024-12-05 23:09:01 +00:00
|
|
|
#include "Commands/SetProgramBreakpointAnyType.hpp"
|
|
|
|
|
#include "Commands/RemoveProgramBreakpoint.hpp"
|
2022-05-01 18:47:57 +01:00
|
|
|
#include "Commands/SetTargetProgramCounter.hpp"
|
2024-07-23 21:14:22 +01:00
|
|
|
#include "Commands/SetTargetStackPointer.hpp"
|
2024-08-16 22:50:06 +01:00
|
|
|
#include "Commands/GetTargetGpioPadStates.hpp"
|
|
|
|
|
#include "Commands/SetTargetGpioPadState.hpp"
|
2022-05-01 18:01:01 +01:00
|
|
|
#include "Commands/GetTargetStackPointer.hpp"
|
2022-05-01 18:44:04 +01:00
|
|
|
#include "Commands/GetTargetProgramCounter.hpp"
|
2022-06-05 16:13:43 +01:00
|
|
|
#include "Commands/EnableProgrammingMode.hpp"
|
|
|
|
|
#include "Commands/DisableProgrammingMode.hpp"
|
2024-12-16 21:36:47 +00:00
|
|
|
#include "Commands/GetTargetPassthroughHelpText.hpp"
|
2024-12-15 17:32:58 +00:00
|
|
|
#include "Commands/InvokeTargetPassthroughCommand.hpp"
|
2022-04-17 23:55:34 +01:00
|
|
|
|
|
|
|
|
// Responses
|
|
|
|
|
#include "Responses/Response.hpp"
|
2023-06-01 22:13:07 +01:00
|
|
|
#include "Responses/AtomicSessionId.hpp"
|
2022-05-01 18:30:58 +01:00
|
|
|
#include "Responses/TargetDescriptor.hpp"
|
2022-04-28 21:02:45 +01:00
|
|
|
#include "Responses/TargetState.hpp"
|
2022-04-24 16:41:40 +01:00
|
|
|
#include "Responses/TargetRegistersRead.hpp"
|
2022-04-24 18:55:19 +01:00
|
|
|
#include "Responses/TargetMemoryRead.hpp"
|
2024-08-16 22:50:06 +01:00
|
|
|
#include "Responses/TargetGpioPadStates.hpp"
|
2022-05-01 18:01:01 +01:00
|
|
|
#include "Responses/TargetStackPointer.hpp"
|
2022-05-01 18:44:04 +01:00
|
|
|
#include "Responses/TargetProgramCounter.hpp"
|
2024-12-05 23:09:01 +00:00
|
|
|
#include "Responses/ProgramBreakpoint.hpp"
|
2024-12-16 21:36:47 +00:00
|
|
|
#include "Responses/TargetPassthroughHelpText.hpp"
|
2024-12-15 17:32:58 +00:00
|
|
|
#include "Responses/TargetPassthroughResponse.hpp"
|
2022-04-17 23:55:34 +01:00
|
|
|
|
2021-04-04 21:04:12 +01:00
|
|
|
#include "src/DebugToolDrivers/DebugTools.hpp"
|
2024-03-02 01:59:55 +00:00
|
|
|
#include "src/Targets/BriefTargetDescriptor.hpp"
|
2021-04-04 21:04:12 +01:00
|
|
|
#include "src/Targets/Target.hpp"
|
|
|
|
|
#include "src/Targets/Targets.hpp"
|
2024-03-09 17:16:29 +00:00
|
|
|
#include "src/Targets/TargetRegisterDescriptor.hpp"
|
2021-09-11 20:39:31 +01:00
|
|
|
#include "src/Targets/TargetMemory.hpp"
|
2024-10-07 00:14:39 +01:00
|
|
|
#include "src/Targets/TargetAddressSpaceDescriptor.hpp"
|
|
|
|
|
#include "src/Targets/TargetMemorySegmentDescriptor.hpp"
|
2024-12-05 23:09:01 +00:00
|
|
|
#include "src/Targets/ProgramBreakpointRegistry.hpp"
|
2023-09-22 17:52:28 +01:00
|
|
|
#include "src/Targets/TargetMemoryCache.hpp"
|
2021-05-30 16:52:32 +01:00
|
|
|
|
2021-04-04 21:04:12 +01:00
|
|
|
#include "src/EventManager/EventManager.hpp"
|
2021-05-30 16:52:32 +01:00
|
|
|
#include "src/EventManager/EventListener.hpp"
|
2021-04-04 21:04:12 +01:00
|
|
|
#include "src/EventManager/Events/Events.hpp"
|
|
|
|
|
|
2023-08-13 15:47:51 +01:00
|
|
|
namespace TargetController
|
2021-04-04 21:04:12 +01:00
|
|
|
{
|
2022-04-27 21:27:59 +01:00
|
|
|
static_assert(std::atomic<TargetControllerState>::is_always_lock_free);
|
|
|
|
|
|
2021-04-04 21:04:12 +01:00
|
|
|
/**
|
|
|
|
|
* The TargetController possesses full control of the debugging target and the debug tool.
|
|
|
|
|
*
|
2021-10-10 23:18:06 +01:00
|
|
|
* The TargetController runs on a dedicated thread. Its sole purpose is to handle communication to & from the
|
2021-04-04 21:04:12 +01:00
|
|
|
* debug tool and target.
|
|
|
|
|
*
|
|
|
|
|
* The TargetController should be oblivious to any manufacture/device specific functionality. It should
|
|
|
|
|
* only ever interface with the base Target and DebugTool classes.
|
|
|
|
|
*/
|
2022-04-09 15:26:56 +01:00
|
|
|
class TargetControllerComponent: public Thread
|
2021-04-04 21:04:12 +01:00
|
|
|
{
|
2021-10-06 21:12:31 +01:00
|
|
|
public:
|
2022-04-09 15:26:56 +01:00
|
|
|
explicit TargetControllerComponent(
|
2021-12-31 19:45:15 +00:00
|
|
|
const ProjectConfig& projectConfig,
|
|
|
|
|
const EnvironmentConfig& environmentConfig
|
2022-04-15 22:06:38 +01:00
|
|
|
);
|
2021-10-06 21:12:31 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Entry point for the TargetController.
|
|
|
|
|
*/
|
|
|
|
|
void run();
|
|
|
|
|
|
2023-06-01 22:13:07 +01:00
|
|
|
static void registerCommand(
|
|
|
|
|
std::unique_ptr<Commands::Command> command,
|
|
|
|
|
const std::optional<AtomicSessionIdType>& atomicSessionId
|
|
|
|
|
);
|
2022-04-17 23:55:34 +01:00
|
|
|
|
|
|
|
|
static std::optional<std::unique_ptr<Responses::Response>> waitForResponse(
|
|
|
|
|
Commands::CommandIdType commandId,
|
|
|
|
|
std::optional<std::chrono::milliseconds> timeout = std::nullopt
|
|
|
|
|
);
|
|
|
|
|
|
2021-04-04 21:04:12 +01:00
|
|
|
private:
|
2023-06-02 00:16:58 +01:00
|
|
|
static inline Synchronised<std::queue<std::unique_ptr<Commands::Command>>> commandQueue;
|
2023-06-01 22:13:07 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* We have a dedicated queue for atomic sessions.
|
|
|
|
|
*
|
|
|
|
|
* During an atomic session, all commands for the session are placed into this dedicated queue.
|
|
|
|
|
* The TargetController will only serve commands from this dedicated queue, until the atomic session ends.
|
|
|
|
|
*/
|
2023-06-02 00:16:58 +01:00
|
|
|
static inline Synchronised<std::queue<std::unique_ptr<Commands::Command>>> atomicSessionCommandQueue;
|
2022-04-17 23:55:34 +01:00
|
|
|
|
2023-06-02 00:16:58 +01:00
|
|
|
static inline Synchronised<
|
2022-04-17 23:55:34 +01:00
|
|
|
std::map<Commands::CommandIdType, std::unique_ptr<Responses::Response>>
|
|
|
|
|
> responsesByCommandId;
|
|
|
|
|
|
2024-07-23 21:14:22 +01:00
|
|
|
static inline ConditionVariableNotifier notifier = {};
|
|
|
|
|
static inline std::condition_variable responsesByCommandIdCv = {};
|
2022-04-17 23:56:57 +01:00
|
|
|
|
2023-05-26 00:23:07 +01:00
|
|
|
static inline std::atomic<TargetControllerState> state = TargetControllerState::INACTIVE;
|
2021-05-30 16:52:32 +01:00
|
|
|
|
2021-12-31 17:05:31 +00:00
|
|
|
ProjectConfig projectConfig;
|
2021-04-04 21:04:12 +01:00
|
|
|
EnvironmentConfig environmentConfig;
|
|
|
|
|
|
2023-06-01 22:13:07 +01:00
|
|
|
std::optional<AtomicSession> activeAtomicSession = std::nullopt;
|
|
|
|
|
|
2021-04-06 02:10:14 +01:00
|
|
|
/**
|
|
|
|
|
* The TargetController should be the sole owner of the target and debugTool. They are constructed and
|
|
|
|
|
* destroyed within the TargetController. Under no circumstance should ownership of these resources be
|
|
|
|
|
* transferred to any other component within Bloom.
|
|
|
|
|
*/
|
2021-04-04 21:04:12 +01:00
|
|
|
std::unique_ptr<Targets::Target> target = nullptr;
|
|
|
|
|
std::unique_ptr<DebugTool> debugTool = nullptr;
|
|
|
|
|
|
2022-04-17 23:55:34 +01:00
|
|
|
std::map<
|
|
|
|
|
Commands::CommandType,
|
|
|
|
|
std::function<std::unique_ptr<Responses::Response>(Commands::Command&)>
|
|
|
|
|
> commandHandlersByCommandType;
|
|
|
|
|
|
2021-04-04 21:04:12 +01:00
|
|
|
EventListenerPointer eventListener = std::make_shared<EventListener>("TargetControllerEventListener");
|
|
|
|
|
|
2024-07-23 21:14:22 +01:00
|
|
|
std::unique_ptr<const Targets::TargetDescriptor> targetDescriptor = nullptr;
|
|
|
|
|
std::unique_ptr<Targets::TargetState> targetState = nullptr;
|
2021-04-04 21:04:12 +01:00
|
|
|
|
2021-09-11 20:39:31 +01:00
|
|
|
/**
|
2024-07-23 21:14:22 +01:00
|
|
|
* Target register descriptors mapped by the address space key
|
2021-09-11 20:39:31 +01:00
|
|
|
*/
|
2024-07-23 21:14:22 +01:00
|
|
|
std::map<std::string, Targets::TargetRegisterDescriptors> registerDescriptorsByAddressSpaceKey;
|
2021-09-11 20:39:31 +01:00
|
|
|
|
2024-12-05 23:09:01 +00:00
|
|
|
Targets::ProgramBreakpointRegistry softwareBreakpointRegistry;
|
|
|
|
|
Targets::ProgramBreakpointRegistry hardwareBreakpointRegistry;
|
2023-09-20 23:37:54 +01:00
|
|
|
|
2023-09-22 17:52:28 +01:00
|
|
|
/**
|
2024-07-23 21:14:22 +01:00
|
|
|
* The target's program memory cache
|
2023-09-22 17:52:28 +01:00
|
|
|
*
|
|
|
|
|
* If program caching is enabled, all program memory reads will be serviced by the cache, if we have the data.
|
|
|
|
|
*
|
2024-10-07 00:14:39 +01:00
|
|
|
* Most targets only have a single memory segment for program memory, but some may have multiple program
|
|
|
|
|
* memories, across multiple address spaces. We have a single cache (TargetMemoryCache object) for each
|
|
|
|
|
* memory segment.
|
2023-09-22 17:52:28 +01:00
|
|
|
*/
|
2024-10-07 00:14:39 +01:00
|
|
|
std::map<Targets::TargetMemorySegmentId, Targets::TargetMemoryCache> programMemoryCachesBySegmentId;
|
2023-09-22 17:52:28 +01:00
|
|
|
|
2022-05-01 19:23:58 +01:00
|
|
|
/**
|
|
|
|
|
* Registers a handler function for a particular command type.
|
|
|
|
|
* Only one handler function can be registered per command type.
|
|
|
|
|
*
|
|
|
|
|
* @tparam CommandType
|
|
|
|
|
* @param callback
|
|
|
|
|
*/
|
2022-04-17 23:55:34 +01:00
|
|
|
template<class CommandType>
|
|
|
|
|
void registerCommandHandler(std::function<std::unique_ptr<Responses::Response>(CommandType&)> callback) {
|
2024-07-23 21:14:22 +01:00
|
|
|
this->commandHandlersByCommandType.emplace(
|
|
|
|
|
CommandType::type,
|
|
|
|
|
[callback] (Commands::Command& command) {
|
|
|
|
|
// Downcast the command to the expected type
|
|
|
|
|
return callback(dynamic_cast<CommandType&>(command));
|
|
|
|
|
}
|
2022-12-17 14:46:08 +00:00
|
|
|
);
|
2021-04-04 21:04:12 +01:00
|
|
|
}
|
|
|
|
|
|
2022-05-01 19:23:58 +01:00
|
|
|
/**
|
|
|
|
|
* Removes any registered handler for a given command type. After calling this function, any commands issued
|
|
|
|
|
* for the given command type will be rejected with a "No handler registered for this command." error, until a
|
|
|
|
|
* handler is registered again.
|
|
|
|
|
*
|
|
|
|
|
* @param commandType
|
|
|
|
|
*/
|
2022-04-18 18:49:49 +01:00
|
|
|
void deregisterCommandHandler(Commands::CommandType commandType);
|
|
|
|
|
|
2021-04-04 21:04:12 +01:00
|
|
|
/**
|
|
|
|
|
* Updates the state of the TargetController and emits a state changed event.
|
|
|
|
|
*
|
|
|
|
|
* @param state
|
|
|
|
|
* @param emitEvent
|
|
|
|
|
*/
|
2021-05-29 21:39:00 +01:00
|
|
|
void setThreadStateAndEmitEvent(ThreadState state) {
|
2023-05-25 23:16:30 +01:00
|
|
|
this->threadState = state;
|
2022-03-20 17:37:36 +00:00
|
|
|
EventManager::triggerEvent(
|
2021-05-29 21:39:00 +01:00
|
|
|
std::make_shared<Events::TargetControllerThreadStateChanged>(state)
|
2021-04-04 21:04:12 +01:00
|
|
|
);
|
2021-05-29 21:39:00 +01:00
|
|
|
}
|
2021-04-04 21:04:12 +01:00
|
|
|
|
2021-10-06 21:12:31 +01:00
|
|
|
/**
|
|
|
|
|
* Because the TargetController hogs the thread, this method must be called in a dedicated thread.
|
|
|
|
|
*/
|
|
|
|
|
void startup();
|
|
|
|
|
|
2023-05-26 00:23:07 +01:00
|
|
|
/**
|
|
|
|
|
* Exit point - must be called before the TargetController thread is terminated.
|
|
|
|
|
*
|
|
|
|
|
* Handles releasing the hardware among other clean-up related things.
|
|
|
|
|
*/
|
|
|
|
|
void shutdown();
|
|
|
|
|
|
2022-04-17 23:55:34 +01:00
|
|
|
/**
|
|
|
|
|
* Constructs a mapping of supported debug tool names to lambdas. The lambdas should *only* instantiate
|
|
|
|
|
* and return an instance to the derived DebugTool class. They should not attempt to establish
|
|
|
|
|
* a connection to the device.
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
std::map<std::string, std::function<std::unique_ptr<DebugTool>()>> getSupportedDebugTools();
|
|
|
|
|
|
|
|
|
|
/**
|
2023-12-17 18:12:53 +00:00
|
|
|
* Constructs a Target instance from a BriefTargetDescriptor object.
|
2022-04-17 23:55:34 +01:00
|
|
|
*
|
2024-03-02 01:59:55 +00:00
|
|
|
* @param briefDescriptor
|
2022-04-17 23:55:34 +01:00
|
|
|
* @return
|
|
|
|
|
*/
|
2024-03-02 01:59:55 +00:00
|
|
|
std::unique_ptr<Targets::Target> constructTarget(const Targets::BriefTargetDescriptor& briefDescriptor);
|
2022-04-17 23:55:34 +01:00
|
|
|
|
2022-05-01 19:23:58 +01:00
|
|
|
/**
|
|
|
|
|
* Processes any pending commands in the queue.
|
|
|
|
|
*/
|
2022-04-17 23:55:34 +01:00
|
|
|
void processQueuedCommands();
|
|
|
|
|
|
2022-05-01 19:23:58 +01:00
|
|
|
/**
|
|
|
|
|
* Records a response for a given command ID. Notifies the TargetControllerComponent::responsesByCommandIdCv
|
|
|
|
|
* condition variable of the new response.
|
|
|
|
|
*
|
|
|
|
|
* @param commandId
|
|
|
|
|
* @param response
|
|
|
|
|
*/
|
2022-04-17 23:55:34 +01:00
|
|
|
void registerCommandResponse(Commands::CommandIdType commandId, std::unique_ptr<Responses::Response> response);
|
|
|
|
|
|
2021-10-06 21:12:31 +01:00
|
|
|
/**
|
|
|
|
|
* Establishes a connection with the debug tool and target. Prepares the hardware for a debug session.
|
|
|
|
|
*/
|
|
|
|
|
void acquireHardware();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Attempts to gracefully disconnect from the debug tool and the target. All control of the debug tool and
|
|
|
|
|
* target will cease.
|
|
|
|
|
*/
|
|
|
|
|
void releaseHardware();
|
|
|
|
|
|
2023-06-01 22:13:07 +01:00
|
|
|
void startAtomicSession();
|
|
|
|
|
void endActiveAtomicSession();
|
|
|
|
|
|
2024-12-16 21:38:30 +00:00
|
|
|
void refreshExecutionState(bool forceRefresh = false);
|
2024-07-23 21:14:22 +01:00
|
|
|
void updateTargetState(const Targets::TargetState& newState);
|
|
|
|
|
|
|
|
|
|
void stopTarget();
|
|
|
|
|
void resumeTarget();
|
|
|
|
|
void stepTarget();
|
|
|
|
|
void resetTarget();
|
|
|
|
|
|
|
|
|
|
Targets::TargetRegisterDescriptorAndValuePairs readTargetRegisters(
|
|
|
|
|
const Targets::TargetRegisterDescriptors& descriptors
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
void writeTargetRegisters(const Targets::TargetRegisterDescriptorAndValuePairs& registers);
|
|
|
|
|
|
|
|
|
|
Targets::TargetMemoryBuffer readTargetMemory(
|
|
|
|
|
const Targets::TargetAddressSpaceDescriptor& addressSpaceDescriptor,
|
|
|
|
|
const Targets::TargetMemorySegmentDescriptor& memorySegmentDescriptor,
|
2022-09-06 17:16:49 +01:00
|
|
|
Targets::TargetMemoryAddress startAddress,
|
2024-07-23 21:14:22 +01:00
|
|
|
Targets::TargetMemorySize bytes,
|
|
|
|
|
const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges,
|
|
|
|
|
bool bypassCache
|
2021-09-11 20:39:31 +01:00
|
|
|
);
|
|
|
|
|
|
2024-07-23 21:14:22 +01:00
|
|
|
void writeTargetMemory(
|
|
|
|
|
const Targets::TargetAddressSpaceDescriptor& addressSpaceDescriptor,
|
|
|
|
|
const Targets::TargetMemorySegmentDescriptor& memorySegmentDescriptor,
|
|
|
|
|
Targets::TargetMemoryAddress startAddress,
|
2024-11-16 21:49:49 +00:00
|
|
|
Targets::TargetMemoryBufferSpan buffer
|
2024-07-23 21:14:22 +01:00
|
|
|
);
|
2021-04-04 21:04:12 +01:00
|
|
|
|
2024-07-23 21:14:22 +01:00
|
|
|
void eraseTargetMemory(
|
|
|
|
|
const Targets::TargetAddressSpaceDescriptor& addressSpaceDescriptor,
|
|
|
|
|
const Targets::TargetMemorySegmentDescriptor& memorySegmentDescriptor
|
|
|
|
|
);
|
|
|
|
|
|
2024-12-05 23:09:01 +00:00
|
|
|
std::uint32_t availableHardwareBreakpoints();
|
|
|
|
|
void setProgramBreakpoint(const Targets::TargetProgramBreakpoint& breakpoint);
|
|
|
|
|
void removeProgramBreakpoint(const Targets::TargetProgramBreakpoint& breakpoint);
|
|
|
|
|
void clearAllBreakpoints();
|
2022-04-08 22:14:01 +01:00
|
|
|
|
2022-06-05 16:13:43 +01:00
|
|
|
/**
|
|
|
|
|
* Puts the target into programming mode and disables command handlers for debug commands (commands that serve
|
|
|
|
|
* debug operations such as SetBreakpoint, ResumeTargetExecution, etc).
|
|
|
|
|
*/
|
|
|
|
|
void enableProgrammingMode();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Pulls the target out of programming mode and enables command handlers for debug commands.
|
|
|
|
|
*/
|
|
|
|
|
void disableProgrammingMode();
|
|
|
|
|
|
2021-04-06 02:10:14 +01:00
|
|
|
/**
|
2024-10-07 00:14:39 +01:00
|
|
|
* Fetches the program memory cache object for the given memory segment. If the segment has no associated
|
2024-07-23 21:14:22 +01:00
|
|
|
* cache object, one will be created.
|
2021-04-06 02:10:14 +01:00
|
|
|
*
|
2024-10-07 00:14:39 +01:00
|
|
|
* @param memorySegmentDescriptor
|
2022-05-01 19:23:58 +01:00
|
|
|
* @return
|
2021-04-06 02:10:14 +01:00
|
|
|
*/
|
2024-07-23 21:14:22 +01:00
|
|
|
Targets::TargetMemoryCache& getProgramMemoryCache(
|
2024-10-07 00:14:39 +01:00
|
|
|
const Targets::TargetMemorySegmentDescriptor& memorySegmentDescriptor
|
2024-07-23 21:14:22 +01:00
|
|
|
);
|
2021-09-11 20:39:31 +01:00
|
|
|
|
2021-04-04 21:04:12 +01:00
|
|
|
/**
|
2021-10-06 21:12:31 +01:00
|
|
|
* Invokes a shutdown.
|
|
|
|
|
*
|
|
|
|
|
* @param event
|
2021-04-04 21:04:12 +01:00
|
|
|
*/
|
2021-10-06 21:12:31 +01:00
|
|
|
void onShutdownTargetControllerEvent(const Events::ShutdownTargetController& event);
|
2021-04-04 21:04:12 +01:00
|
|
|
|
2021-10-06 21:12:31 +01:00
|
|
|
/**
|
|
|
|
|
* Will simply kick off execution on the target.
|
|
|
|
|
*
|
|
|
|
|
* @param event
|
|
|
|
|
*/
|
|
|
|
|
void onDebugSessionFinishedEvent(const Events::DebugSessionFinished& event);
|
|
|
|
|
|
2022-05-02 13:38:03 +01:00
|
|
|
// Command handlers
|
2023-06-01 22:13:07 +01:00
|
|
|
std::unique_ptr<Responses::AtomicSessionId> handleStartAtomicSession(Commands::StartAtomicSession& command);
|
|
|
|
|
std::unique_ptr<Responses::Response> handleEndAtomicSession(Commands::EndAtomicSession& command);
|
2023-05-26 01:02:51 +01:00
|
|
|
std::unique_ptr<Responses::Response> handleShutdown(Commands::Shutdown& command);
|
2022-05-01 18:30:58 +01:00
|
|
|
std::unique_ptr<Responses::TargetDescriptor> handleGetTargetDescriptor(Commands::GetTargetDescriptor& command);
|
2022-04-28 21:02:45 +01:00
|
|
|
std::unique_ptr<Responses::TargetState> handleGetTargetState(Commands::GetTargetState& command);
|
2022-04-18 18:50:23 +01:00
|
|
|
std::unique_ptr<Responses::Response> handleStopTargetExecution(Commands::StopTargetExecution& command);
|
2022-04-19 21:12:59 +01:00
|
|
|
std::unique_ptr<Responses::Response> handleResumeTargetExecution(Commands::ResumeTargetExecution& command);
|
2022-04-23 17:41:02 +01:00
|
|
|
std::unique_ptr<Responses::Response> handleResetTarget(Commands::ResetTarget& command);
|
2022-04-24 16:41:40 +01:00
|
|
|
std::unique_ptr<Responses::TargetRegistersRead> handleReadTargetRegisters(
|
|
|
|
|
Commands::ReadTargetRegisters& command
|
|
|
|
|
);
|
2022-04-24 17:37:58 +01:00
|
|
|
std::unique_ptr<Responses::Response> handleWriteTargetRegisters(Commands::WriteTargetRegisters& command);
|
2022-04-24 18:55:19 +01:00
|
|
|
std::unique_ptr<Responses::TargetMemoryRead> handleReadTargetMemory(Commands::ReadTargetMemory& command);
|
2022-04-30 01:30:57 +01:00
|
|
|
std::unique_ptr<Responses::Response> handleWriteTargetMemory(Commands::WriteTargetMemory& command);
|
2022-12-11 23:25:15 +00:00
|
|
|
std::unique_ptr<Responses::Response> handleEraseTargetMemory(Commands::EraseTargetMemory& command);
|
2022-04-29 22:12:09 +01:00
|
|
|
std::unique_ptr<Responses::Response> handleStepTargetExecution(Commands::StepTargetExecution& command);
|
2024-12-05 23:09:01 +00:00
|
|
|
std::unique_ptr<Responses::ProgramBreakpoint> handleSetProgramBreakpointBreakpointAnyType(
|
|
|
|
|
Commands::SetProgramBreakpointAnyType& command
|
|
|
|
|
);
|
|
|
|
|
std::unique_ptr<Responses::Response> handleRemoveProgramBreakpoint(Commands::RemoveProgramBreakpoint& command);
|
2022-05-01 18:47:57 +01:00
|
|
|
std::unique_ptr<Responses::Response> handleSetProgramCounter(Commands::SetTargetProgramCounter& command);
|
2024-07-23 21:14:22 +01:00
|
|
|
std::unique_ptr<Responses::Response> handleSetStackPointer(Commands::SetTargetStackPointer& command);
|
2024-08-16 22:50:06 +01:00
|
|
|
std::unique_ptr<Responses::TargetGpioPadStates> handleGetTargetGpioPadStates(
|
|
|
|
|
Commands::GetTargetGpioPadStates& command
|
2024-07-23 21:14:22 +01:00
|
|
|
);
|
2024-08-16 22:50:06 +01:00
|
|
|
std::unique_ptr<Responses::Response> handleSetTargetGpioPadState(Commands::SetTargetGpioPadState& command);
|
2022-05-01 18:01:01 +01:00
|
|
|
std::unique_ptr<Responses::TargetStackPointer> handleGetTargetStackPointer(
|
|
|
|
|
Commands::GetTargetStackPointer& command
|
|
|
|
|
);
|
2022-05-01 18:44:04 +01:00
|
|
|
std::unique_ptr<Responses::TargetProgramCounter> handleGetTargetProgramCounter(
|
|
|
|
|
Commands::GetTargetProgramCounter& command
|
|
|
|
|
);
|
2022-06-05 16:13:43 +01:00
|
|
|
std::unique_ptr<Responses::Response> handleEnableProgrammingMode(Commands::EnableProgrammingMode& command);
|
|
|
|
|
std::unique_ptr<Responses::Response> handleDisableProgrammingMode(Commands::DisableProgrammingMode& command);
|
2024-12-16 21:36:47 +00:00
|
|
|
std::unique_ptr<Responses::TargetPassthroughHelpText> handleTargetPassthroughHelpText(
|
|
|
|
|
Commands::GetTargetPassthroughHelpText& command
|
|
|
|
|
);
|
2024-12-15 17:32:58 +00:00
|
|
|
std::unique_ptr<Responses::TargetPassthroughResponse> handleTargetPassthroughCommand(
|
|
|
|
|
Commands::InvokeTargetPassthroughCommand& command
|
|
|
|
|
);
|
2021-04-04 21:04:12 +01:00
|
|
|
};
|
|
|
|
|
}
|