3 Copyright (c) 2016-2016,2018 ARM Limited
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
9 http://www.apache.org/licenses/LICENSE-2.0
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
17 Author: Russ Butler <russ.butler@arm.com>
21 from .host_test_plugins
import HostTestPluginBase
22 from pyocd.core.helpers
import ConnectHelper
23 from pyocd.flash.loader
import FileProgrammer
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
Base class for all plugins used with host tests.
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)