Module: OrigenDebuggers::JLink::Custom

Included in:
OrigenDebuggers::JLink
Defined in:
lib/origen_debuggers/j_link.rb

Overview

Other methods can expose unique features of a given debugger

Instance Method Summary collapse

Instance Method Details

#haltObject



386
387
388
# File 'lib/origen_debuggers/j_link.rb', line 386

def halt
  dw 'halt'
end

#quitObject



390
391
392
# File 'lib/origen_debuggers/j_link.rb', line 390

def quit
  dw 'q'
end

#read_memory(address, options = {}) ⇒ Object



394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
# File 'lib/origen_debuggers/j_link.rb', line 394

def read_memory(address, options = {})
  options = {
    number: 1,    # number of items to read
    size:   8     # number of bits in each item
  }.merge(options)

  if options[:size] == 32
    dw "mem32 0x#{address.to_s(16).upcase}, #{options[:number].to_hex}"
  elsif options[:size] == 16
    dw "mem16 0x#{address.to_s(16).upcase}, #{options[:number].to_hex}"
  elsif options[:size] == 8
    dw "mem 0x#{address.to_s(16).upcase}, #{options[:number].to_hex}"
    # not sure difference between mem and mem8
  else
    fail 'You must supply a valid :size option!'
  end
end

#set_interface(interface) ⇒ Object



375
376
377
378
379
380
381
382
383
384
# File 'lib/origen_debuggers/j_link.rb', line 375

def set_interface(interface)
  # set interface and reset
  value = interface == :swd ? 1 : 0   # set interface : JTAG=0, SWD=1
  dw "si #{value}"
  # pull a reset now
  dw 'RSetType 2' # reset via reset pin which should be same as manual reset pin
  # toggle.  Also forces CPU to halt when it comes out of reset
  dw 'r'          # reset and halts the device (prob not needed)
  dw 'halt'       # halt core just in case
end