Skip to content

Commit

Permalink
[cbuild-run] Implement extensions (system-resources, debug-vars, …
Browse files Browse the repository at this point in the history
…`debuggers`)
  • Loading branch information
spcaipers-arm authored Feb 19, 2025
1 parent 3256e32 commit 536537a
Show file tree
Hide file tree
Showing 14 changed files with 529 additions and 37 deletions.
2 changes: 2 additions & 0 deletions test/packs/ARM/RteTest_DFP/0.2.0/ARM.RteTest_DFP.pdsc
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@
<description>
RteTest ARM Cortex M4 is a clone description from ARM.CMSIS pack.
</description>
<debugconfig default="jtag" clock="40000000"/>
<debugvars configfile="Device/ARM/Debug/ARMCM4.dbgconf" version="0.2.1" >
__var DbgMCU_CR = 0x00000007; // DBGMCU_CR: DBG_SLEEP, DBG_STOP, DBG_STANDBY
__var TraceClk_Pin = 0x00040003; // PE2
Expand Down Expand Up @@ -458,6 +459,7 @@
<compatibleDevice deviceIndex="0" Dvendor="ARM:82" Dname="RteTest_ARMCM3"/>
<memory name="RAM-External" access="rwx" start="0x90000000" size="0x00800000"/>
<memory name="Flash-External" access="rx" start="0x70000000" size="0x04000000"/>
<debugProbe debugClock="30000000" debugLink="swd" name="CMSIS-DAP"/>
</board>
<board name="RteTest Test board no mounted device" vendor="Keil" revision="2.2.2">
<description>uVision Simulator</description>
Expand Down
24 changes: 22 additions & 2 deletions tools/projmgr/include/ProjMgrParser.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2021 Arm Limited. All rights reserved.
* Copyright (c) 2020-2025 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -420,6 +420,24 @@ struct CdefaultItem {
std::vector<MiscItem> misc;
};

/**
* @brief debugger item containing
* name of debug configuration
* brief description
* debug port (jtag or swd)
* debug clock speed
* debug configuration file
* type filter
*/
struct DebuggerItem {
std::string name;
std::string info;
std::string port;
std::string clock;
std::string dbgconf;
TypeFilter type;
};

typedef std::vector<std::pair<std::string, BuildType>> BuildTypes;
typedef std::vector<std::pair<std::string, TargetType>> TargetTypes;
/**
Expand All @@ -439,7 +457,8 @@ typedef std::vector<std::pair<std::string, TargetType>> TargetTypes;
* list of packs,
* cdefault enable switch,
* generator options,
* list of executes
* list of executes,
* list of debuggers
*/
struct CsolutionItem {
std::string name;
Expand All @@ -459,6 +478,7 @@ struct CsolutionItem {
GeneratorsItem generators;
CbuildPackItem cbuildPack;
std::vector<ExecutesItem> executes;
std::vector<DebuggerItem> debuggers;
std::vector<std::string> ymlOrderedBuildTypes;
std::vector<std::string> ymlOrderedTargetTypes;
};
Expand Down
50 changes: 47 additions & 3 deletions tools/projmgr/include/ProjMgrRunDebug.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 Arm Limited. All rights reserved.
* Copyright (c) 2024-2025 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand All @@ -9,7 +9,7 @@

#include "ProjMgrWorker.h"

/**
/**
* @brief programming algorithm types
*/
struct AlgorithmType {
Expand All @@ -22,6 +22,29 @@ struct AlgorithmType {
std::string pname;
};

/**
* @brief memory type
*/
struct MemoryType {
std::string name;
std::string access;
std::string alias;
std::string fromPack;
unsigned long long start = 0;
unsigned long long size = 0;
bool bDefault = false;
bool bStartup = false;
bool bUninit = false;
std::string pname;
};

/**
* @brief system resources type
*/
struct SystemResourcesType {
std::vector<MemoryType> memories;
};

/**
* @brief files type
*/
Expand All @@ -40,7 +63,7 @@ struct DebugSequencesBlockType {
std::string control_if;
std::string control_while;
std::string timeout;
bool atomic = false;
bool bAtomic = false;
std::vector<DebugSequencesBlockType> blocks;
};

Expand All @@ -54,6 +77,24 @@ struct DebugSequencesType {
std::string pname;
};

/**
* @brief debug vars type
*/
struct DebugVarsType {
std::string vars;
};

/**
* @brief debugger type
*/
struct DebuggerType {
std::string name;
std::string info;
std::string port;
unsigned long long clock = 0;
std::string dbgconf;
};

/**
* @brief debug run manager types
*/
Expand All @@ -69,6 +110,9 @@ struct RunDebugType {
std::vector<AlgorithmType> algorithms;
std::vector<FilesType> outputs;
std::vector<FilesType> systemDescriptions;
SystemResourcesType systemResources;
std::vector<DebuggerType> debuggers;
DebugVarsType debugVars;
std::vector<DebugSequencesType> debugSequences;
};

Expand Down
3 changes: 3 additions & 0 deletions tools/projmgr/include/ProjMgrWorker.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ struct ContextTypesItem {
* vector of device books
* vector of board books
* additional memory
* debuggers
*/
struct ContextItem {
CdefaultItem* cdefault = nullptr;
Expand Down Expand Up @@ -359,6 +360,7 @@ struct ContextItem {
std::vector<BookItem> deviceBooks;
std::vector<BookItem> boardBooks;
std::vector<MemoryItem> memory;
std::vector<DebuggerItem> debuggers;
};

/**
Expand Down Expand Up @@ -851,6 +853,7 @@ class ProjMgrWorker {
bool ProcessGpdsc(ContextItem& context);
bool ProcessConfigFiles(ContextItem& context);
bool ProcessComponentFiles(ContextItem& context);
void ProcessDebuggers(ContextItem& context);
bool ProcessExecutes(ContextItem& context, bool solutionLevel = false);
bool ProcessGroups(ContextItem& context);
bool ProcessSequencesRelatives(ContextItem& context, bool rerun);
Expand Down
15 changes: 13 additions & 2 deletions tools/projmgr/include/ProjMgrYamlParser.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2023 Arm Limited. All rights reserved.
* Copyright (c) 2020-2025 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand All @@ -15,6 +15,7 @@
*/
static constexpr const char* YAML_ACCESS = "access";
static constexpr const char* YAML_ALGORITHM = "algorithm";
static constexpr const char* YAML_ALIAS = "alias";
static constexpr const char* YAML_APIS = "apis";
static constexpr const char* YAML_API = "api";
static constexpr const char* YAML_ADDPATH = "add-path";
Expand Down Expand Up @@ -49,6 +50,7 @@ static constexpr const char* YAML_CBUILD_SET = "cbuild-set";
static constexpr const char* YAML_CDEFAULT = "cdefault";
static constexpr const char* YAML_CLAYERS = "clayers";
static constexpr const char* YAML_CLAYER = "clayer";
static constexpr const char* YAML_CLOCK = "clock";
static constexpr const char* YAML_CPROJECTS = "cprojects";
static constexpr const char* YAML_CPROJECT = "cproject";
static constexpr const char* YAML_CSOLUTION = "csolution";
Expand All @@ -71,6 +73,10 @@ static constexpr const char* YAML_COPY_TO = "copy-to";
static constexpr const char* YAML_CREATED_BY = "created-by";
static constexpr const char* YAML_CREATED_FOR = "created-for";
static constexpr const char* YAML_DEBUG = "debug";
static constexpr const char* YAML_DEBUG_SEQUENCES = "debug-sequences";
static constexpr const char* YAML_DEBUG_VARS = "debug-vars";
static constexpr const char* YAML_DEBUGGER = "debugger";
static constexpr const char* YAML_DBGCONF = "dbgconf";
static constexpr const char* YAML_DEFAULT = "default";
static constexpr const char* YAML_DEFINE = "define";
static constexpr const char* YAML_DEFINE_ASM = "define-asm";
Expand Down Expand Up @@ -152,6 +158,7 @@ static constexpr const char* YAML_PACKS_MISSING = "packs-missing";
static constexpr const char* YAML_PACKS_UNUSED = "packs-unused";
static constexpr const char* YAML_PATH = "path";
static constexpr const char* YAML_PNAME = "pname";
static constexpr const char* YAML_PORT = "port";
static constexpr const char* YAML_PROCESSOR = "processor";
static constexpr const char* YAML_PROGRAMMING = "programming";
static constexpr const char* YAML_PROJECT = "project";
Expand All @@ -172,17 +179,18 @@ static constexpr const char* YAML_SOLUTION = "solution";
static constexpr const char* YAML_SELECT = "select";
static constexpr const char* YAML_SELECTED_BY = "selected-by";
static constexpr const char* YAML_SELECTED_BY_PACK = "selected-by-pack";
static constexpr const char* YAML_SEQUENCES = "sequences";
static constexpr const char* YAML_SETUPS = "setups";
static constexpr const char* YAML_SETUP = "setup";
static constexpr const char* YAML_SET = "set";
static constexpr const char* YAML_SETTINGS = "settings";
static constexpr const char* YAML_SELECT_COMPILER = "select-compiler";
static constexpr const char* YAML_SIZE = "size";
static constexpr const char* YAML_START = "start";
static constexpr const char* YAML_STARTUP = "startup";
static constexpr const char* YAML_STATUS = "status";
static constexpr const char* YAML_SWITCH = "switch";
static constexpr const char* YAML_SYSTEM_DESCRIPTIONS = "system-descriptions";
static constexpr const char* YAML_SYSTEM_RESOURCES = "system-resources";
static constexpr const char* YAML_TARGET_CONFIGURATIONS = "target-configurations";
static constexpr const char* YAML_TARGETTYPE = "target-type";
static constexpr const char* YAML_TARGETTYPES = "target-types";
Expand All @@ -192,8 +200,10 @@ static constexpr const char* YAML_CORE = "core";
static constexpr const char* YAML_TITLE = "title";
static constexpr const char* YAML_TYPE = "type";
static constexpr const char* YAML_UNDEFINE = "undefine";
static constexpr const char* YAML_UNINIT = "uninit";
static constexpr const char* YAML_UPDATE = "update";
static constexpr const char* YAML_VARIABLES = "variables";
static constexpr const char* YAML_VARS = "vars";
static constexpr const char* YAML_VERSION = "version";
static constexpr const char* YAML_WARNINGS = "warnings";
static constexpr const char* YAML_WHILE = "while";
Expand Down Expand Up @@ -280,6 +290,7 @@ class ProjMgrYamlParser {
void ParseOutputDirs(const YAML::Node& parent, const std::string& file, struct DirectoriesItem& directories);
void ParseGenerators(const YAML::Node& parent, const std::string& file, GeneratorsItem& generators);
void ParseExecutes(const YAML::Node& parent, const std::string& file, std::vector<ExecutesItem>& executes);
bool ParseDebugger(const YAML::Node& parent, const std::string& file, std::vector<DebuggerItem>& debbugers);
void ParseConnections(const YAML::Node& parent, std::vector<ConnectItem>& connects);
bool ParseTargetType(const YAML::Node& parent, const std::string& file, TargetType& targetType);
bool ParseBuildTypes(const YAML::Node& parent, const std::string& file, BuildTypes& buildTypes);
Expand Down
95 changes: 82 additions & 13 deletions tools/projmgr/schemas/common.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,7 @@
"description": "The tool required to build this csolution project."
},
"debug": { "$ref": "#/definitions/DebugType" },
"debugger": { "$ref": "#/definitions/DebuggersType" },
"define": { "$ref": "#/definitions/DefinesType" },
"define-asm": { "$ref": "#/definitions/DefinesAsmType" },
"del-path": { "$ref": "#/definitions/DelpathsType" },
Expand Down Expand Up @@ -1922,6 +1923,11 @@
},
"additionalProperties": false
},
"MemoryAccessType": {
"description": "Memory access permission.",
"pattern": "^[rwxpsnc]+$",
"type": "string"
},
"MemoryType": {
"title": "memory:",
"description": "Additional memory available",
Expand All @@ -1933,7 +1939,7 @@
"type": "object",
"properties": {
"name": { "title": "name:", "type": "string", "description": "Memory identifier." },
"access": { "title": "access:", "type": "string", "description": "Memory access permission." },
"access": { "title": "access:", "$ref": "#/definitions/MemoryAccessType" },
"algorithm":{ "title": "algorithm:", "type": "string", "description": "Programming algorithm." },
"start": { "title": "start:", "type": "number", "description": "Memory start address." },
"size": { "title": "size:", "type": "number", "description": "Memory size." }
Expand Down Expand Up @@ -1974,6 +1980,7 @@
"additionalProperties": false
},
"DebugSequencesType": {
"description": "Debug sequences for the target.",
"type": "array",
"uniqueItems": true,
"items": { "$ref": "#/definitions/DebugSequenceType" }
Expand Down Expand Up @@ -2009,22 +2016,84 @@
},
"additionalProperties": false
},
"SystemResourcesType": {
"description": "Resources of a target system.",
"type": "object",
"properties": {
"memory": { "$ref": "#/definitions/SystemMemoriesType" }
},
"additionalProperties": false
},
"SystemMemoriesType": {
"type": "array",
"uniqueItems": true,
"items": { "$ref": "#/definitions/SystemMemoryType" }
},
"SystemMemoryType": {
"type": "object",
"properties": {
"name": { "type": "string", "description": "Name of the memory region." },
"access": { "$ref": "#/definitions/MemoryAccessType" },
"start": { "type": "number", "description": "Base address of the memory." },
"size": { "type": "number", "description": "Size of the memory." },
"default": { "type": "boolean", "description": "Memory is always accessible (used for algorithm when no ram-start is specified)." },
"startup": { "type": "boolean", "description": "Default startup code location (vector table)." },
"pname": { "type": "string", "description": "Only accessible by a specific processor." },
"uninit": { "type": "boolean", "description": "Memory content must not be altered." },
"alias": { "type": "string", "description": "Name of identical memory exposed at different address." },
"from-pack": { "$ref": "#/definitions/PackID" }
},
"additionalProperties": false,
"required": ["name"]
},
"DebuggersType": {
"description": "Connection information to debuggers.",
"type": "array",
"uniqueItems": true,
"items": { "$ref": "#/definitions/DebuggerType" }
},
"DebuggerType": {
"type": "object",
"properties": {
"name": { "type": "string", "description": "Identifies the debug configuration." },
"info": { "type": "string", "description": "Brief description of the connection." },
"port": { "enum": [ "jtag", "swd" ], "description": "Selected debug port (jtag or swd)." },
"clock": { "type": "number", "description": "Selected debug clock speed." },
"dbgconf": { "type": "string", "description": "Debugger configuration file (pinout, trace)." },
"for-context": { "$ref": "#/definitions/ForContext" },
"not-for-context": { "$ref": "#/definitions/NotForContext" }
},
"additionalProperties": false,
"required": ["name"]
},
"DebugVarsType": {
"description": "Debug variables for debug sequences.",
"type": "object",
"properties": {
"vars": { "type": "string", "description": "Initial values for debug variables used in debug sequences." }
},
"additionalProperties": false,
"required": ["vars"]
},
"RunDebugDescType": {
"description": "This section describes generated contents",
"type": "object",
"properties": {
"generated-by": { "type": "string", "description": "Tool name along with version information used to generate this file." },
"solution": { "type": "string", "description": "Solution path." },
"target-type": { "type": "string", "description": "Target type." },
"compiler": { "type": "string", "description": "Selection of compiler used." },
"board": { "$ref": "#/definitions/BoardType" },
"device": { "$ref": "#/definitions/DeviceType" },
"board-pack": { "$ref": "#/definitions/PackID" },
"device-pack": { "$ref": "#/definitions/PackID" },
"programming": { "$ref": "#/definitions/ProgrammingType" },
"system-descriptions": { "$ref": "#/definitions/RunFilesType", "description": "System description files." },
"output": { "$ref": "#/definitions/RunFilesType", "description": "Application image files." },
"sequences": { "$ref": "#/definitions/DebugSequencesType", "description": "Debug sequences for the target." }
"generated-by": { "type": "string", "description": "Tool name along with version information used to generate this file." },
"solution": { "type": "string", "description": "Solution path." },
"target-type": { "type": "string", "description": "Target type." },
"compiler": { "type": "string", "description": "Selection of compiler used." },
"board": { "$ref": "#/definitions/BoardType" },
"device": { "$ref": "#/definitions/DeviceType" },
"board-pack": { "$ref": "#/definitions/PackID" },
"device-pack": { "$ref": "#/definitions/PackID" },
"programming": { "$ref": "#/definitions/ProgrammingType" },
"system-descriptions": { "$ref": "#/definitions/RunFilesType", "description": "System description files." },
"output": { "$ref": "#/definitions/RunFilesType", "description": "Application image files." },
"system-resources": { "$ref": "#/definitions/SystemResourcesType" },
"debugger": { "$ref": "#/definitions/DebuggersType" },
"debug-vars": { "$ref": "#/definitions/DebugVarsType" },
"debug-sequences": { "$ref": "#/definitions/DebugSequencesType" }
},
"additionalProperties": false
}
Expand Down
Loading

0 comments on commit 536537a

Please sign in to comment.