Skip to content

Commit ff716f4

Browse files
grasci-armbrondani
andauthored
[devtools] Fix dbgconf handling when not present in PDSC (#2097)
Co-authored-by: Daniel Brondani <[email protected]>
1 parent 8c37dec commit ff716f4

File tree

8 files changed

+43
-12
lines changed

8 files changed

+43
-12
lines changed

libs/rtemodel/src/RteProject.cpp

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

14121414
// collect copied files and sources
14131415
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::[email protected]

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
@@ -6735,6 +6735,23 @@ TEST_F(ProjMgrUnitTests, TestRunDebug) {
67356735
testinput_folder + "/TestRunDebug/ref/run-debug+TestHW2.cbuild.yml");
67366736
}
67376737

6738+
TEST_F(ProjMgrUnitTests, TestNoDbgconf) {
6739+
char* argv[7];
6740+
const string& csolution = testinput_folder + "/TestRunDebug/no-dbgconf.csolution.yml";
6741+
argv[1] = (char*)"convert";
6742+
argv[2] = (char*)csolution.c_str();
6743+
argv[3] = (char*)"-o";
6744+
argv[4] = (char*)testoutput_folder.c_str();
6745+
argv[5] = (char*)"--active";
6746+
argv[6] = (char*)"ARMCM3";
6747+
EXPECT_EQ(0, RunProjMgr(7, argv, m_envp));
6748+
6749+
const YAML::Node& cbuild = YAML::LoadFile(testoutput_folder + "/run-debug+ARMCM3.cbuild.yml");
6750+
EXPECT_FALSE(cbuild["build"]["dbgconf"].IsDefined());
6751+
const YAML::Node& cbuildrun = YAML::LoadFile(testoutput_folder + "/no-dbgconf+ARMCM3.cbuild-run.yml");
6752+
EXPECT_FALSE(cbuildrun["cbuild-run"]["debugger"]["dbgconf"].IsDefined());
6753+
}
6754+
67386755
TEST_F(ProjMgrUnitTests, TestRunDebugMulticore) {
67396756
char* argv[7];
67406757
const string& csolution = testinput_folder + "/TestRunDebug/run-debug.csolution.yml";

0 commit comments

Comments
 (0)