From eff38cf35d50c3fa28160b6cdbf0284bd8f567ac Mon Sep 17 00:00:00 2001 From: Daniel Brondani Date: Thu, 12 Jun 2025 10:28:22 +0200 Subject: [PATCH] [projmgr] Handle `load` mode for `project-context` --- tools/projmgr/include/ProjMgrWorker.h | 2 ++ tools/projmgr/schemas/common.schema.json | 2 +- tools/projmgr/src/ProjMgrRunDebug.cpp | 3 ++- tools/projmgr/src/ProjMgrWorker.cpp | 3 +++ tools/projmgr/test/data/TestRunDebug/core1.cproject.yml | 3 +++ .../TestRunDebug/ref/run-debug+TestHW3.cbuild-run.yml | 9 +++++++-- .../test/data/TestRunDebug/run-debug.csolution.yml | 6 ++++++ 7 files changed, 24 insertions(+), 4 deletions(-) diff --git a/tools/projmgr/include/ProjMgrWorker.h b/tools/projmgr/include/ProjMgrWorker.h index 64b247f13..86871c6ff 100644 --- a/tools/projmgr/include/ProjMgrWorker.h +++ b/tools/projmgr/include/ProjMgrWorker.h @@ -359,6 +359,7 @@ struct DebuggerType { * images * selected target-set * load offset for generated binary + * load modes */ struct ContextItem { CdefaultItem* cdefault = nullptr; @@ -426,6 +427,7 @@ struct ContextItem { std::vector images; std::string targetSet; std::string loadOffset; + StrMap loadMode; }; /** diff --git a/tools/projmgr/schemas/common.schema.json b/tools/projmgr/schemas/common.schema.json index e8a50abd7..0c4e647ab 100644 --- a/tools/projmgr/schemas/common.schema.json +++ b/tools/projmgr/schemas/common.schema.json @@ -2363,7 +2363,7 @@ }, "additionalProperties": false, "oneOf": [ - { "required": ["project-context"], "not": {"required": ["image", "load", "type"]} }, + { "required": ["project-context"], "not": {"required": ["image"]} }, { "required": ["image"], "not": {"required": ["project-context"]} } ] }, diff --git a/tools/projmgr/src/ProjMgrRunDebug.cpp b/tools/projmgr/src/ProjMgrRunDebug.cpp index 4ffeec34f..0df2a9d0a 100644 --- a/tools/projmgr/src/ProjMgrRunDebug.cpp +++ b/tools/projmgr/src/ProjMgrRunDebug.cpp @@ -532,7 +532,8 @@ void ProjMgrRunDebug::AddGeneratedImage(const ContextItem* context, const string image.file = file; image.info = "generate by " + context->name; image.type = type; - image.load = load; + image.load = context->loadMode.find(type) != context->loadMode.end() ? context->loadMode.at(type) : + context->loadMode.find("") != context->loadMode.end() ? context->loadMode.at("") : load; image.pname = context->deviceItem.pname; image.offset = type == RteConstants::OUTPUT_TYPE_BIN ? context->loadOffset : RteUtils::EMPTY_STRING; m_runDebug.outputs.push_back(image); diff --git a/tools/projmgr/src/ProjMgrWorker.cpp b/tools/projmgr/src/ProjMgrWorker.cpp index dea007f25..f8c8e29fd 100644 --- a/tools/projmgr/src/ProjMgrWorker.cpp +++ b/tools/projmgr/src/ProjMgrWorker.cpp @@ -2540,6 +2540,9 @@ bool ProjMgrWorker::ProcessImages(ContextItem& context) { } else if (item.context == context.cproject->name + (context.type.build.empty() ? "" : '.' + context.type.build)) { context.loadOffset = item.offset; + if (!item.load.empty()) { + context.loadMode[item.type] = item.load; + } } } return true; diff --git a/tools/projmgr/test/data/TestRunDebug/core1.cproject.yml b/tools/projmgr/test/data/TestRunDebug/core1.cproject.yml index 33cb5d558..eadfa9108 100644 --- a/tools/projmgr/test/data/TestRunDebug/core1.cproject.yml +++ b/tools/projmgr/test/data/TestRunDebug/core1.cproject.yml @@ -3,3 +3,6 @@ project: device: :cm0_core1 + + output: + type: [elf, bin] 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 3087d480f..f245d2a4e 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 @@ -10,12 +10,17 @@ cbuild-run: - file: out/core0/TestHW3/core0.axf info: generate by core0+TestHW3 type: elf - load: image+symbols + load: none pname: cm0_core0 - file: out/core1/TestHW3/core1.axf info: generate by core1+TestHW3 type: elf - load: image+symbols + load: none + pname: cm0_core1 + - file: out/core1/TestHW3/core1.bin + info: generate by core1+TestHW3 + type: bin + load: image pname: cm0_core1 system-resources: memory: diff --git a/tools/projmgr/test/data/TestRunDebug/run-debug.csolution.yml b/tools/projmgr/test/data/TestRunDebug/run-debug.csolution.yml index 36b564bb8..72419cf02 100644 --- a/tools/projmgr/test/data/TestRunDebug/run-debug.csolution.yml +++ b/tools/projmgr/test/data/TestRunDebug/run-debug.csolution.yml @@ -44,7 +44,13 @@ solution: - set: images: - project-context: core0 + load: none - project-context: core1 + type: elf + load: none + - project-context: core1 + type: bin + load: image debugger: name: CMSIS-DAP start-pname: cm0_core1