forked from Open-CMSIS-Pack/devtools
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathRteConstants.cpp
More file actions
83 lines (76 loc) · 3.77 KB
/
Copy pathRteConstants.cpp
File metadata and controls
83 lines (76 loc) · 3.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/******************************************************************************/
/* RTE - CMSIS Run-Time Environment */
/******************************************************************************/
/** @file RteConstants.cpp
* @brief CMSIS RTE Data Model
*/
/******************************************************************************/
/*
* Copyright (c) 2020-2026 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*/
/******************************************************************************/
#include "RteConstants.h"
#include "RteUtils.h"
using namespace std;
const StrMap RteConstants::DeviceAttributesKeys = {
{ RTE_DFPU , YAML_FPU },
{ RTE_DDSP , YAML_DSP },
{ RTE_DMVE , YAML_MVE },
{ RTE_DENDIAN , YAML_ENDIAN },
{ RTE_DSECURE , YAML_TRUSTZONE },
{ RTE_DBRANCHPROT, YAML_BRANCH_PROTECTION },
};
const StrPairVecMap RteConstants::DeviceAttributesValues = {
{ RTE_DFPU , {{ RTE_DP_FPU , YAML_FPU_DP },
{ RTE_SP_FPU , YAML_FPU_SP },
{ RTE_NO_FPU , YAML_OFF }}},
{ RTE_DDSP , {{ RTE_DSP , YAML_ON },
{ RTE_NO_DSP , YAML_OFF }}},
{ RTE_DMVE , {{ RTE_FP_MVE , YAML_MVE_FP },
{ RTE_MVE , YAML_MVE_INT },
{ RTE_NO_MVE , YAML_OFF }}},
{ RTE_DENDIAN , {{ RTE_ENDIAN_BIG , YAML_ENDIAN_BIG },
{ RTE_ENDIAN_LITTLE, YAML_ENDIAN_LITTLE }}},
{ RTE_DSECURE , {{ RTE_SECURE , YAML_TZ_SECURE },
{ RTE_SECURE_ONLY , YAML_TZ_SECURE_ONLY },
{ RTE_NON_SECURE , YAML_TZ_NON_SECURE },
{ RTE_TZ_DISABLED , YAML_OFF }}},
{ RTE_DBRANCHPROT, {{ RTE_BTI , YAML_BP_BTI },
{ RTE_BTI_SIGNRET , YAML_BP_BTI_SIGNRET },
{ RTE_NO_BRANCHPROT, YAML_OFF }}},
};
const StrPairVecMap RteConstants::ProcessorCapabilities = {
{ RTE_DFPU , {{ RTE_DP_FPU , YAML_FPU_DP },
{ RTE_SP_FPU , YAML_FPU_SP },
{ RTE_NO_FPU , YAML_NONE }}},
{ RTE_DMPU , {{ RTE_MPU , YAML_PRESENT },
{ RTE_NO_MPU , YAML_NONE }}},
{ RTE_DDSP , {{ RTE_DSP , YAML_PRESENT },
{ RTE_NO_DSP , YAML_NONE }}},
{ RTE_DMVE , {{ RTE_FP_MVE , YAML_MVE_FP },
{ RTE_MVE , YAML_MVE_INT },
{ RTE_NO_MVE , YAML_NONE }}},
{ RTE_DENDIAN , {{ RTE_ENDIAN_BIG , YAML_ENDIAN_BIG },
{ RTE_ENDIAN_LITTLE , YAML_ENDIAN_LITTLE },
{ RTE_ENDIAN_CONFIGURABLE, YAML_ENDIAN_CONFIG }}},
{ RTE_DTZ , {{ RTE_TZ , YAML_PRESENT },
{ RTE_NO_TZ , YAML_NONE }}},
{ RTE_DPACBTI, {{ RTE_PACBTI , YAML_PRESENT },
{ RTE_NO_PACBTI , YAML_NONE }}},
};
const string& RteConstants::GetDeviceAttribute(const string& key, const string& value, const StrPairVecMap& attr) {
auto it = attr.find(key);
if(it != attr.end()) {
for(const auto& [rte, yaml] : it->second) {
if(value == rte) {
return yaml;
} else if(value == yaml) {
return rte;
}
}
}
return RteUtils::EMPTY_STRING;
}
// end of RteConstants.cpp