From 21f40035d785950c439a77303b162940978e6fac Mon Sep 17 00:00:00 2001 From: Anouk Van Laer Date: Tue, 31 Jan 2017 13:11:03 +0000 Subject: [PATCH] gem5: Small tweaks in target to allow gem5 simulations The target knows as little as possible about gem5 as a platform but these tweaks add gem5 as a valid platform. modified: devlib/target.py --- devlib/target.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/devlib/target.py b/devlib/target.py index e628ab7..92d8367 100644 --- a/devlib/target.py +++ b/devlib/target.py @@ -152,7 +152,22 @@ class Target(object): conn_cls=None, ): self.connection_settings = connection_settings or {} - self.platform = platform or Platform() + # Set self.platform: either it's given directly (by platform argument) + # or it's given in the connection_settings argument + # If neither, create default Platform() + if platform is None: + self.platform = self.connection_settings.get('platform', Platform()) + else: + self.platform = platform + # Check if the user hasn't given two different platforms + if 'platform' in self.connection_settings: + if connection_settings['platform'] is not platform: + raise TargetError('Platform specified in connection_settings ' + '({}) differs from that directly passed ' + '({})!)' + .format(connection_settings['platform'], + self.platform)) + self.connection_settings['platform'] = self.platform self.working_directory = working_directory self.executables_directory = executables_directory self.modules = modules or [] @@ -222,6 +237,9 @@ class Target(object): for host_exe in (executables or []): # pylint: disable=superfluous-parens self.install(host_exe) + # Check for platform dependent setup procedures + self.platform.setup(self) + # Initialize modules which requires Buxybox (e.g. shutil dependent tasks) self._update_modules('setup')