Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions tools/projmgr/src/ProjMgrRunDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,18 +313,25 @@ void ProjMgrRunDebug::CollectDebuggerSettings(const ContextItem& context, const
m_runDebug.debugger = defaultDebugger;
}

// primary processor: pname of first cproject
if (m_runDebug.debugger.startPname.empty()) {
m_runDebug.debugger.startPname = context.deviceItem.pname;
}

// add info from debug-adapters
if (!adapters.empty()) {
DebugAdapterItem adapter;
if (GetDebugAdapter(m_runDebug.debugger.name, adapters, adapter)) {
m_runDebug.debugger.name = adapter.name;
if (adapter.gdbserver) {
unsigned long long port = adapter.defaults.port.empty() ? 0 : RteUtils::StringToULL(adapter.defaults.port);
// add primary processor port first
m_runDebug.debugger.gdbserver.push_back({ port, m_runDebug.debugger.startPname });
for (const auto& [pname, _] : pnames) {
GdbServerItem item;
item.port = port++;
item.pname = pname;
m_runDebug.debugger.gdbserver.push_back(item);
// add ports for other processors
if (pname != m_runDebug.debugger.startPname) {
m_runDebug.debugger.gdbserver.push_back({ ++port, pname });
}
}
}
if (m_runDebug.debugger.protocol.empty()) {
Expand All @@ -335,11 +342,6 @@ void ProjMgrRunDebug::CollectDebuggerSettings(const ContextItem& context, const
}
}
}

// primary processor
if (m_runDebug.debugger.startPname.empty()) {
m_runDebug.debugger.startPname = context.deviceItem.pname;
}
}

void ProjMgrRunDebug::CollectDebugTopology(const ContextItem& context, const vector<pair<const RteItem*, vector<string>>> debugs,
Expand Down Expand Up @@ -418,6 +420,7 @@ void ProjMgrRunDebug::CollectDebugTopology(const ContextItem& context, const vec
}
}
// processors
map<unsigned int, ProcessorType> processorMap;
for (const auto& [pname, _] : pnames) {
ProcessorType processor;
processor.pname = pname;
Expand All @@ -435,6 +438,12 @@ void ProjMgrRunDebug::CollectDebugTopology(const ContextItem& context, const vec
}
// 'punits': placeholder for future expansion
processor.punits.clear();
// add processors according to apid order
if (processor.apid.has_value()) {
processorMap[processor.apid.value()] = processor;
}
}
for (const auto& [_, processor] : processorMap) {
m_runDebug.debugTopology.processors.push_back(processor);
}
// APv1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ cbuild-run:
start-pname: cm0_core1
gdbserver:
- port: 3333
pname: cm0_core0
- port: 3334
pname: cm0_core1
- port: 3334
pname: cm0_core0
debug-vars:
vars: |
__var DbgMCU_CR = 0x00000007; // DBGMCU_CR: DBG_SLEEP, DBG_STOP, DBG_STANDBY
Expand Down