aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Leach <mike.leach@linaro.org>2019-10-15 14:07:41 +0100
committerMike Leach <mike.leach@linaro.org>2019-10-18 16:30:22 +0100
commit02307e1b7618a59f5240642ef691e5aace444959 (patch)
tree1e1210fc208c2bb8fe474c4c9db13f49edfd7ee3
parenta1961c91b02a92f3c6ed8b145c636ac4c5565aca (diff)
downloadOpenCSD-02307e1b7618a59f5240642ef691e5aace444959.tar.gz
opencsd: test: docs: Update core name / profile matching.
Update the core name to architecture version and profile matching class. Adds in generic profile names such as ARMv8-A which can now be used in snapshots where the core name is not supported in the library routine. Added documentation for the mapping class and a note to the test program usage docs to ensure that the valid name strings are full documented where needed. Signed-off-by: Mike Leach <mike.leach@linaro.org>
-rw-r--r--decoder/docs/test_progs.md3
-rw-r--r--decoder/include/common/trc_core_arch_map.h34
-rw-r--r--decoder/source/trc_core_arch_map.cpp24
3 files changed, 57 insertions, 4 deletions
diff --git a/decoder/docs/test_progs.md b/decoder/docs/test_progs.md
index 2719455..c02d02e 100644
--- a/decoder/docs/test_progs.md
+++ b/decoder/docs/test_progs.md
@@ -20,6 +20,9 @@ See [external_custom.md](@ref custom_decoders) for details.
These programs are both built at the same time as the library for the same set of platforms.
See [build_libs.md](@ref build_lib) for build details.
+_Note:_ The programs above use the library's [core name mapper helper class] (@ref CoreArchProfileMap) to map
+the name of the core into a profile / architecture pair that the library can use.
+The snapshot definition must use one of the names recognised by this class or an error will occur.
Trace "Snapshot" directory.
----------------------------
diff --git a/decoder/include/common/trc_core_arch_map.h b/decoder/include/common/trc_core_arch_map.h
index 5a24149..b72b4b4 100644
--- a/decoder/include/common/trc_core_arch_map.h
+++ b/decoder/include/common/trc_core_arch_map.h
@@ -39,6 +39,23 @@
#include <string>
#include "opencsd/ocsd_if_types.h"
+/** @class CoreArchProfileMap
+ *
+ * @brief Map core / arch name to profile for decoder.
+ *
+ * Helper class for library clients to map core or architecture version names onto
+ * a profile / arch version pair suitable for use with the decode library.
+ *
+ * Valid core names are:-
+ * - Cortex-Axx : where xx = 5,7,12,15,17,32,35,53,55,57,65,72,73,75,76,77;
+ * - Cortex-Rxx : where xx = 5,7,8,52;
+ * - Cortex-Mxx : where xx = 0,0+,3,4,23,33;
+ *
+ * Valid architecture profile names are:-
+ * - ARMv7-A, ARMv7-R, ARMv7-M;
+ * - ARMv8-A, ARMv8.3A, ARMv8-R, ARMv8-M;
+ *
+ */
class CoreArchProfileMap
{
public:
@@ -50,16 +67,31 @@ public:
private:
std::map<std::string, ocsd_arch_profile_t> core_profiles;
+ std::map<std::string, ocsd_arch_profile_t> arch_profiles;
};
inline ocsd_arch_profile_t CoreArchProfileMap::getArchProfile(const std::string &coreName)
{
ocsd_arch_profile_t ap = { ARCH_UNKNOWN, profile_Unknown };
+ bool bFound = false;
std::map<std::string, ocsd_arch_profile_t>::const_iterator it;
+
+ /* match against the core name map. */
it = core_profiles.find(coreName);
- if(it != core_profiles.end())
+ if (it != core_profiles.end())
+ {
ap = it->second;
+ bFound = true;
+ }
+
+ /* scan architecture profiles on no core name match */
+ if (!bFound)
+ {
+ it = arch_profiles.find(coreName);
+ if (it != arch_profiles.end())
+ ap = it->second;
+ }
return ap;
}
diff --git a/decoder/source/trc_core_arch_map.cpp b/decoder/source/trc_core_arch_map.cpp
index 70a25ee..a26f79d 100644
--- a/decoder/source/trc_core_arch_map.cpp
+++ b/decoder/source/trc_core_arch_map.cpp
@@ -34,10 +34,12 @@
#include "common/trc_core_arch_map.h"
-static struct _ap_map_elements {
+typedef struct _ap_map_elements {
const char *name;
ocsd_arch_profile_t ap;
-} ap_map_array[] =
+} ap_map_elem_t;
+
+static ap_map_elem_t ap_map_array[] =
{
{ "Cortex-A77", { ARCH_V8r3, profile_CortexA } },
{ "Cortex-A76", { ARCH_V8r3, profile_CortexA } },
@@ -70,12 +72,28 @@ static struct _ap_map_elements {
{ "Cortex-M4", { ARCH_V7, profile_CortexM } }
};
+static ap_map_elem_t arch_map_array[] =
+{
+ { "ARMv7-A", { ARCH_V7, profile_CortexA } },
+ { "ARMv7-R", { ARCH_V7, profile_CortexR } },
+ { "ARMv7-M", { ARCH_V7, profile_CortexM } },
+ { "ARMv8-A", { ARCH_V8, profile_CortexA } },
+ { "ARMv8.3-A", { ARCH_V8r3, profile_CortexA } },
+ { "ARMv8-R", { ARCH_V8, profile_CortexR } },
+ { "ARMv8-M", { ARCH_V8, profile_CortexM } },
+};
+
CoreArchProfileMap::CoreArchProfileMap()
{
- for(unsigned i = 0; i < sizeof(ap_map_array)/sizeof(_ap_map_elements); i++)
+ unsigned i;
+ for (i = 0; i < sizeof(ap_map_array) / sizeof(_ap_map_elements); i++)
{
core_profiles[ap_map_array[i].name] = ap_map_array[i].ap;
}
+ for (i = 0; i < sizeof(arch_map_array) / sizeof(_ap_map_elements); i++)
+ {
+ arch_profiles[arch_map_array[i].name] = arch_map_array[i].ap;
+ }
}
/* End of File trc_core_arch_map.cpp */