Skip to content

Commit d210ea8

Browse files
grasci-armedriouk
andauthored
Use Bname="" for condition evaluation (#1305) (#2197)
Bname is set to explicit empty string if device is selected, but no board is specified The filters-out all board-specific pack items that has conditions with Bname Fixes Open-CMSIS-Pack/ST_B-U585I-IOT02A_BSP#5 Co-authored-by: Evgueni Driouk <[email protected]>
1 parent 33e2974 commit d210ea8

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

libs/rtemodel/src/RteProject.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,6 +1589,11 @@ bool RteProject::AddTarget(const string& name, const map<string, string>& attrib
15891589
if (boardInfo) {
15901590
targetAttributes.AddAttributes(boardInfo->GetAttributes(), false);
15911591
}
1592+
if(targetAttributes.HasAttribute("Dname") &&
1593+
!targetAttributes.HasAttribute("Bname")) {
1594+
// set empty board name to filter-out board-specific items if device is selected
1595+
targetAttributes.AddAttribute("Bname", "");
1596+
}
15921597

15931598
// add Brevision attribute if Bversion is specified
15941599
if (!targetAttributes.HasAttribute("Brevision") && targetAttributes.HasAttribute("Bversion")) {

libs/rtemodel/test/src/RteModelTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ TEST_F(RteModelPrjTest, LoadCprjM4) {
11261126
auto& allLayerDescriptors = rteKernel.GetGlobalModel()->GetLayerDescriptors();
11271127
EXPECT_EQ(allLayerDescriptors.size(), 10);
11281128
auto& filteredLayerDescriptors = activeTarget->GetFilteredModel()->GetLayerDescriptors();
1129-
EXPECT_EQ(filteredLayerDescriptors.size(), 10);
1129+
EXPECT_EQ(filteredLayerDescriptors.size(), 7);
11301130
ca = activeTarget->GetComponentAggregate("ARM::Device:Startup");
11311131
ASSERT_NE(ca, nullptr);
11321132
EXPECT_EQ(ca->GetAttribute("layer"), "LayerOne");

0 commit comments

Comments
 (0)