diff --git a/tools/projmgr/include/ProjMgrParser.h b/tools/projmgr/include/ProjMgrParser.h index d8cebae2b..3758a6473 100644 --- a/tools/projmgr/include/ProjMgrParser.h +++ b/tools/projmgr/include/ProjMgrParser.h @@ -166,6 +166,7 @@ struct DebuggerItem { * type specifies an explicit file type * load mode * load offset + * processor name associated with specified image */ struct ImageItem { std::string context; @@ -174,6 +175,7 @@ struct ImageItem { std::string type; std::string load; std::string offset; + std::string pname; }; /** diff --git a/tools/projmgr/schemas/common.schema.json b/tools/projmgr/schemas/common.schema.json index bc6b88b54..36b72f59e 100644 --- a/tools/projmgr/schemas/common.schema.json +++ b/tools/projmgr/schemas/common.schema.json @@ -222,7 +222,13 @@ "title": "device:\nDocumentation: https://open-cmsis-pack.github.io/cmsis-toolbox/YML-Input-Format/#device", "type": "string", "pattern": "^(([ -9;-~]+::)?[ -9;-~]+)?(:[ -9;-~]+)?$", - "description": "Unique device name. Overrules default board device setting.\nA unique processor ID is reqiured for devices with multiple processors.\nExample: STMicroelectronics::STM32H735IGK" + "description": "Unique device name. Overrules default board device setting.\nA unique processor ID is required for devices with multiple processors.\nExample: STMicroelectronics::STM32H735IGK" + }, + "ProcessorNameType": { + "title": "device:\nDocumentation: https://open-cmsis-pack.github.io/cmsis-toolbox/YML-Input-Format/#device", + "type": "string", + "pattern": "^:[ -9;-~]+$", + "description": "Unique processor ID.\nFormat :pname (see device name convention).\nExample: :cm0plus" }, "BoardType": { "title": "board:\nDocumentation: https://open-cmsis-pack.github.io/cmsis-toolbox/YML-Input-Format/#board", @@ -2367,11 +2373,12 @@ "info": { "type": "string", "description": "Brief description of the image file." }, "type": { "enum": [ "elf", "hex", "bin", "lib" ], "description": "Specifies an explicit image type." }, "load": { "$ref": "#/definitions/TargetSetLoadType" }, - "load-offset": { "type": "number", "description": "Offset applied to the binary content when loading the image file." } + "load-offset": { "type": "number", "description": "Offset applied to the binary content when loading the image file." }, + "device": { "$ref": "#/definitions/ProcessorNameType" } }, "additionalProperties": false, "oneOf": [ - { "required": ["project-context"], "not": {"required": ["image", "type"]} }, + { "required": ["project-context"], "not": {"required": ["image", "type", "device"]} }, { "required": ["image"], "not": {"required": ["project-context"]} } ] }, diff --git a/tools/projmgr/src/ProjMgrRunDebug.cpp b/tools/projmgr/src/ProjMgrRunDebug.cpp index 7d10bd842..b20f17363 100644 --- a/tools/projmgr/src/ProjMgrRunDebug.cpp +++ b/tools/projmgr/src/ProjMgrRunDebug.cpp @@ -242,7 +242,7 @@ bool ProjMgrRunDebug::CollectSettings(const vector& contexts, cons item.load = item.type == RteConstants::OUTPUT_TYPE_ELF ? LOAD_IMAGE_SYMBOLS : item.type == RteConstants::OUTPUT_TYPE_LIB ? LOAD_NONE : LOAD_IMAGE; } - m_runDebug.outputs.push_back({ item.image, item.info, item.type, item.load, item.offset }); + m_runDebug.outputs.push_back({ item.image, item.info, item.type, item.load, item.offset, item.pname }); } // debug vars diff --git a/tools/projmgr/src/ProjMgrWorker.cpp b/tools/projmgr/src/ProjMgrWorker.cpp index 2f495b6b3..0389caf17 100644 --- a/tools/projmgr/src/ProjMgrWorker.cpp +++ b/tools/projmgr/src/ProjMgrWorker.cpp @@ -1413,7 +1413,7 @@ bool ProjMgrWorker::ProcessDevice(ContextItem& context, BoardOrDevice process) { if (!deviceItem.pname.empty()) { ProjMgrLogger::Get().Error("processor name '" + deviceItem.pname + "' was not found", context.name); return false; - } else if (!HasVarDefineError() && process != BoardOrDevice::SkipProcessor) { + } else if (!HasVarDefineError() && process != BoardOrDevice::SkipProcessor && !context.imageOnly) { string msg = "one of the following processors must be specified:"; const auto& processors = matchedDevice->GetProcessors(); for (const auto& p : processors) { diff --git a/tools/projmgr/src/ProjMgrYamlParser.cpp b/tools/projmgr/src/ProjMgrYamlParser.cpp index 20252612a..e1ee16adf 100644 --- a/tools/projmgr/src/ProjMgrYamlParser.cpp +++ b/tools/projmgr/src/ProjMgrYamlParser.cpp @@ -1065,6 +1065,8 @@ void ProjMgrYamlParser::ParseImages(const YAML::Node& parent, const string& file ParseString(imagesEntry, YAML_INFO, imageItem.info); ParseString(imagesEntry, YAML_TYPE, imageItem.type); ParseString(imagesEntry, YAML_LOAD, imageItem.load); + ParseString(imagesEntry, YAML_DEVICE, imageItem.pname); + imageItem.pname = RteUtils::ExtractSuffix(imageItem.pname); ParseNumber(imagesEntry, file, YAML_LOAD_OFFSET, imageItem.offset); images.push_back(imageItem); } diff --git a/tools/projmgr/test/data/ImageOnly/image-only-multicore.csolution.yml b/tools/projmgr/test/data/ImageOnly/image-only-multicore.csolution.yml new file mode 100644 index 000000000..eb1b78886 --- /dev/null +++ b/tools/projmgr/test/data/ImageOnly/image-only-multicore.csolution.yml @@ -0,0 +1,19 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/main/tools/projmgr/schemas/csolution.schema.json + +solution: + + packs: + - pack: ARM::RteTest_DFP + + target-types: + - type: CM0 + device: RteTest_ARMCM0_Dual + target-set: + - set: + debugger: + name: CMSIS-DAP + images: + - image: ./images/image1.elf + device: :cm0_core0 + - image: ./images/image2.elf + device: :cm0_core1 diff --git a/tools/projmgr/test/src/ProjMgrUnitTests.cpp b/tools/projmgr/test/src/ProjMgrUnitTests.cpp index fc679d6c9..7985b5f40 100644 --- a/tools/projmgr/test/src/ProjMgrUnitTests.cpp +++ b/tools/projmgr/test/src/ProjMgrUnitTests.cpp @@ -7093,6 +7093,20 @@ TEST_F(ProjMgrUnitTests, ImageOnly) { testinput_folder + "/ImageOnly/ref/image-only+CM0.cbuild-run.yml"); } +TEST_F(ProjMgrUnitTests, ImageOnlyMulticore) { + char* argv[5]; + const string& csolution = testinput_folder + "/ImageOnly/image-only-multicore.csolution.yml"; + argv[1] = (char*)"convert"; + argv[2] = (char*)csolution.c_str(); + argv[3] = (char*)"--active"; + argv[4] = (char*)"CM0"; + EXPECT_EQ(0, RunProjMgr(5, argv, m_envp)); + + const YAML::Node& cbuildRun = YAML::LoadFile(testinput_folder + "/ImageOnly/out/image-only-multicore+CM0.cbuild-run.yml"); + EXPECT_EQ("cm0_core0", cbuildRun["cbuild-run"]["output"][0]["pname"].as()); + EXPECT_EQ("cm0_core1", cbuildRun["cbuild-run"]["output"][1]["pname"].as()); +} + TEST_F(ProjMgrUnitTests, ListDebuggers) { char* argv[6]; StdStreamRedirect streamRedirect;