Skip to content

Commit a6e568a

Browse files
[experimental] Initial implementation of cbuild-run.yml handling
1 parent 1c77da6 commit a6e568a

33 files changed

+1842
-1131
lines changed

external/json-schema-validator.patch

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ index 0beb613..0a9122b 100644
6060
return esub;
6161
}
6262

63+
@@ -468,7 +472,7 @@ class type_schema : public schema
64+
65+
if (type)
66+
type->validate(ptr, instance, patch, e);
67+
- else
68+
+ else if (!instance.is_string() || instance.get_ref<const json::string_t&>().find("0x") != 0)
69+
e.error(ptr, instance, "unexpected instance type");
70+
71+
if (enum_.first) {
6372
@@ -576,6 +580,32 @@ public:
6473
attr = sch.find("enum");
6574
if (attr != sch.end()) {

test/packs/ARM/RteTest_DFP/0.2.0/ARM.RteTest_DFP.pdsc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@
486486
<description>uVision Simulator</description>
487487
<mountedDevice deviceIndex="0" Dvendor="ARM:82" Dname="RteTest_ARMCM4_NOFP"/>
488488
<compatibleDevice deviceIndex="0" Dvendor="ARM:82" Dname="RteTest_ARMCM4_FP"/>
489+
<algorithm name="Device/ARM/Flash/BOARD.FLM" start="0x80000000" size="0x00020000" default="1"/>
489490
</board>
490491
<board name="RteTest board test revision" vendor="Keil" revision="Rev1">
491492
<description>uVision Simulator</description>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BOARD.FLM : not real flash algorithm
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
FAMILY.FLM : not real flash algorithm
1+
FAMILY.FLM : not real flash algorithm

tools/projmgr/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@ SET(PROJMGR_SOURCE_FILES ProjMgr.cpp ProjMgrKernel.cpp ProjMgrCallback.cpp
1414
ProjMgrParser.cpp ProjMgrWorker.cpp ProjMgrGenerator.cpp ProjMgrXmlParser.cpp
1515
ProjMgrYamlParser.cpp ProjMgrLogger.cpp ProjMgrYamlSchemaChecker.cpp
1616
ProjMgrYamlEmitter.cpp ProjMgrUtils.cpp ProjMgrExtGenerator.cpp
17+
ProjMgrCbuildBase.cpp ProjMgrCbuild.cpp ProjMgrCbuildIdx.cpp
18+
ProjMgrCbuildGenIdx.cpp ProjMgrCbuildPack.cpp ProjMgrCbuildSet.cpp
19+
ProjMgrCbuildRun.cpp ProjMgrRunDebug.cpp
1720
)
1821
SET(PROJMGR_HEADER_FILES ProjMgr.h ProjMgrKernel.h ProjMgrCallback.h
1922
ProjMgrParser.h ProjMgrWorker.h ProjMgrGenerator.h ProjMgrXmlParser.h
2023
ProjMgrYamlParser.h ProjMgrLogger.h ProjMgrYamlSchemaChecker.h
2124
ProjMgrYamlEmitter.h ProjMgrUtils.h ProjMgrExtGenerator.h
25+
ProjMgrCbuildBase.h ProjMgrRunDebug.h
2226
)
2327

2428
list(TRANSFORM PROJMGR_SOURCE_FILES PREPEND src/)

tools/projmgr/include/ProjMgr.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "ProjMgrWorker.h"
1212
#include "ProjMgrGenerator.h"
1313
#include "ProjMgrYamlEmitter.h"
14+
#include "ProjMgrRunDebug.h"
1415

1516
#include <cxxopts.hpp>
1617

@@ -105,6 +106,12 @@ class ProjMgr {
105106
*/
106107
ProjMgrYamlEmitter& GetEmitter() { return m_emitter; };
107108

109+
/**
110+
* @brief get run debug manager object
111+
* @return reference to m_runDebug
112+
*/
113+
ProjMgrRunDebug& GetRunDebug() { return m_runDebug; };
114+
108115
/**
109116
* @brief get cdefault file in solution/project or in installation directory
110117
* @return true if file is found successfully, false otherwise
@@ -122,6 +129,7 @@ class ProjMgr {
122129
ProjMgrWorker m_worker;
123130
ProjMgrGenerator m_generator;
124131
ProjMgrYamlEmitter m_emitter;
132+
ProjMgrRunDebug m_runDebug;
125133

126134
std::string m_csolutionFile;
127135
std::string m_cdefaultFile;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright (c) 2020-2024 Arm Limited. All rights reserved.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef PROJMGRCBUILDBASE_H
8+
#define PROJMGRCBUILDBASE_H
9+
10+
#include <vector>
11+
#include <string>
12+
13+
/**
14+
* Forward declarations
15+
*/
16+
namespace YAML {
17+
class Node;
18+
}
19+
20+
/**
21+
* @brief projmgr base class for output yaml files
22+
*/
23+
class ProjMgrCbuildBase {
24+
protected:
25+
ProjMgrCbuildBase(bool useAbsolutePaths = false) : m_useAbsolutePaths(useAbsolutePaths) {};
26+
void SetNodeValue(YAML::Node node, const std::string& value);
27+
void SetNodeValue(YAML::Node node, const std::vector<std::string>& vec);
28+
const std::string FormatPath(const std::string& original, const std::string& directory);
29+
30+
bool m_useAbsolutePaths;
31+
};
32+
33+
#endif // PROJMGRCBUILDBASE_H

tools/projmgr/include/ProjMgrParser.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,22 @@ struct ProcessorItem {
110110
std::string branchProtection;
111111
};
112112

113+
/**
114+
* @brief memory item containing
115+
* name
116+
* access
117+
* start
118+
* size
119+
* algorithm
120+
*/
121+
struct MemoryItem {
122+
std::string name;
123+
std::string access;
124+
std::string start;
125+
std::string size;
126+
std::string algorithm;
127+
};
128+
113129
/**
114130
* @brief build types containing
115131
* toolchain,
@@ -151,10 +167,13 @@ struct BuildType {
151167
* @brief target types containing
152168
* platform board,
153169
* platform device,
170+
* additional memory,
171+
* build options
154172
*/
155173
struct TargetType {
156174
std::string board;
157175
std::string device;
176+
std::vector<MemoryItem> memory;
158177
BuildType build;
159178
};
160179

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*
2+
* Copyright (c) 2024 Arm Limited. All rights reserved.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef PROJMGRRUNDEBUG_H
8+
#define PROJMGRRUNDEBUG_H
9+
10+
#include "ProjMgrWorker.h"
11+
12+
/**
13+
* @brief programming algorithm types
14+
*/
15+
struct AlgorithmType {
16+
std::string algorithm;
17+
unsigned long long start = 0;
18+
unsigned long long size = 0;
19+
unsigned long long ramStart = 0;
20+
unsigned long long ramSize = 0;
21+
bool bDefault = false;
22+
};
23+
24+
/**
25+
* @brief files type
26+
*/
27+
struct FilesType {
28+
std::string file;
29+
std::string type;
30+
};
31+
32+
/**
33+
* @brief debug run manager types
34+
*/
35+
struct RunDebugType {
36+
std::string solution;
37+
std::string targetType;
38+
std::string compiler;
39+
std::string board;
40+
std::string boardPack;
41+
std::string device;
42+
std::string devicePack;
43+
std::vector<AlgorithmType> algorithms;
44+
std::vector<FilesType> outputs;
45+
std::vector<FilesType> systemDescriptions;
46+
};
47+
48+
/**
49+
* @brief projmgr run debug management class
50+
*/
51+
class ProjMgrRunDebug {
52+
public:
53+
/**
54+
* @brief class constructor
55+
*/
56+
ProjMgrRunDebug(void);
57+
58+
/**
59+
* @brief class destructor
60+
*/
61+
~ProjMgrRunDebug(void);
62+
63+
/**
64+
* @brief get run debug info
65+
* @return reference to m_runDebug
66+
*/
67+
RunDebugType& Get() { return m_runDebug; };
68+
69+
/**
70+
* @brief collect run/debug info for selected contexts
71+
* @param vector of selected contexts
72+
* @return true if executed successfully
73+
*/
74+
bool CollectSettings(const std::vector<ContextItem*>& contexts);
75+
76+
protected:
77+
RunDebugType m_runDebug;
78+
};
79+
80+
#endif // PROJMGRRUNDEBUG_H

tools/projmgr/include/ProjMgrUtils.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020-2022 Arm Limited. All rights reserved.
2+
* Copyright (c) 2020-2024 Arm Limited. All rights reserved.
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -130,7 +130,7 @@ class ProjMgrUtils {
130130
*/
131131
static RtePackage* ReadGpdscFile(const std::string& gpdsc, bool& valid);
132132

133-
/**
133+
/**
134134
* @brief expand compiler id the format <name>@[>=]<version> into name, minimum and maximum versions
135135
* @param compiler id
136136
* @param name reference to compiler name
@@ -231,7 +231,7 @@ class ProjMgrUtils {
231231
* @param input string
232232
* @return string with replaced characters
233233
*/
234-
static std:: string ReplaceDelimiters(const std::string input);
234+
static std::string ReplaceDelimiters(const std::string input);
235235

236236
/**
237237
* @brief find referenced context
@@ -273,6 +273,13 @@ class ProjMgrUtils {
273273
*/
274274
static bool ContainsIncompatiblePack(const std::list<RtePackage*>& packs, const std::string& requirement);
275275

276+
/**
277+
* @brief convert ULL to hex string
278+
* @param unsigned long long number
279+
* @return hexadecimal string
280+
*/
281+
static const std::string ULLToHex(unsigned long long number);
282+
276283
protected:
277284
/**
278285
* @brief get filtered list of contexts

0 commit comments

Comments
 (0)