3Copyright (c) 2016-2016,2018 ARM Limited
5Licensed under the Apache License, Version 2.0 (the "License");
6you may not use this file except in compliance with the License.
7You may obtain a copy of the License at
9 http://www.apache.org/licenses/LICENSE-2.0
11Unless required by applicable law or agreed to
in writing, software
12distributed under the License
is distributed on an
"AS IS" BASIS,
13WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied.
14See the License
for the specific language governing permissions
and
15limitations under the License.
17Author: Russ Butler <russ.butler
@arm.com>
21from .host_test_plugins import HostTestPluginBase
22from pyocd.core.helpers import ConnectHelper
23from pyocd.flash.loader import FileProgrammer
26class HostTestPluginCopyMethod_pyOCD(HostTestPluginBase):
28 name =
'HostTestPluginCopyMethod_pyOCD'
31 capabilities = [
'pyocd']
32 required_parameters = [
'image_path',
'target_id']
37 HostTestPluginBase.__init__(self)
39 def setup(self, *args, **kwargs):
40 """ Configure plugin, this function should be called before plugin execute() method is used.
44 def execute(self, capability, *args, **kwargs):
45 """! Executes capability by name
47 @param capability Capability name
48 @param args Additional arguments
49 @param kwargs Additional arguments
50 @return Capability call
return value
55 if not kwargs[
'image_path']:
59 if not kwargs[
'target_id']:
63 target_id = kwargs[
'target_id']
64 image_path = os.path.normpath(kwargs[
'image_path'])
65 with ConnectHelper.session_with_chosen_probe(unique_id=target_id, resume_on_disconnect=
False)
as session:
70 target_type = session.board.target_type
71 if target_type ==
"nrf51":
74 if target_type ==
"ncs36510":
79 session.probe.set_clock(test_clock)
82 programmer = FileProgrammer(session)
83 programmer.program(image_path)
89 """ Returns plugin available in this module
def print_plugin_error(self, text)
Interface helper methods - overload only if you need to have custom behaviour.
def check_parameters(self, capability, *args, **kwargs)
This function should be ran each time we call execute() to check if none of the required parameters i...
def execute(self, capability, *args, **kwargs)
Executes capability by name.
def setup(self, *args, **kwargs)