Removed redundant programming mode events and updated TC documentation.
These events were made redundant by the introduction of the `TargetState` struct, and the `TargetStateChanged` event.
This commit is contained in:
@@ -15,8 +15,6 @@
|
|||||||
#include "TargetStateChanged.hpp"
|
#include "TargetStateChanged.hpp"
|
||||||
#include "MemoryWrittenToTarget.hpp"
|
#include "MemoryWrittenToTarget.hpp"
|
||||||
#include "TargetReset.hpp"
|
#include "TargetReset.hpp"
|
||||||
#include "ProgrammingModeEnabled.hpp"
|
|
||||||
#include "ProgrammingModeDisabled.hpp"
|
|
||||||
|
|
||||||
#ifndef EXCLUDE_INSIGHT
|
#ifndef EXCLUDE_INSIGHT
|
||||||
#include "InsightActivationRequested.hpp"
|
#include "InsightActivationRequested.hpp"
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include "Event.hpp"
|
|
||||||
|
|
||||||
namespace Events
|
|
||||||
{
|
|
||||||
class ProgrammingModeDisabled: public Event
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static constexpr EventType type = EventType::PROGRAMMING_MODE_DISABLED;
|
|
||||||
static const inline std::string name = "ProgrammingModeDisabled";
|
|
||||||
|
|
||||||
[[nodiscard]] EventType getType() const override {
|
|
||||||
return ProgrammingModeDisabled::type;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] std::string getName() const override {
|
|
||||||
return ProgrammingModeDisabled::name;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include "Event.hpp"
|
|
||||||
|
|
||||||
namespace Events
|
|
||||||
{
|
|
||||||
class ProgrammingModeEnabled: public Event
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static constexpr EventType type = EventType::PROGRAMMING_MODE_ENABLED;
|
|
||||||
static const inline std::string name = "ProgrammingModeEnabled";
|
|
||||||
|
|
||||||
[[nodiscard]] EventType getType() const override {
|
|
||||||
return ProgrammingModeEnabled::type;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] std::string getName() const override {
|
|
||||||
return ProgrammingModeEnabled::name;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -49,14 +49,6 @@ Insight::Insight(
|
|||||||
std::bind(&Insight::onTargetMemoryWrittenEvent, this, std::placeholders::_1)
|
std::bind(&Insight::onTargetMemoryWrittenEvent, this, std::placeholders::_1)
|
||||||
);
|
);
|
||||||
|
|
||||||
this->eventListener.registerCallbackForEventType<Events::ProgrammingModeEnabled>(
|
|
||||||
std::bind(&Insight::onProgrammingModeEnabledEvent, this, std::placeholders::_1)
|
|
||||||
);
|
|
||||||
|
|
||||||
this->eventListener.registerCallbackForEventType<Events::ProgrammingModeDisabled>(
|
|
||||||
std::bind(&Insight::onProgrammingModeDisabledEvent, this, std::placeholders::_1)
|
|
||||||
);
|
|
||||||
|
|
||||||
QApplication::setQuitOnLastWindowClosed(false);
|
QApplication::setQuitOnLastWindowClosed(false);
|
||||||
QApplication::setStyle(new BloomProxyStyle{});
|
QApplication::setStyle(new BloomProxyStyle{});
|
||||||
|
|
||||||
@@ -226,11 +218,3 @@ void Insight::onTargetMemoryWrittenEvent(const Events::MemoryWrittenToTarget& ev
|
|||||||
Targets::TargetMemoryAddressRange{event.startAddress, event.startAddress + (event.size - 1)}
|
Targets::TargetMemoryAddressRange{event.startAddress, event.startAddress + (event.size - 1)}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Insight::onProgrammingModeEnabledEvent(const Events::ProgrammingModeEnabled& event) {
|
|
||||||
emit this->insightSignals->programmingModeEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Insight::onProgrammingModeDisabledEvent(const Events::ProgrammingModeDisabled& event) {
|
|
||||||
emit this->insightSignals->programmingModeDisabled();
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -91,6 +91,4 @@ private:
|
|||||||
void onTargetResetEvent(const Events::TargetReset& event);
|
void onTargetResetEvent(const Events::TargetReset& event);
|
||||||
void onTargetRegistersWrittenEvent(const Events::RegistersWrittenToTarget& event);
|
void onTargetRegistersWrittenEvent(const Events::RegistersWrittenToTarget& event);
|
||||||
void onTargetMemoryWrittenEvent(const Events::MemoryWrittenToTarget& event);
|
void onTargetMemoryWrittenEvent(const Events::MemoryWrittenToTarget& event);
|
||||||
void onProgrammingModeEnabledEvent(const Events::ProgrammingModeEnabled& event);
|
|
||||||
void onProgrammingModeDisabledEvent(const Events::ProgrammingModeDisabled& event);
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -333,56 +333,16 @@ void onTargetStateChanged(const Events::TargetStateChanged& event) {
|
|||||||
|
|
||||||
### Programming mode
|
### Programming mode
|
||||||
|
|
||||||
When a component needs to write to the target's program memory, it must enable programming mode on the target. This can
|
When a component needs to write to the target's program memory, it must enable programming mode. This can be done by
|
||||||
be done by issuing the `EnableProgrammingMode` command to the TargetController (see
|
issuing the `EnableProgrammingMode` command to the TargetController (see
|
||||||
`TargetControllerService::enableProgrammingMode()`).
|
`TargetControllerService::enableProgrammingMode()`).
|
||||||
|
|
||||||
Once programming mode has been enabled, standard debugging operations such as program flow control and RAM access will
|
Once programming mode has been enabled, standard debugging operations such as program flow control and RAM access will
|
||||||
become unavailable. The TargetController will reject any commands that involve these operations, until programming mode
|
become unavailable. The TargetController will reject any commands that involve these operations, until programming mode
|
||||||
has been disabled. The [`Command::requiresDebugMode()`](./Commands/Command.hpp) virtual member function communicates a
|
has been disabled.
|
||||||
particular command's requirement for the target to **not** be in programming mode.
|
|
||||||
|
|
||||||
For example, the `ResumeTargetExecution` command returns `true` here, as it attempts to control program flow on the
|
The TargetController will emit a `TargetStateChanged` event when programming mode is enabled/disabled. See
|
||||||
target, which can only be done when the target is not in programming mode:
|
[`TargetState::mode`](../Targets/TargetState.hpp) for more.
|
||||||
|
|
||||||
```c++
|
|
||||||
class ResumeTargetExecution: public Command
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// ...
|
|
||||||
[[nodiscard]] bool requiresDebugMode() const override {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
On the other hand, the `ReadTargetMemory` command will only return `true` if we're reading from RAM, as RAM is the
|
|
||||||
only memory which isn't accessible when the target is in programming mode:
|
|
||||||
|
|
||||||
```c++
|
|
||||||
class ReadTargetMemory: public Command
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Targets::TargetMemoryType memoryType;
|
|
||||||
Targets::TargetMemoryAddress startAddress;
|
|
||||||
Targets::TargetMemorySize bytes;
|
|
||||||
|
|
||||||
// ...
|
|
||||||
|
|
||||||
[[nodiscard]] bool requiresDebugMode() const override {
|
|
||||||
return this->memoryType == Targets::TargetMemoryType::RAM;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
The TargetController will emit `ProgrammingModeEnabled` and `ProgrammingModeDisabled` events when it enables/disables
|
|
||||||
programming mode. Components should listen for these events to ensure that they disable any means for the user to trigger
|
|
||||||
debugging operations whilst programming mode is enabled. For example, the Insight component will disable much of its
|
|
||||||
GUI components when programming mode is enabled.
|
|
||||||
|
|
||||||
It shouldn't be too much of a problem if a component attempts to perform a debug operation on the target whilst
|
|
||||||
programming mode is enabled, as the TargetController will just respond with an error. But still, it would be best to
|
|
||||||
avoid doing this where possible.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user