summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorKshitij Sisodia <kshitij.sisodia@arm.com>2022-12-19 16:37:33 +0000
committerKshitij Sisodia <kshitij.sisodia@arm.com>2022-12-19 17:05:29 +0000
commit2ea46232a15aaf7600f1b92314612f4aa2fc6cd2 (patch)
tree7c05c514c3bbe932a067067b719d46ff16e5c2e7 /scripts
parent9a97134ee00125c7a406cbf57c3ba8360df8f980 (diff)
downloadml-embedded-evaluation-kit-2ea46232a15aaf7600f1b92314612f4aa2fc6cd2.tar.gz
MLECO-3611: Formatting fixes for generated files.
Template files updated for generated files to adhere to coding guidelines and clang format configuration. There will still be unavoidable violations, but most of the others have been fixed. Change-Id: Ia03db40f8c62a369f2b07fe02eea65e41993a523 Signed-off-by: Kshitij Sisodia <kshitij.sisodia@arm.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/py/setup_hooks.py2
-rw-r--r--scripts/py/templates/AudioClips.cc.template26
-rw-r--r--scripts/py/templates/AudioClips.hpp.template25
-rw-r--r--scripts/py/templates/Images.cc.template16
-rw-r--r--scripts/py/templates/Images.hpp.template19
-rw-r--r--scripts/py/templates/TestData.cc.template16
-rw-r--r--scripts/py/templates/TestData.hpp.template23
-rw-r--r--scripts/py/templates/default.hpp.template11
8 files changed, 88 insertions, 50 deletions
diff --git a/scripts/py/setup_hooks.py b/scripts/py/setup_hooks.py
index 178765c..ead5e1f 100644
--- a/scripts/py/setup_hooks.py
+++ b/scripts/py/setup_hooks.py
@@ -67,7 +67,7 @@ do
exit $exitcode1
fi
- cppcheck --enable=performance,portability --error-exitcode=1 $changed_files
+ cppcheck --enable=performance,portability --error-exitcode=1 --suppress=*:tests* $changed_files
exitcode2=$?
if [ $exitcode2 -ne 0 ]; then
exit $exitcode2
diff --git a/scripts/py/templates/AudioClips.cc.template b/scripts/py/templates/AudioClips.cc.template
index 724aa84..659234b 100644
--- a/scripts/py/templates/AudioClips.cc.template
+++ b/scripts/py/templates/AudioClips.cc.template
@@ -18,45 +18,41 @@
#include "InputFiles.hpp"
-static const char *audio_clip_filenames[] = {
+static const char* audioClipFilenames[] = {
{% for name in clip_names %}
"{{name}}",
{% endfor %}
};
-static const int16_t *audio_clip_arrays[] = {
- {{ var_names|join(',\n\t') }}
+static const int16_t* audioClipArrays[] = {
+ {{ var_names|join(',\n ') }}
};
-static const size_t audio_clip_sizes[NUMBER_OF_FILES] = {
- {{ clip_sizes|join(',\n\t') }}
+static const size_t audioClipSizes[NUMBER_OF_FILES] = {
+ {{ clip_sizes|join(',\n ') }}
};
-
-const char* get_filename(const uint32_t idx)
+const char* GetFilename(const uint32_t idx)
{
if (idx < NUMBER_OF_FILES) {
- return audio_clip_filenames[idx];
+ return audioClipFilenames[idx];
}
return nullptr;
}
-
-const int16_t* get_audio_array(const uint32_t idx)
+const int16_t* GetAudioArray(const uint32_t idx)
{
if (idx < NUMBER_OF_FILES) {
- return audio_clip_arrays[idx];
+ return audioClipArrays[idx];
}
return nullptr;
}
-
-uint32_t get_audio_array_size(const uint32_t idx)
+uint32_t GetAudioArraySize(const uint32_t idx)
{
if (idx < NUMBER_OF_FILES) {
- return audio_clip_sizes[idx];
+ return audioClipSizes[idx];
}
return 0;
}
-
diff --git a/scripts/py/templates/AudioClips.hpp.template b/scripts/py/templates/AudioClips.hpp.template
index dfe435c..12a7ae5 100644
--- a/scripts/py/templates/AudioClips.hpp.template
+++ b/scripts/py/templates/AudioClips.hpp.template
@@ -22,14 +22,31 @@
#include <cstdint>
#include <stddef.h>
-#define NUMBER_OF_FILES ({{clips_count}}U)
+#define NUMBER_OF_FILES ({{clips_count}}U)
{% for var_name, size in varname_size %}
extern const int16_t {{var_name}}[{{size}}];
{% endfor %}
-const char* get_filename(const uint32_t idx);
-const int16_t* get_audio_array(const uint32_t idx);
-uint32_t get_audio_array_size(const uint32_t idx);
+/**
+ * @brief Gets the filename for the baked-in input array
+ * @param[in] idx Index of the input.
+ * @return const C string pointer to the name.
+ **/
+const char* GetFilename(const uint32_t idx);
+
+/**
+ * @brief Gets the pointer to audio data.
+ * @param[in] idx Index of the input.
+ * @return Pointer to 16-bit signed integer data.
+ **/
+const int16_t* GetAudioArray(const uint32_t idx);
+
+/**
+ * @brief Gets the size of the input array.
+ * @param[in] idx Index of the input.
+ * @return Size of the input array in bytes.
+ **/
+uint32_t GetAudioArraySize(const uint32_t idx);
#endif /* GENERATED_AUDIOCLIPS_H */
diff --git a/scripts/py/templates/Images.cc.template b/scripts/py/templates/Images.cc.template
index 0cbd4f3..2620ab4 100644
--- a/scripts/py/templates/Images.cc.template
+++ b/scripts/py/templates/Images.cc.template
@@ -18,30 +18,28 @@
#include "InputFiles.hpp"
-static const char *img_filenames[] = {
+static const char* imgFilenames[] = {
{% for name in img_names %}
"{{name}}",
{% endfor %}
};
-static const uint8_t *img_arrays[] = {
- {{ var_names|join(',\n\t') }}
+static const uint8_t* imgArrays[] = {
+ {{ var_names|join(',\n ') }}
};
-const char* get_filename(const uint32_t idx)
+const char* GetFilename(const uint32_t idx)
{
if (idx < NUMBER_OF_FILES) {
- return img_filenames[idx];
+ return imgFilenames[idx];
}
return nullptr;
}
-
-const uint8_t* get_img_array(const uint32_t idx)
+const uint8_t* GetImgArray(const uint32_t idx)
{
if (idx < NUMBER_OF_FILES) {
- return img_arrays[idx];
+ return imgArrays[idx];
}
return nullptr;
}
-
diff --git a/scripts/py/templates/Images.hpp.template b/scripts/py/templates/Images.hpp.template
index 01f0c0f..d39fc49 100644
--- a/scripts/py/templates/Images.hpp.template
+++ b/scripts/py/templates/Images.hpp.template
@@ -21,14 +21,25 @@
#include <cstdint>
-#define NUMBER_OF_FILES ({{imgs_count}}U)
-#define IMAGE_DATA_SIZE ({{img_size}}U)
+#define NUMBER_OF_FILES ({{imgs_count}}U)
+#define IMAGE_DATA_SIZE ({{img_size}}U)
{% for var_name in var_names %}
extern const uint8_t {{var_name}}[IMAGE_DATA_SIZE];
{% endfor %}
-const char* get_filename(const uint32_t idx);
-const uint8_t* get_img_array(const uint32_t idx);
+/**
+ * @brief Gets the filename for the baked-in input array
+ * @param[in] idx Index of the input.
+ * @return const C string pointer to the name.
+ **/
+const char* GetFilename(const uint32_t idx);
+
+/**
+ * @brief Gets the pointer to image data.
+ * @param[in] idx Index of the input.
+ * @return Pointer to the 8-bit unsigned integer data.
+ **/
+const uint8_t* GetImgArray(const uint32_t idx);
#endif /* GENERATED_IMAGES_H */
diff --git a/scripts/py/templates/TestData.cc.template b/scripts/py/templates/TestData.cc.template
index 18f415a..f07879f 100644
--- a/scripts/py/templates/TestData.cc.template
+++ b/scripts/py/templates/TestData.cc.template
@@ -22,26 +22,26 @@
namespace {{namespace}} {
{% endfor %}
-static const {{data_type}} *ifm_arrays[] = {
- {{ ifm_var_names|join(',\n\t') }}
+static const {{data_type}} *ifmArrays[] = {
+ {{ ifm_var_names|join(',\n ') }}
};
-static const {{data_type}} *ofm_arrays[] = {
- {{ ofm_var_names|join(',\n\t') }}
+static const {{data_type}} *ofmArrays[] = {
+ {{ ofm_var_names|join(',\n ') }}
};
-const {{data_type}}* get_ifm_data_array(const uint32_t idx)
+const {{data_type}}* GetIfmDataArray(const uint32_t idx)
{
if (idx < NUMBER_OF_IFM_FILES) {
- return ifm_arrays[idx];
+ return ifmArrays[idx];
}
return nullptr;
}
-const {{data_type}}* get_ofm_data_array(const uint32_t idx)
+const {{data_type}}* GetOfmDataArray(const uint32_t idx)
{
if (idx < NUMBER_OF_OFM_FILES) {
- return ofm_arrays[idx];
+ return ofmArrays[idx];
}
return nullptr;
}
diff --git a/scripts/py/templates/TestData.hpp.template b/scripts/py/templates/TestData.hpp.template
index 13c410d..bd56f9f 100644
--- a/scripts/py/templates/TestData.hpp.template
+++ b/scripts/py/templates/TestData.hpp.template
@@ -25,13 +25,13 @@
namespace {{namespace}} {
{% endfor %}
-#define NUMBER_OF_IFM_FILES ({{ifm_count}}U)
-#define NUMBER_OF_OFM_FILES ({{ofm_count}}U)
+#define NUMBER_OF_IFM_FILES ({{ifm_count}}U)
+#define NUMBER_OF_OFM_FILES ({{ofm_count}}U)
{% for ifm_size in ifm_var_sizes %}
-#define IFM_{{loop.index0}}_DATA_SIZE ({{ifm_size}}U)
+#define IFM_{{loop.index0}}_DATA_SIZE ({{ifm_size}}U)
{% endfor %}
{% for ofm_size in ofm_var_sizes %}
-#define OFM_{{loop.index0}}_DATA_SIZE ({{ofm_size}}U)
+#define OFM_{{loop.index0}}_DATA_SIZE ({{ofm_size}}U)
{% endfor %}
{% for ifm_var_name in ifm_var_names %}
@@ -42,8 +42,19 @@ extern const {{data_type}} {{ifm_var_name}}[IFM_{{loop.index0}}_DATA_SIZE];
extern const {{data_type}} {{ofm_var_name}}[OFM_{{loop.index0}}_DATA_SIZE];
{% endfor %}
-const {{data_type}}* get_ifm_data_array(const uint32_t idx);
-const {{data_type}}* get_ofm_data_array(const uint32_t idx);
+/**
+ * @brief Gets the pointer to input feature map (IFM).
+ * @param[in] idx Index of the input.
+ * @return Pointer to IFM.
+ **/
+const {{data_type}}* GetIfmDataArray(const uint32_t idx);
+
+/**
+ * @brief Gets the pointer to output feature map (OFM).
+ * @param[in] idx Index of the output.
+ * @return Pointer to OFM.
+ **/
+const {{data_type}}* GetOfmDataArray(const uint32_t idx);
{% for namespace in namespaces %}
} /* namespace {{namespace}} */
diff --git a/scripts/py/templates/default.hpp.template b/scripts/py/templates/default.hpp.template
index 14b2326..9a461a6 100644
--- a/scripts/py/templates/default.hpp.template
+++ b/scripts/py/templates/default.hpp.template
@@ -21,8 +21,13 @@
#include <cstdint>
-#define NUMBER_OF_FILES (0U)
-
-const char* get_filename(const uint32_t idx);
+#define NUMBER_OF_FILES (0U)
+
+/**
+ * @brief Gets the filename for the baked-in input array
+ * @param[in] idx Index of the input.
+ * @return const C string pointer to the name.
+ **/
+const char* GetFilename(const uint32_t idx);
#endif /* DEFAULT_GENERATED_INPUT_H */