Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 28 additions & 11 deletions tools/projmgr/include/ProjMgrParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,19 @@ struct MemoryItem {
};

/**
* @brief telnet item containing
* @brief stdio item containing
* mode
* port
* file
* legacy output file
* input and output files
* pname
*/
struct TelnetItem {
struct StdioItem {
std::string mode;
std::string port;
std::string file;
std::string fileIn;
std::string fileOut;
std::string pname;
};

Expand Down Expand Up @@ -182,6 +185,19 @@ struct CustomItem {
std::vector<std::pair<std::string, CustomItem>> map;
};

// Keep RTT configuration extensible, processing file paths separately from
// the remaining channel and control-block properties, as for trace options.
struct RttChannelItem {
std::string fileIn;
std::string fileOut;
CustomItem custom;
};

struct RttItem {
std::vector<RttChannelItem> channels;
CustomItem custom;
};

struct TraceItem {
std::string file;
CustomItem custom;
Expand All @@ -195,7 +211,7 @@ struct TraceItem {
* debug configuration file
* device settings
* start pname
* telnet options
* stdio options
* systemview options
* custom properties
*/
Expand All @@ -206,7 +222,8 @@ struct DebuggerItem {
std::string dbgconf;
std::map<std::string, std::string> deviceSettings;
std::string startPname;
std::vector<TelnetItem> telnet;
std::vector<StdioItem> stdio;
std::vector<RttItem> rtt;
std::vector<TraceItem> trace;
SystemViewItem systemView;
CustomItem custom;
Expand Down Expand Up @@ -795,12 +812,12 @@ struct GdbServerDefaults {
};

/**
* @brief telnet defaults item containing
* telnet port
* telnet mode
* @brief stdio defaults item containing
* stdio port
* stdio mode
* active flag
*/
struct TelnetDefaults {
struct StdioDefaults {
std::string port;
std::string mode;
bool active = false;
Expand All @@ -809,14 +826,14 @@ struct TelnetDefaults {
/**
* @brief debug-adapter defaults item containing
* gdbserver defaults
* telnet defaults
* stdio defaults
* systemview defaults
* debug protocol(jtag or swd)
* debug clock speed
*/
struct DebugAdapterDefaultsItem {
GdbServerDefaults gdbserver;
TelnetDefaults telnet;
StdioDefaults stdio;
std::string protocol;
std::string clock;
CustomItem custom;
Expand Down
4 changes: 2 additions & 2 deletions tools/projmgr/include/ProjMgrRunDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,10 @@ class ProjMgrRunDebug {
const std::map<std::string, RteDeviceProperty*>& pnames);
void CollectDebugTopology(const ContextItem& context, std::vector<std::pair<const RteItem*, std::vector<std::string>>> debugs,
const std::map<std::string, RteDeviceProperty*>& pnames);
void CollectTelnetOptions(const ContextItem& context, DebugAdapterItem& adapter,
void CollectStdioOptions(const ContextItem& context, DebugAdapterItem& adapter,
const std::map<std::string, RteDeviceProperty*>& pnames);
void CollectSystemViewOptions(const SystemViewItem& context);
void SetTelnetPort(TelnetOptionsItem& item, unsigned long long& port, std::set<unsigned long long>& usedPorts);
void SetStdioPort(StdioOptionsItem& item, unsigned long long& port, std::set<unsigned long long>& usedPorts);
};

#endif // PROJMGRRUNDEBUG_H
9 changes: 5 additions & 4 deletions tools/projmgr/include/ProjMgrWorker.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,10 @@ struct GdbServerItem {
};

/**
* @brief telnet port item extends TelnetItem containing
* @brief stdio port item extends StdioItem containing
resolved port number
*/
struct TelnetOptionsItem : TelnetItem {
struct StdioOptionsItem : StdioItem {
unsigned long long ullPort;
};

Expand Down Expand Up @@ -390,7 +390,7 @@ struct TemplateItem {
* device settings
* start pname
* list of gdbserver items
* list of telnet options items
* list of stdio options items
* custom options
*/
struct DebuggerType {
Expand All @@ -402,7 +402,8 @@ struct DebuggerType {
std::map<std::string, std::string> deviceSettings;
std::string startPname;
std::vector<GdbServerItem> gdbserver;
std::map<std::string, TelnetOptionsItem> telnet;
std::map<std::string, StdioOptionsItem> stdio;
std::vector<RttItem> rtt;
std::vector<TraceItem> trace;
SystemViewItem systemView;
CustomItem custom;
Expand Down
8 changes: 7 additions & 1 deletion tools/projmgr/include/ProjMgrYamlParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,12 @@ static constexpr const char* YAML_TARGET_SET = "target-set";
static constexpr const char* YAML_TARGETTYPE = "target-type";
static constexpr const char* YAML_TARGETTYPES = "target-types";
static constexpr const char* YAML_TEMPLATE = "template";
static constexpr const char* YAML_STDIO = "stdio";
static constexpr const char* YAML_TELNET = "telnet";
static constexpr const char* YAML_RTT = "rtt";
static constexpr const char* YAML_CHANNEL = "channel";
static constexpr const char* YAML_FILE_IN = "file-in";
static constexpr const char* YAML_FILE_OUT = "file-out";
static constexpr const char* YAML_TRACE = "trace";
static constexpr const char* YAML_TRACE_SINKS = "trace-sinks";
static constexpr const char* YAML_TRACEBUFFER = "tracebuffer";
Expand Down Expand Up @@ -411,7 +416,8 @@ class ProjMgrYamlParser {
bool ParseLinker(const YAML::Node& parent, const std::string& file, std::vector<LinkerItem>& linker);
void ParseRte(const YAML::Node& parent, std::string& rteBaseDir);
void ParseDebugDefaults(const YAML::Node& parent, const std::string& file, DebugAdapterDefaultsItem& defaults);
void ParseTelnet(const YAML::Node& parent, const std::string& file, std::vector<TelnetItem>& telnet);
void ParseRtt(const YAML::Node& parent, const std::string& file, std::vector<RttItem>& rtt);
void ParseStdio(const YAML::Node& parent, const std::string& file, std::vector<StdioItem>& stdio);
void ParseTrace(const YAML::Node& parent, const std::string& file, std::vector<TraceItem>& trace);
void ParseSystemView(const YAML::Node& parent, const std::string& file, SystemViewItem& systemView);
void ParseCustom(const YAML::Node& parent, const std::vector<std::string>& skip, CustomItem& custom);
Expand Down
34 changes: 21 additions & 13 deletions tools/projmgr/schemas/common.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2316,7 +2316,8 @@
"dbgconf": { "type": "string", "description": "Debugger configuration file (pinout, trace)." },
"start-pname": { "type": "string", "description": "Debugger connects at start to this processor." },
"gdbserver": { "$ref": "#/definitions/GdbServersType" },
"telnet": { "$ref": "#/definitions/TelnetOptionsType" },
"stdio": { "$ref": "#/definitions/StdioOptionsType" },
"telnet": { "$ref": "#/definitions/StdioOptionsType", "description": "Legacy alias for stdio." },
"rtt": { "$ref": "#/definitions/RttOptionsType" },
"trace": { "$ref": "#/definitions/TraceOptionsType" },
"systemview": { "$ref": "#/definitions/SystemViewOptionType" },
Expand Down Expand Up @@ -2400,26 +2401,32 @@
"type": "object",
"properties": {
"number": { "type": "number", "description": "RTT channel number." },
"mode": { "enum": [ "stdio", "server", "systemview", "systemview-server" ], "description": "RTT channel mode." },
"port": { "type": "number", "description": "TCP port number (required for server and systemview-server)." }
"mode": { "enum": [ "stdio", "server", "file", "systemview", "systemview-server" ], "description": "RTT channel mode." },
"port": { "type": "number", "description": "TCP port number (required for server and systemview-server)." },
"file-in": { "type": "string", "description": "Path to the RTT channel input file in file mode." },
"file-out": { "type": "string", "description": "Path to the RTT channel output file in file mode." }
},
"additionalProperties": false,
"required": [ "number", "mode" ]
},
"TelnetOptionsType": {
"title": "telnet:\nDocumentation: https://open-cmsis-pack.github.io/cmsis-toolbox/pyOCD-Debugger/#telnet",
"description": "Telnet port for connecting remote tools.",
"TelnetOptionsType": { "$ref": "#/definitions/StdioOptionsType" },
"TelnetOptionType": { "$ref": "#/definitions/StdioOptionType" },
"StdioOptionsType": {
"title": "stdio:\nDocumentation: https://open-cmsis-pack.github.io/cmsis-toolbox/pyOCD-Debugger/#stdio",
"description": "Standard I/O configuration.",
"type": "array",
"uniqueItems": true,
"items": { "$ref": "#/definitions/TelnetOptionType" }
"items": { "$ref": "#/definitions/StdioOptionType" }
},
"TelnetOptionType": {
"StdioOptionType": {
"type": "object",
"properties": {
"mode": { "enum": [ "off", "server", "file", "console", "monitor" ], "description": "Redirect output mode." },
"pname": { "type": "string", "description": "Processor name of the processor (only required for multi-core systems)." },
"port": { "type": "number", "description": "Set TCP/IP port number of Telnet Server." },
"file": { "type": "string", "description": "Base path and name of the telnet output file (without extension)."}
"mode": { "enum": [ "off", "server", "file", "console", "monitor" ], "description": "Redirect output mode." },
"pname": { "type": "string", "description": "Processor name of the processor (only required for multi-core systems)." },
"port": { "type": "number", "description": "Set TCP/IP port number of Telnet Server." },
"file": { "type": "string", "description": "Legacy explicit path and name of the standard I/O output file." },
"file-in": { "type": "string", "description": "Complete path and filename of the standard I/O input file." },
"file-out": { "type": "string", "description": "Complete path and filename of the standard I/O output file." }
},
"additionalProperties": false,
"required": ["mode"]
Expand Down Expand Up @@ -2659,7 +2666,8 @@
"clock": { "type": "number", "description": "Selected debug clock speed (in Hz)." },
"dbgconf": { "type": "string", "description": "Debugger configuration file (pinout, trace)." },
"start-pname": { "type": "string", "description": "Debugger connects at start to this processor." },
"telnet": { "$ref": "#/definitions/TelnetOptionsType" },
"stdio": { "$ref": "#/definitions/StdioOptionsType" },
"telnet": { "$ref": "#/definitions/StdioOptionsType", "description": "Legacy alias for stdio." },
"rtt": { "$ref": "#/definitions/RttOptionsType" },
"trace": { "$ref": "#/definitions/TraceOptionsType" },
"systemview": { "$ref": "#/definitions/SystemViewOptionType" },
Expand Down
48 changes: 38 additions & 10 deletions tools/projmgr/src/ProjMgrCbuildRun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ class ProjMgrCbuildRun : public ProjMgrCbuildBase {
void SetAccessPortsNode(YAML::Node node, const std::vector<AccessPortType>& accessPorts);
void SetDatapatchNode(YAML::Node node, const std::vector<DatapatchType>& datapatch);
void SetGdbServerNode(YAML::Node node, const std::vector<GdbServerItem>& gdbserver);
void SetTelnetNode(YAML::Node node, const std::map<std::string, TelnetOptionsItem>& telnet);
void SetRttNode(YAML::Node node, const std::vector<RttItem>& rtt);
void SetStdioNode(YAML::Node node, const std::map<std::string, StdioOptionsItem>& stdio);
void SetTraceNode(YAML::Node node, const std::vector<TraceItem>& trace);
void SetSystemViewNode(YAML::Node node, const SystemViewItem& systemView);
};
Expand Down Expand Up @@ -189,7 +190,8 @@ void ProjMgrCbuildRun::SetDebuggerNode(YAML::Node node, const DebuggerType& debu
}
SetNodeValue(node[YAML_START_PNAME], debugger.startPname);
SetGdbServerNode(node[YAML_GDBSERVER], debugger.gdbserver);
SetTelnetNode(node[YAML_TELNET], debugger.telnet);
SetStdioNode(node[YAML_STDIO], debugger.stdio);
SetRttNode(node[YAML_RTT], debugger.rtt);
SetTraceNode(node[YAML_TRACE], debugger.trace);
SetSystemViewNode(node[YAML_SYSTEMVIEW], debugger.systemView);
SetDeviceSettingsNode(node[YAML_DEVICE_SETTINGS], debugger.deviceSettings);
Expand All @@ -212,16 +214,42 @@ void ProjMgrCbuildRun::SetGdbServerNode(YAML::Node node, const std::vector<GdbSe
}
}

void ProjMgrCbuildRun::SetTelnetNode(YAML::Node node, const std::map<std::string, TelnetOptionsItem>& telnet) {
for (const auto& [pname, item] : telnet) {
YAML::Node telnetNode;
SetNodeValue(telnetNode[YAML_MODE], item.mode);
SetNodeValue(telnetNode[YAML_PNAME], pname);
telnetNode[YAML_PORT] = item.ullPort;
void ProjMgrCbuildRun::SetStdioNode(YAML::Node node, const std::map<std::string, StdioOptionsItem>& stdio) {
for (const auto& [pname, item] : stdio) {
YAML::Node stdioNode;
SetNodeValue(stdioNode[YAML_MODE], item.mode);
SetNodeValue(stdioNode[YAML_PNAME], pname);
stdioNode[YAML_PORT] = item.ullPort;
if (!item.file.empty()) {
SetNodeValue(telnetNode[YAML_FILE], FormatPath(item.file, m_directory));
SetNodeValue(stdioNode[YAML_FILE], FormatPath(item.file, m_directory));
}
node.push_back(telnetNode);
if (!item.fileIn.empty()) {
SetNodeValue(stdioNode[YAML_FILE_IN], FormatPath(item.fileIn, m_directory));
}
if (!item.fileOut.empty()) {
SetNodeValue(stdioNode[YAML_FILE_OUT], FormatPath(item.fileOut, m_directory));
}
node.push_back(stdioNode);
}
}

void ProjMgrCbuildRun::SetRttNode(YAML::Node node, const std::vector<RttItem>& rtt) {
for (const auto& item : rtt) {
YAML::Node rttNode(YAML::NodeType::Map);
SetCustomNodes(rttNode, item.custom);
rttNode[YAML_CHANNEL] = YAML::Node(YAML::NodeType::Sequence);
for (const auto& channel : item.channels) {
YAML::Node channelNode(YAML::NodeType::Map);
SetCustomNodes(channelNode, channel.custom);
if (!channel.fileIn.empty()) {
SetNodeValue(channelNode[YAML_FILE_IN], FormatPath(channel.fileIn, m_directory));
}
if (!channel.fileOut.empty()) {
SetNodeValue(channelNode[YAML_FILE_OUT], FormatPath(channel.fileOut, m_directory));
}
rttNode[YAML_CHANNEL].push_back(channelNode);
}
node.push_back(rttNode);
}
}

Expand Down
Loading
Loading