summaryrefslogtreecommitdiff
path: root/set_up_default_resources.py
diff options
context:
space:
mode:
authorKshitij Sisodia <kshitij.sisodia@arm.com>2022-03-14 09:26:48 +0000
committerKshitij Sisodia <kshitij.sisodia@arm.com>2022-03-14 17:18:25 +0000
commitc22e80e25521bdd291fdef9ba20194ce9d2a8544 (patch)
treeb8ffe314220d4d04e84dbd6a240f77271c1e5e70 /set_up_default_resources.py
parent1716efd0b35889b580276e27c8b6f661c9858cd0 (diff)
downloadml-embedded-evaluation-kit-c22e80e25521bdd291fdef9ba20194ce9d2a8544.tar.gz
MLECO-2919: Restructuring to standardise HAL APIs
* LCD module component created (removed from individual platform packs). * retarget.c moved out into its own component that wraps the uart module. It also have the native stub for GetLine => paved the way for removing data_acq module from profiles. * shortened names for components' dir for npu and ta * remove peripheral_memmap and peripheral_irqs headers from platform_drivers.h. There should be no need for these to be included in the top level now. These should be private headers. * cmsis_device moved in as a component. * Pyenv created by set_up_default_resource.py will also install packages that CMake's source generator needs. TODO's: * Remove timer from profiles (MLECO-3096) Change-Id: I9d6ea2f4f291788f40a16ed507019563c8d7f205
Diffstat (limited to 'set_up_default_resources.py')
-rwxr-xr-xset_up_default_resources.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/set_up_default_resources.py b/set_up_default_resources.py
index 3138844..56363a1 100755
--- a/set_up_default_resources.py
+++ b/set_up_default_resources.py
@@ -345,6 +345,7 @@ def set_up_resources(
additional_npu_config_names: list = (),
arena_cache_size: int = 0,
check_clean_folder: bool = False,
+ additional_requirements_file: str = ''
):
"""
Helpers function that retrieve the output from a command.
@@ -359,6 +360,9 @@ def set_up_resources(
the NPU config requirements, are used.
check_clean_folder (bool): Indicates whether the resources folder needs to
be checked for updates and cleaned.
+ additional_requirements_file (str): Path to a requirements.txt file if
+ additional packages need to be
+ installed.
"""
# Paths
current_file_dir = os.path.dirname(os.path.abspath(__file__))
@@ -419,7 +423,7 @@ def set_up_resources(
call_command(command)
os.chdir(current_file_dir)
- # 1.3 Make sure to have all the requirement
+ # 1.3 Make sure to have all the requirements
requirements = [f"ethos-u-vela=={vela_version}"]
command = f"{env_python} -m pip freeze"
packages = call_command(command)
@@ -428,6 +432,11 @@ def set_up_resources(
command = f"{env_python} -m pip install {req}"
call_command(command)
+ # 1.4 Install additional requirements, if a valid file has been provided
+ if additional_requirements_file and os.path.isfile(additional_requirements_file):
+ command = f"{env_python} -m pip install -r {additional_requirements_file}"
+ call_command(command)
+
# 2. Download models
logging.info("Downloading resources.")
for uc in json_uc_res:
@@ -615,11 +624,22 @@ if __name__ == "__main__":
help="Clean the disctory and optimize the downloaded resources",
action="store_true",
)
+ parser.add_argument(
+ "--requirements-file",
+ help="Path to requirements.txt file to install additional packages",
+ type=str,
+ default=os.path.join(os.path.dirname(os.path.abspath(__file__)),
+ 'scripts', 'py', 'requirements.txt')
+ )
+
args = parser.parse_args()
if args.arena_cache_size < 0:
raise ArgumentTypeError("Arena cache size cannot not be less than 0")
+ if not os.path.isfile(args.requirements_file):
+ raise ArgumentTypeError(f"Invalid requirements file: {args.requirements_file}")
+
logging.basicConfig(filename="log_build_default.log", level=logging.DEBUG)
logging.getLogger().addHandler(logging.StreamHandler(sys.stdout))
@@ -628,4 +648,5 @@ if __name__ == "__main__":
args.additional_ethos_u_config_name,
args.arena_cache_size,
args.clean,
+ args.requirements_file
)