diff --git a/wa/framework/target/descriptor.py b/wa/framework/target/descriptor.py index bcaba382..c1252289 100644 --- a/wa/framework/target/descriptor.py +++ b/wa/framework/target/descriptor.py @@ -24,7 +24,7 @@ def get_target_descriptions(loader=pluginloader): return targets.values() -def instantiate_target(tdesc, params): +def instantiate_target(tdesc, params, connect=None): target_params = {p.name: p for p in tdesc.target_params} platform_params = {p.name: p for p in tdesc.platform_params} conn_params = {p.name: p for p in tdesc.conn_params} @@ -47,6 +47,8 @@ def instantiate_target(tdesc, params): tp['connection_settings'] = cp if tdesc.connection: tp['conn_cls'] = tdesc.connection + if connect is not None: + tp['connect'] = connect return tdesc.target(**tp) diff --git a/wa/framework/target/manager.py b/wa/framework/target/manager.py index 4da43bd5..545178e6 100644 --- a/wa/framework/target/manager.py +++ b/wa/framework/target/manager.py @@ -62,10 +62,7 @@ class TargetManager(object): self._init_target() self._init_assistant() - self.runtime_configs = [cls(self.target) for cls in self.runtime_config_cls] - with signal.wrap('TARGET_CONNECT'): - self.target.connect() def finalize(self): # self.logger.info('Disconnecting from the device') @@ -108,7 +105,9 @@ class TargetManager(object): if self.target_name not in target_map: raise ValueError('Unknown Target: {}'.format(self.target_name)) tdesc = target_map[self.target_name] - self.target = instantiate_target(tdesc, self.parameters) + self.target = instantiate_target(tdesc, self.parameters, connect=False) + with signal.wrap('TARGET_CONNECT'): + self.target.connect() self.target.setup() def _init_assistant(self):