Skip to content

Commit d9e84b0

Browse files
committed
Merge branch 'develop'
2 parents fc2b7ef + 46a6c04 commit d9e84b0

File tree

126 files changed

+284653
-38184
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+284653
-38184
lines changed

docs/configuration.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ multiple ways to set these options.
1010

1111
- Many of the most commonly used session options have dedicated command line arguments.
1212
- Options can be placed in a YAML config file.
13-
- Arbitrary options can be set individually with the `-Ooption=value` command line argument.
13+
- Arbitrary options can be set individually with the <tt>-O<i>option</i>=<i>value</i></tt> command line argument.
1414
- If you are using the Python API, you may pass any option values directly
1515
to the `ConnectHelper` methods or `Session` constructor as keyword arguments. You can also
1616
pass a dictionary for the `options` parameter of these methods.
@@ -27,14 +27,18 @@ The priorities of the different session option sources, from highest to lowest:
2727
## Project directory
2828

2929
To help pyOCD automatically find configuration files and other resources, it has the concept of
30-
the project directory. By default this is simply the working directory where you ran the `pyocd`
31-
tool. You can set the project directory explicitly with the `-j` or `--dir` command line
32-
arguments. This can be helpful if you are running pyOCD from another tool or application.
30+
the project directory.
3331

3432
When pyOCD looks for files such as the config file or a user script, it first expands '~'
3533
references to the home directory. Then it checks whether the filename is absolute, and if so, it
3634
uses the filename as-is. Otherwise, it looks for the file in the project directory.
3735

36+
By default, the project directory is simply the working directory where you ran the `pyocd` tool.
37+
You can change the project directory to another location with the `-j`, `--project`, or `--dir` command line
38+
arguments. This can be helpful if you are running pyOCD from another tool or application. The project
39+
directory can also be set using the `PYOCD_PROJECT_DIR` environment variable. Command line arguments
40+
have precedence over the environment variable.
41+
3842
## Config file
3943

4044
pyOCD supports a YAML configuration file that lets you set session options that either apply to
@@ -44,7 +48,8 @@ The easiest way to use a config file is to place a `pyocd.yaml` file in the proj
4448
An alternate `.yml` extension and
4549
optional dot prefix on the config file name are allowed. Alternatively, you can use the
4650
`--config` command line option, for instance `--config=myconfig.yaml`. Finally, you can set the
47-
`config_file` option.
51+
`config_file` option. If there is a need to prevent reading a config file, use the `--no-config`
52+
argument.
4853

4954
The top level of the YAML file is a dictionary. The keys in the top-level dictionary must be names
5055
of session options, or the key `probes`. Session options are set to the value corresponding to the

docs/options.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ working directory.
9090
<td>'halt'</td>
9191
<td>
9292
Controls how pyOCD connects to the target. One of 'halt', 'pre-reset', 'under-reset', 'attach'.
93+
<ul>
94+
<li>'halt': immediately halt all accessible cores upon connect.</li>
95+
<li>'pre-reset': perform a hardware reset prior to connect and halt.</li>
96+
<li>'under-reset': assert hardware reset during the connect sequence, then deassert after the cores are halted.
97+
This connect mode is often necessary to gain control of a target that is in a deep low power mode.</li>
98+
<li>'attach': connect to a running target without halting cores.</li>
99+
</ul>
93100
</td></tr>
94101

95102
<tr><td>cpu.step.instruction.timeout</td>

docs/target_support.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,13 @@ DFPs. The part number patterns are matched case-insensitively and as a contains
133133
For instance, if you know the specific part number of the device you are using, say STM32L073, you
134134
can run this command to install support:
135135

136-
$ pyocd pack --install stm32l073
136+
$ pyocd pack install stm32l073
137137

138138
This will download the index if required, then download the STM32L0xx_DFP pack. The
139139

140140
As another example, to find which pack(s) support the NXP MK26F family, you could run:
141141

142-
$ pyocd pack --find k26
142+
$ pyocd pack find k26
143143

144144
This will print a table similar to:
145145

docs/terminology.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ Terminology
33

44
These are the key terms used by pyOCD and its documentation.
55

6-
- **ADI**: Arm Debug Interface, an Arm architecture standard for how JTAG and SWD interface with CoreSight.
6+
- **ADI**: Arm Debug Interface, an Arm architecture specification for how JTAG and SWD interface with CoreSight.
77
It defines the DAP structure and registers.
88
- **AP**: Access Port, part of the DAP, connected to the DP, that allows the debugger to perform operations
99
on the chip and cores. There are multiple types of AP that serve different purposes (see MEM-AP). Some MCU
1010
vendors implement proprietary APs in their chips.
11-
- **CoreSight**: A standard Arm architecture for debug subsystems. It defines a standardised way
11+
- **Commander**: Refers to the `pyocd commander` subcommand that presents an interactive interface for exploring
12+
the connected target.
13+
- **CoreSight**: An Arm architecture specification for debug subsystems. It defines a standardised way
1214
to discover the debug resources provided by a device.
1315
- **DAP**: Debug Access Port, the debugging module that is accessed via the JTAG or SWD port. Composed of a
1416
DP and one or more APs.
@@ -30,6 +32,8 @@ These are the key terms used by pyOCD and its documentation.
3032
writes within the chip. Concrete MEM-APs have names that represent the kind of bus fabric with which they
3133
interface, such as AHB-AP or AXI-AP.
3234
- **probe server**: Server that shares a debug probe over TCP/IP.
35+
- **REPL**: Read-Eval-Print-Loop. An interactive type of command interface used by pyOCD Commander, as well as
36+
Python and other similar tools.
3337
- **session**: Represents a connection to a debug probe and the runtime object graph.
3438
- **session option**: A named setting that controls some feature of pyOCD. Options are associated with
3539
a session, and each session can have different values for a given option.. They can be set from the

pyocd/board/board.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# pyOCD debugger
22
# Copyright (c) 2006-2013,2018 Arm Limited
3+
# Copyright (c) 2021 Chris Reed
34
# SPDX-License-Identifier: Apache-2.0
45
#
56
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,12 +15,12 @@
1415
# See the License for the specific language governing permissions and
1516
# limitations under the License.
1617

18+
import logging
19+
1720
from ..core import exceptions
1821
from ..target import TARGET
1922
from ..target.pack import pack_target
2023
from ..utility.graph import GraphNode
21-
import logging
22-
import six
2324

2425
LOG = logging.getLogger(__name__)
2526

@@ -60,11 +61,11 @@ def __init__(self, session, target=None):
6061
try:
6162
self.target = TARGET[self._target_type](session)
6263
except KeyError as exc:
63-
six.raise_from(exceptions.TargetSupportError(
64-
"Target type '%s' not recognized. Use 'pyocd list --targets' to see currently "
64+
raise exceptions.TargetSupportError(
65+
f"Target type {self._target_type} not recognized. Use 'pyocd list --targets' to see currently "
6566
"available target types. "
6667
"See <https://github.com/pyocd/pyOCD/blob/master/docs/target_support.md> "
67-
"for how to install additional target support." % self._target_type), exc)
68+
"for how to install additional target support.") from exc
6869

6970
# Tell the user what target type is selected.
7071
LOG.info("Target type is %s", self._target_type)
@@ -97,7 +98,7 @@ def uninit(self):
9798
resume = self.session.options.get('resume_on_disconnect')
9899
self.target.disconnect(resume)
99100
self._inited = False
100-
except:
101+
except exceptions.Error:
101102
LOG.error("link exception during target disconnect:", exc_info=self._session.log_tracebacks)
102103

103104
@property

pyocd/board/board_ids.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ def __init__(self, name, target, binary):
262262
"9014": BoardInfo( "Seeed 96Boards Nitrogen", "nrf52", "l1_nrf52-dk.bin", ),
263263
"9900": BoardInfo( "micro:bit", "nrf51", "l1_microbit.bin", ),
264264
"9901": BoardInfo( "micro:bit", "nrf51", "l1_microbit.bin", ),
265+
"9903": BoardInfo( "micro:bit v2", "nrf52833", "microbitv2.bin", ),
266+
"9904": BoardInfo( "micro:bit v2", "nrf52833", "microbitv2.bin", ),
265267
"C004": BoardInfo( "tinyK20", "k20d50m", "l1_k20d50m.bin", ),
266268
"C006": BoardInfo( "VBLUno51", "nrf51", "l1_nrf51.bin", ),
267269
}

pyocd/commands/base.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import logging
1919
import textwrap
20-
import six
2120

2221
from ..core import exceptions
2322
from ..utility import conversion
@@ -55,8 +54,7 @@ def __new__(mcs, name, bases, dict):
5554
ALL_COMMANDS.setdefault(info['group'], set()).add(new_type)
5655
return new_type
5756

58-
@six.add_metaclass(CommandMeta)
59-
class CommandBase(object):
57+
class CommandBase(metaclass=CommandMeta):
6058
"""! @brief Base class for a command.
6159
6260
Each command class must have an `INFO` attribute with the following keys:
@@ -164,7 +162,7 @@ def _convert_value(self, arg):
164162

165163
return value
166164
except ValueError as err:
167-
raise six.raise_from(exceptions.CommandError("invalid argument '{}'".format(arg)), None)
165+
raise exceptions.CommandError("invalid argument '{}'".format(arg)) from None
168166

169167
@classmethod
170168
def format_help(cls, context, max_width=72):

pyocd/commands/commander.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# pyOCD debugger
22
# Copyright (c) 2015-2020 Arm Limited
3+
# Copyright (c) 2021 Chris Reed
34
# SPDX-License-Identifier: Apache-2.0
45
#
56
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,7 +15,6 @@
1415
# See the License for the specific language governing permissions and
1516
# limitations under the License.
1617

17-
from __future__ import print_function
1818
import logging
1919
import os
2020
import traceback

pyocd/commands/execution_context.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def write(self, message='', **kwargs):
162162
if self._output is None:
163163
return
164164
end = kwargs.pop('end', "\n")
165-
if not isinstance(message, six.string_types):
165+
if not isinstance(message, str):
166166
message = str(message)
167167
self._output.write(message + end)
168168

@@ -175,7 +175,7 @@ def writei(self, fmt, *args, **kwargs):
175175
@param self This object.
176176
@param fmt Format string using printf-style "%" formatters.
177177
"""
178-
assert isinstance(fmt, six.string_types)
178+
assert isinstance(fmt, str)
179179
message = fmt % args
180180
self.write(message, **kwargs)
181181

@@ -188,7 +188,7 @@ def writef(self, fmt, *args, **kwargs):
188188
@param self This object.
189189
@param fmt Format string using the format() mini-language.
190190
"""
191-
assert isinstance(fmt, six.string_types)
191+
assert isinstance(fmt, str)
192192
message = fmt.format(*args, **kwargs)
193193
self.write(message, **kwargs)
194194

@@ -394,7 +394,7 @@ def handle_python(self, invocation):
394394

395395
result = eval(invocation.cmd, globals(), self._python_namespace)
396396
if result is not None:
397-
if isinstance(result, six.integer_types):
397+
if isinstance(result, str):
398398
self.writei("0x%08x (%d)", result, result)
399399
else:
400400
w, h = get_terminal_size()
@@ -411,4 +411,4 @@ def handle_system(self, invocation):
411411
output = subprocess.check_output(invocation.cmd, stderr=subprocess.STDOUT, shell=True)
412412
self.write(six.ensure_str(output), end='')
413413
except subprocess.CalledProcessError as err:
414-
six.raise_from(exceptions.CommandError(str(err)), err)
414+
raise exceptions.CommandError(str(err)) from err

pyocd/commands/repl.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# pyOCD debugger
22
# Copyright (c) 2015-2020 Arm Limited
3+
# Copyright (c) 2021 Chris Reed
34
# SPDX-License-Identifier: Apache-2.0
45
#
56
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,10 +15,8 @@
1415
# See the License for the specific language governing permissions and
1516
# limitations under the License.
1617

17-
from __future__ import print_function
1818
import logging
1919
import os
20-
import six
2120
import traceback
2221
import atexit
2322

@@ -75,7 +74,7 @@ def run(self):
7574
try:
7675
while True:
7776
try:
78-
line = six.moves.input(self.PROMPT)
77+
line = input(self.PROMPT)
7978
self.run_one_command(line)
8079
except KeyboardInterrupt:
8180
print()

0 commit comments

Comments
 (0)