diff --git a/test/packs/ARM/RteTest_DFP/0.2.0/ARM.RteTest_DFP.pdsc b/test/packs/ARM/RteTest_DFP/0.2.0/ARM.RteTest_DFP.pdsc index e6582a048..d2f500b35 100644 --- a/test/packs/ARM/RteTest_DFP/0.2.0/ARM.RteTest_DFP.pdsc +++ b/test/packs/ARM/RteTest_DFP/0.2.0/ARM.RteTest_DFP.pdsc @@ -31,6 +31,10 @@ + + + + __var DbgMCU_CR = 0x00000007; // DBGMCU_CR: DBG_SLEEP, DBG_STOP, DBG_STANDBY __var TraceClk_Pin = 0x00040002; // PE2 @@ -150,6 +154,9 @@ + + + diff --git a/tools/projmgr/include/ProjMgrRunDebug.h b/tools/projmgr/include/ProjMgrRunDebug.h index ccacc5997..5fa533d70 100644 --- a/tools/projmgr/include/ProjMgrRunDebug.h +++ b/tools/projmgr/include/ProjMgrRunDebug.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024-2025 Arm Limited. All rights reserved. + * Copyright (c) 2024-2026 Arm Limited. All rights reserved. * * SPDX-License-Identifier: Apache-2.0 */ @@ -41,6 +41,30 @@ struct MemoryType { std::string pname; }; +/** + * @brief flash info block + */ +struct FlashInfoBlockType { + unsigned long long count = 0; + unsigned long long size = 0; + std::optional arg; +}; + +/** + * @brief flash info + */ +struct FlashInfoType { + std::string name; + unsigned long long start = 0; + unsigned long long pageSize = 0; + std::vector blocks; + std::optional blankVal; + std::optional fillVal; + std::optional ptime; + std::optional etime; + std::string pname; +}; + /** * @brief system resources type */ @@ -169,6 +193,7 @@ struct RunDebugType { std::string device; std::string devicePack; std::vector algorithms; + std::vector flashInfo; std::vector outputs; std::vector systemDescriptions; SystemResourcesType systemResources; diff --git a/tools/projmgr/include/ProjMgrYamlParser.h b/tools/projmgr/include/ProjMgrYamlParser.h index 47a296c62..ac4a7ee39 100644 --- a/tools/projmgr/include/ProjMgrYamlParser.h +++ b/tools/projmgr/include/ProjMgrYamlParser.h @@ -29,12 +29,14 @@ static constexpr const char* YAML_APID = "apid"; static constexpr const char* YAML_APIS = "apis"; static constexpr const char* YAML_API = "api"; static constexpr const char* YAML_APP_PATH = "app-path"; +static constexpr const char* YAML_ARG = "arg"; static constexpr const char* YAML_ATOMIC = "atomic"; static constexpr const char* YAML_ATTR = "attr"; static constexpr const char* YAML_AUTO = "auto"; static constexpr const char* YAML_BASE = "base"; static constexpr const char* YAML_BASE_DIR = "base-dir"; static constexpr const char* YAML_BASE_NAME = "base-name"; +static constexpr const char* YAML_BLANK_VAL = "blank-val"; static constexpr const char* YAML_BLOCKS = "blocks"; static constexpr const char* YAML_BOARD = "board"; static constexpr const char* YAML_BOARD_BOOKS = "board-books"; @@ -77,6 +79,7 @@ static constexpr const char* YAML_CONTEXTS = "contexts"; static constexpr const char* YAML_CONTEXT_MAP = "context-map"; static constexpr const char* YAML_COPY_TO = "copy-to"; static constexpr const char* YAML_CORE = "core"; +static constexpr const char* YAML_COUNT = "count"; static constexpr const char* YAML_CREATED_BY = "created-by"; static constexpr const char* YAML_CREATED_FOR = "created-for"; static constexpr const char* YAML_DATAPATCH = "datapatch"; @@ -107,8 +110,11 @@ static constexpr const char* YAML_ENVIRONMENT = "environment"; static constexpr const char* YAML_ERRORS = "errors"; static constexpr const char* YAML_EXECUTE = "execute"; static constexpr const char* YAML_EXECUTES = "executes"; +static constexpr const char* YAML_ETIME = "etime"; static constexpr const char* YAML_FILE = "file"; static constexpr const char* YAML_FILES = "files"; +static constexpr const char* YAML_FILL_VAL = "fill-val"; +static constexpr const char* YAML_FLASH_INFO = "flash-info"; static constexpr const char* YAML_FROM_PACK = "from-pack"; static constexpr const char* YAML_FORBOARD = "for-board"; static constexpr const char* YAML_FORCOMPILER = "for-compiler"; @@ -184,6 +190,7 @@ static constexpr const char* YAML_PACK = "pack"; static constexpr const char* YAML_PACKS = "packs"; static constexpr const char* YAML_PACKS_MISSING = "packs-missing"; static constexpr const char* YAML_PACKS_UNUSED = "packs-unused"; +static constexpr const char* YAML_PAGE_SIZE = "page-size"; static constexpr const char* YAML_PATH = "path"; static constexpr const char* YAML_PNAME = "pname"; static constexpr const char* YAML_PORT = "port"; @@ -199,6 +206,7 @@ static constexpr const char* YAML_PROJECT_CONTEXT = "project-context"; static constexpr const char* YAML_PROJECT_TYPE = "project-type"; static constexpr const char* YAML_PROTOCOL = "protocol"; static constexpr const char* YAML_PROVIDES = "provides"; +static constexpr const char* YAML_PTIME = "ptime"; static constexpr const char* YAML_RAM_SIZE = "ram-size"; static constexpr const char* YAML_RAM_START = "ram-start"; static constexpr const char* YAML_REBUILD = "rebuild"; diff --git a/tools/projmgr/schemas/common.schema.json b/tools/projmgr/schemas/common.schema.json index dfdb5ab88..2ea7dffdd 100644 --- a/tools/projmgr/schemas/common.schema.json +++ b/tools/projmgr/schemas/common.schema.json @@ -2087,6 +2087,45 @@ "additionalProperties": false, "required": ["name", "access", "start", "size"] }, + "FlashInfoType": { + "title": "flash-info:\nDocumentation: https://open-cmsis-pack.github.io/cmsis-toolbox/YML-CBuild-Format/#flash-info", + "description": "Flash information that the debugger can use to erase and program flash.", + "type": "array", + "uniqueItems": true, + "items": { "$ref": "#/definitions/FlashInfoElementType" } + }, + "FlashInfoElementType": { + "type": "object", + "properties": { + "name": { "type": "string", "description": "Name of the specified flash device." }, + "start": { "type": "number", "description": "Base address of the specified flash device as mapped into target memory system." }, + "page-size": { "type": "number", "description": "Programming page size (page is the smallest unit that can be programmed)." }, + "blocks": { "$ref": "#/definitions/FlashInfoBlocksType" }, + "blank-val": { "type": "number", "description": "Expected memory value for unprogrammed address ranges (64-bit value)." }, + "fill-val": { "type": "number", "description": "Value that a debugger uses to fill the remainder of a programming page (64-bit value)." }, + "ptime": { "type": "number", "description": "Timeout in milliseconds for programming a page." }, + "etime": { "type": "number", "description": "Timeout in milliseconds for erasing a page." }, + "pname": { "type": "string", "description": "Specifies the processor for the execution of the algorithm." } + }, + "additionalProperties": false, + "required": ["name", "start", "page-size", "blocks"] + }, + "FlashInfoBlocksType": { + "description": "An ordered list of subsequent blocks (block is the smallest unit that can be erased).", + "type": "array", + "uniqueItems": true, + "items": { "$ref": "#/definitions/FlashInfoBlockType" } + }, + "FlashInfoBlockType": { + "type": "object", + "properties": { + "count": { "type": "number", "description": "Number of subsequent blocks." }, + "size": { "type": "number", "description": "Block size in bytes. The overall memory size that is covered by this block is count times size." }, + "arg": { "type": "number", "description": "An optional argument (non-negative number) to pass to flash operation sequence." } + }, + "additionalProperties": false, + "required": ["count", "size"] + }, "ProgrammingType": { "title": "programming:\nDocumentation: https://open-cmsis-pack.github.io/cmsis-toolbox/YML-CBuild-Format/#programming", "description": "Algorithms for flash download.", @@ -2394,6 +2433,7 @@ "debug-vars": { "$ref": "#/definitions/DebugVarsType" }, "debug-sequences": { "$ref": "#/definitions/DebugSequencesType" }, "programming": { "$ref": "#/definitions/ProgrammingType" }, + "flash-info": { "$ref": "#/definitions/FlashInfoType" }, "debug-topology": { "$ref": "#/definitions/DebugTopologyType" } }, "additionalProperties": false, diff --git a/tools/projmgr/src/ProjMgrCbuildRun.cpp b/tools/projmgr/src/ProjMgrCbuildRun.cpp index 6bef076e7..8d8fe1be9 100644 --- a/tools/projmgr/src/ProjMgrCbuildRun.cpp +++ b/tools/projmgr/src/ProjMgrCbuildRun.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2025 Arm Limited. All rights reserved. + * Copyright (c) 2020-2026 Arm Limited. All rights reserved. * * SPDX-License-Identifier: Apache-2.0 */ @@ -20,6 +20,7 @@ class ProjMgrCbuildRun : public ProjMgrCbuildBase { protected: std::string m_directory; void SetProgrammingNode(YAML::Node node, const std::vector& algorithms); + void SetFlashInfoNode(YAML::Node node, const std::vector& flashInfo); void SetFilesNode(YAML::Node node, const std::vector& outputs); void SetResourcesNode(YAML::Node node, const SystemResourcesType& systemResources); void SetDebuggerNode(YAML::Node node, const DebuggerType& debugger); @@ -55,6 +56,7 @@ ProjMgrCbuildRun::ProjMgrCbuildRun(YAML::Node node, SetDebugVarsNode(node[YAML_DEBUG_VARS], debugRun.debugVars); SetDebugSequencesNode(node[YAML_DEBUG_SEQUENCES], debugRun.debugSequences); SetProgrammingNode(node[YAML_PROGRAMMING], debugRun.algorithms); + SetFlashInfoNode(node[YAML_FLASH_INFO], debugRun.flashInfo); SetDebugTopologyNode(node[YAML_DEBUG_TOPOLOGY], debugRun.debugTopology); }; @@ -71,6 +73,40 @@ void ProjMgrCbuildRun::SetProgrammingNode(YAML::Node node, const std::vector& flashInfo) { + for (const auto& item : flashInfo) { + YAML::Node flashInfoNode; + SetNodeValue(flashInfoNode[YAML_NAME], item.name); + SetNodeValue(flashInfoNode[YAML_START], ProjMgrUtils::ULLToHex(item.start)); + SetNodeValue(flashInfoNode[YAML_PAGE_SIZE], ProjMgrUtils::ULLToHex(item.pageSize)); + if (!item.blocks.empty()) { + for (const auto& block : item.blocks) { + YAML::Node blockNode; + blockNode[YAML_COUNT] = block.count; + SetNodeValue(blockNode[YAML_SIZE], ProjMgrUtils::ULLToHex(block.size)); + if (block.arg.has_value()) { + blockNode[YAML_ARG] = block.arg.value(); + } + flashInfoNode[YAML_BLOCKS].push_back(blockNode); + } + } + if (item.blankVal.has_value()) { + SetNodeValue(flashInfoNode[YAML_BLANK_VAL], ProjMgrUtils::ULLToHex(item.blankVal.value())); + } + if (item.fillVal.has_value()) { + SetNodeValue(flashInfoNode[YAML_FILL_VAL], ProjMgrUtils::ULLToHex(item.fillVal.value())); + } + if (item.ptime.has_value()) { + flashInfoNode[YAML_PTIME] = item.ptime.value(); + } + if (item.etime.has_value()) { + flashInfoNode[YAML_ETIME] = item.etime.value(); + } + SetNodeValue(flashInfoNode[YAML_PNAME], item.pname); + node.push_back(flashInfoNode); + } +} + void ProjMgrCbuildRun::SetFilesNode(YAML::Node node, const std::vector& files) { for (const auto& item : files) { YAML::Node fileNode; diff --git a/tools/projmgr/src/ProjMgrRunDebug.cpp b/tools/projmgr/src/ProjMgrRunDebug.cpp index d6720a546..0c678048e 100644 --- a/tools/projmgr/src/ProjMgrRunDebug.cpp +++ b/tools/projmgr/src/ProjMgrRunDebug.cpp @@ -61,6 +61,8 @@ bool ProjMgrRunDebug::CollectSettings(const vector& contexts, cons vector>> debugvars; // debug sequences vector>> debugSequences; + // flash info + vector>> flashInfo; // all processors const auto& pnames = context0->rteDevice->GetProcessors(); @@ -89,6 +91,10 @@ bool ProjMgrRunDebug::CollectSettings(const vector& contexts, cons for (const auto& deviceDebugSequence : deviceDebugSequences) { PushBackUniquely(debugSequences, deviceDebugSequence, pname); } + const auto& deviceFlashInfos = context0->rteDevice->GetEffectiveProperties("flashinfo", pname); + for (const auto& deviceFlashInfo : deviceFlashInfos) { + PushBackUniquely(flashInfo, deviceFlashInfo, pname); + } } } @@ -134,7 +140,7 @@ bool ProjMgrRunDebug::CollectSettings(const vector& contexts, cons } // sort collections starting with specific pnames - for (auto vec : { &algorithms, &memories, &debugs, &debugSequences }) { + for (auto vec : { &algorithms, &memories, &debugs, &debugSequences, &flashInfo }) { sort(vec->begin(), vec->end(), [](auto& left, auto& right) { return left.second.size() < right.second.size(); }); @@ -200,6 +206,38 @@ bool ProjMgrRunDebug::CollectSettings(const vector& contexts, cons } } + // flash info + for (const auto& [flash, _] : flashInfo) { + FlashInfoType item; + item.name = flash->GetName(); + item.start = flash->GetAttributeAsULL("start"); + item.pageSize = flash->GetAttributeAsULL("pagesize"); + Collection blocks; + for (const auto& block : flash->GetChildrenByTag("block", blocks)) { + FlashInfoBlockType b; + b.count = block->GetAttributeAsULL("count"); + b.size = block->GetAttributeAsULL("size"); + if (block->HasAttribute("arg")) { + b.arg = block->GetAttributeAsULL("arg"); + } + item.blocks.push_back(b); + } + if (flash->HasAttribute("blankval")) { + item.blankVal = flash->GetAttributeAsULL("blankval"); + } + if (flash->HasAttribute("filler")) { + item.fillVal = flash->GetAttributeAsULL("filler"); + } + if (flash->HasAttribute("ptime")) { + item.ptime = flash->GetAttributeAsUnsigned("ptime"); + } + if (flash->HasAttribute("etime")) { + item.etime = flash->GetAttributeAsUnsigned("etime"); + } + item.pname = flash->GetProcessorName(); + m_runDebug.flashInfo.push_back(item); + } + // system descriptions for (const auto& [debug, _] : debugs) { const auto& svd = debug->GetAttribute("svd"); diff --git a/tools/projmgr/test/data/ImageOnly/ref/image-only+CM0.cbuild-run.yml b/tools/projmgr/test/data/ImageOnly/ref/image-only+CM0.cbuild-run.yml index 2aebb41c9..5574a4d1f 100644 --- a/tools/projmgr/test/data/ImageOnly/ref/image-only+CM0.cbuild-run.yml +++ b/tools/projmgr/test/data/ImageOnly/ref/image-only+CM0.cbuild-run.yml @@ -109,6 +109,15 @@ cbuild-run: size: 0x00040000 ram-start: 0x20000000 ram-size: 0x00020000 + flash-info: + - name: Family Flash + start: 0x80000000 + page-size: 0x00000100 + blocks: + - count: 64 + size: 0x00000100 + - count: 128 + size: 0x00000400 debug-topology: debugports: - dpid: 0 diff --git a/tools/projmgr/test/data/TestRunDebug/ref/custom+TestHW.cbuild-run.yml b/tools/projmgr/test/data/TestRunDebug/ref/custom+TestHW.cbuild-run.yml index a33013bb0..46813603d 100644 --- a/tools/projmgr/test/data/TestRunDebug/ref/custom+TestHW.cbuild-run.yml +++ b/tools/projmgr/test/data/TestRunDebug/ref/custom+TestHW.cbuild-run.yml @@ -123,6 +123,15 @@ cbuild-run: size: 0x00040000 ram-start: 0x20000000 ram-size: 0x00020000 + flash-info: + - name: Family Flash + start: 0x80000000 + page-size: 0x00000100 + blocks: + - count: 64 + size: 0x00000100 + - count: 128 + size: 0x00000400 debug-topology: debugports: - dpid: 0 diff --git a/tools/projmgr/test/data/TestRunDebug/ref/run-debug+TestHW.cbuild-run.yml b/tools/projmgr/test/data/TestRunDebug/ref/run-debug+TestHW.cbuild-run.yml index 181b7184c..30f08d8bc 100644 --- a/tools/projmgr/test/data/TestRunDebug/ref/run-debug+TestHW.cbuild-run.yml +++ b/tools/projmgr/test/data/TestRunDebug/ref/run-debug+TestHW.cbuild-run.yml @@ -145,6 +145,15 @@ cbuild-run: size: 0x00010000 ram-start: 0x20000000 ram-size: 0x00020000 + flash-info: + - name: Family Flash + start: 0x80000000 + page-size: 0x00000100 + blocks: + - count: 64 + size: 0x00000100 + - count: 128 + size: 0x00000400 debug-topology: debugports: - dpid: 0 diff --git a/tools/projmgr/test/data/TestRunDebug/ref/run-debug+TestHW2.cbuild-run.yml b/tools/projmgr/test/data/TestRunDebug/ref/run-debug+TestHW2.cbuild-run.yml index 041fea47f..b5725d93b 100644 --- a/tools/projmgr/test/data/TestRunDebug/ref/run-debug+TestHW2.cbuild-run.yml +++ b/tools/projmgr/test/data/TestRunDebug/ref/run-debug+TestHW2.cbuild-run.yml @@ -130,6 +130,15 @@ cbuild-run: size: 0x00040000 ram-start: 0x20000000 ram-size: 0x00020000 + flash-info: + - name: Family Flash + start: 0x80000000 + page-size: 0x00000100 + blocks: + - count: 64 + size: 0x00000100 + - count: 128 + size: 0x00000400 debug-topology: debugports: - dpid: 0 diff --git a/tools/projmgr/test/data/TestRunDebug/ref/run-debug+TestHW3.cbuild-run.yml b/tools/projmgr/test/data/TestRunDebug/ref/run-debug+TestHW3.cbuild-run.yml index 375bcd820..553b70ba0 100644 --- a/tools/projmgr/test/data/TestRunDebug/ref/run-debug+TestHW3.cbuild-run.yml +++ b/tools/projmgr/test/data/TestRunDebug/ref/run-debug+TestHW3.cbuild-run.yml @@ -146,6 +146,27 @@ cbuild-run: size: 0x00040000 ram-start: 0x20000000 ram-size: 0x00020000 + flash-info: + - name: Internal Flash 16KB + start: 0x0000F000 + page-size: 0x00000040 + blocks: + - count: 64 + size: 0x00000100 + arg: 0 + blank-val: 0x00000000 + fill-val: 0xCCCCCCCC + ptime: 100000 + etime: 1000000 + pname: cm0_core1 + - name: Family Flash + start: 0x80000000 + page-size: 0x00000100 + blocks: + - count: 64 + size: 0x00000100 + - count: 128 + size: 0x00000400 debug-topology: debugports: - dpid: 0 diff --git a/tools/projmgr/test/data/WestSupport/ref/solution+CM0.cbuild-run.yml b/tools/projmgr/test/data/WestSupport/ref/solution+CM0.cbuild-run.yml index 60f07665d..4d18e459a 100644 --- a/tools/projmgr/test/data/WestSupport/ref/solution+CM0.cbuild-run.yml +++ b/tools/projmgr/test/data/WestSupport/ref/solution+CM0.cbuild-run.yml @@ -145,6 +145,27 @@ cbuild-run: size: 0x00040000 ram-start: 0x20000000 ram-size: 0x00020000 + flash-info: + - name: Internal Flash 16KB + start: 0x0000F000 + page-size: 0x00000040 + blocks: + - count: 64 + size: 0x00000100 + arg: 0 + blank-val: 0x00000000 + fill-val: 0xCCCCCCCC + ptime: 100000 + etime: 1000000 + pname: cm0_core1 + - name: Family Flash + start: 0x80000000 + page-size: 0x00000100 + blocks: + - count: 64 + size: 0x00000100 + - count: 128 + size: 0x00000400 debug-topology: debugports: - dpid: 0