Skip to content

Commit 866c70e

Browse files
authored
[projmgr] Add device and board books to cbuild.yml (#1087)
1 parent 936cf7d commit 866c70e

File tree

59 files changed

+241
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+241
-0
lines changed

test/packs/ARM/RteTestBoard/0.1.0/ARM.RteTestBoard.pdsc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
</board>
3838
<board name="RteTest CM4 board" vendor="Keil" revision="Rev.C">
3939
<description>uVision Simulator</description>
40+
<book category="overview" name="https://www.keil.arm.com/boards/" title="Development boards for application prototyping"/>
41+
<book category="other" name="Documents/README.md" title="Guide" public="true"/>
4042
<mountedDevice deviceIndex="0" Dvendor="ARM:82" Dname="RteTest_ARMCM4_FP"/>
4143
<compatibleDevice deviceIndex="0" Dvendor="ARM:82" Dname="RteTest_ARMCM4_NOFP"/>
4244
<algorithm name="Board/Flash/BoargAlgo1.FLM" start="0x00000000" size="0x00040000" default="1"/>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Board documentation

tools/projmgr/include/ProjMgrWorker.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,18 @@ struct LinkerContextItem {
211211
std::string script;
212212
};
213213

214+
/**
215+
* @brief book item containing
216+
* string name
217+
* string title
218+
* string category
219+
*/
220+
struct BookItem {
221+
std::string name;
222+
std::string title;
223+
std::string category;
224+
};
225+
214226
/**
215227
* @brief context type item containing
216228
* list of all build types including mapped ones
@@ -273,6 +285,8 @@ struct ContextTypesItem {
273285
* vector of dependent contexts
274286
* map of layers descriptors from packs
275287
* flag indicating the context needs a rebuild
288+
* vector of device books
289+
* vector of board books
276290
*/
277291
struct ContextItem {
278292
CdefaultItem* cdefault = nullptr;
@@ -328,6 +342,8 @@ struct ContextItem {
328342
StrVec dependsOn;
329343
std::map<std::string, RteItem*> packLayers;
330344
bool needRebuild = false;
345+
std::vector<BookItem> deviceBooks;
346+
std::vector<BookItem> boardBooks;
331347
};
332348

333349
/**

tools/projmgr/include/ProjMgrYamlParser.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ static constexpr const char* YAML_BASE = "base";
2626
static constexpr const char* YAML_BASE_DIR = "base-dir";
2727
static constexpr const char* YAML_BASE_NAME = "base-name";
2828
static constexpr const char* YAML_BOARD = "board";
29+
static constexpr const char* YAML_BOARD_BOOKS = "board-books";
2930
static constexpr const char* YAML_BOARD_PACK = "board-pack";
3031
static constexpr const char* YAML_BRANCH_PROTECTION = "branch-protection";
3132
static constexpr const char* YAML_BUILD = "build";
@@ -72,6 +73,7 @@ static constexpr const char* YAML_DELPATH = "del-path";
7273
static constexpr const char* YAML_DEPENDS_ON = "depends-on";
7374
static constexpr const char* YAML_DESCRIPTION = "description";
7475
static constexpr const char* YAML_DEVICE = "device";
76+
static constexpr const char* YAML_DEVICE_BOOKS = "device-books";
7577
static constexpr const char* YAML_DEVICE_PACK = "device-pack";
7678
static constexpr const char* YAML_DOWNLOAD_URL = "download-url";
7779
static constexpr const char* YAML_DSP = "dsp";
@@ -170,6 +172,7 @@ static constexpr const char* YAML_TARGETTYPE = "target-type";
170172
static constexpr const char* YAML_TARGETTYPES = "target-types";
171173
static constexpr const char* YAML_TRUSTZONE = "trustzone";
172174
static constexpr const char* YAML_CORE = "core";
175+
static constexpr const char* YAML_TITLE = "title";
173176
static constexpr const char* YAML_TYPE = "type";
174177
static constexpr const char* YAML_UNDEFINE = "undefine";
175178
static constexpr const char* YAML_UPDATE = "update";

tools/projmgr/schemas/common.schema.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,21 @@
1919
"type": "string",
2020
"pattern": "^([^\\.\\+]+|[^\\.\\+]*\\.[a-zA-Z0-9_-]{1,32}(\\+[a-zA-Z0-9_-]{1,32})|[^\\.\\+]*\\+[a-zA-Z0-9_-]{1,32}(\\.[a-zA-Z0-9_-]{1,32})?)$"
2121
},
22+
"BooksType": {
23+
"type": "array",
24+
"uniqueItems": true,
25+
"minItems": 1,
26+
"items": { "$ref": "#/definitions/BookType" }
27+
},
28+
"BookType": {
29+
"type": "object",
30+
"properties": {
31+
"name": { "type": "string" },
32+
"title": { "type": "string" },
33+
"category": { "type": "string" }
34+
},
35+
"additionalProperties": false
36+
},
2237
"ArrayOfContextMapAlternativeContext": {
2338
"type": "array",
2439
"uniqueItems": true,
@@ -1058,8 +1073,10 @@
10581073
"compiler": { "$ref": "#/definitions/CompilerType" },
10591074
"board": { "$ref": "#/definitions/BoardType" },
10601075
"board-pack": { "$ref": "#/definitions/PackID" },
1076+
"board-books": { "$ref": "#/definitions/BooksType" },
10611077
"device": { "$ref": "#/definitions/DeviceType" },
10621078
"device-pack": { "$ref": "#/definitions/PackID" },
1079+
"device-books": { "$ref": "#/definitions/BooksType" },
10631080
"processor": { "$ref": "#/definitions/BuildProcessorType" },
10641081
"packs": { "$ref": "#/definitions/BuildPacksType" },
10651082
"optimize": { "$ref": "#/definitions/OptimizeType" },

tools/projmgr/src/ProjMgrWorker.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,6 +1239,17 @@ bool ProjMgrWorker::ProcessDevice(ContextItem& context) {
12391239
if (context.boardPack) {
12401240
context.packages.insert({ context.boardPack->GetID(), context.boardPack });
12411241
context.variables[RteConstants::AS_BPACK] = context.boardPack->GetAbsolutePackagePath();
1242+
1243+
Collection<RteItem*> books;
1244+
books = matchedBoard->GetChildrenByTag("book", books);
1245+
context.boardBooks.clear();
1246+
for (const auto& book : books) {
1247+
BookItem bookItem;
1248+
bookItem.name = book->GetDocFile();
1249+
bookItem.title = book->GetAttribute("title");
1250+
bookItem.category = book->GetAttribute("category");
1251+
context.boardBooks.push_back(bookItem);
1252+
}
12421253
}
12431254
context.targetAttributes["Bname"] = matchedBoard->GetName();
12441255
context.targetAttributes["Bvendor"] = matchedBoard->GetVendorName();
@@ -1385,6 +1396,14 @@ bool ProjMgrWorker::ProcessDevice(ContextItem& context) {
13851396
if (context.devicePack) {
13861397
context.packages.insert({ context.devicePack->GetID(), context.devicePack });
13871398
context.variables[RteConstants::AS_DPACK] = context.devicePack->GetAbsolutePackagePath();
1399+
const auto& books = matchedDevice->GetEffectiveProperties("book", deviceItem.pname);
1400+
context.deviceBooks.clear();
1401+
for (const auto& book : books) {
1402+
BookItem bookItem;
1403+
bookItem.name = book->GetDocFile();
1404+
bookItem.title = book->GetAttribute("title");
1405+
context.deviceBooks.push_back(bookItem);
1406+
}
13881407
}
13891408
GetDeviceItem(context.device, context.deviceItem);
13901409
context.variables[RteConstants::AS_DNAME] = context.deviceItem.name;

tools/projmgr/src/ProjMgrYamlEmitter.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class ProjMgrYamlCbuild : public ProjMgrYamlBase {
6969
void SetMiscNode(YAML::Node miscNode, const MiscItem& misc);
7070
void SetMiscNode(YAML::Node miscNode, const vector<MiscItem>& misc);
7171
void SetDefineNode(YAML::Node node, const vector<string>& vec);
72+
void SetBooksNode(YAML::Node node, const std::vector<BookItem>& books, const std::string& dir);
7273
const bool m_ignoreRteFileMissing;
7374
};
7475

@@ -464,11 +465,13 @@ void ProjMgrYamlCbuild::SetContextNode(YAML::Node contextNode, const ContextItem
464465
if (context->boardPack != nullptr) {
465466
SetNodeValue(contextNode[YAML_BOARD_PACK], context->boardPack->GetID());
466467
}
468+
SetBooksNode(contextNode[YAML_BOARD_BOOKS], context->boardBooks, context->directories.cbuild);
467469
}
468470
SetNodeValue(contextNode[YAML_DEVICE], context->device);
469471
if (context->devicePack != nullptr) {
470472
SetNodeValue(contextNode[YAML_DEVICE_PACK], context->devicePack->GetID());
471473
}
474+
SetBooksNode(contextNode[YAML_DEVICE_BOOKS], context->deviceBooks, context->directories.cbuild);
472475
SetProcessorNode(contextNode[YAML_PROCESSOR], context->targetAttributes);
473476
SetPacksNode(contextNode[YAML_PACKS], context);
474477
SetControlsNode(contextNode, context, context->controls.processed);
@@ -869,6 +872,16 @@ void ProjMgrYamlCbuild::SetControlsNode(YAML::Node node, const ContextItem* cont
869872
}
870873
}
871874

875+
void ProjMgrYamlCbuild::SetBooksNode(YAML::Node node, const std::vector<BookItem>& books, const std::string& dir) {
876+
for (const auto& book : books) {
877+
YAML::Node bookNode;
878+
SetNodeValue(bookNode[YAML_NAME], FormatPath(book.name, dir));
879+
SetNodeValue(bookNode[YAML_TITLE], book.title);
880+
SetNodeValue(bookNode[YAML_CATEGORY], book.category);
881+
node.push_back(bookNode);
882+
}
883+
}
884+
872885
void ProjMgrYamlCbuild::SetProcessorNode(YAML::Node node, const map<string, string>& targetAttributes) {
873886
for (const auto& [rteKey, yamlKey]: RteConstants::DeviceAttributesKeys) {
874887
if (targetAttributes.find(rteKey) != targetAttributes.end()) {

tools/projmgr/test/data/ExternalGenerator/ref/MultiCore/core0.Debug+MultiCore.cbuild-gen.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ build-gen:
88
compiler: AC6
99
device: RteTest_ARMCM0_Dual:cm0_core0
1010
device-pack: ARM::[email protected]
11+
device-books:
12+
- name: http://infocenter.arm.com/help/topic/com.arm.doc.dui0497a/index.html
13+
title: Cortex-M0 Device Generic Users Guide
1114
processor:
1215
fpu: off
1316
core: Cortex-M0

tools/projmgr/test/data/ExternalGenerator/ref/MultiCore/core1.Debug+MultiCore.cbuild-gen.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ build-gen:
88
compiler: AC6
99
device: RteTest_ARMCM0_Dual:cm0_core1
1010
device-pack: ARM::[email protected]
11+
device-books:
12+
- name: http://infocenter.arm.com/help/topic/com.arm.doc.dui0497a/index.html
13+
title: Cortex-M0 Device Generic Users Guide
1114
processor:
1215
fpu: off
1316
core: Cortex-M0

tools/projmgr/test/data/ExternalGenerator/ref/SingleCore/single-core.Debug+Board.cbuild.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,18 @@ build:
66
compiler: AC6
77
board: RteTest CM4 board
88
board-pack: ARM::[email protected]
9+
board-books:
10+
- name: https://www.keil.arm.com/boards/
11+
title: Development boards for application prototyping
12+
category: overview
13+
- name: ${CMSIS_PACK_ROOT}/ARM/RteTestBoard/0.1.0/Documents/README.md
14+
title: Guide
15+
category: other
916
device: RteTest_ARMCM4_FP
1017
device-pack: ARM::[email protected]
18+
device-books:
19+
- name: http://infocenter.arm.com/help/topic/com.arm.doc.dui0553a/index.html
20+
title: Cortex-M4 Device Generic Users Guide
1121
processor:
1222
fpu: sp
1323
core: Cortex-M4

0 commit comments

Comments
 (0)