Skip to content

Commit 62f4be7

Browse files
committed
[devtools] Fix dbgconf handling when not present in PDSC
1 parent b4ab6b8 commit 62f4be7

8 files changed

Lines changed: 43 additions & 12 deletions

File tree

libs/rtemodel/src/RteProject.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1405,7 +1405,9 @@ void RteProject::CollectSettings(const string& targetName)
14051405
t->AddDeviceProperties(d, processorName);
14061406
// add dbgconf file
14071407
auto debugVars = t->GetDeviceDebugVars();
1408-
AddFileInstance(nullptr, debugVars, 0, t);
1408+
if (debugVars && debugVars->HasAttribute("configfile")) {
1409+
AddFileInstance(nullptr, debugVars, 0, t);
1410+
}
14091411

14101412
// collect copied files and sources
14111413
for (auto [_,fi] : m_files) {

test/packs/ARM/RteTest_DFP/0.1.1/ARM.RteTest_DFP.pdsc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
RteTest ARM M Device Family
2828
</description>
2929
<algorithm name="Device/ARM/Flash/FAMILY.FLM" start="0x00000000" size="0x00040000" default="1"/>
30-
<debugvars configfile="Device/ARM/Debug/ARMCM.dbgconf">
30+
<debugvars>
3131
__var DbgMCU_CR = 0x00000007; // DBGMCU_CR: DBG_SLEEP, DBG_STOP, DBG_STANDBY
3232
__var TraceClk_Pin = 0x00040002; // PE2
3333
__var TraceD0_Pin = 0x00040003; // PE3

tools/projmgr/src/ProjMgrCbuildRun.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ void ProjMgrCbuildRun::SetDebuggerNode(YAML::Node node, const DebuggerType& debu
105105
if (debugger.clock.has_value()) {
106106
node[YAML_CLOCK] = debugger.clock.value();
107107
}
108-
SetNodeValue(node[YAML_DBGCONF], FormatPath(debugger.dbgconf, m_directory));
108+
if (!debugger.dbgconf.empty()) {
109+
SetNodeValue(node[YAML_DBGCONF], FormatPath(debugger.dbgconf, m_directory));
110+
}
109111
SetNodeValue(node[YAML_START_PNAME], debugger.startPname);
110112
SetGdbServerNode(node[YAML_GDBSERVER], debugger.gdbserver);
111113
}

tools/projmgr/test/data/TestDefault/ref/empty/project.Debug+TEST_TARGET.cbuild.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ build:
99
device-books:
1010
- name: http://infocenter.arm.com/help/topic/com.arm.doc.dui0497a/index.html
1111
title: Cortex-M0 Device Generic Users Guide
12-
dbgconf:
13-
- file: ../../data/TestDefault/.cmsis/empty+TEST_TARGET.dbgconf
14-
version: 0.0.0
1512
processor:
1613
fpu: off
1714
core: Cortex-M0

tools/projmgr/test/data/TestDefault/ref/empty/project.Release+TEST_TARGET.cbuild.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ build:
99
device-books:
1010
- name: http://infocenter.arm.com/help/topic/com.arm.doc.dui0497a/index.html
1111
title: Cortex-M0 Device Generic Users Guide
12-
dbgconf:
13-
- file: ../../data/TestDefault/.cmsis/empty+TEST_TARGET.dbgconf
14-
version: 0.0.0
1512
processor:
1613
fpu: off
1714
core: Cortex-M0
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/main/tools/projmgr/schemas/csolution.schema.json
2+
3+
solution:
4+
5+
compiler: AC6
6+
7+
target-types:
8+
- type: ARMCM3
9+
device: RteTest_ARMCM3
10+
target-set:
11+
- set:
12+
images:
13+
- project-context: run-debug
14+
15+
projects:
16+
- project: run-debug.cproject.yml
17+
18+
packs:
19+
- pack: ARM::RteTest_DFP@0.1.1

tools/projmgr/test/data/TestSolution/PackMetadata/ref/metadata.Debug+RteTest_ARMCM3.cbuild.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ build:
99
device-books:
1010
- name: http://infocenter.arm.com/help/topic/com.arm.doc.dui0552a/index.html
1111
title: Cortex-M3 Device Generic Users Guide
12-
dbgconf:
13-
- file: ../data/TestSolution/PackMetadata/.cmsis/metadata+RteTest_ARMCM3.dbgconf
14-
version: 0.0.0
1512
processor:
1613
fpu: off
1714
core: Cortex-M3

tools/projmgr/test/src/ProjMgrUnitTests.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6721,6 +6721,23 @@ TEST_F(ProjMgrUnitTests, TestRunDebug) {
67216721
testinput_folder + "/TestRunDebug/ref/run-debug+TestHW2.cbuild.yml");
67226722
}
67236723

6724+
TEST_F(ProjMgrUnitTests, TestNoDbgconf) {
6725+
char* argv[7];
6726+
const string& csolution = testinput_folder + "/TestRunDebug/no-dbgconf.csolution.yml";
6727+
argv[1] = (char*)"convert";
6728+
argv[2] = (char*)csolution.c_str();
6729+
argv[3] = (char*)"-o";
6730+
argv[4] = (char*)testoutput_folder.c_str();
6731+
argv[5] = (char*)"--active";
6732+
argv[6] = (char*)"ARMCM3";
6733+
EXPECT_EQ(0, RunProjMgr(7, argv, m_envp));
6734+
6735+
const YAML::Node& cbuild = YAML::LoadFile(testoutput_folder + "/run-debug+ARMCM3.cbuild.yml");
6736+
EXPECT_FALSE(cbuild["build"]["dbgconf"].IsDefined());
6737+
const YAML::Node& cbuildrun = YAML::LoadFile(testoutput_folder + "/no-dbgconf+ARMCM3.cbuild-run.yml");
6738+
EXPECT_FALSE(cbuildrun["cbuild-run"]["debugger"]["dbgconf"].IsDefined());
6739+
}
6740+
67246741
TEST_F(ProjMgrUnitTests, TestRunDebugMulticore) {
67256742
char* argv[7];
67266743
const string& csolution = testinput_folder + "/TestRunDebug/run-debug.csolution.yml";

0 commit comments

Comments
 (0)