Bindings

The native J-Link SDK is a C library. PyLink makes use of ctypes to interface with the library, and as such implements native Python structure bindings, and constants for values returned by the C SDK.

Structures

class pylink.structs.JLinkBreakpointInfo

Bases: _ctypes.Structure

Class representing information about a breakpoint.

SizeOfStruct

the size of the structure (this should not be modified).

Handle

breakpoint handle.

Addr

address of where the breakpoint has been set.

Type

type flags which were specified when the breakpoint was created.

ImpFlags

describes the current state of the breakpoint.

UseCnt

describes how often the breakpoint is set at the same address.

Addr

Structure/Union member

Handle

Structure/Union member

ImpFlags

Structure/Union member

SizeOfStruct

Structure/Union member

Type

Structure/Union member

UseCnt

Structure/Union member

hardware_breakpoint()

Returns whether this is a hardware breakpoint.

Parameters:self (JLinkBreakpointInfo) – the JLinkBreakpointInfo instance
Returns:True if the breakpoint is a hardware breakpoint, otherwise False.
pending()

Returns if this breakpoint is pending.

Parameters:self (JLinkBreakpointInfo) – the JLinkBreakpointInfo instance
Returns:True if the breakpoint is still pending, otherwise False.
software_breakpoint()

Returns whether this is a software breakpoint.

Parameters:self (JLinkBreakpointInfo) – the JLinkBreakpointInfo instance
Returns:True if the breakpoint is a software breakpoint, otherwise False.
class pylink.structs.JLinkConnectInfo

Bases: _ctypes.Structure

J-Link connection info structure.

SerialNumber

J-Link serial number.

Connection

type of connection (e.g. enums.JLinkHost.USB)

USBAddr

USB address if connected via USB.

aIPAddr

IP address if connected via IP.

Time

Time period (ms) after which UDP discover answer was received.

Time_us

Time period (uS) after which UDP discover answer was received.

HWVersion

Hardware version of J-Link, if connected via IP.

abMACAddr

MAC Address, if connected via IP.

acProduct

Product name, if connected via IP.

acNickname

Nickname, if connected via IP.

acFWString

Firmware string, if connected via IP.

IsDHCPAssignedIP

Is IP address reception via DHCP.

IsDHCPAssignedIPIsValid

True if connected via IP.

NumIPConnections

Number of IP connections currently established.

NumIPConnectionsIsValid

True if connected via IP.

aPadding

Bytes reserved for future use.

Connection

Structure/Union member

HWVersion

Structure/Union member

IsDHCPAssignedIP

Structure/Union member

IsDHCPAssignedIPIsValid

Structure/Union member

NumIPConnections

Structure/Union member

NumIPConnectionsIsValid

Structure/Union member

SerialNumber

Structure/Union member

Time

Structure/Union member

Time_us

Structure/Union member

USBAddr

Structure/Union member

aIPAddr

Structure/Union member

aPadding

Structure/Union member

abMACAddr

Structure/Union member

acFWString

Structure/Union member

acNickname

Structure/Union member

acProduct

Structure/Union member

class pylink.structs.JLinkDataEvent

Bases: _ctypes.Structure

Class representing a data event.

A data may halt the CPU, trigger SWO output, or trigger trace output.

SizeOfStruct

the size of the structure (this should not be modified).

Type

the type of the data event (this should not be modified).

Addr

the address on which the watchpoint was set

AddrMask

the address mask used for comparision.

Data

the data on which the watchpoint has been set.

DataMask

the data mask used for comparision.

Access

the control data on which the event has been set.

AccessMask

the control mask used for comparison.

Access

Structure/Union member

AccessMask

Structure/Union member

Addr

Structure/Union member

AddrMask

Structure/Union member

Data

Structure/Union member

DataMask

Structure/Union member

SizeOfStruct

Structure/Union member

Type

Structure/Union member

class pylink.structs.JLinkDeviceInfo(*args, **kwargs)

Bases: _ctypes.Structure

J-Link device information.

This structure is used to represent a device that is supported by the J-Link.

SizeOfStruct

Size of the struct (DO NOT CHANGE).

sName

name of the device.

CoreId

core identifier of the device.

FlashAddr

base address of the internal flash of the device.

RAMAddr

base address of the internal RAM of the device.

EndianMode

the endian mode of the device (0 -> only little endian, 1 -> only big endian, 2 -> both).

FlashSize

total flash size in bytes.

RAMSize

total RAM size in bytes.

sManu

device manufacturer.

aFlashArea

a list of JLinkFlashArea instances.

aRamArea

a list of JLinkRAMArea instances.

Core

CPU core.

Core

Structure/Union member

CoreId

Structure/Union member

EndianMode

Structure/Union member

FlashAddr

Structure/Union member

FlashSize

Structure/Union member

RAMAddr

Structure/Union member

RAMSize

Structure/Union member

SizeofStruct

Structure/Union member

aFlashArea

Structure/Union member

aRAMArea

Structure/Union member

manufacturer

Returns the name of the manufacturer of the device.

Parameters:self (JLinkDeviceInfo) – the JLinkDeviceInfo instance
Returns:Manufacturer name.
name

Returns the name of the device.

Parameters:self (JLinkDeviceInfo) – the JLinkDeviceInfo instance
Returns:Device name.
sManu

Structure/Union member

sName

Structure/Union member

class pylink.structs.JLinkFlashArea

Bases: _ctypes.Structure

Definition for a region of Flash.

Addr

address where the flash area starts.

Size

size of the flash area.

Addr

Structure/Union member

Size

Structure/Union member

class pylink.structs.JLinkGPIODescriptor

Bases: _ctypes.Structure

Definition for the structure that details the name and capabilities of a user-controllable GPIO.

acName

name of the GPIO.

Caps

bitfield of capabilities.

Caps

Structure/Union member

acName

Structure/Union member

class pylink.structs.JLinkHardwareStatus

Bases: _ctypes.Structure

Definition for the hardware status information for a J-Link.

VTarget

target supply voltage.

tck

measured state of TCK pin.

tdi

measured state of TDI pin.

tdo

measured state of TDO pin.

tms

measured state of TMS pin.

tres

measured state of TRES pin.

trst

measured state of TRST pin.

VTarget

Structure/Union member

tck

Structure/Union member

tdi

Structure/Union member

tdo

Structure/Union member

tms

Structure/Union member

tres

Structure/Union member

trst

Structure/Union member

voltage

Returns the target supply voltage.

This is an alias for .VTarget.

Parameters:self (JLInkHardwareStatus) – the JLinkHardwareStatus instance
Returns:Target supply voltage as an integer.
class pylink.structs.JLinkMOEInfo

Bases: _ctypes.Structure

Structure representing the Method of Debug Entry (MOE).

The method of debug entry is a reason for which a CPU has stopped. At any given time, there may be multiple methods of debug entry.

HaltReason

reason why the CPU stopped.

Index

if cause of CPU stop was a code/data breakpoint, this identifies the index of the code/data breakpoint unit which causes the CPU to stop, otherwise it is -1.

HaltReason

Structure/Union member

Index

Structure/Union member

code_breakpoint()

Returns whether this a code breakpoint.

Parameters:self (JLinkMOEInfo) – the JLinkMOEInfo instance
Returns:True if this is a code breakpoint, otherwise False.
data_breakpoint()

Returns whether this a data breakpoint.

Parameters:self (JLinkMOEInfo) – the JLinkMOEInfo instance
Returns:True if this is a data breakpoint, otherwise False.
dbgrq()

Returns whether this a DBGRQ.

Parameters:self (JLinkMOEInfo) – the JLinkMOEInfo instance
Returns:True if this is a DBGRQ, otherwise False.
vector_catch()

Returns whether this a vector catch.

Parameters:self (JLinkMOEInfo) – the JLinkMOEInfo instance
Returns:True if this is a vector catch, otherwise False.
class pylink.structs.JLinkMemoryZone

Bases: _ctypes.Structure

Represents a CPU memory zone.

sName

initials of the memory zone.

sDesc

name of the memory zone.

VirtAddr

start address of the virtual address space of the memory zone.

abDummy

reserved for future use.

VirtAddr

Structure/Union member

abDummy

Structure/Union member

name

Alias for the memory zone name.

Parameters:self (JLinkMemoryZone) – the JLinkMemoryZone instance
Returns:The memory zone name.
sDesc

Structure/Union member

sName

Structure/Union member

class pylink.structs.JLinkRAMArea

Bases: pylink.structs.JLinkFlashArea

Definition for a region of RAM.

Addr

address where the flash area starts.

Size

size of the flash area.

class pylink.structs.JLinkRTTerminalBufDesc

Bases: _ctypes.Structure

Structure describing a RTT buffer.

BufferIndex

index of the buffer to request information about.

Direction

direction of the upper (0 for up, 1 for Down).

acName

Name of the buffer.

SizeOfBuffer

size of the buffer in bytes.

Flags

flags set on the buffer.

BufferIndex

Structure/Union member

Direction

Structure/Union member

Flags

Structure/Union member

SizeOfBuffer

Structure/Union member

acName

Structure/Union member

down

Returns a boolean indicating if the buffer is an ‘DOWN’ buffer.

Parameters:self (JLinkRTTerminalBufDesc) – the terminal buffer descriptor.
Returns:True if the buffer is an ‘DOWN’ buffer, otherwise False.
name

Returns the name of the buffer.

Parameters:self (JLinkRTTerminalBufDesc) – the terminal buffer descriptor.
Returns:String name of the buffer.
up

Returns a boolean indicating if the buffer is an ‘UP’ buffer.

Parameters:self (JLinkRTTerminalBufDesc) – the terminal buffer descriptor.
Returns:True if the buffer is an ‘UP’ buffer, otherwise False.
class pylink.structs.JLinkRTTerminalStart

Bases: _ctypes.Structure

Structure used to configure an RTT instance.

ConfigBlockAddress

Address of the RTT block.

ConfigBlockAddress

Structure/Union member

Reserved

Structure/Union member

class pylink.structs.JLinkRTTerminalStatus

Bases: _ctypes.Structure

Structure describing the status of the RTT terminal.

NumBytesTransferred

number of bytes sent to the client application.

NumBytesRead

number of bytes read from the target.

HostOverflowCount

number of overflows on the host.

IsRunning

if RTT is running.

NumUpBuffers

number of ‘UP’ buffers.

NumDownBuffers

number of ‘DOWN’ buffers.

HostOverflowCount

Structure/Union member

IsRunning

Structure/Union member

NumBytesRead

Structure/Union member

NumBytesTransferred

Structure/Union member

NumDownBuffers

Structure/Union member

NumUpBuffers

Structure/Union member

Reserved

Structure/Union member

class pylink.structs.JLinkSWOSpeedInfo

Bases: _ctypes.Structure

Structure representing information about target’s supported SWO speeds.

To calculate the supported SWO speeds, the base frequency is taken and divide by a number in the range of [ MinDiv, MaxDiv ].

SizeofStruct

size of the structure.

Interface

interface type for the speed information.

BaseFreq

base frequency (Hz) used to calculate supported SWO speeds.

MinDiv

minimum divider allowed to divide the base frequency.

MaxDiv

maximum divider allowed to divide the base frequency.

MinPrescale

minimum prescaler allowed to adjust the base frequency.

MaxPrescale

maximum prescaler allowed to adjust the base frequency.

Note

You should never change .SizeofStruct or .Interface.

BaseFreq

Structure/Union member

Interface

Structure/Union member

MaxDiv

Structure/Union member

MaxPrescale

Structure/Union member

MinDiv

Structure/Union member

MinPrescale

Structure/Union member

SizeofStruct

Structure/Union member

class pylink.structs.JLinkSWOStartInfo

Bases: _ctypes.Structure

Represents configuration information for collecting Serial Wire Output (SWO) information.

SizeofStruct

size of the structure.

Interface

the interface type used for SWO.

Speed

the frequency used for SWO communication in Hz.

Note

You should never change .SizeofStruct or .Interface.

Interface

Structure/Union member

SizeofStruct

Structure/Union member

Speed

Structure/Union member

class pylink.structs.JLinkSpeedInfo

Bases: _ctypes.Structure

Represents information about an emulator’s supported speeds.

The emulator can support all target interface speeds calculated by dividing the base frequency by atleast MinDiv.

SizeOfStruct

the size of this structure.

BaseFreq

Base frequency (in HZ) used to calculate supported speeds.

MinDiv

minimum divider allowed to divide the base frequency.

SupportAdaptive

1 if emulator supports adaptive clocking, otherwise 0.

BaseFreq

Structure/Union member

MinDiv

Structure/Union member

SizeOfStruct

Structure/Union member

SupportAdaptive

Structure/Union member

class pylink.structs.JLinkStraceEventInfo

Bases: _ctypes.Structure

Class representing the STRACE event information.

SizeOfStruct

size of the structure.

Type

type of event.

Op

the STRACE operation to perform.

AccessSize

access width for trace events.

Reserved0

reserved.

Addr

specifies the load/store address for data.

Data

the data to be compared for the operation for data access events.

DataMask

bitmask for bits of data to omit in comparision for data access events.

AddrRangeSize

address range for range events.

AccessSize

Structure/Union member

Addr

Structure/Union member

AddrRangeSize

Structure/Union member

Data

Structure/Union member

DataMask

Structure/Union member

Op

Structure/Union member

Reserved0

Structure/Union member

SizeOfStruct

Structure/Union member

Type

Structure/Union member

class pylink.structs.JLinkTraceData

Bases: _ctypes.Structure

Structure representing trace data returned by the trace buffer.

PipeStat

type of trace data.

Sync

sync point in buffer.

Packet

trace data packet.

Packet

Structure/Union member

PipeStat

Structure/Union member

Sync

Structure/Union member

branch()

Returns whether the data corresponds to a branch execution.

Parameters:self (JLinkTraceData) – the JLinkTraceData instance.
Returns:True if this is trace data for a branch execution.
data_branch()

Returns whether the data corresponds to a branch with data.

Parameters:self (JLinkTraceData) – the JLinkTraceData instance.
Returns:True if this is trace data for a branch with data.
data_instruction()

Returns whether the data corresponds to an data instruction.

Parameters:self (JLinkTraceData) – the JLinkTraceData instance.
Returns:True if this is trace data for an data instruction.
instruction()

Returns whether the data corresponds to an executed instruction.

Parameters:self (JLinkTraceData) – the JLinkTraceData instance.
Returns:True if this is trace data for an executed instruction.
non_instruction()

Returns whether the data corresponds to an un-executed instruction.

Parameters:self (JLinkTraceData) – the JLinkTraceData instance.
Returns:True if this is trace data for an un-executed instruction.
trace_disabled()

Returns whether the data corresponds to trace being disabled.

Parameters:self (JLinkTraceData) – the JLinkTraceData instance.
Returns:True if this is trace data for the trace disabled event.
trigger()

Returns whether the data corresponds to a trigger event.

Parameters:self (JLinkTraceData) – the JLinkTraceData instance.
Returns:True if this is trace data for a trigger event.
wait()

Returns whether the data corresponds to a wait.

Parameters:self (JLinkTraceData) – the JLinkTraceData instance.
Returns:True if this is trace data for a wait.
class pylink.structs.JLinkTraceRegion

Bases: _ctypes.Structure

Structure describing a trace region.

SizeOfStruct

size of the structure.

RegionIndex

index of the region.

NumSamples

number of samples in the region.

Off

offset in the trace buffer.

RegionCnt

number of trace regions.

Dummy

unused.

Timestamp

timestamp of last event written to buffer.

Dummy

Structure/Union member

NumSamples

Structure/Union member

Off

Structure/Union member

RegionCnt

Structure/Union member

RegionIndex

Structure/Union member

SizeOfStruct

Structure/Union member

Timestamp

Structure/Union member

class pylink.structs.JLinkWatchpointInfo

Bases: _ctypes.Structure

Class representing information about a watchpoint.

SizeOfStruct

the size of the structure (this should not be modified).

Handle

the watchpoint handle.

Addr

the address the watchpoint was set at.

AddrMask

the address mask used for comparison.

Data

the data on which the watchpoint was set.

DataMask

the data mask used for comparision.

Ctrl

the control data on which the breakpoint was set.

CtrlMask

the control mask used for comparison.

WPUnit

the index of the watchpoint unit.

Addr

Structure/Union member

AddrMask

Structure/Union member

Ctrl

Structure/Union member

CtrlMask

Structure/Union member

Data

Structure/Union member

DataMask

Structure/Union member

Handle

Structure/Union member

SizeOfStruct

Structure/Union member

WPUnit

Structure/Union member

Enumerations

class pylink.enums.JLinkAccessFlags

Bases: object

J-Link access types for data events.

These access types allow specifying the different types of access events that should be monitored.

READ

specifies to monitor read accesses.

WRITE

specifies to monitor write accesses.

PRIVILEGED

specifies to monitor privileged accesses.

SIZE_8BIT

specifies to monitor an 8-bit access width.

SIZE_16BIT

specifies to monitor an 16-bit access width.

SIZE_32BIT

specifies to monitor an 32-bit access width.

PRIV = 16
READ = 0
SIZE_16BIT = 2
SIZE_32BIT = 4
SIZE_8BIT = 0
WRITE = 1
class pylink.enums.JLinkAccessMaskFlags

Bases: object

J-Link access mask flags.

SIZE

specifies to not care about the access size of the event.

DIR

specifies to not care about the access direction of the event.

PRIV

specifies to not care about the access privilege of the event.

DIR = 1
PRIV = 16
SIZE = 6
class pylink.enums.JLinkBreakpoint

Bases: object

J-Link breakpoint types.

SW_RAM

Software breakpont located in RAM.

SW_FLASH

Software breakpoint located in flash.

SW

Software breakpoint located in RAM or flash.

HW

Hardware breakpoint.

ANY

Allows specifying any time of breakpoint.

ARM

Breakpoint in ARM mode (only available on ARM 7/9 cores).

THUMB

Breakpoint in THUMB mode (only available on ARM 7/9 cores).

ANY = 4294967280
ARM = 1
HW = 4294967040
SW = 240
SW_FLASH = 32
SW_RAM = 16
THUMB = 2
class pylink.enums.JLinkBreakpointImplementation

Bases: object

J-Link breakpoint implementation types.

HARD

Hardware breakpoint using a breakpoint unit.

SOFT

Software breakpoint using a breakpoint instruction.

PENDING

Breakpoint has not been set yet.

FLASH

Breakpoint set in flash.

FLASH = 16
HARD = 1
PENDING = 4
SOFT = 2
class pylink.enums.JLinkCPUCapabilities

Bases: object

Target CPU Cabilities.

DCC = 16384
GO = 32
HALT = 128
HSS = 32768
IS_HALTED = 256
READ_MEMORY = 2
READ_REGISTERS = 8
RESET = 512
RUN_STOP = 1024
STEP = 64
TERMINAL = 2048
WRITE_MEMORY = 4
WRITE_REGISTERS = 16
class pylink.enums.JLinkCore

Bases: object

Enumeration for the different CPU core identifiers.

These are the possible cores for targets the J-Link is connected to. Note that these are bitfields.

ANY = 4294967295
ARM11 = 201326591
ARM1136 = 188153855
ARM1136J = 188089087
ARM1136JF = 188090111
ARM1136JF_S = 188090367
ARM1136J_S = 188089343
ARM1156 = 190251007
ARM1176 = 192348159
ARM1176J = 192283391
ARM1176JF = 192284415
ARM1176JF_S = 192284671
ARM1176J_S = 192283647
ARM7 = 134217727
ARM7TDMI = 117440767
ARM7TDMI_R3 = 117440575
ARM7TDMI_R4 = 117440591
ARM7TDMI_S = 117441023
ARM7TDMI_S_R3 = 117440831
ARM7TDMI_S_R4 = 117440847
ARM9 = 167772159
ARM920T = 153092351
ARM922T = 153223423
ARM926EJ_S = 153485823
ARM946E_S = 155582975
ARM966E_S = 157680127
ARM968E_S = 157811199
ARM9TDMI_S = 150995455
CIP51 = 302055423
COLDFIRE = 50331647
CORTEX_A12 = 134873343
CORTEX_A15 = 134938879
CORTEX_A17 = 135004415
CORTEX_A5 = 251658495
CORTEX_A7 = 134742271
CORTEX_A8 = 134217983
CORTEX_A9 = 134807807
CORTEX_M0 = 100663551
CORTEX_M1 = 16777471
CORTEX_M3 = 50331903
CORTEX_M3_R1P0 = 50331664
CORTEX_M3_R1P1 = 50331665
CORTEX_M3_R2P0 = 50331680
CORTEX_M4 = 234881279
CORTEX_M7 = 234946815
CORTEX_M_V8BASEL = 100729087
CORTEX_M_V8MAINL = 235012351
CORTEX_R4 = 201326847
CORTEX_R5 = 201392383
EFM8_UNSPEC = 318767103
MIPS = 301989887
MIPS_M4K = 285278207
MIPS_MICROAPTIV = 285343743
NONE = 0
POWER_PC = 285212671
POWER_PC_N1 = 285147391
POWER_PC_N2 = 285147647
RX = 234881023
RX110 = 220332031
RX111 = 220266495
RX113 = 220397567
RX210 = 219217919
RX21A = 219283455
RX220 = 219348991
RX230 = 219414527
RX231 = 219480063
RX23T = 219545599
RX610 = 218169343
RX621 = 218562559
RX62G = 218628095
RX62N = 218234879
RX62T = 218300415
RX630 = 218431487
RX631 = 218693631
RX63N = 218365951
RX63T = 218497023
RX64M = 221315071
RX71M = 221380607
SIM = 83886079
XSCALE = 100663295
class pylink.enums.JLinkDataErrors

Bases: pylink.enums.JLinkGlobalErrors

Enumeration for the error codes generated when setting a data event.

ERROR_INVALID_ACCESS_MASK = 2147483776
ERROR_INVALID_ADDR_MASK = 2147483680
ERROR_INVALID_DATA_MASK = 2147483712
ERROR_NO_MORE_ADDR_COMP = 2147483650
ERROR_NO_MORE_DATA_COMP = 2147483652
ERROR_NO_MORE_EVENTS = 2147483649
ERROR_UNKNOWN = 2147483648
classmethod to_string(error_code)

Returns the string message for the given error code.

Parameters:
  • cls (JLinkDataErrors) – the JLinkDataErrors class
  • error_code (int) – error code to convert
Returns:

An error string corresponding to the error code.

Raises:

ValueError – if the error code is invalid.

class pylink.enums.JLinkDeviceFamily

Bases: object

Enumeration for the difference device families.

These are the possible device families for targets that the J-Link is connected to.

ANY = 255
ARM10 = 10
ARM11 = 11
ARM7 = 7
ARM9 = 9
AUTO = 0
COLDFIRE = 2
CORTEX_A5 = 15
CORTEX_A8 = 8
CORTEX_A9 = 8
CORTEX_M0 = 6
CORTEX_M1 = 1
CORTEX_M3 = 3
CORTEX_M4 = 14
CORTEX_R4 = 12
EFM8 = 18
MIPS = 17
POWERPC = 16
RX = 13
SIMULATOR = 4
XSCALE = 5
class pylink.enums.JLinkEraseErrors

Bases: pylink.enums.JLinkGlobalErrors

Enumeration for the error codes generated during an erase operation.

ILLEGAL_COMMAND = -5
classmethod to_string(error_code)

Returns the string message for the given error_code.

Parameters:
  • cls (JLinkEraseErrors) – the JLinkEraseErrors class
  • error_code (int) – error code to convert
Returns:

An error string corresponding to the error code.

Raises:

ValueError – if the error code is invalid.

class pylink.enums.JLinkEventTypes

Bases: object

J-Link data event types.

BREAKPOINT

breakpoint data event.

BREAKPOINT = 1
class pylink.enums.JLinkFlags

Bases: object

Enumeration for the different flags that are passed to the J-Link C SDK API methods.

DLG_BUTTON_CANCEL = 8
DLG_BUTTON_NO = 2
DLG_BUTTON_OK = 4
DLG_BUTTON_YES = 1
GO_OVERSTEP_BP = 1
HW_PIN_STATUS_HIGH = 1
HW_PIN_STATUS_LOW = 0
HW_PIN_STATUS_UNKNOWN = 255
class pylink.enums.JLinkFlashErrors

Bases: pylink.enums.JLinkGlobalErrors

Enumeration for the error codes generated during a flash operation.

COMPARE_ERROR = -2
PROGRAM_ERASE_ERROR = -3
VERIFICATION_ERROR = -4
classmethod to_string(error_code)

Returns the string message for the given error_code.

Parameters:
  • cls (JLinkFlashErrors) – the JLinkFlashErrors class
  • error_code (int) – error code to convert
Returns:

An error string corresponding to the error code.

Raises:

ValueError – if the error code is invalid.

class pylink.enums.JLinkFunctions

Bases: object

Collection of function prototype and type builders for the J-Link SDK API calls.

FLASH_PROGRESS_PROTOTYPE

alias of CFunctionType

LOG_PROTOTYPE

alias of CFunctionType

UNSECURE_HOOK_PROTOTYPE

alias of CFunctionType

class pylink.enums.JLinkGlobalErrors

Bases: object

Enumeration for the error codes which any J-Link SDK DLL API-function can have as a return value.

CPU_IN_LOW_POWER_MODE = -274
DEVICE_FEATURE_NOT_SUPPORTED = -271
DLL_NOT_OPEN = -258
EMU_COMM_ERROR = -257
EMU_FEATURE_UNSUPPORTED = -262
EMU_NO_CONNECTION = -256
EMU_NO_MEMORY = -263
FLASH_PROG_COMPARE_FAILED = -265
FLASH_PROG_PROGRAM_FAILED = -266
FLASH_PROG_VERIFY_FAILED = -267
INVALID_HANDLE = -260
NO_CPU_FOUND = -261
NO_TARGET_DEVICE_SELECTED = -273
OPEN_FILE_FAILED = -268
TIF_STATUS_ERROR = -264
UNKNOWN_FILE_FORMAT = -269
UNSPECIFIED_ERROR = -1
VCC_FAILURE = -259
WRITE_TARGET_MEMORY_FAILED = -270
WRONG_USER_CONFIG = -272
classmethod to_string(error_code)

Returns the string message for the given error_code.

Parameters:
  • cls (JlinkGlobalErrors) – the JLinkGlobalErrors class
  • error_code (int) – error code to convert
Returns:

An error string corresponding to the error code.

Raises:

ValueError – if the error code is invalid.

class pylink.enums.JLinkHaltReasons

Bases: object

Halt reasons for the CPU.

DBGRQ

CPU has been halted because DBGRQ signal asserted.

CODE_BREAKPOINT

CPU has been halted because of code breakpoint match.

DATA_BREAKPOINT

CPU has been halted because of data breakpoint match.

VECTOR_CATCH

CPU has been halted because of vector catch.

CODE_BREAKPOINT = 1
DATA_BREAKPOINT = 2
DBGRQ = 0
VECTOR_CATCH = 3
class pylink.enums.JLinkHost

Bases: object

Enumeration for the different JLink hosts: currently only IP and USB.

IP = 2
USB = 1
USB_OR_IP = 3
class pylink.enums.JLinkInterfaces

Bases: object

Target interfaces for the J-Link.

C2 = 6
FINE = 3
ICSP = 4
JTAG = 0
SPI = 5
SWD = 1
class pylink.enums.JLinkROMTable

Bases: object

The J-Link ROM tables.

AHBAP = 270
APBAP = 269
DBG = 268
DWT = 261
ETB = 267
ETM = 257
FPB = 262
ITM = 260
MTB = 258
NONE = 256
NVIC = 263
PTM = 266
SECURE = 271
TF = 265
TMC = 264
TPIU = 259
class pylink.enums.JLinkRTTCommand

Bases: object

RTT commands.

GETDESC = 2
GETNUMBUF = 3
GETSTAT = 4
START = 0
STOP = 1
class pylink.enums.JLinkRTTDirection

Bases: object

RTT Direction.

DOWN = 1
UP = 0
class pylink.enums.JLinkRTTErrors

Bases: pylink.enums.JLinkGlobalErrors

Enumeration for error codes from RTT.

RTT_ERROR_CONTROL_BLOCK_NOT_FOUND = -2
classmethod to_string(error_code)

Returns the string message for the given error code.

Parameters:
  • cls (JLinkRTTErrors) – the JLinkRTTErrors class
  • error_code (int) – error code to convert
Returns:

An error string corresponding to the error code.

Raises:

ValueError – if the error code is invalid.

class pylink.enums.JLinkReadErrors

Bases: pylink.enums.JLinkGlobalErrors

Enumeration for the error codes generated during a read.

ZONE_NOT_FOUND_ERROR = -5
classmethod to_string(error_code)

Returns the string message for the given error_code.

Parameters:
  • cls (JLinkReadErrors) – the JLinkReadErrors class
  • error_code (int) – error code to convert
Returns:

An error string corresponding to the error code.

Raises:

ValueError – if the error code is invalid.

class pylink.enums.JLinkResetStrategyCortexM3

Bases: object

Target reset strategies for the J-Link.

NORMAL

default reset strategy, does whatever is best to reset.

CORE

only the core is reset via the VECTRESET bit.

RESETPIN

pulls the reset pin low to reset the core and peripherals.

CONNECT_UNDER_RESET

J-Link connects to target while keeping reset active. This is recommented for STM32 devices.

HALT_AFTER_BTL

halt the core after the bootloader is executed.

HALT_BEFORE_BTL

halt the core before the bootloader is executed.

KINETIS

performs a normal reset, but also disables the watchdog.

ADI_HALT_AFTER_KERNEL

sets the SYSRESETREQ bit in the AIRCR in order to reset the device.

CORE_AND_PERIPHERALS

sets the SYSRESETREQ bit in the AIRCR, and the VC_CORERESET bit in the DEMCR to make sure that the CPU is halted immediately after reset.

LPC1200

reset for LPC1200 devices.

S3FN60D

reset for Samsung S3FN60D devices.

Note

Please see the J-Link SEGGER Documentation, UM8001, for full information about the different reset strategies.

ADI_HALT_AFTER_KERNEL = 7
CONNECT_UNDER_RESET = 3
CORE = 1
CORE_AND_PERIPHERALS = 8
HALT_AFTER_BTL = 4
HALT_BEFORE_BTL = 5
KINETIS = 6
LPC1200 = 9
NORMAL = 0
RESETPIN = 2
S3FN60D = 10
class pylink.enums.JLinkSWOCommands

Bases: object

Serial Wire Output (SWO) commands.

FLUSH = 2
GET_NUM_BYTES = 10
GET_SPEED_INFO = 3
SET_BUFFERSIZE_EMU = 21
SET_BUFFERSIZE_HOST = 20
START = 0
STOP = 1
class pylink.enums.JLinkSWOInterfaces

Bases: object

Serial Wire Output (SWO) interfaces.

MANCHESTER = 1
UART = 0
class pylink.enums.JLinkStraceCommand

Bases: object

STRACE commmands.

SET_BUFFER_SIZE = 3
TRACE_EVENT_CLR = 1
TRACE_EVENT_CLR_ALL = 2
TRACE_EVENT_SET = 0
class pylink.enums.JLinkStraceEvent

Bases: object

STRACE events.

CODE_FETCH = 0
DATA_ACCESS = 1
DATA_LOAD = 2
DATA_STORE = 3
class pylink.enums.JLinkStraceOperation

Bases: object

STRACE operation specifiers.

TRACE_EXCLUDE_RANGE = 3
TRACE_INCLUDE_RANGE = 2
TRACE_START = 0
TRACE_STOP = 1
class pylink.enums.JLinkTraceCommand

Bases: object

J-Link trace commands.

FLUSH = 2
GET_CONF_CAPACITY = 17
GET_FORMAT = 33
GET_MAX_CAPACITY = 20
GET_MIN_CAPACITY = 19
GET_NUM_REGIONS = 48
GET_NUM_SAMPLES = 16
GET_REGION_PROPS = 49
GET_REGION_PROPS_EX = 50
SET_CAPACITY = 18
SET_FORMAT = 32
START = 0
STOP = 1
class pylink.enums.JLinkTraceFormat

Bases: object

J-Link trace formats.

FORMAT_4BIT

4-bit data.

FORMAT_8BIT

8-bit data.

FORMAT_16BIT

16-bit data.

FORMAT_MULTIPLEXED

multiplexing on ETM / buffer link.

FORMAT_DEMULTIPLEXED

de-multiplexing on ETM / buffer link.

FORMAT_DOUBLE_EDGE

clock data on both ETM / buffer link edges.

FORMAT_ETM7_9

ETM7/ETM9 protocol.

FORMAT_ETM10

ETM10 protocol.

FORMAT_1BIT

1-bit data.

FORMAT_2BIT

2-bit data.

FORMAT_16BIT = 4
FORMAT_1BIT = 256
FORMAT_2BIT = 512
FORMAT_4BIT = 1
FORMAT_8BIT = 2
FORMAT_DEMULTIPLEXED = 16
FORMAT_DOUBLE_EDGE = 32
FORMAT_ETM10 = 128
FORMAT_ETM7_9 = 64
FORMAT_MULTIPLEXED = 8
class pylink.enums.JLinkTraceSource

Bases: object

Sources for tracing.

ETB = 0
ETM = 1
MTB = 2
class pylink.enums.JLinkVectorCatchCortexM3

Bases: object

Vector catch types for the ARM Cortex M3.

CORE_RESET

The CPU core reset.

MEM_ERROR

A memory management error occurred.

COPROCESSOR_ERROR

Usage fault error accessing the Coprocessor.

CHECK_ERROR

Usage fault error on enabled check.

STATE_ERROR

Usage fault state error.

BUS_ERROR

Normal bus error.

INT_ERROR

Interrupt or exception service error.

HARD_ERROR

Hard fault error.

BUS_ERROR = 256
CHECK_ERROR = 64
COPROCESSOR_ERROR = 32
CORE_RESET = 1
HARD_ERROR = 1024
INT_ERROR = 512
MEM_ERROR = 16
STATE_ERROR = 128
class pylink.enums.JLinkWriteErrors

Bases: pylink.enums.JLinkGlobalErrors

Enumeration for the error codes generated during a write.

ZONE_NOT_FOUND_ERROR = -5
classmethod to_string(error_code)

Returns the string message for the given error_code.

Parameters:
  • cls (JLinkWriteErrors) – the JLinkWriteErrors class
  • error_code (int) – error code to convert
Returns:

An error string corresponding to the error code.

Raises:

ValueError – if the error code is invalid.