Skip to content

Commit 27a0951

Browse files
grasci-armbrondani
andauthored
[projmgr] Extend RPC BoardInfo with on-board Debugger info (#1332) (#2239)
* [projmgr] Extend RPC `BoardInfo` with on-board Debugger info * Update tools/projmgr/CMakeLists.txt Co-authored-by: Daniel Brondani <[email protected]>
1 parent b45b714 commit 27a0951

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

tools/projmgr/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ include(FetchContent)
2424
FetchContent_Declare(
2525
rpc-interface
2626
DOWNLOAD_EXTRACT_TIMESTAMP ON
27-
URL https://github.com/Open-CMSIS-Pack/csolution-rpc/releases/download/v0.0.4/csolution-rpc.zip
28-
URL_HASH SHA256=ca9bfdacb35b44b6cadf29d87123adbfc1a5e944af7f2aefda0ccf7fd4bd216f
27+
URL https://github.com/Open-CMSIS-Pack/csolution-rpc/releases/download/v0.0.5/csolution-rpc.zip
28+
URL_HASH SHA256=94bd65ec0f8054dc7685a60812f00bc32cc7f9227bec5abdbaa7215fb6b6bd27
2929
)
3030
FetchContent_MakeAvailable(rpc-interface)
3131

tools/projmgr/src/ProjMgrRpcServerData.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,14 @@ RpcArgs::Board RpcDataCollector::FromRteBoard( RteBoard* rteBoard, bool bInclude
224224
if(!memories.empty()) {
225225
b.memories = memories;
226226
}
227+
auto debugProbe = rteBoard->GetItemByTag("debugProbe");
228+
if (debugProbe) {
229+
RpcArgs::Debugger d;
230+
d.name = debugProbe->GetName();
231+
d.protocol = debugProbe->GetAttribute("debugLink");
232+
d.clock = debugProbe->GetAttributeAsULL("debugClock");
233+
b.debugger = d;
234+
}
227235
vector<RpcArgs::Device> devices;
228236
list<RteDevice*> processedDevices;
229237
CollectBoardDevices(devices, rteBoard, true, processedDevices);

tools/projmgr/test/src/ProjMgrRpcTests.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ TEST_F(ProjMgrRpcTests, RpcBoardInfo) {
375375
requests += FormatRequest(6, "GetBoardInfo", json({{ "id", "RteTest NoMCU board"}}));
376376
// only vendor => no ID
377377
requests += FormatRequest(7, "GetBoardInfo", json({{ "id", "Keil::"}}));
378+
// board with debugger
379+
requests += FormatRequest(8, "GetBoardInfo", json({{ "id", "Keil::RteTest-Test-board With.Memory:1.1.1" }}));
378380

379381
const auto responses = RunRpcMethods(requests);
380382
EXPECT_TRUE(responses[0]["result"]["success"]);
@@ -422,6 +424,14 @@ TEST_F(ProjMgrRpcTests, RpcBoardInfo) {
422424

423425
EXPECT_FALSE(responses[6]["result"]["success"]);
424426
EXPECT_EQ(responses[6]["result"]["message"], "Invalid board ID: 'Keil::'");
427+
428+
auto b7 = responses[7]["result"]["board"];
429+
EXPECT_EQ(b7["id"], "Keil::RteTest-Test-board With.Memory:1.1.1");
430+
EXPECT_EQ(b7["pack"], "ARM::[email protected]");
431+
EXPECT_EQ(b7["description"], "TestBoard with dots in the name and memory");
432+
EXPECT_EQ(b7["debugger"]["name"], "CMSIS-DAP");
433+
EXPECT_EQ(b7["debugger"]["protocol"], "swd");
434+
EXPECT_EQ(b7["debugger"]["clock"], 30000000);
425435
}
426436

427437
/////////

0 commit comments

Comments
 (0)