Document API IEC60730 Library
Public Member Functions | Static Public Attributes | List of all members
jlink.JLinkDll Class Reference

Public Member Functions

def __init__ (self, lib_path)
 
def abort (self, errMsg)
 
def execute_command (self, command_string)
 
def get_usb_adapter_list (self)
 
def get_tcp_ip_adapter_list (self)
 
def get_adapter_list (self)
 
def connect (self, serial_number, chip_name)
 
def close (self)
 
def get_speed (self)
 
def set_max_speed (self)
 
def set_speed (self, speed=4000)
 
def get_speed_info (self)
 
def get_id (self)
 
def get_id_data (self)
 
def halted (self)
 
def run_to_breakpoint (self, timeout)
 
def go_ex (self)
 
def step (self)
 
def halt (self)
 
def reset (self, halt=True)
 
def get_device_family (self)
 
def set_device (self, device)
 
def read_mem (self, address, num_bytes)
 
def read_ram_arm_8 (self, address, num_bytes)
 
def read_ram_arm_16 (self, address, num_words)
 
def read_ram_arm_32 (self, address, num_words)
 
def read_ram_arm_64 (self, address, num_words)
 
def clear_breakpoint (self, bp_to_clear)
 
def clear_all_breakpoints (self)
 
def register_name (self, register_index)
 
def register_list (self)
 
def register_read (self, register_index)
 
def register_write (self, reg_index, value)
 
def num_active_breakpoints (self)
 
def set_breakpoint (self, address, typeflags)
 
def memory_read (self, addr, num_units, zone=None, nbits=None)
 
def memory_read8 (self, addr, num_bytes, zone=None)
 
def memory_read16 (self, addr, num_halfwords, zone=None)
 
def memory_read32 (self, addr, num_words, zone=None)
 
def memory_read64 (self, addr, num_long_words)
 
def memory_write (self, addr, data, zone=None, nbits=None)
 
def memory_write8 (self, addr, data, zone=None)
 
def memory_write16 (self, addr, data, zone=None)
 
def memory_write32 (self, addr, data, zone=None)
 
def memory_write64 (self, addr, data, zone=None)
 
def erase_chip (self)
 
def download (self, image, offset=0)
 
def ErrorOutHandler (cls, errorMsg)
 
def WarnOutHandler (cls, warnMsg)
 

Static Public Attributes

int MAX_BUF_SIZE = 336
 
int MAX_NUM_ADAPTERS = 32
 
int MAX_NUM_CPU_REGISTERS = 256
 

Detailed Description

Object for accessing and controlling a JLink adapter

Member Function Documentation

◆ clear_breakpoint()

def jlink.JLinkDll.clear_breakpoint (   self,
  bp_to_clear 
)
Clears breakpoint on the connected device.

Keyword arguments:
bp_to_clear - Handle of the breakpoint to clear.
    Pass JLINKARM_BP_HANDLE_ALL to clear all breakpoints.

◆ close()

def jlink.JLinkDll.close (   self)
Closes the connection to the JLink adapter.

◆ erase_chip()

def jlink.JLinkDll.erase_chip (   self)
Erases all user flash on the connected device.

◆ ErrorOutHandler()

def jlink.JLinkDll.ErrorOutHandler (   cls,
  errorMsg 
)
Log error from the DLL.

:param errorMsg: The DLL error message.

◆ execute_command()

def jlink.JLinkDll.execute_command (   self,
  command_string 
)
Execute a JLink command string.

Keyword arguments:
command_string -- the string to execute with JLINKARM_ExecCommand()

Returns the return value of the executed command.

◆ get_adapter_list()

def jlink.JLinkDll.get_adapter_list (   self)
Returns a list of all adapters connected to the host via TCP/IP or USB.

◆ get_id()

def jlink.JLinkDll.get_id (   self)
Retrieves ID of the core.

◆ get_id_data()

def jlink.JLinkDll.get_id_data (   self)
Retrieves detailed info of the device on the JTAG bus.

◆ get_speed()

def jlink.JLinkDll.get_speed (   self)
Returns the current JTAG connection speed.

◆ get_speed_info()

def jlink.JLinkDll.get_speed_info (   self)
Gets the target interface speed information.

Returns a dictionary containing the speed information.

◆ get_tcp_ip_adapter_list()

def jlink.JLinkDll.get_tcp_ip_adapter_list (   self)
Returns a list of all adapters connected to the host via TCP/IP.

◆ get_usb_adapter_list()

def jlink.JLinkDll.get_usb_adapter_list (   self)
Returns a list of all adapters connected to the host via USB.

◆ go_ex()

def jlink.JLinkDll.go_ex (   self)
Runs the currently connected device, skipping over any breakpoint at the current instruction.

◆ halted()

def jlink.JLinkDll.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.

◆ memory_read()

def jlink.JLinkDll.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 either ``8``, ``16``, or
``32``.  If not provided, always reads ``num_units`` bytes.

Args:
  self (JLink): the ``JLink`` instance
  addr (int): start address to read from
  num_units (int): number of units to read
  zone (str): optional memory zone name to access
  nbits (int): number of bits to use for each unit

Returns:
  List of units read from the target system.

Raises:
  JLinkException: if memory could not be read.
  ValueError: if ``nbits`` is not ``None``, and not in ``8``, ``16``,
    or ``32``.

◆ memory_read16()

def jlink.JLinkDll.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): memory zone to read from

Returns:
  List of halfwords read from the target system.

Raises:
  JLinkException: if memory could not be read

◆ memory_read32()

def jlink.JLinkDll.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 read from

Returns:
  List of words read from the target system.

Raises:
  JLinkException: if memory could not be read

◆ memory_read64()

def jlink.JLinkDll.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 of long words read from the target system.

Raises:
  JLinkException: if memory could not be read

◆ memory_read8()

def jlink.JLinkDll.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 read from

Returns:
  List of bytes read from the target system.

Raises:
  JLinkException: if memory could not be read.

◆ memory_write()

def jlink.JLinkDll.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``, ``16``, or
``32``.

Args:
  self (JLink): the ``JLink`` instance
  addr (int): start address to write to
  data (list): list of data units to write
  zone (str): optional memory zone name to access
  nbits (int): number of bits to use for each unit

Returns:
  Number of units written.

Raises:
  JLinkException: on write hardware failure.
  ValueError: if ``nbits`` is not ``None``, and not in ``8``, ``16`` or
    ``32``.

◆ memory_write16()

def jlink.JLinkDll.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 access

Returns:
  Number of half-words written to target.

Raises:
  JLinkException: on memory access error.

◆ memory_write32()

def jlink.JLinkDll.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

Returns:
  Number of words written to target.

Raises:
  JLinkException: on memory access error.

◆ memory_write64()

def jlink.JLinkDll.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
  zone (str): optional memory zone to access

Returns:
  Number of long words written to target.

Raises:
  JLinkException: on memory access error.

◆ memory_write8()

def jlink.JLinkDll.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

Returns:
  Number of bytes written to target.

Raises:
  JLinkException: on memory access error.

◆ num_active_breakpoints()

def jlink.JLinkDll.num_active_breakpoints (   self)
Returns the number of currently active breakpoints.

Args:
  self (JLink): the ``JLink`` instance

Returns:
  The number of breakpoints that are currently set.

◆ read_ram_arm_64()

def jlink.JLinkDll.read_ram_arm_64 (   self,
  address,
  num_words 
)
Reads a block of RAM in 64-bit words.

Keyword arguments:
address -- starting address to read
num_words -- number of 64-bit words to read

◆ register_list()

def jlink.JLinkDll.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.

◆ register_name()

def jlink.JLinkDll.register_name (   self,
  register_index 
)
Retrieves 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.

◆ register_read()

def jlink.JLinkDll.register_read (   self,
  register_index 
)
Reads the value from the given register.

Args:
  self (JLink): the ``JLink`` instance
  register_index (int/str): the register to read

Returns:
  The value stored in the given register.

◆ register_write()

def jlink.JLinkDll.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/str): the ARM register to write to
  value (int): the value to write to the register

Returns:
  The value written to the ARM register.

Raises:
  JLinkException: on write error.

◆ reset()

def jlink.JLinkDll.reset (   self,
  halt = True 
)
Resets the currently connected device.

Keyword arguments:
halt -- if true, the part will be halted before reset
if false, the part will not be halted before reset

◆ set_breakpoint()

def jlink.JLinkDll.set_breakpoint (   self,
  address,
  typeflags 
)
Set a breakpoint within the CPU.

address - Address for the breakpoint.
typeflags - Flags for the breakpoint.  Ignored for EFM8 devices.

◆ set_max_speed()

def jlink.JLinkDll.set_max_speed (   self)
Sets the JTAG connection speed to its maximum value.

◆ set_speed()

def jlink.JLinkDll.set_speed (   self,
  speed = 4000 
)
Sets the JTAG connection speed.

Keyword arguments:
speed -- speed of JTAG connection in kHz.

◆ WarnOutHandler()

def jlink.JLinkDll.WarnOutHandler (   cls,
  warnMsg 
)
Log warning from the DLL.

:param warnMsg: The DLL error message.

The documentation for this class was generated from the following file: