idx
int64
0
252k
question
stringlengths
48
5.28k
target
stringlengths
5
1.23k
230,900
def extended_capabilities ( self ) : buf = ( ctypes . c_uint8 * 32 ) ( ) self . _dll . JLINKARM_GetEmuCapsEx ( buf , 32 ) return list ( buf )
Gets the capabilities of the connected emulator as a list .
230,901
def features ( self ) : buf = ( ctypes . c_char * self . MAX_BUF_SIZE ) ( ) self . _dll . JLINKARM_GetFeatureString ( buf ) result = ctypes . string_at ( buf ) . decode ( ) . strip ( ) if len ( result ) == 0 : return list ( ) return result . split ( ', ' )
Returns a list of the J - Link embedded features .
230,902
def product_name ( self ) : buf = ( ctypes . c_char * self . MAX_BUF_SIZE ) ( ) self . _dll . JLINKARM_EMU_GetProductName ( buf , self . MAX_BUF_SIZE ) return ctypes . string_at ( buf ) . decode ( )
Returns the product name of the connected J - Link .
230,903
def oem ( self ) : buf = ( ctypes . c_char * self . MAX_BUF_SIZE ) ( ) res = self . _dll . JLINKARM_GetOEMString ( ctypes . byref ( buf ) ) if res != 0 : raise errors . JLinkException ( 'Failed to grab OEM string.' ) oem = ctypes . string_at ( buf ) . decode ( ) if len ( oem ) == 0 : return None return oem
Retrieves and returns the OEM string of the connected J - Link .
230,904
def set_speed ( self , speed = None , auto = False , adaptive = False ) : if speed is None : speed = 0 elif not util . is_natural ( speed ) : raise TypeError ( 'Expected positive number for speed, given %s.' % speed ) elif speed > self . MAX_JTAG_SPEED : raise ValueError ( 'Given speed exceeds max speed of %d.' % self ...
Sets the speed of the JTAG communication with the ARM core .
230,905
def speed_info ( self ) : speed_info = structs . JLinkSpeedInfo ( ) self . _dll . JLINKARM_GetSpeedInfo ( ctypes . byref ( speed_info ) ) return speed_info
Retrieves information about supported target interface speeds .
230,906
def licenses ( self ) : buf_size = self . MAX_BUF_SIZE buf = ( ctypes . c_char * buf_size ) ( ) res = self . _dll . JLINK_GetAvailableLicense ( buf , buf_size ) if res < 0 : raise errors . JLinkException ( res ) return ctypes . string_at ( buf ) . decode ( )
Returns a string of the built - in licenses the J - Link has .
230,907
def custom_licenses ( self ) : buf = ( ctypes . c_char * self . MAX_BUF_SIZE ) ( ) result = self . _dll . JLINK_EMU_GetLicenses ( buf , self . MAX_BUF_SIZE ) if result < 0 : raise errors . JLinkException ( result ) return ctypes . string_at ( buf ) . decode ( )
Returns a string of the installed licenses the J - Link has .
230,908
def add_license ( self , contents ) : buf_size = len ( contents ) buf = ( ctypes . c_char * ( buf_size + 1 ) ) ( * contents . encode ( ) ) res = self . _dll . JLINK_EMU_AddLicense ( buf ) if res == - 1 : raise errors . JLinkException ( 'Unspecified error.' ) elif res == - 2 : raise errors . JLinkException ( 'Failed to ...
Adds the given contents as a new custom license to the J - Link .
230,909
def supported_tifs ( self ) : buf = ctypes . c_uint32 ( ) self . _dll . JLINKARM_TIF_GetAvailable ( ctypes . byref ( buf ) ) return buf . value
Returns a bitmask of the supported target interfaces .
230,910
def set_tif ( self , interface ) : if not ( ( 1 << interface ) & self . supported_tifs ( ) ) : raise errors . JLinkException ( 'Unsupported target interface: %s' % interface ) res = self . _dll . JLINKARM_TIF_Select ( interface ) if res != 0 : return False self . _tif = interface return True
Selects the specified target interface .
230,911
def gpio_properties ( self ) : res = self . _dll . JLINK_EMU_GPIO_GetProps ( 0 , 0 ) if res < 0 : raise errors . JLinkException ( res ) num_props = res buf = ( structs . JLinkGPIODescriptor * num_props ) ( ) res = self . _dll . JLINK_EMU_GPIO_GetProps ( ctypes . byref ( buf ) , num_props ) if res < 0 : raise errors . J...
Returns the properties of the user - controllable GPIOs .
230,912
def gpio_get ( self , pins = None ) : if pins is None : pins = range ( 4 ) size = len ( pins ) indices = ( ctypes . c_uint8 * size ) ( * pins ) statuses = ( ctypes . c_uint8 * size ) ( ) result = self . _dll . JLINK_EMU_GPIO_GetState ( ctypes . byref ( indices ) , ctypes . byref ( statuses ) , size ) if result < 0 : ra...
Returns a list of states for the given pins .
230,913
def gpio_set ( self , pins , states ) : if len ( pins ) != len ( states ) : raise ValueError ( 'Length mismatch between pins and states.' ) size = len ( pins ) indices = ( ctypes . c_uint8 * size ) ( * pins ) states = ( ctypes . c_uint8 * size ) ( * states ) result_states = ( ctypes . c_uint8 * size ) ( ) result = self...
Sets the state for one or more user - controllable GPIOs .
230,914
def unlock ( self ) : if not unlockers . unlock ( self , self . _device . manufacturer ) : raise errors . JLinkException ( 'Failed to unlock device.' ) return True
Unlocks the device connected to the J - Link .
230,915
def erase ( self ) : try : if not self . halted ( ) : self . halt ( ) except errors . JLinkException : pass res = self . _dll . JLINK_EraseChip ( ) if res < 0 : raise errors . JLinkEraseException ( res ) return res
Erases the flash contents of the device .
230,916
def reset ( self , ms = 0 , halt = True ) : self . _dll . JLINKARM_SetResetDelay ( ms ) res = self . _dll . JLINKARM_Reset ( ) if res < 0 : raise errors . JLinkException ( res ) elif not halt : self . _dll . JLINKARM_Go ( ) return res
Resets the target .
230,917
def halt ( self ) : res = int ( self . _dll . JLINKARM_Halt ( ) ) if res == 0 : time . sleep ( 1 ) return True return False
Halts the CPU Core .
230,918
def halted ( self ) : result = int ( self . _dll . JLINKARM_IsHalted ( ) ) if result < 0 : raise errors . JLinkException ( result ) return ( result > 0 )
Returns whether the CPU core was halted .
230,919
def core_name ( self ) : buf_size = self . MAX_BUF_SIZE buf = ( ctypes . c_char * buf_size ) ( ) self . _dll . JLINKARM_Core2CoreName ( self . core_cpu ( ) , buf , buf_size ) return ctypes . string_at ( buf ) . decode ( )
Returns the name of the target ARM core .
230,920
def scan_chain_len ( self , scan_chain ) : res = self . _dll . JLINKARM_MeasureSCLen ( scan_chain ) if res < 0 : raise errors . JLinkException ( res ) return res
Retrieves and returns the number of bits in the scan chain .
230,921
def register_list ( self ) : num_items = self . MAX_NUM_CPU_REGISTERS buf = ( ctypes . c_uint32 * num_items ) ( ) num_regs = self . _dll . JLINKARM_GetRegisterList ( buf , num_items ) return buf [ : num_regs ]
Returns a list of the indices for the CPU registers .
230,922
def register_name ( self , register_index ) : result = self . _dll . JLINKARM_GetRegisterName ( register_index ) return ctypes . cast ( result , ctypes . c_char_p ) . value . decode ( )
Retrives and returns the name of an ARM CPU register .
230,923
def cpu_speed ( self , silent = False ) : res = self . _dll . JLINKARM_MeasureCPUSpeedEx ( - 1 , 1 , int ( silent ) ) if res < 0 : raise errors . JLinkException ( res ) return res
Retrieves the CPU speed of the target .
230,924
def cpu_halt_reasons ( self ) : buf_size = self . MAX_NUM_MOES buf = ( structs . JLinkMOEInfo * buf_size ) ( ) num_reasons = self . _dll . JLINKARM_GetMOEs ( buf , buf_size ) if num_reasons < 0 : raise errors . JLinkException ( num_reasons ) return list ( buf ) [ : num_reasons ]
Retrives the reasons that the CPU was halted .
230,925
def jtag_send ( self , tms , tdi , num_bits ) : if not util . is_natural ( num_bits ) or num_bits <= 0 or num_bits > 32 : raise ValueError ( 'Number of bits must be >= 1 and <= 32.' ) self . _dll . JLINKARM_StoreBits ( tms , tdi , num_bits ) return None
Sends data via JTAG .
230,926
def swd_read8 ( self , offset ) : value = self . _dll . JLINK_SWD_GetU8 ( offset ) return ctypes . c_uint8 ( value ) . value
Gets a unit of 8 bits from the input buffer .
230,927
def swd_read16 ( self , offset ) : value = self . _dll . JLINK_SWD_GetU16 ( offset ) return ctypes . c_uint16 ( value ) . value
Gets a unit of 16 bits from the input buffer .
230,928
def swd_read32 ( self , offset ) : value = self . _dll . JLINK_SWD_GetU32 ( offset ) return ctypes . c_uint32 ( value ) . value
Gets a unit of 32 bits from the input buffer .
230,929
def swd_sync ( self , pad = False ) : if pad : self . _dll . JLINK_SWD_SyncBytes ( ) else : self . _dll . JLINK_SWD_SyncBits ( ) return None
Causes a flush to write all data remaining in output buffers to SWD device .
230,930
def flash_write ( self , addr , data , nbits = None , flags = 0 ) : self . _dll . JLINKARM_BeginDownload ( flags ) self . memory_write ( addr , data , nbits = nbits ) bytes_flashed = self . _dll . JLINKARM_EndDownload ( ) if bytes_flashed < 0 : raise errors . JLinkFlashException ( bytes_flashed ) return bytes_flashed
Writes data to the flash region of a device .
230,931
def code_memory_read ( self , addr , num_bytes ) : buf_size = num_bytes buf = ( ctypes . c_uint8 * buf_size ) ( ) res = self . _dll . JLINKARM_ReadCodeMem ( addr , buf_size , buf ) if res < 0 : raise errors . JLinkException ( res ) return list ( buf ) [ : res ]
Reads bytes from code memory .
230,932
def num_memory_zones ( self ) : count = self . _dll . JLINK_GetMemZones ( 0 , 0 ) if count < 0 : raise errors . JLinkException ( count ) return count
Returns the number of memory zones supported by the target .
230,933
def memory_zones ( self ) : count = self . num_memory_zones ( ) if count == 0 : return list ( ) buf = ( structs . JLinkMemoryZone * count ) ( ) res = self . _dll . JLINK_GetMemZones ( buf , count ) if res < 0 : raise errors . JLinkException ( res ) return list ( buf )
Gets all memory zones supported by the current target .
230,934
def memory_read ( self , addr , num_units , zone = None , nbits = None ) : buf_size = num_units buf = None access = 0 if nbits is None : buf = ( ctypes . c_uint8 * buf_size ) ( ) access = 0 elif nbits == 8 : buf = ( ctypes . c_uint8 * buf_size ) ( ) access = 1 elif nbits == 16 : buf = ( ctypes . c_uint16 * buf_size ) (...
Reads memory from a target system or specific memory zone .
230,935
def memory_read8 ( self , addr , num_bytes , zone = None ) : return self . memory_read ( addr , num_bytes , zone = zone , nbits = 8 )
Reads memory from the target system in units of bytes .
230,936
def memory_read16 ( self , addr , num_halfwords , zone = None ) : return self . memory_read ( addr , num_halfwords , zone = zone , nbits = 16 )
Reads memory from the target system in units of 16 - bits .
230,937
def memory_read32 ( self , addr , num_words , zone = None ) : return self . memory_read ( addr , num_words , zone = zone , nbits = 32 )
Reads memory from the target system in units of 32 - bits .
230,938
def memory_read64 ( self , addr , num_long_words ) : buf_size = num_long_words buf = ( ctypes . c_ulonglong * buf_size ) ( ) units_read = self . _dll . JLINKARM_ReadMemU64 ( addr , buf_size , buf , 0 ) if units_read < 0 : raise errors . JLinkException ( units_read ) return buf [ : units_read ]
Reads memory from the target system in units of 64 - bits .
230,939
def memory_write ( self , addr , data , zone = None , nbits = None ) : buf_size = len ( data ) buf = None access = 0 if nbits is None : packed_data = map ( lambda d : reversed ( binpacker . pack ( d ) ) , data ) packed_data = list ( itertools . chain ( * packed_data ) ) buf_size = len ( packed_data ) buf = ( ctypes . c...
Writes memory to a target system or specific memory zone .
230,940
def memory_write8 ( self , addr , data , zone = None ) : return self . memory_write ( addr , data , zone , 8 )
Writes bytes to memory of a target system .
230,941
def memory_write16 ( self , addr , data , zone = None ) : return self . memory_write ( addr , data , zone , 16 )
Writes half - words to memory of a target system .
230,942
def memory_write32 ( self , addr , data , zone = None ) : return self . memory_write ( addr , data , zone , 32 )
Writes words to memory of a target system .
230,943
def memory_write64 ( self , addr , data , zone = None ) : words = [ ] bitmask = 0xFFFFFFFF for long_word in data : words . append ( long_word & bitmask ) words . append ( ( long_word >> 32 ) & bitmask ) return self . memory_write32 ( addr , words , zone = zone )
Writes long words to memory of a target system .
230,944
def register_read_multiple ( self , register_indices ) : num_regs = len ( register_indices ) buf = ( ctypes . c_uint32 * num_regs ) ( * register_indices ) data = ( ctypes . c_uint32 * num_regs ) ( 0 ) statuses = ( ctypes . c_uint8 * num_regs ) ( 0 ) res = self . _dll . JLINKARM_ReadRegs ( buf , data , statuses , num_re...
Retrieves the values from the registers specified .
230,945
def register_write ( self , reg_index , value ) : res = self . _dll . JLINKARM_WriteReg ( reg_index , value ) if res != 0 : raise errors . JLinkException ( 'Error writing to register %d' % reg_index ) return value
Writes into an ARM register .
230,946
def register_write_multiple ( self , register_indices , values ) : if len ( register_indices ) != len ( values ) : raise ValueError ( 'Must be an equal number of registers and values' ) num_regs = len ( register_indices ) buf = ( ctypes . c_uint32 * num_regs ) ( * register_indices ) data = ( ctypes . c_uint32 * num_reg...
Writes to multiple CPU registers .
230,947
def ice_register_write ( self , register_index , value , delay = False ) : self . _dll . JLINKARM_WriteICEReg ( register_index , int ( value ) , int ( delay ) ) return None
Writes a value to an ARM ICE register .
230,948
def etm_supported ( self ) : res = self . _dll . JLINKARM_ETM_IsPresent ( ) if ( res == 1 ) : return True info = ctypes . c_uint32 ( 0 ) index = enums . JLinkROMTable . ETM res = self . _dll . JLINKARM_GetDebugInfo ( index , ctypes . byref ( info ) ) if ( res == 1 ) : return False return True
Returns if the CPU core supports ETM .
230,949
def etm_register_write ( self , register_index , value , delay = False ) : self . _dll . JLINKARM_ETM_WriteReg ( int ( register_index ) , int ( value ) , int ( delay ) ) return None
Writes a value to an ETM register .
230,950
def set_vector_catch ( self , flags ) : res = self . _dll . JLINKARM_WriteVectorCatch ( flags ) if res < 0 : raise errors . JLinkException ( res ) return None
Sets vector catch bits of the processor .
230,951
def step ( self , thumb = False ) : method = self . _dll . JLINKARM_Step if thumb : method = self . _dll . JLINKARM_StepComposite res = method ( ) if res != 0 : raise errors . JLinkException ( "Failed to step over instruction." ) return None
Executes a single step .
230,952
def num_available_breakpoints ( self , arm = False , thumb = False , ram = False , flash = False , hw = False ) : flags = [ enums . JLinkBreakpoint . ARM , enums . JLinkBreakpoint . THUMB , enums . JLinkBreakpoint . SW_RAM , enums . JLinkBreakpoint . SW_FLASH , enums . JLinkBreakpoint . HW ] set_flags = [ arm , thumb ,...
Returns the number of available breakpoints of the specified type .
230,953
def breakpoint_info ( self , handle = 0 , index = - 1 ) : if index < 0 and handle == 0 : raise ValueError ( 'Handle must be provided if index is not set.' ) bp = structs . JLinkBreakpointInfo ( ) bp . Handle = int ( handle ) res = self . _dll . JLINKARM_GetBPInfoEx ( index , ctypes . byref ( bp ) ) if res < 0 : raise e...
Returns the information about a set breakpoint .
230,954
def breakpoint_set ( self , addr , thumb = False , arm = False ) : flags = enums . JLinkBreakpoint . ANY if thumb : flags = flags | enums . JLinkBreakpoint . THUMB elif arm : flags = flags | enums . JLinkBreakpoint . ARM handle = self . _dll . JLINKARM_SetBPEx ( int ( addr ) , flags ) if handle <= 0 : raise errors . JL...
Sets a breakpoint at the specified address .
230,955
def software_breakpoint_set ( self , addr , thumb = False , arm = False , flash = False , ram = False ) : if flash and not ram : flags = enums . JLinkBreakpoint . SW_FLASH elif not flash and ram : flags = enums . JLinkBreakpoint . SW_RAM else : flags = enums . JLinkBreakpoint . SW if thumb : flags = flags | enums . JLi...
Sets a software breakpoint at the specified address .
230,956
def watchpoint_info ( self , handle = 0 , index = - 1 ) : if index < 0 and handle == 0 : raise ValueError ( 'Handle must be provided if index is not set.' ) wp = structs . JLinkWatchpointInfo ( ) res = self . _dll . JLINKARM_GetWPInfoEx ( index , ctypes . byref ( wp ) ) if res < 0 : raise errors . JLinkException ( 'Fai...
Returns information about the specified watchpoint .
230,957
def watchpoint_set ( self , addr , addr_mask = 0x0 , data = 0x0 , data_mask = 0x0 , access_size = None , read = False , write = False , privileged = False ) : access_flags = 0x0 access_mask_flags = 0x0 if access_size is None : access_mask_flags = access_mask_flags | enums . JLinkAccessMaskFlags . SIZE elif access_size ...
Sets a watchpoint at the given address .
230,958
def disassemble_instruction ( self , instruction ) : if not util . is_integer ( instruction ) : raise TypeError ( 'Expected instruction to be an integer.' ) buf_size = self . MAX_BUF_SIZE buf = ( ctypes . c_char * buf_size ) ( ) res = self . _dll . JLINKARM_DisassembleInst ( ctypes . byref ( buf ) , buf_size , instruct...
Disassembles and returns the assembly instruction string .
230,959
def strace_configure ( self , port_width ) : if port_width not in [ 1 , 2 , 4 ] : raise ValueError ( 'Invalid port width: %s' % str ( port_width ) ) config_string = 'PortWidth=%d' % port_width res = self . _dll . JLINK_STRACE_Config ( config_string . encode ( ) ) if res < 0 : raise errors . JLinkException ( 'Failed to ...
Configures the trace port width for tracing .
230,960
def strace_read ( self , num_instructions ) : if num_instructions < 0 or num_instructions > 0x10000 : raise ValueError ( 'Invalid instruction count.' ) buf = ( ctypes . c_uint32 * num_instructions ) ( ) buf_size = num_instructions res = self . _dll . JLINK_STRACE_Read ( ctypes . byref ( buf ) , buf_size ) if res < 0 : ...
Reads and returns a number of instructions captured by STRACE .
230,961
def strace_data_access_event ( self , operation , address , data , data_mask = None , access_width = 4 , address_range = 0 ) : cmd = enums . JLinkStraceCommand . TRACE_EVENT_SET event_info = structs . JLinkStraceEventInfo ( ) event_info . Type = enums . JLinkStraceEvent . DATA_ACCESS event_info . Op = operation event_i...
Sets an event to trigger trace logic when data access is made .
230,962
def strace_data_store_event ( self , operation , address , address_range = 0 ) : cmd = enums . JLinkStraceCommand . TRACE_EVENT_SET event_info = structs . JLinkStraceEventInfo ( ) event_info . Type = enums . JLinkStraceEvent . DATA_STORE event_info . Op = operation event_info . Addr = int ( address ) event_info . AddrR...
Sets an event to trigger trace logic when data write access is made .
230,963
def strace_clear ( self , handle ) : data = ctypes . c_int ( handle ) res = self . _dll . JLINK_STRACE_Control ( enums . JLinkStraceCommand . TRACE_EVENT_CLR , ctypes . byref ( data ) ) if res < 0 : raise errors . JLinkException ( 'Failed to clear STRACE event.' ) return None
Clears the trace event specified by the given handle .
230,964
def strace_clear_all ( self ) : data = 0 res = self . _dll . JLINK_STRACE_Control ( enums . JLinkStraceCommand . TRACE_EVENT_CLR_ALL , data ) if res < 0 : raise errors . JLinkException ( 'Failed to clear all STRACE events.' ) return None
Clears all STRACE events .
230,965
def strace_set_buffer_size ( self , size ) : size = ctypes . c_uint32 ( size ) res = self . _dll . JLINK_STRACE_Control ( enums . JLinkStraceCommand . SET_BUFFER_SIZE , size ) if res < 0 : raise errors . JLinkException ( 'Failed to set the STRACE buffer size.' ) return None
Sets the STRACE buffer size .
230,966
def trace_start ( self ) : cmd = enums . JLinkTraceCommand . START res = self . _dll . JLINKARM_TRACE_Control ( cmd , 0 ) if ( res == 1 ) : raise errors . JLinkException ( 'Failed to start trace.' ) return None
Starts collecting trace data .
230,967
def trace_stop ( self ) : cmd = enums . JLinkTraceCommand . STOP res = self . _dll . JLINKARM_TRACE_Control ( cmd , 0 ) if ( res == 1 ) : raise errors . JLinkException ( 'Failed to stop trace.' ) return None
Stops collecting trace data .
230,968
def trace_flush ( self ) : cmd = enums . JLinkTraceCommand . FLUSH res = self . _dll . JLINKARM_TRACE_Control ( cmd , 0 ) if ( res == 1 ) : raise errors . JLinkException ( 'Failed to flush the trace buffer.' ) return None
Flushes the trace buffer .
230,969
def trace_buffer_capacity ( self ) : cmd = enums . JLinkTraceCommand . GET_CONF_CAPACITY data = ctypes . c_uint32 ( 0 ) res = self . _dll . JLINKARM_TRACE_Control ( cmd , ctypes . byref ( data ) ) if ( res == 1 ) : raise errors . JLinkException ( 'Failed to get trace buffer size.' ) return data . value
Retrieves the trace buffer s current capacity .
230,970
def trace_set_buffer_capacity ( self , size ) : cmd = enums . JLinkTraceCommand . SET_CAPACITY data = ctypes . c_uint32 ( size ) res = self . _dll . JLINKARM_TRACE_Control ( cmd , ctypes . byref ( data ) ) if ( res == 1 ) : raise errors . JLinkException ( 'Failed to set trace buffer size.' ) return None
Sets the capacity for the trace buffer .
230,971
def trace_min_buffer_capacity ( self ) : cmd = enums . JLinkTraceCommand . GET_MIN_CAPACITY data = ctypes . c_uint32 ( 0 ) res = self . _dll . JLINKARM_TRACE_Control ( cmd , ctypes . byref ( data ) ) if ( res == 1 ) : raise errors . JLinkException ( 'Failed to get min trace buffer size.' ) return data . value
Retrieves the minimum capacity the trace buffer can be configured with .
230,972
def trace_max_buffer_capacity ( self ) : cmd = enums . JLinkTraceCommand . GET_MAX_CAPACITY data = ctypes . c_uint32 ( 0 ) res = self . _dll . JLINKARM_TRACE_Control ( cmd , ctypes . byref ( data ) ) if ( res == 1 ) : raise errors . JLinkException ( 'Failed to get max trace buffer size.' ) return data . value
Retrieves the maximum size the trace buffer can be configured with .
230,973
def trace_set_format ( self , fmt ) : cmd = enums . JLinkTraceCommand . SET_FORMAT data = ctypes . c_uint32 ( fmt ) res = self . _dll . JLINKARM_TRACE_Control ( cmd , ctypes . byref ( data ) ) if ( res == 1 ) : raise errors . JLinkException ( 'Failed to set trace format.' ) return None
Sets the format for the trace buffer to use .
230,974
def trace_format ( self ) : cmd = enums . JLinkTraceCommand . GET_FORMAT data = ctypes . c_uint32 ( 0 ) res = self . _dll . JLINKARM_TRACE_Control ( cmd , ctypes . byref ( data ) ) if ( res == 1 ) : raise errors . JLinkException ( 'Failed to get trace format.' ) return data . value
Retrieves the current format the trace buffer is using .
230,975
def trace_region_count ( self ) : cmd = enums . JLinkTraceCommand . GET_NUM_REGIONS data = ctypes . c_uint32 ( 0 ) res = self . _dll . JLINKARM_TRACE_Control ( cmd , ctypes . byref ( data ) ) if ( res == 1 ) : raise errors . JLinkException ( 'Failed to get trace region count.' ) return data . value
Retrieves a count of the number of available trace regions .
230,976
def trace_region ( self , region_index ) : cmd = enums . JLinkTraceCommand . GET_REGION_PROPS_EX region = structs . JLinkTraceRegion ( ) region . RegionIndex = int ( region_index ) res = self . _dll . JLINKARM_TRACE_Control ( cmd , ctypes . byref ( region ) ) if ( res == 1 ) : raise errors . JLinkException ( 'Failed to...
Retrieves the properties of a trace region .
230,977
def trace_read ( self , offset , num_items ) : buf_size = ctypes . c_uint32 ( num_items ) buf = ( structs . JLinkTraceData * num_items ) ( ) res = self . _dll . JLINKARM_TRACE_Read ( buf , int ( offset ) , ctypes . byref ( buf_size ) ) if ( res == 1 ) : raise errors . JLinkException ( 'Failed to read from trace buffer....
Reads data from the trace buffer and returns it .
230,978
def swo_start ( self , swo_speed = 9600 ) : if self . swo_enabled ( ) : self . swo_stop ( ) info = structs . JLinkSWOStartInfo ( ) info . Speed = swo_speed res = self . _dll . JLINKARM_SWO_Control ( enums . JLinkSWOCommands . START , ctypes . byref ( info ) ) if res < 0 : raise errors . JLinkException ( res ) self . _s...
Starts collecting SWO data .
230,979
def swo_stop ( self ) : res = self . _dll . JLINKARM_SWO_Control ( enums . JLinkSWOCommands . STOP , 0 ) if res < 0 : raise errors . JLinkException ( res ) return None
Stops collecting SWO data .
230,980
def swo_enable ( self , cpu_speed , swo_speed = 9600 , port_mask = 0x01 ) : if self . swo_enabled ( ) : self . swo_stop ( ) res = self . _dll . JLINKARM_SWO_EnableTarget ( cpu_speed , swo_speed , enums . JLinkSWOInterfaces . UART , port_mask ) if res != 0 : raise errors . JLinkException ( res ) self . _swo_enabled = Tr...
Enables SWO output on the target device .
230,981
def swo_disable ( self , port_mask ) : res = self . _dll . JLINKARM_SWO_DisableTarget ( port_mask ) if res != 0 : raise errors . JLinkException ( res ) return None
Disables ITM & Stimulus ports .
230,982
def swo_flush ( self , num_bytes = None ) : if num_bytes is None : num_bytes = self . swo_num_bytes ( ) buf = ctypes . c_uint32 ( num_bytes ) res = self . _dll . JLINKARM_SWO_Control ( enums . JLinkSWOCommands . FLUSH , ctypes . byref ( buf ) ) if res < 0 : raise errors . JLinkException ( res ) return None
Flushes data from the SWO buffer .
230,983
def swo_speed_info ( self ) : info = structs . JLinkSWOSpeedInfo ( ) res = self . _dll . JLINKARM_SWO_Control ( enums . JLinkSWOCommands . GET_SPEED_INFO , ctypes . byref ( info ) ) if res < 0 : raise errors . JLinkException ( res ) return info
Retrieves information about the supported SWO speeds .
230,984
def swo_num_bytes ( self ) : res = self . _dll . JLINKARM_SWO_Control ( enums . JLinkSWOCommands . GET_NUM_BYTES , 0 ) if res < 0 : raise errors . JLinkException ( res ) return res
Retrives the number of bytes in the SWO buffer .
230,985
def swo_set_host_buffer_size ( self , buf_size ) : buf = ctypes . c_uint32 ( buf_size ) res = self . _dll . JLINKARM_SWO_Control ( enums . JLinkSWOCommands . SET_BUFFERSIZE_HOST , ctypes . byref ( buf ) ) if res < 0 : raise errors . JLinkException ( res ) return None
Sets the size of the buffer used by the host to collect SWO data .
230,986
def swo_set_emu_buffer_size ( self , buf_size ) : buf = ctypes . c_uint32 ( buf_size ) res = self . _dll . JLINKARM_SWO_Control ( enums . JLinkSWOCommands . SET_BUFFERSIZE_EMU , ctypes . byref ( buf ) ) if res < 0 : raise errors . JLinkException ( res ) return None
Sets the size of the buffer used by the J - Link to collect SWO data .
230,987
def swo_supported_speeds ( self , cpu_speed , num_speeds = 3 ) : buf_size = num_speeds buf = ( ctypes . c_uint32 * buf_size ) ( ) res = self . _dll . JLINKARM_SWO_GetCompatibleSpeeds ( cpu_speed , 0 , buf , buf_size ) if res < 0 : raise errors . JLinkException ( res ) return list ( buf ) [ : res ]
Retrives a list of SWO speeds supported by both the target and the connected J - Link .
230,988
def swo_read ( self , offset , num_bytes , remove = False ) : buf_size = ctypes . c_uint32 ( num_bytes ) buf = ( ctypes . c_uint8 * num_bytes ) ( 0 ) self . _dll . JLINKARM_SWO_Read ( buf , offset , ctypes . byref ( buf_size ) ) buf_size = buf_size . value if remove : self . swo_flush ( buf_size ) return list ( buf ) [...
Reads data from the SWO buffer .
230,989
def swo_read_stimulus ( self , port , num_bytes ) : if port < 0 or port > 31 : raise ValueError ( 'Invalid port number: %s' % port ) buf_size = num_bytes buf = ( ctypes . c_uint8 * buf_size ) ( ) bytes_read = self . _dll . JLINKARM_SWO_ReadStimulus ( port , buf , buf_size ) return list ( buf ) [ : bytes_read ]
Reads the printable data via SWO .
230,990
def rtt_read ( self , buffer_index , num_bytes ) : buf = ( ctypes . c_ubyte * num_bytes ) ( ) bytes_read = self . _dll . JLINK_RTTERMINAL_Read ( buffer_index , buf , num_bytes ) if bytes_read < 0 : raise errors . JLinkRTTException ( bytes_read ) return list ( buf ) [ : bytes_read ]
Reads data from the RTT buffer .
230,991
def rtt_write ( self , buffer_index , data ) : buf_size = len ( data ) buf = ( ctypes . c_ubyte * buf_size ) ( * bytearray ( data ) ) bytes_written = self . _dll . JLINK_RTTERMINAL_Write ( buffer_index , buf , buf_size ) if bytes_written < 0 : raise errors . JLinkRTTException ( bytes_written ) return bytes_written
Writes data to the RTT buffer .
230,992
def rtt_control ( self , command , config ) : config_byref = ctypes . byref ( config ) if config is not None else None res = self . _dll . JLINK_RTTERMINAL_Control ( command , config_byref ) if res < 0 : raise errors . JLinkRTTException ( res ) return res
Issues an RTT Control command .
230,993
def main ( target_device ) : jlink = pylink . JLink ( ) print ( "connecting to JLink..." ) jlink . open ( ) print ( "connecting to %s..." % target_device ) jlink . set_tif ( pylink . enums . JLinkInterfaces . SWD ) jlink . connect ( target_device ) print ( "connected, starting RTT..." ) jlink . rtt_start ( ) while True...
Creates an interactive terminal to the target via RTT .
230,994
def run ( self ) : target = getattr ( self , '_Thread__target' , getattr ( self , '_target' , None ) ) args = getattr ( self , '_Thread__args' , getattr ( self , '_args' , None ) ) kwargs = getattr ( self , '_Thread__kwargs' , getattr ( self , '_kwargs' , None ) ) if target is not None : self . _return = target ( * arg...
Runs the thread .
230,995
def join ( self , * args , ** kwargs ) : super ( ThreadReturn , self ) . join ( * args , ** kwargs ) return self . _return
Joins the thread .
230,996
def main ( ) : windows_libraries = list ( pylink . Library . find_library_windows ( ) ) latest_library = None for lib in windows_libraries : if os . path . dirname ( lib ) . endswith ( 'JLinkARM' ) : latest_library = lib break elif latest_library is None : latest_library = lib elif os . path . dirname ( lib ) > os . pa...
Upgrades the firmware of the J - Links connected to a Windows device .
230,997
def async_decorator ( func ) : @ functools . wraps ( func ) def async_wrapper ( * args , ** kwargs ) : if 'callback' not in kwargs or not kwargs [ 'callback' ] : return func ( * args , ** kwargs ) callback = kwargs . pop ( 'callback' ) if not callable ( callback ) : raise TypeError ( 'Expected \'callback\' is not calla...
Asynchronous function decorator . Interprets the function as being asynchronous so returns a function that will handle calling the Function asynchronously .
230,998
def strace ( device , trace_address , breakpoint_address ) : jlink = pylink . JLink ( ) jlink . open ( ) jlink . power_on ( ) jlink . set_tif ( pylink . JLinkInterfaces . SWD ) jlink . connect ( device ) jlink . reset ( ) jlink . breakpoint_clear_all ( ) op = pylink . JLinkStraceOperation . TRACE_START jlink . strace_c...
Implements simple trace using the STrace API .
230,999
def create_parser ( ) : parser = argparse . ArgumentParser ( prog = pylink . __title__ , description = pylink . __description__ , epilog = pylink . __copyright__ ) parser . add_argument ( '--version' , action = 'version' , version = '%(prog)s ' + pylink . __version__ ) parser . add_argument ( '-v' , '--verbose' , actio...
Builds the command parser .