INSTRUCTION stringlengths 1 46.3k | RESPONSE stringlengths 75 80.2k |
|---|---|
Erases the flash contents of the device.
This erases the flash memory of the target device. If this method
fails, the device may be left in an inoperable state.
Args:
self (JLink): the ``JLink`` instance
Returns:
Number of bytes erased. | def erase(self):
"""Erases the flash contents of the device.
This erases the flash memory of the target device. If this method
fails, the device may be left in an inoperable state.
Args:
self (JLink): the ``JLink`` instance
Returns:
Number of bytes erased.... |
Flashes the target device.
The given ``on_progress`` callback will be called as
``on_progress(action, progress_string, percentage)`` periodically as the
data is written to flash. The action is one of ``Compare``, ``Erase``,
``Verify``, ``Flash``.
Args:
self (JLink): ... | def flash(self, data, addr, on_progress=None, power_on=False, flags=0):
"""Flashes the target device.
The given ``on_progress`` callback will be called as
``on_progress(action, progress_string, percentage)`` periodically as the
data is written to flash. The action is one of ``Compare``... |
Flashes the target device.
The given ``on_progress`` callback will be called as
``on_progress(action, progress_string, percentage)`` periodically as the
data is written to flash. The action is one of ``Compare``, ``Erase``,
``Verify``, ``Flash``.
Args:
self (JLink): ... | def flash_file(self, path, addr, on_progress=None, power_on=False):
"""Flashes the target device.
The given ``on_progress`` callback will be called as
``on_progress(action, progress_string, percentage)`` periodically as the
data is written to flash. The action is one of ``Compare``, ``... |
Resets the target.
This method resets the target, and by default toggles the RESET and
TRST pins.
Args:
self (JLink): the ``JLink`` instance
ms (int): Amount of milliseconds to delay after reset (default: 0)
halt (bool): if the CPU should halt after reset (default... | def reset(self, ms=0, halt=True):
"""Resets the target.
This method resets the target, and by default toggles the RESET and
TRST pins.
Args:
self (JLink): the ``JLink`` instance
ms (int): Amount of milliseconds to delay after reset (default: 0)
halt (bool)... |
Restarts the CPU core and simulates/emulates instructions.
Note:
This is a no-op if the CPU isn't halted.
Args:
self (JLink): the ``JLink`` instance
num_instructions (int): number of instructions to simulate, defaults
to zero
skip_breakpoints (bool):... | def restart(self, num_instructions=0, skip_breakpoints=False):
"""Restarts the CPU core and simulates/emulates instructions.
Note:
This is a no-op if the CPU isn't halted.
Args:
self (JLink): the ``JLink`` instance
num_instructions (int): number of instructions to... |
Halts the CPU Core.
Args:
self (JLink): the ``JLink`` instance
Returns:
``True`` if halted, ``False`` otherwise. | def halt(self):
"""Halts the CPU Core.
Args:
self (JLink): the ``JLink`` instance
Returns:
``True`` if halted, ``False`` otherwise.
"""
res = int(self._dll.JLINKARM_Halt())
if res == 0:
time.sleep(1)
return True
return... |
Returns whether the CPU core was halted.
Args:
self (JLink): the ``JLink`` instance
Returns:
``True`` if the CPU core is halted, otherwise ``False``.
Raises:
JLinkException: on device errors. | def halted(self):
"""Returns whether the CPU core was halted.
Args:
self (JLink): the ``JLink`` instance
Returns:
``True`` if the CPU core is halted, otherwise ``False``.
Raises:
JLinkException: on device errors.
"""
result = int(self._dll... |
Returns the name of the target ARM core.
Args:
self (JLink): the ``JLink`` instance
Returns:
The target core's name. | def core_name(self):
"""Returns the name of the target ARM core.
Args:
self (JLink): the ``JLink`` instance
Returns:
The target core's name.
"""
buf_size = self.MAX_BUF_SIZE
buf = (ctypes.c_char * buf_size)()
self._dll.JLINKARM_Core2CoreName(... |
Retrieves and returns the number of bits in the scan chain.
Args:
self (JLink): the ``JLink`` instance
scan_chain (int): scan chain to be measured
Returns:
Number of bits in the specified scan chain.
Raises:
JLinkException: on error. | def scan_chain_len(self, scan_chain):
"""Retrieves and returns the number of bits in the scan chain.
Args:
self (JLink): the ``JLink`` instance
scan_chain (int): scan chain to be measured
Returns:
Number of bits in the specified scan chain.
Raises:
... |
Returns a list of the indices for the CPU registers.
The returned indices can be used to read the register content or grab
the register name.
Args:
self (JLink): the ``JLink`` instance
Returns:
List of registers. | def register_list(self):
"""Returns a list of the indices for the CPU registers.
The returned indices can be used to read the register content or grab
the register name.
Args:
self (JLink): the ``JLink`` instance
Returns:
List of registers.
"""
... |
Retrives and returns the name of an ARM CPU register.
Args:
self (JLink): the ``JLink`` instance
register_index (int): index of the register whose name to retrieve
Returns:
Name of the register. | def register_name(self, register_index):
"""Retrives and returns the name of an ARM CPU register.
Args:
self (JLink): the ``JLink`` instance
register_index (int): index of the register whose name to retrieve
Returns:
Name of the register.
"""
resul... |
Retrieves the CPU speed of the target.
If the target does not support CPU frequency detection, this function
will return ``0``.
Args:
self (JLink): the ``JLink`` instance
silent (bool): ``True`` if the CPU detection should not report errors
to the error handler ... | def cpu_speed(self, silent=False):
"""Retrieves the CPU speed of the target.
If the target does not support CPU frequency detection, this function
will return ``0``.
Args:
self (JLink): the ``JLink`` instance
silent (bool): ``True`` if the CPU detection should not r... |
Retrives the reasons that the CPU was halted.
Args:
self (JLink): the ``JLink`` instance
Returns:
A list of ``JLInkMOEInfo`` instances specifying the reasons for which
the CPU was halted. This list may be empty in the case that the CPU
is not halted.
R... | def cpu_halt_reasons(self):
"""Retrives the reasons that the CPU was halted.
Args:
self (JLink): the ``JLink`` instance
Returns:
A list of ``JLInkMOEInfo`` instances specifying the reasons for which
the CPU was halted. This list may be empty in the case that the ... |
Sends data via JTAG.
Sends data via JTAG on the rising clock edge, TCK. At on each rising
clock edge, on bit is transferred in from TDI and out to TDO. The
clock uses the TMS to step through the standard JTAG state machine.
Args:
self (JLink): the ``JLink`` instance
... | def jtag_send(self, tms, tdi, num_bits):
"""Sends data via JTAG.
Sends data via JTAG on the rising clock edge, TCK. At on each rising
clock edge, on bit is transferred in from TDI and out to TDO. The
clock uses the TMS to step through the standard JTAG state machine.
Args:
... |
Gets a unit of ``8`` bits from the input buffer.
Args:
self (JLink): the ``JLink`` instance
offset (int): the offset (in bits) from which to start reading
Returns:
The integer read from the input buffer. | def swd_read8(self, offset):
"""Gets a unit of ``8`` bits from the input buffer.
Args:
self (JLink): the ``JLink`` instance
offset (int): the offset (in bits) from which to start reading
Returns:
The integer read from the input buffer.
"""
value = ... |
Gets a unit of ``16`` bits from the input buffer.
Args:
self (JLink): the ``JLink`` instance
offset (int): the offset (in bits) from which to start reading
Returns:
The integer read from the input buffer. | def swd_read16(self, offset):
"""Gets a unit of ``16`` bits from the input buffer.
Args:
self (JLink): the ``JLink`` instance
offset (int): the offset (in bits) from which to start reading
Returns:
The integer read from the input buffer.
"""
value ... |
Gets a unit of ``32`` bits from the input buffer.
Args:
self (JLink): the ``JLink`` instance
offset (int): the offset (in bits) from which to start reading
Returns:
The integer read from the input buffer. | def swd_read32(self, offset):
"""Gets a unit of ``32`` bits from the input buffer.
Args:
self (JLink): the ``JLink`` instance
offset (int): the offset (in bits) from which to start reading
Returns:
The integer read from the input buffer.
"""
value ... |
Writes bytes over SWD (Serial Wire Debug).
Args:
self (JLink): the ``JLink`` instance
output (int): the output buffer offset to write to
value (int): the value to write to the output buffer
nbits (int): the number of bits needed to represent the ``output`` and
... | def swd_write(self, output, value, nbits):
"""Writes bytes over SWD (Serial Wire Debug).
Args:
self (JLink): the ``JLink`` instance
output (int): the output buffer offset to write to
value (int): the value to write to the output buffer
nbits (int): the number of ... |
Causes a flush to write all data remaining in output buffers to SWD
device.
Args:
self (JLink): the ``JLink`` instance
pad (bool): ``True`` if should pad the data to full byte size
Returns:
``None`` | def swd_sync(self, pad=False):
"""Causes a flush to write all data remaining in output buffers to SWD
device.
Args:
self (JLink): the ``JLink`` instance
pad (bool): ``True`` if should pad the data to full byte size
Returns:
``None``
"""
if ... |
Writes data to the flash region of a device.
The given number of bits, if provided, must be either ``8``, ``16``, or
``32``.
Args:
self (JLink): the ``JLink`` instance
addr (int): starting flash address to write to
data (list): list of data units to write
... | def flash_write(self, addr, data, nbits=None, flags=0):
"""Writes data to the flash region of a device.
The given number of bits, if provided, must be either ``8``, ``16``, or
``32``.
Args:
self (JLink): the ``JLink`` instance
addr (int): starting flash address to w... |
Reads bytes from code memory.
Note:
This is similar to calling ``memory_read`` or ``memory_read8``,
except that this uses a cache and reads ahead. This should be used
in instances where you want to read a small amount of bytes at a
time, and expect to always read ahead.... | def code_memory_read(self, addr, num_bytes):
"""Reads bytes from code memory.
Note:
This is similar to calling ``memory_read`` or ``memory_read8``,
except that this uses a cache and reads ahead. This should be used
in instances where you want to read a small amount of byt... |
Returns the number of memory zones supported by the target.
Args:
self (JLink): the ``JLink`` instance
Returns:
An integer count of the number of memory zones supported by the
target.
Raises:
JLinkException: on error. | def num_memory_zones(self):
"""Returns the number of memory zones supported by the target.
Args:
self (JLink): the ``JLink`` instance
Returns:
An integer count of the number of memory zones supported by the
target.
Raises:
JLinkException: on err... |
Gets all memory zones supported by the current target.
Some targets support multiple memory zones. This function provides the
ability to get a list of all the memory zones to facilate using the
memory zone routing functions.
Args:
self (JLink): the ``JLink`` instance
... | def memory_zones(self):
"""Gets all memory zones supported by the current target.
Some targets support multiple memory zones. This function provides the
ability to get a list of all the memory zones to facilate using the
memory zone routing functions.
Args:
self (JLi... |
Reads memory from a target system or specific memory zone.
The optional ``zone`` specifies a memory zone to access to read from,
e.g. ``IDATA``, ``DDATA``, or ``CODE``.
The given number of bits, if provided, must be either ``8``, ``16``, or
``32``. If not provided, always reads ``num_... | def memory_read(self, addr, num_units, zone=None, nbits=None):
"""Reads memory from a target system or specific memory zone.
The optional ``zone`` specifies a memory zone to access to read from,
e.g. ``IDATA``, ``DDATA``, or ``CODE``.
The given number of bits, if provided, must be eith... |
Reads memory from the target system in units of bytes.
Args:
self (JLink): the ``JLink`` instance
addr (int): start address to read from
num_bytes (int): number of bytes to read
zone (str): memory zone to read from
Returns:
List of bytes read from the ... | def memory_read8(self, addr, num_bytes, zone=None):
"""Reads memory from the target system in units of bytes.
Args:
self (JLink): the ``JLink`` instance
addr (int): start address to read from
num_bytes (int): number of bytes to read
zone (str): memory zone to rea... |
Reads memory from the target system in units of 16-bits.
Args:
self (JLink): the ``JLink`` instance
addr (int): start address to read from
num_halfwords (int): number of half words to read
zone (str): memory zone to read from
Returns:
List of halfwords... | def memory_read16(self, addr, num_halfwords, zone=None):
"""Reads memory from the target system in units of 16-bits.
Args:
self (JLink): the ``JLink`` instance
addr (int): start address to read from
num_halfwords (int): number of half words to read
zone (str): me... |
Reads memory from the target system in units of 32-bits.
Args:
self (JLink): the ``JLink`` instance
addr (int): start address to read from
num_words (int): number of words to read
zone (str): memory zone to read from
Returns:
List of words read from th... | def memory_read32(self, addr, num_words, zone=None):
"""Reads memory from the target system in units of 32-bits.
Args:
self (JLink): the ``JLink`` instance
addr (int): start address to read from
num_words (int): number of words to read
zone (str): memory zone to ... |
Reads memory from the target system in units of 64-bits.
Args:
self (JLink): the ``JLink`` instance
addr (int): start address to read from
num_long_words (int): number of long words to read
Returns:
List of long words read from the target system.
Raises... | def memory_read64(self, addr, num_long_words):
"""Reads memory from the target system in units of 64-bits.
Args:
self (JLink): the ``JLink`` instance
addr (int): start address to read from
num_long_words (int): number of long words to read
Returns:
List ... |
Writes memory to a target system or specific memory zone.
The optional ``zone`` specifies a memory zone to access to write to,
e.g. ``IDATA``, ``DDATA``, or ``CODE``.
The given number of bits, if provided, must be either ``8``, ``16``, or
``32``.
Args:
self (JLink): ... | def memory_write(self, addr, data, zone=None, nbits=None):
"""Writes memory to a target system or specific memory zone.
The optional ``zone`` specifies a memory zone to access to write to,
e.g. ``IDATA``, ``DDATA``, or ``CODE``.
The given number of bits, if provided, must be either ``8... |
Writes bytes to memory of a target system.
Args:
self (JLink): the ``JLink`` instance
addr (int): start address to write to
data (list): list of bytes to write
zone (str): optional memory zone to access
Returns:
Number of bytes written to target.
... | def memory_write8(self, addr, data, zone=None):
"""Writes bytes to memory of a target system.
Args:
self (JLink): the ``JLink`` instance
addr (int): start address to write to
data (list): list of bytes to write
zone (str): optional memory zone to access
... |
Writes half-words to memory of a target system.
Args:
self (JLink): the ``JLink`` instance
addr (int): start address to write to
data (list): list of half-words to write
zone (str): optional memory zone to access
Returns:
Number of half-words written t... | def memory_write16(self, addr, data, zone=None):
"""Writes half-words to memory of a target system.
Args:
self (JLink): the ``JLink`` instance
addr (int): start address to write to
data (list): list of half-words to write
zone (str): optional memory zone to acces... |
Writes words to memory of a target system.
Args:
self (JLink): the ``JLink`` instance
addr (int): start address to write to
data (list): list of words to write
zone (str): optional memory zone to access
Returns:
Number of words written to target.
... | def memory_write32(self, addr, data, zone=None):
"""Writes words to memory of a target system.
Args:
self (JLink): the ``JLink`` instance
addr (int): start address to write to
data (list): list of words to write
zone (str): optional memory zone to access
... |
Writes long words to memory of a target system.
Note:
This is little-endian.
Args:
self (JLink): the ``JLink`` instance
addr (int): start address to write to
data (list): list of long words to write
zone (str): optional memory zone to access
R... | def memory_write64(self, addr, data, zone=None):
"""Writes long words to memory of a target system.
Note:
This is little-endian.
Args:
self (JLink): the ``JLink`` instance
addr (int): start address to write to
data (list): list of long words to write
... |
Retrieves the values from the registers specified.
Args:
self (JLink): the ``JLink`` instance
register_indices (list): list of registers to read
Returns:
A list of values corresponding one-to-one for each of the given
register indices. The returned list of valu... | def register_read_multiple(self, register_indices):
"""Retrieves the values from the registers specified.
Args:
self (JLink): the ``JLink`` instance
register_indices (list): list of registers to read
Returns:
A list of values corresponding one-to-one for each of t... |
Writes into an ARM register.
Note:
The data is not immediately written, but is cached before being
transferred to the CPU on CPU start.
Args:
self (JLink): the ``JLink`` instance
reg_index (int): the ARM register to write to
value (int): the value to w... | def register_write(self, reg_index, value):
"""Writes into an ARM register.
Note:
The data is not immediately written, but is cached before being
transferred to the CPU on CPU start.
Args:
self (JLink): the ``JLink`` instance
reg_index (int): the ARM reg... |
Writes to multiple CPU registers.
Writes the values to the given registers in order. There must be a
one-to-one correspondence between the values and the registers
specified.
Args:
self (JLink): the ``JLink`` instance
register_indices (list): list of registers to w... | def register_write_multiple(self, register_indices, values):
"""Writes to multiple CPU registers.
Writes the values to the given registers in order. There must be a
one-to-one correspondence between the values and the registers
specified.
Args:
self (JLink): the ``JL... |
Writes a value to an ARM ICE register.
Args:
self (JLink): the ``JLink`` instance
register_index (int): the ICE register to write to
value (int): the value to write to the ICE register
delay (bool): boolean specifying if the write should be delayed
Returns:
... | def ice_register_write(self, register_index, value, delay=False):
"""Writes a value to an ARM ICE register.
Args:
self (JLink): the ``JLink`` instance
register_index (int): the ICE register to write to
value (int): the value to write to the ICE register
delay (bo... |
Returns if the CPU core supports ETM.
Args:
self (JLink): the ``JLink`` instance.
Returns:
``True`` if the CPU has the ETM unit, otherwise ``False``. | def etm_supported(self):
"""Returns if the CPU core supports ETM.
Args:
self (JLink): the ``JLink`` instance.
Returns:
``True`` if the CPU has the ETM unit, otherwise ``False``.
"""
res = self._dll.JLINKARM_ETM_IsPresent()
if (res == 1):
... |
Writes a value to an ETM register.
Args:
self (JLink): the ``JLink`` instance.
register_index (int): the register to write to.
value (int): the value to write to the register.
delay (bool): boolean specifying if the write should be buffered.
Returns:
`... | def etm_register_write(self, register_index, value, delay=False):
"""Writes a value to an ETM register.
Args:
self (JLink): the ``JLink`` instance.
register_index (int): the register to write to.
value (int): the value to write to the register.
delay (bool): bool... |
Reads an Ap/DP register on a CoreSight DAP.
Wait responses and special handling are both handled by this method.
Note:
``coresight_configure()`` must be called prior to calling this method.
Args:
self (JLink): the ``JLink`` instance
reg (int): index of DP/AP regi... | def coresight_read(self, reg, ap=True):
"""Reads an Ap/DP register on a CoreSight DAP.
Wait responses and special handling are both handled by this method.
Note:
``coresight_configure()`` must be called prior to calling this method.
Args:
self (JLink): the ``JLink`... |
Writes an Ap/DP register on a CoreSight DAP.
Note:
``coresight_configure()`` must be called prior to calling this method.
Args:
self (JLink): the ``JLink`` instance
reg (int): index of DP/AP register to write
data (int): data to write
ap (bool): ``True... | def coresight_write(self, reg, data, ap=True):
"""Writes an Ap/DP register on a CoreSight DAP.
Note:
``coresight_configure()`` must be called prior to calling this method.
Args:
self (JLink): the ``JLink`` instance
reg (int): index of DP/AP register to write
... |
Sets vector catch bits of the processor.
The CPU will jump to a vector if the given vector catch is active, and
will enter a debug state. This has the effect of halting the CPU as
well, meaning the CPU must be explicitly restarted.
Args:
self (JLink): the ``JLink`` instance
... | def set_vector_catch(self, flags):
"""Sets vector catch bits of the processor.
The CPU will jump to a vector if the given vector catch is active, and
will enter a debug state. This has the effect of halting the CPU as
well, meaning the CPU must be explicitly restarted.
Args:
... |
Executes a single step.
Steps even if there is a breakpoint.
Args:
self (JLink): the ``JLink`` instance
thumb (bool): boolean indicating if to step in thumb mode
Returns:
``None``
Raises:
JLinkException: on error | def step(self, thumb=False):
"""Executes a single step.
Steps even if there is a breakpoint.
Args:
self (JLink): the ``JLink`` instance
thumb (bool): boolean indicating if to step in thumb mode
Returns:
``None``
Raises:
JLinkException: ... |
Returns the information about a set breakpoint.
Note:
Either ``handle`` or ``index`` can be specified. If the ``index``
is not provided, the ``handle`` must be set, and vice-versa. If
both ``index`` and ``handle`` are provided, the ``index`` overrides
the provided ``ha... | def breakpoint_info(self, handle=0, index=-1):
"""Returns the information about a set breakpoint.
Note:
Either ``handle`` or ``index`` can be specified. If the ``index``
is not provided, the ``handle`` must be set, and vice-versa. If
both ``index`` and ``handle`` are pro... |
Sets a breakpoint at the specified address.
If ``thumb`` is ``True``, the breakpoint is set in THUMB-mode, while if
``arm`` is ``True``, the breakpoint is set in ARM-mode, otherwise a
normal breakpoint is set.
Args:
self (JLink): the ``JLink`` instance
addr (int): t... | def breakpoint_set(self, addr, thumb=False, arm=False):
"""Sets a breakpoint at the specified address.
If ``thumb`` is ``True``, the breakpoint is set in THUMB-mode, while if
``arm`` is ``True``, the breakpoint is set in ARM-mode, otherwise a
normal breakpoint is set.
Args:
... |
Sets a software breakpoint at the specified address.
If ``thumb`` is ``True``, the breakpoint is set in THUMB-mode, while if
``arm`` is ``True``, the breakpoint is set in ARM-mode, otherwise a
normal breakpoint is set.
If ``flash`` is ``True``, the breakpoint is set in flash, otherwise... | def software_breakpoint_set(self, addr, thumb=False, arm=False, flash=False, ram=False):
"""Sets a software breakpoint at the specified address.
If ``thumb`` is ``True``, the breakpoint is set in THUMB-mode, while if
``arm`` is ``True``, the breakpoint is set in ARM-mode, otherwise a
no... |
Returns information about the specified watchpoint.
Note:
Either ``handle`` or ``index`` can be specified. If the ``index``
is not provided, the ``handle`` must be set, and vice-versa. If
both ``index`` and ``handle`` are provided, the ``index`` overrides
the provided ... | def watchpoint_info(self, handle=0, index=-1):
"""Returns information about the specified watchpoint.
Note:
Either ``handle`` or ``index`` can be specified. If the ``index``
is not provided, the ``handle`` must be set, and vice-versa. If
both ``index`` and ``handle`` are... |
Sets a watchpoint at the given address.
This method allows for a watchpoint to be set on an given address or
range of addresses. The watchpoint can then be triggered if the data
at the given address matches the specified ``data`` or range of data as
determined by ``data_mask``, on spec... | def watchpoint_set(self,
addr,
addr_mask=0x0,
data=0x0,
data_mask=0x0,
access_size=None,
read=False,
write=False,
privileged=False):
... |
Disassembles and returns the assembly instruction string.
Args:
self (JLink): the ``JLink`` instance.
instruction (int): the instruction address.
Returns:
A string corresponding to the assembly instruction string at the
given instruction address.
Raises... | def disassemble_instruction(self, instruction):
"""Disassembles and returns the assembly instruction string.
Args:
self (JLink): the ``JLink`` instance.
instruction (int): the instruction address.
Returns:
A string corresponding to the assembly instruction string ... |
Configures the trace port width for tracing.
Note that configuration cannot occur while STRACE is running.
Args:
self (JLink): the ``JLink`` instance
port_width (int): the trace port width to use.
Returns:
``None``
Raises:
ValueError: if ``port... | def strace_configure(self, port_width):
"""Configures the trace port width for tracing.
Note that configuration cannot occur while STRACE is running.
Args:
self (JLink): the ``JLink`` instance
port_width (int): the trace port width to use.
Returns:
``None... |
Reads and returns a number of instructions captured by STRACE.
The number of instructions must be a non-negative value of at most
``0x10000`` (``65536``).
Args:
self (JLink): the ``JLink`` instance.
num_instructions (int): number of instructions to fetch.
Returns:
... | def strace_read(self, num_instructions):
"""Reads and returns a number of instructions captured by STRACE.
The number of instructions must be a non-negative value of at most
``0x10000`` (``65536``).
Args:
self (JLink): the ``JLink`` instance.
num_instructions (int):... |
Sets an event to trigger trace logic when data access is made.
Data access corresponds to either a read or write.
Args:
self (JLink): the ``JLink`` instance.
operation (int): one of the operations in ``JLinkStraceOperation``.
address (int): the address of the load/store d... | def strace_data_access_event(self,
operation,
address,
data,
data_mask=None,
access_width=4,
address_range=0):
"""... |
Sets an event to trigger trace logic when data write access is made.
Args:
self (JLink): the ``JLink`` instance.
operation (int): one of the operations in ``JLinkStraceOperation``.
address (int): the address of the store data.
address_range (int): optional range of addre... | def strace_data_store_event(self, operation, address, address_range=0):
"""Sets an event to trigger trace logic when data write access is made.
Args:
self (JLink): the ``JLink`` instance.
operation (int): one of the operations in ``JLinkStraceOperation``.
address (int): th... |
Clears the trace event specified by the given handle.
Args:
self (JLink): the ``JLink`` instance.
handle (int): handle of the trace event.
Returns:
``None``
Raises:
JLinkException: on error. | def strace_clear(self, handle):
"""Clears the trace event specified by the given handle.
Args:
self (JLink): the ``JLink`` instance.
handle (int): handle of the trace event.
Returns:
``None``
Raises:
JLinkException: on error.
"""
... |
Clears all STRACE events.
Args:
self (JLink): the ``JLink`` instance.
Returns:
``None``
Raises:
JLinkException: on error. | def strace_clear_all(self):
"""Clears all STRACE events.
Args:
self (JLink): the ``JLink`` instance.
Returns:
``None``
Raises:
JLinkException: on error.
"""
data = 0
res = self._dll.JLINK_STRACE_Control(enums.JLinkStraceCommand.TRA... |
Sets the STRACE buffer size.
Args:
self (JLink): the ``JLink`` instance.
Returns:
``None``
Raises:
JLinkException: on error. | def strace_set_buffer_size(self, size):
"""Sets the STRACE buffer size.
Args:
self (JLink): the ``JLink`` instance.
Returns:
``None``
Raises:
JLinkException: on error.
"""
size = ctypes.c_uint32(size)
res = self._dll.JLINK_STRACE_C... |
Starts collecting trace data.
Args:
self (JLink): the ``JLink`` instance.
Returns:
``None`` | def trace_start(self):
"""Starts collecting trace data.
Args:
self (JLink): the ``JLink`` instance.
Returns:
``None``
"""
cmd = enums.JLinkTraceCommand.START
res = self._dll.JLINKARM_TRACE_Control(cmd, 0)
if (res == 1):
raise erro... |
Stops collecting trace data.
Args:
self (JLink): the ``JLink`` instance.
Returns:
``None`` | def trace_stop(self):
"""Stops collecting trace data.
Args:
self (JLink): the ``JLink`` instance.
Returns:
``None``
"""
cmd = enums.JLinkTraceCommand.STOP
res = self._dll.JLINKARM_TRACE_Control(cmd, 0)
if (res == 1):
raise errors.... |
Flushes the trace buffer.
After this method is called, the trace buffer is empty. This method is
best called when the device is reset.
Args:
self (JLink): the ``JLink`` instance.
Returns:
``None`` | def trace_flush(self):
"""Flushes the trace buffer.
After this method is called, the trace buffer is empty. This method is
best called when the device is reset.
Args:
self (JLink): the ``JLink`` instance.
Returns:
``None``
"""
cmd = enums.J... |
Retrieves the trace buffer's current capacity.
Args:
self (JLink): the ``JLink`` instance.
Returns:
The current capacity of the trace buffer. This is not necessarily
the maximum possible size the buffer could be configured with. | def trace_buffer_capacity(self):
"""Retrieves the trace buffer's current capacity.
Args:
self (JLink): the ``JLink`` instance.
Returns:
The current capacity of the trace buffer. This is not necessarily
the maximum possible size the buffer could be configured with... |
Sets the capacity for the trace buffer.
Args:
self (JLink): the ``JLink`` instance.
size (int): the new capacity for the trace buffer.
Returns:
``None`` | def trace_set_buffer_capacity(self, size):
"""Sets the capacity for the trace buffer.
Args:
self (JLink): the ``JLink`` instance.
size (int): the new capacity for the trace buffer.
Returns:
``None``
"""
cmd = enums.JLinkTraceCommand.SET_CAPACITY
... |
Retrieves the minimum capacity the trace buffer can be configured with.
Args:
self (JLink): the ``JLink`` instance.
Returns:
The minimum configurable capacity for the trace buffer. | def trace_min_buffer_capacity(self):
"""Retrieves the minimum capacity the trace buffer can be configured with.
Args:
self (JLink): the ``JLink`` instance.
Returns:
The minimum configurable capacity for the trace buffer.
"""
cmd = enums.JLinkTraceCommand.GET... |
Retrieves the maximum size the trace buffer can be configured with.
Args:
self (JLink): the ``JLink`` instance.
Returns:
The maximum configurable capacity for the trace buffer. | def trace_max_buffer_capacity(self):
"""Retrieves the maximum size the trace buffer can be configured with.
Args:
self (JLink): the ``JLink`` instance.
Returns:
The maximum configurable capacity for the trace buffer.
"""
cmd = enums.JLinkTraceCommand.GET_MAX... |
Sets the format for the trace buffer to use.
Args:
self (JLink): the ``JLink`` instance.
fmt (int): format for the trace buffer; this is one of the attributes
of ``JLinkTraceFormat``.
Returns:
``None`` | def trace_set_format(self, fmt):
"""Sets the format for the trace buffer to use.
Args:
self (JLink): the ``JLink`` instance.
fmt (int): format for the trace buffer; this is one of the attributes
of ``JLinkTraceFormat``.
Returns:
``None``
"""
... |
Retrieves the current format the trace buffer is using.
Args:
self (JLink): the ``JLink`` instance.
Returns:
The current format the trace buffer is using. This is one of the
attributes of ``JLinkTraceFormat``. | def trace_format(self):
"""Retrieves the current format the trace buffer is using.
Args:
self (JLink): the ``JLink`` instance.
Returns:
The current format the trace buffer is using. This is one of the
attributes of ``JLinkTraceFormat``.
"""
cmd = ... |
Retrieves a count of the number of available trace regions.
Args:
self (JLink): the ``JLink`` instance.
Returns:
Count of the number of available trace regions. | def trace_region_count(self):
"""Retrieves a count of the number of available trace regions.
Args:
self (JLink): the ``JLink`` instance.
Returns:
Count of the number of available trace regions.
"""
cmd = enums.JLinkTraceCommand.GET_NUM_REGIONS
data =... |
Retrieves the properties of a trace region.
Args:
self (JLink): the ``JLink`` instance.
region_index (int): the trace region index.
Returns:
An instance of ``JLinkTraceRegion`` describing the specified region. | def trace_region(self, region_index):
"""Retrieves the properties of a trace region.
Args:
self (JLink): the ``JLink`` instance.
region_index (int): the trace region index.
Returns:
An instance of ``JLinkTraceRegion`` describing the specified region.
"""
... |
Reads data from the trace buffer and returns it.
Args:
self (JLink): the ``JLink`` instance.
offset (int): the offset from which to start reading from the trace
buffer.
num_items (int): number of items to read from the trace buffer.
Returns:
A list o... | def trace_read(self, offset, num_items):
"""Reads data from the trace buffer and returns it.
Args:
self (JLink): the ``JLink`` instance.
offset (int): the offset from which to start reading from the trace
buffer.
num_items (int): number of items to read from th... |
Starts collecting SWO data.
Note:
If SWO is already enabled, it will first stop SWO before enabling it
again.
Args:
self (JLink): the ``JLink`` instance
swo_speed (int): the frequency in Hz used by the target to communicate
Returns:
``None``
... | def swo_start(self, swo_speed=9600):
"""Starts collecting SWO data.
Note:
If SWO is already enabled, it will first stop SWO before enabling it
again.
Args:
self (JLink): the ``JLink`` instance
swo_speed (int): the frequency in Hz used by the target to co... |
Stops collecting SWO data.
Args:
self (JLink): the ``JLink`` instance
Returns:
``None``
Raises:
JLinkException: on error | def swo_stop(self):
"""Stops collecting SWO data.
Args:
self (JLink): the ``JLink`` instance
Returns:
``None``
Raises:
JLinkException: on error
"""
res = self._dll.JLINKARM_SWO_Control(enums.JLinkSWOCommands.STOP, 0)
if res < 0:
... |
Enables SWO output on the target device.
Configures the output protocol, the SWO output speed, and enables any
ITM & stimulus ports.
This is equivalent to calling ``.swo_start()``.
Note:
If SWO is already enabled, it will first stop SWO before enabling it
again.
... | def swo_enable(self, cpu_speed, swo_speed=9600, port_mask=0x01):
"""Enables SWO output on the target device.
Configures the output protocol, the SWO output speed, and enables any
ITM & stimulus ports.
This is equivalent to calling ``.swo_start()``.
Note:
If SWO is al... |
Disables ITM & Stimulus ports.
Args:
self (JLink): the ``JLink`` instance
port_mask (int): mask specifying which ports to disable
Returns:
``None``
Raises:
JLinkException: on error | def swo_disable(self, port_mask):
"""Disables ITM & Stimulus ports.
Args:
self (JLink): the ``JLink`` instance
port_mask (int): mask specifying which ports to disable
Returns:
``None``
Raises:
JLinkException: on error
"""
res = s... |
Flushes data from the SWO buffer.
After this method is called, the flushed part of the SWO buffer is
empty.
If ``num_bytes`` is not present, flushes all data currently in the SWO
buffer.
Args:
self (JLink): the ``JLink`` instance
num_bytes (int): the number... | def swo_flush(self, num_bytes=None):
"""Flushes data from the SWO buffer.
After this method is called, the flushed part of the SWO buffer is
empty.
If ``num_bytes`` is not present, flushes all data currently in the SWO
buffer.
Args:
self (JLink): the ``JLink`... |
Retrieves information about the supported SWO speeds.
Args:
self (JLink): the ``JLink`` instance
Returns:
A ``JLinkSWOSpeedInfo`` instance describing the target's supported
SWO speeds.
Raises:
JLinkException: on error | def swo_speed_info(self):
"""Retrieves information about the supported SWO speeds.
Args:
self (JLink): the ``JLink`` instance
Returns:
A ``JLinkSWOSpeedInfo`` instance describing the target's supported
SWO speeds.
Raises:
JLinkException: on erro... |
Retrives the number of bytes in the SWO buffer.
Args:
self (JLink): the ``JLink`` instance
Returns:
Number of bytes in the SWO buffer.
Raises:
JLinkException: on error | def swo_num_bytes(self):
"""Retrives the number of bytes in the SWO buffer.
Args:
self (JLink): the ``JLink`` instance
Returns:
Number of bytes in the SWO buffer.
Raises:
JLinkException: on error
"""
res = self._dll.JLINKARM_SWO_Control(en... |
Sets the size of the buffer used by the host to collect SWO data.
Args:
self (JLink): the ``JLink`` instance
buf_size (int): the new size of the host buffer
Returns:
``None``
Raises:
JLinkException: on error | def swo_set_host_buffer_size(self, buf_size):
"""Sets the size of the buffer used by the host to collect SWO data.
Args:
self (JLink): the ``JLink`` instance
buf_size (int): the new size of the host buffer
Returns:
``None``
Raises:
JLinkExceptio... |
Sets the size of the buffer used by the J-Link to collect SWO data.
Args:
self (JLink): the ``JLink`` instance
buf_size (int): the new size of the emulator buffer
Returns:
``None``
Raises:
JLinkException: on error | def swo_set_emu_buffer_size(self, buf_size):
"""Sets the size of the buffer used by the J-Link to collect SWO data.
Args:
self (JLink): the ``JLink`` instance
buf_size (int): the new size of the emulator buffer
Returns:
``None``
Raises:
JLinkExc... |
Retrives a list of SWO speeds supported by both the target and the
connected J-Link.
The supported speeds are returned in order from highest to lowest.
Args:
self (JLink): the ``JLink`` instance
cpu_speed (int): the target's CPU speed in Hz
num_speeds (int): the n... | def swo_supported_speeds(self, cpu_speed, num_speeds=3):
"""Retrives a list of SWO speeds supported by both the target and the
connected J-Link.
The supported speeds are returned in order from highest to lowest.
Args:
self (JLink): the ``JLink`` instance
cpu_speed (... |
Reads data from the SWO buffer.
The data read is not automatically removed from the SWO buffer after
reading unless ``remove`` is ``True``. Otherwise the callee must
explicitly remove the data by calling ``.swo_flush()``.
Args:
self (JLink): the ``JLink`` instance
... | def swo_read(self, offset, num_bytes, remove=False):
"""Reads data from the SWO buffer.
The data read is not automatically removed from the SWO buffer after
reading unless ``remove`` is ``True``. Otherwise the callee must
explicitly remove the data by calling ``.swo_flush()``.
... |
Reads the printable data via SWO.
This method reads SWO for one stimulus port, which is all printable
data.
Note:
Stimulus port ``0`` is used for ``printf`` debugging.
Args:
self (JLink): the ``JLink`` instance
port (int): the stimulus port to read from, ... | def swo_read_stimulus(self, port, num_bytes):
"""Reads the printable data via SWO.
This method reads SWO for one stimulus port, which is all printable
data.
Note:
Stimulus port ``0`` is used for ``printf`` debugging.
Args:
self (JLink): the ``JLink`` instan... |
After starting RTT, get the current number of up buffers.
Args:
self (JLink): the ``JLink`` instance
Returns:
The number of configured up buffers on the target.
Raises:
JLinkRTTException if the underlying JLINK_RTTERMINAL_Control call fails. | def rtt_get_num_up_buffers(self):
"""After starting RTT, get the current number of up buffers.
Args:
self (JLink): the ``JLink`` instance
Returns:
The number of configured up buffers on the target.
Raises:
JLinkRTTException if the underlying JLINK_RTTERMIN... |
After starting RTT, get the current number of down buffers.
Args:
self (JLink): the ``JLink`` instance
Returns:
The number of configured down buffers on the target.
Raises:
JLinkRTTException if the underlying JLINK_RTTERMINAL_Control call fails. | def rtt_get_num_down_buffers(self):
"""After starting RTT, get the current number of down buffers.
Args:
self (JLink): the ``JLink`` instance
Returns:
The number of configured down buffers on the target.
Raises:
JLinkRTTException if the underlying JLINK_RT... |
Reads data from the RTT buffer.
This method will read at most num_bytes bytes from the specified
RTT buffer. The data is automatically removed from the RTT buffer.
If there are not num_bytes bytes waiting in the RTT buffer, the
entire contents of the RTT buffer will be read.
Ar... | def rtt_read(self, buffer_index, num_bytes):
"""Reads data from the RTT buffer.
This method will read at most num_bytes bytes from the specified
RTT buffer. The data is automatically removed from the RTT buffer.
If there are not num_bytes bytes waiting in the RTT buffer, the
ent... |
Writes data to the RTT buffer.
This method will write at most len(data) bytes to the specified RTT
buffer.
Args:
self (JLink): the ``JLink`` instance
buffer_index (int): the index of the RTT buffer to write to
data (list): the list of bytes to write to the RTT buf... | def rtt_write(self, buffer_index, data):
"""Writes data to the RTT buffer.
This method will write at most len(data) bytes to the specified RTT
buffer.
Args:
self (JLink): the ``JLink`` instance
buffer_index (int): the index of the RTT buffer to write to
da... |
Issues an RTT Control command.
All RTT control is done through a single API call which expects
specifically laid-out configuration structures.
Args:
self (JLink): the ``JLink`` instance
command (int): the command to issue (see enums.JLinkRTTCommand)
config (ctypes... | def rtt_control(self, command, config):
"""Issues an RTT Control command.
All RTT control is done through a single API call which expects
specifically laid-out configuration structures.
Args:
self (JLink): the ``JLink`` instance
command (int): the command to issue (... |
Reads the JLink RTT buffer #0 at 10Hz and prints to stdout.
This method is a polling loop against the connected JLink unit. If
the JLink is disconnected, it will exit. Additionally, if any exceptions
are raised, they will be caught and re-raised after interrupting the
main thread.
sys.stdout.write... | def read_rtt(jlink):
"""Reads the JLink RTT buffer #0 at 10Hz and prints to stdout.
This method is a polling loop against the connected JLink unit. If
the JLink is disconnected, it will exit. Additionally, if any exceptions
are raised, they will be caught and re-raised after interrupting the
main t... |
Writes kayboard input to JLink RTT buffer #0.
This method is a loop that blocks waiting on stdin. When enter is pressed,
LF and NUL bytes are added to the input and transmitted as a byte list.
If the JLink is disconnected, it will exit gracefully. If any other
exceptions are raised, they will be caught... | def write_rtt(jlink):
"""Writes kayboard input to JLink RTT buffer #0.
This method is a loop that blocks waiting on stdin. When enter is pressed,
LF and NUL bytes are added to the input and transmitted as a byte list.
If the JLink is disconnected, it will exit gracefully. If any other
exceptions ar... |
Creates an interactive terminal to the target via RTT.
The main loop opens a connection to the JLink, and then connects
to the target device. RTT is started, the number of buffers is presented,
and then two worker threads are spawned: one for read, and one for write.
The main loops sleeps until the JL... | def main(target_device):
"""Creates an interactive terminal to the target via RTT.
The main loop opens a connection to the JLink, and then connects
to the target device. RTT is started, the number of buffers is presented,
and then two worker threads are spawned: one for read, and one for write.
Th... |
Runs the thread.
Args:
self (ThreadReturn): the ``ThreadReturn`` instance
Returns:
``None`` | def run(self):
"""Runs the thread.
Args:
self (ThreadReturn): the ``ThreadReturn`` instance
Returns:
``None``
"""
target = getattr(self, '_Thread__target', getattr(self, '_target', None))
args = getattr(self, '_Thread__args', getattr(self, '_args', N... |
Joins the thread.
Args:
self (ThreadReturn): the ``ThreadReturn`` instance
args: optional list of arguments
kwargs: optional key-word arguments
Returns:
The return value of the exited thread. | def join(self, *args, **kwargs):
"""Joins the thread.
Args:
self (ThreadReturn): the ``ThreadReturn`` instance
args: optional list of arguments
kwargs: optional key-word arguments
Returns:
The return value of the exited thread.
"""
super(... |
Upgrades the firmware of the J-Links connected to a Windows device.
Returns:
None.
Raises:
OSError: if there are no J-Link software packages. | def main():
"""Upgrades the firmware of the J-Links connected to a Windows device.
Returns:
None.
Raises:
OSError: if there are no J-Link software packages.
"""
windows_libraries = list(pylink.Library.find_library_windows())
latest_library = None
for lib in windows_libraries:
... |
Main function.
Args:
jlink_serial (str): the J-Link serial number
device (str): the target CPU
Returns:
``None``
Raises:
JLinkException: on error | def main(jlink_serial, device):
"""Main function.
Args:
jlink_serial (str): the J-Link serial number
device (str): the target CPU
Returns:
``None``
Raises:
JLinkException: on error
"""
buf = StringIO.StringIO()
jlink = pylink.JLink(log=buf.write, detailed_log=buf.w... |
Asynchronous function decorator. Interprets the function as being
asynchronous, so returns a function that will handle calling the
Function asynchronously.
Args:
func (function): function to be called asynchronously
Returns:
The wrapped function.
Raises:
AttributeError: if ``fu... | def async_decorator(func):
"""Asynchronous function decorator. Interprets the function as being
asynchronous, so returns a function that will handle calling the
Function asynchronously.
Args:
func (function): function to be called asynchronously
Returns:
The wrapped function.
Rai... |
Implements simple trace using the STrace API.
Args:
device (str): the device to connect to
trace_address (int): address to begin tracing from
breakpoint_address (int): address to breakpoint at
Returns:
``None`` | def strace(device, trace_address, breakpoint_address):
"""Implements simple trace using the STrace API.
Args:
device (str): the device to connect to
trace_address (int): address to begin tracing from
breakpoint_address (int): address to breakpoint at
Returns:
``None``
"""
j... |
Builds the command parser.
This needs to be exported in order for Sphinx to document it correctly.
Returns:
An instance of an ``argparse.ArgumentParser`` that parses all the
commands supported by the PyLink CLI. | def create_parser():
"""Builds the command parser.
This needs to be exported in order for Sphinx to document it correctly.
Returns:
An instance of an ``argparse.ArgumentParser`` that parses all the
commands supported by the PyLink CLI.
"""
parser = argparse.ArgumentParser(prog=pylink._... |
Main command-line interface entrypoint.
Runs the given subcommand or argument that were specified. If not given a
``args`` parameter, assumes the arguments are passed on the command-line.
Args:
args (list): list of command-line arguments
Returns:
Zero on success, non-zero otherwise. | def main(args=None):
"""Main command-line interface entrypoint.
Runs the given subcommand or argument that were specified. If not given a
``args`` parameter, assumes the arguments are passed on the command-line.
Args:
args (list): list of command-line arguments
Returns:
Zero on succe... |
Creates an instance of a J-Link from the given arguments.
Args:
self (Command): the ``Command`` instance
args (Namespace): arguments to construct the ``JLink`` instance from
Returns:
An instance of a ``JLink``. | def create_jlink(self, args):
"""Creates an instance of a J-Link from the given arguments.
Args:
self (Command): the ``Command`` instance
args (Namespace): arguments to construct the ``JLink`` instance from
Returns:
An instance of a ``JLink``.
"""
... |
Adds common arguments to the given parser.
Common arguments for a J-Link command are the target interface, and
J-Link serial number or IP address.
Args:
self (Command): the ``Command`` instance
parser (argparse.ArgumentParser): the parser to add the arguments to
h... | def add_common_arguments(self, parser, has_device=False):
"""Adds common arguments to the given parser.
Common arguments for a J-Link command are the target interface, and
J-Link serial number or IP address.
Args:
self (Command): the ``Command`` instance
parser (arg... |
Erases the device connected to the J-Link.
Args:
self (EraseCommand): the ``EraseCommand`` instance
args (Namespace): the arguments passed on the command-line
Returns:
``None`` | def run(self, args):
"""Erases the device connected to the J-Link.
Args:
self (EraseCommand): the ``EraseCommand`` instance
args (Namespace): the arguments passed on the command-line
Returns:
``None``
"""
jlink = self.create_jlink(args)
era... |
Flashes the device connected to the J-Link.
Args:
self (FlashCommand): the ``FlashCommand`` instance
args (Namespace): the arguments passed on the command-line
Returns:
``None`` | def run(self, args):
"""Flashes the device connected to the J-Link.
Args:
self (FlashCommand): the ``FlashCommand`` instance
args (Namespace): the arguments passed on the command-line
Returns:
``None``
"""
kwargs = {}
kwargs['path'] = args.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.