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
7 changes: 7 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 @@ -31,6 +31,10 @@
<algorithm name="Device/ARM/Flash/FAMILY.FLM" start="0x00000000" size="0x00040000" default="1"/>
<algorithm name="Device/ARM/Flash/NonDefaultAlgo.FLM" start="0x00000000" size="0x00010000"/>
<algorithm name="Device/ARM/Flash/IARAlgo.FLM" start="0x00000000" size="0x00020000" default="1" style="IAR"/>
<flashinfo name="Family Flash" start="0x80000000" pagesize="0x00000100">
<block count="64" size="0x100"/>
<block count="128" size="0x400"/>
</flashinfo>
<debugvars configfile="Device/ARM/Debug/ARMCM.dbgconf" version="0.0.2">
__var DbgMCU_CR = 0x00000007; // DBGMCU_CR: DBG_SLEEP, DBG_STOP, DBG_STANDBY
__var TraceClk_Pin = 0x00040002; // PE2
Expand Down Expand Up @@ -150,6 +154,9 @@
<datapatch __dp="0" __ap="0" address="0xE0040FF0" value="0x0D" info="CIDR0"/>
</debug>
<algorithm name="Device/ARM/Flash/CortexM4Dual.FLM" start="0x000A0000" size="0x00020000" RAMstart="0x000C0000" RAMsize="0x00040000" Pname="cm0_core1" default="1"/>
<flashinfo name="Internal Flash 16KB" start="0x0000F000" blankval="0x00000000" filler="0xCCCCCCCC" pagesize="0x00000040" ptime="100000" etime="1000000" Pname="cm0_core1">
<block count="64" size="0x100" arg="0"/>
</flashinfo>
</device>
<device Dname="RteTest_ARMCM0_Single">
<processor Pname="cm0_core1" Dcore="Cortex-M0" DcoreVersion="r0p0" Dfpu="NO_FPU" Dmpu="NO_MPU" Dendian="Configurable" Dclock="10000000"/>
Expand Down
27 changes: 26 additions & 1 deletion tools/projmgr/include/ProjMgrRunDebug.h
Original file line number Diff line number Diff line change
@@ -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
*/
Expand Down Expand Up @@ -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<unsigned long long> arg;
};

/**
* @brief flash info
*/
struct FlashInfoType {
std::string name;
unsigned long long start = 0;
unsigned long long pageSize = 0;
std::vector<FlashInfoBlockType> blocks;
std::optional<unsigned long long> blankVal;
std::optional<unsigned long long> fillVal;
std::optional<unsigned int> ptime;
std::optional<unsigned int> etime;
std::string pname;
};

/**
* @brief system resources type
*/
Expand Down Expand Up @@ -169,6 +193,7 @@ struct RunDebugType {
std::string device;
std::string devicePack;
std::vector<AlgorithmType> algorithms;
std::vector<FlashInfoType> flashInfo;
std::vector<FilesType> outputs;
std::vector<FilesType> systemDescriptions;
SystemResourcesType systemResources;
Expand Down
8 changes: 8 additions & 0 deletions tools/projmgr/include/ProjMgrYamlParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand All @@ -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";
Expand Down
40 changes: 40 additions & 0 deletions tools/projmgr/schemas/common.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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,
Expand Down
38 changes: 37 additions & 1 deletion tools/projmgr/src/ProjMgrCbuildRun.cpp
Original file line number Diff line number Diff line change
@@ -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
*/
Expand All @@ -20,6 +20,7 @@ class ProjMgrCbuildRun : public ProjMgrCbuildBase {
protected:
std::string m_directory;
void SetProgrammingNode(YAML::Node node, const std::vector<AlgorithmType>& algorithms);
void SetFlashInfoNode(YAML::Node node, const std::vector<FlashInfoType>& flashInfo);
void SetFilesNode(YAML::Node node, const std::vector<FilesType>& outputs);
void SetResourcesNode(YAML::Node node, const SystemResourcesType& systemResources);
void SetDebuggerNode(YAML::Node node, const DebuggerType& debugger);
Expand Down Expand Up @@ -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);
};

Expand All @@ -71,6 +73,40 @@ void ProjMgrCbuildRun::SetProgrammingNode(YAML::Node node, const std::vector<Alg
}
}

void ProjMgrCbuildRun::SetFlashInfoNode(YAML::Node node, const std::vector<FlashInfoType>& 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<FilesType>& files) {
for (const auto& item : files) {
YAML::Node fileNode;
Expand Down
40 changes: 39 additions & 1 deletion tools/projmgr/src/ProjMgrRunDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ bool ProjMgrRunDebug::CollectSettings(const vector<ContextItem*>& contexts, cons
vector<pair<const RteItem*, vector<string>>> debugvars;
// debug sequences
vector<pair<const RteItem*, vector<string>>> debugSequences;
// flash info
vector<pair<const RteItem*, vector<string>>> flashInfo;

// all processors
const auto& pnames = context0->rteDevice->GetProcessors();
Expand Down Expand Up @@ -89,6 +91,10 @@ bool ProjMgrRunDebug::CollectSettings(const vector<ContextItem*>& 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);
}
}
}

Expand Down Expand Up @@ -134,7 +140,7 @@ bool ProjMgrRunDebug::CollectSettings(const vector<ContextItem*>& 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();
});
Expand Down Expand Up @@ -200,6 +206,38 @@ bool ProjMgrRunDebug::CollectSettings(const vector<ContextItem*>& 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<RteItem*> 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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
Loading