diff options
author | Kshitij Sisodia <kshitij.sisodia@arm.com> | 2021-05-19 10:30:06 +0100 |
---|---|---|
committer | Kshitij Sisodia <kshitij.sisodia@arm.com> | 2021-05-19 10:47:59 +0100 |
commit | 659fcd951ac18d1ee7737a6ddf6a3ec162c73ca5 (patch) | |
tree | 091232857b7ce8a52a7656424db4e4536b45cc7b /scripts | |
parent | a3d87702b743e4e2d2ef08f0210445b01a86c87c (diff) | |
download | ml-embedded-evaluation-kit-659fcd951ac18d1ee7737a6ddf6a3ec162c73ca5.tar.gz |
MLECO-1933, MLECO-1914, MLECO-1885: Update to 21.05-rc2 components
Core driver and sofware dependencies updated to latest release
candidate revisions. Note: TensorFlow Lite Micro has not been
updated.
Also, gcc warnings for simple_platform target and ad use case have
been fixed.
Change-Id: I455b421f34375a719a941e6e220fe292a57613f5
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/cmake/subsystem-profiles/simple_platform.cmake | 2 | ||||
-rw-r--r-- | scripts/py/gen_audio_cpp.py | 17 | ||||
-rw-r--r-- | scripts/py/gen_rgb_cpp.py | 8 | ||||
-rw-r--r-- | scripts/py/templates/AudioClips.hpp.template | 1 |
4 files changed, 18 insertions, 10 deletions
diff --git a/scripts/cmake/subsystem-profiles/simple_platform.cmake b/scripts/cmake/subsystem-profiles/simple_platform.cmake index c11706d..c5e9d59 100644 --- a/scripts/cmake/subsystem-profiles/simple_platform.cmake +++ b/scripts/cmake/subsystem-profiles/simple_platform.cmake @@ -24,7 +24,7 @@ # Application specific config # ################################################################################################### -# This parameter is based on the linker/scatter script for internal FVP. Do not change this +# This parameter is based on the linker/scatter script for simple platform. Do not change this # parameter in isolation. set(ACTIVATION_BUF_SRAM_SZ "0x00200000" CACHE STRING "Maximum SRAM size for activation buffers") set(DESIGN_NAME "Simple platform" CACHE STRING "Design name") diff --git a/scripts/py/gen_audio_cpp.py b/scripts/py/gen_audio_cpp.py index 54fdb23..e7155c7 100644 --- a/scripts/py/gen_audio_cpp.py +++ b/scripts/py/gen_audio_cpp.py @@ -75,7 +75,7 @@ def write_hpp_file(header_filepath, cc_filepath, header_template_file, num_audio def write_individual_audio_cc_file(clip_dirpath, clip_filename, cc_filename, header_template_file, array_name, - sampling_rate_value, mono_value, offset_value, + sampling_rate_value, mono_value, offset_value, duration_value, res_type_value, min_len): print(f"++ Converting {clip_filename} to {path.basename(cc_filename)}") audio_filepath = path.join(clip_dirpath, clip_filename) @@ -85,8 +85,8 @@ def write_individual_audio_cc_file(clip_dirpath, clip_filename, res_type_value, min_len) # Change from [-1, 1] fp32 range to int16 range. - clip_data = np.clip((clip_data * (1 << 15)), - np.iinfo(np.int16).min, + clip_data = np.clip((clip_data * (1 << 15)), + np.iinfo(np.int16).min, np.iinfo(np.int16).max).flatten().astype(np.int16) header_template = env.get_template(header_template_file) @@ -117,7 +117,7 @@ def main(args): header_filepath = path.join(args.header_folder_path, header_filename) common_cc_filepath = path.join(args.source_folder_path, common_cc_filename) - if os.path.isdir(args.audio_path): + if os.path.isdir(args.audio_path): filepaths = sorted(glob.glob(path.join(args.audio_path, '**/*.wav'), recursive=True)) elif os.path.isfile(args.audio_path): filepaths = [args.audio_path] @@ -125,7 +125,7 @@ def main(args): raise OSError("Directory or file does not exist.") for filepath in filepaths: - filename = path.basename(filepath) + filename = path.basename(filepath) clip_dirpath = path.dirname(filepath) try: audioclip_filenames.append(filename) @@ -145,8 +145,11 @@ def main(args): if args.verbosity: print(f"Failed to open {filename} as an audio.") - write_hpp_file(header_filepath, common_cc_filepath, args.license_template, - audioclip_idx, audioclip_filenames, audioclip_array_names) + if len(audioclip_filenames) > 0: + write_hpp_file(header_filepath, common_cc_filepath, args.license_template, + audioclip_idx, audioclip_filenames, audioclip_array_names) + else: + raise FileNotFoundError("No valid audio clip files found.") if __name__ == '__main__': diff --git a/scripts/py/gen_rgb_cpp.py b/scripts/py/gen_rgb_cpp.py index 1a2e09b..957d2d0 100644 --- a/scripts/py/gen_rgb_cpp.py +++ b/scripts/py/gen_rgb_cpp.py @@ -127,8 +127,12 @@ def main(args): header_filepath = os.path.join(args.header_folder_path, header_filename) common_cc_filename = "InputFiles.cc" common_cc_filepath = os.path.join(args.source_folder_path, common_cc_filename) - write_hpp_file(header_filepath, common_cc_filepath, args.license_template, - image_idx, image_filenames, image_array_names, args.image_size) + + if len(image_filenames) > 0: + write_hpp_file(header_filepath, common_cc_filepath, args.license_template, + image_idx, image_filenames, image_array_names, args.image_size) + else: + raise FileNotFoundError("No valid images found.") if __name__ == '__main__': diff --git a/scripts/py/templates/AudioClips.hpp.template b/scripts/py/templates/AudioClips.hpp.template index eb0beda..2bcf45c 100644 --- a/scripts/py/templates/AudioClips.hpp.template +++ b/scripts/py/templates/AudioClips.hpp.template @@ -23,6 +23,7 @@ #include <stddef.h> #define NUMBER_OF_FILES ({{clips_count}}U) + {% for var_name, size in varname_size %} extern const int16_t {{var_name}}[{{size}}]; {% endfor %} |