diff --git a/libs/rtemodel/src/RteProject.cpp b/libs/rtemodel/src/RteProject.cpp index 7b432b2bb..4559a70d1 100644 --- a/libs/rtemodel/src/RteProject.cpp +++ b/libs/rtemodel/src/RteProject.cpp @@ -1405,7 +1405,9 @@ void RteProject::CollectSettings(const string& targetName) t->AddDeviceProperties(d, processorName); // add dbgconf file auto debugVars = t->GetDeviceDebugVars(); - AddFileInstance(nullptr, debugVars, 0, t); + if (debugVars && debugVars->HasAttribute("configfile")) { + AddFileInstance(nullptr, debugVars, 0, t); + } // collect copied files and sources for (auto [_,fi] : m_files) { diff --git a/test/packs/ARM/RteTest_DFP/0.1.1/ARM.RteTest_DFP.pdsc b/test/packs/ARM/RteTest_DFP/0.1.1/ARM.RteTest_DFP.pdsc index cb939bf71..098a90b6c 100644 --- a/test/packs/ARM/RteTest_DFP/0.1.1/ARM.RteTest_DFP.pdsc +++ b/test/packs/ARM/RteTest_DFP/0.1.1/ARM.RteTest_DFP.pdsc @@ -27,7 +27,7 @@ RteTest ARM M Device Family - + __var DbgMCU_CR = 0x00000007; // DBGMCU_CR: DBG_SLEEP, DBG_STOP, DBG_STANDBY __var TraceClk_Pin = 0x00040002; // PE2 __var TraceD0_Pin = 0x00040003; // PE3 diff --git a/tools/projmgr/src/ProjMgrCbuildRun.cpp b/tools/projmgr/src/ProjMgrCbuildRun.cpp index 35f31d85f..480774199 100644 --- a/tools/projmgr/src/ProjMgrCbuildRun.cpp +++ b/tools/projmgr/src/ProjMgrCbuildRun.cpp @@ -105,7 +105,9 @@ void ProjMgrCbuildRun::SetDebuggerNode(YAML::Node node, const DebuggerType& debu if (debugger.clock.has_value()) { node[YAML_CLOCK] = debugger.clock.value(); } - SetNodeValue(node[YAML_DBGCONF], FormatPath(debugger.dbgconf, m_directory)); + if (!debugger.dbgconf.empty()) { + SetNodeValue(node[YAML_DBGCONF], FormatPath(debugger.dbgconf, m_directory)); + } SetNodeValue(node[YAML_START_PNAME], debugger.startPname); SetGdbServerNode(node[YAML_GDBSERVER], debugger.gdbserver); } diff --git a/tools/projmgr/test/data/TestDefault/ref/empty/project.Debug+TEST_TARGET.cbuild.yml b/tools/projmgr/test/data/TestDefault/ref/empty/project.Debug+TEST_TARGET.cbuild.yml index 7d28b0c4f..9b2f86aa9 100644 --- a/tools/projmgr/test/data/TestDefault/ref/empty/project.Debug+TEST_TARGET.cbuild.yml +++ b/tools/projmgr/test/data/TestDefault/ref/empty/project.Debug+TEST_TARGET.cbuild.yml @@ -9,9 +9,6 @@ build: device-books: - name: http://infocenter.arm.com/help/topic/com.arm.doc.dui0497a/index.html title: Cortex-M0 Device Generic Users Guide - dbgconf: - - file: ../../data/TestDefault/.cmsis/empty+TEST_TARGET.dbgconf - version: 0.0.0 processor: fpu: off core: Cortex-M0 diff --git a/tools/projmgr/test/data/TestDefault/ref/empty/project.Release+TEST_TARGET.cbuild.yml b/tools/projmgr/test/data/TestDefault/ref/empty/project.Release+TEST_TARGET.cbuild.yml index ae5103269..044826b43 100644 --- a/tools/projmgr/test/data/TestDefault/ref/empty/project.Release+TEST_TARGET.cbuild.yml +++ b/tools/projmgr/test/data/TestDefault/ref/empty/project.Release+TEST_TARGET.cbuild.yml @@ -9,9 +9,6 @@ build: device-books: - name: http://infocenter.arm.com/help/topic/com.arm.doc.dui0497a/index.html title: Cortex-M0 Device Generic Users Guide - dbgconf: - - file: ../../data/TestDefault/.cmsis/empty+TEST_TARGET.dbgconf - version: 0.0.0 processor: fpu: off core: Cortex-M0 diff --git a/tools/projmgr/test/data/TestRunDebug/no-dbgconf.csolution.yml b/tools/projmgr/test/data/TestRunDebug/no-dbgconf.csolution.yml new file mode 100644 index 000000000..cacb7d089 --- /dev/null +++ b/tools/projmgr/test/data/TestRunDebug/no-dbgconf.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: + + compiler: AC6 + + target-types: + - type: ARMCM3 + device: RteTest_ARMCM3 + target-set: + - set: + images: + - project-context: run-debug + + projects: + - project: run-debug.cproject.yml + + packs: + - pack: ARM::RteTest_DFP@0.1.1 diff --git a/tools/projmgr/test/data/TestSolution/PackMetadata/ref/metadata.Debug+RteTest_ARMCM3.cbuild.yml b/tools/projmgr/test/data/TestSolution/PackMetadata/ref/metadata.Debug+RteTest_ARMCM3.cbuild.yml index 5b6c5e491..47b1e8261 100644 --- a/tools/projmgr/test/data/TestSolution/PackMetadata/ref/metadata.Debug+RteTest_ARMCM3.cbuild.yml +++ b/tools/projmgr/test/data/TestSolution/PackMetadata/ref/metadata.Debug+RteTest_ARMCM3.cbuild.yml @@ -9,9 +9,6 @@ build: device-books: - name: http://infocenter.arm.com/help/topic/com.arm.doc.dui0552a/index.html title: Cortex-M3 Device Generic Users Guide - dbgconf: - - file: ../data/TestSolution/PackMetadata/.cmsis/metadata+RteTest_ARMCM3.dbgconf - version: 0.0.0 processor: fpu: off core: Cortex-M3 diff --git a/tools/projmgr/test/src/ProjMgrUnitTests.cpp b/tools/projmgr/test/src/ProjMgrUnitTests.cpp index 7e73b6c12..f468f5a83 100644 --- a/tools/projmgr/test/src/ProjMgrUnitTests.cpp +++ b/tools/projmgr/test/src/ProjMgrUnitTests.cpp @@ -6721,6 +6721,23 @@ TEST_F(ProjMgrUnitTests, TestRunDebug) { testinput_folder + "/TestRunDebug/ref/run-debug+TestHW2.cbuild.yml"); } +TEST_F(ProjMgrUnitTests, TestNoDbgconf) { + char* argv[7]; + const string& csolution = testinput_folder + "/TestRunDebug/no-dbgconf.csolution.yml"; + argv[1] = (char*)"convert"; + argv[2] = (char*)csolution.c_str(); + argv[3] = (char*)"-o"; + argv[4] = (char*)testoutput_folder.c_str(); + argv[5] = (char*)"--active"; + argv[6] = (char*)"ARMCM3"; + EXPECT_EQ(0, RunProjMgr(7, argv, m_envp)); + + const YAML::Node& cbuild = YAML::LoadFile(testoutput_folder + "/run-debug+ARMCM3.cbuild.yml"); + EXPECT_FALSE(cbuild["build"]["dbgconf"].IsDefined()); + const YAML::Node& cbuildrun = YAML::LoadFile(testoutput_folder + "/no-dbgconf+ARMCM3.cbuild-run.yml"); + EXPECT_FALSE(cbuildrun["cbuild-run"]["debugger"]["dbgconf"].IsDefined()); +} + TEST_F(ProjMgrUnitTests, TestRunDebugMulticore) { char* argv[7]; const string& csolution = testinput_folder + "/TestRunDebug/run-debug.csolution.yml";