origen_debuggers 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c69434410a715da3818e4cabc0246700dd0e7a52
4
- data.tar.gz: 55f7bb58c4aa7addbf790e5552356f30bf9abcb3
3
+ metadata.gz: 3953a38f824c2c77649cf0059f8176f646396847
4
+ data.tar.gz: dbf6a2c4c0a22d7aff1ad56468e914216aa5ff65
5
5
  SHA512:
6
- metadata.gz: ddfb4384f7a2901c05543c4277b784ae2d9e864c4caa3a8fb3db5720aed9173913fea668b3e772f085ea6d5c96c5faf460b95ff060ffb41f0b1cd3f94f61cf7b
7
- data.tar.gz: 55edbaaab07ab7fe8efd089a3464bcf187edd91387162846f8cbb086423ace9d5f48c07a35fbda7edd94ba8d75aacfc306e1f6f5ff7976bd2e74a55e0ada876d
6
+ metadata.gz: f18be4760f48bc01f20eb6612a84ddd1cef548e47b9542a5e92558027b622cac8e1c74cba855995520028fe87ec590e71b87f34d16ae3ed2478d9d115643963b
7
+ data.tar.gz: 155582f087d66bd897e38b211f285ce03537f497e805ecab57fd94079b31181c59891ce7ed6428d69833589e6364f64fe0cde714e1a79785d488002c9064951b
data/config/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module OrigenDebuggers
2
2
  MAJOR = 0
3
3
  MINOR = 5
4
- BUGFIX = 1
4
+ BUGFIX = 2
5
5
  DEV = nil
6
6
 
7
7
  VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
@@ -226,21 +226,47 @@ module OrigenDebuggers
226
226
 
227
227
  # Read 8 bits of data to the given byte address
228
228
  def read8(data, options = {})
229
- read_memory(extract_address(data, options), number_of_bytes: 1)
229
+ read_memory(extract_address(data, options), number: 1)
230
230
  end
231
231
  alias_method :read_byte, :read8
232
232
  alias_method :read_8, :read8
233
233
 
234
234
  # Read 16 bits of data to the given byte address
235
235
  def read16(data, options = {})
236
- read_memory(extract_address(data, options), number_of_bytes: 2)
236
+ read_memory(extract_address(data, options), number: 2)
237
237
  end
238
238
  alias_method :read_word, :read16
239
239
  alias_method :read_16, :read16
240
240
 
241
241
  # Read 32 bits of data to the given byte address
242
+ #
243
+ # data can be array of registers, if array of data then will auto-incrememnt address
242
244
  def read32(data, options = {})
243
- read_memory(extract_address(data, options), number_of_bytes: 4)
245
+ options = { optimize: false, # whether to use a single command to do the read
246
+ # user may care regarding endianness
247
+ size: 32, # size of each item in bits
248
+ number: 1, # default number of items
249
+ }.merge(options)
250
+ options[:optimize] = options[:optimized] if options[:optimized]
251
+
252
+ if data.is_a?(Array)
253
+ if options[:optimize]
254
+ # for optimized option assume single starting address for data in array
255
+ read_memory(extract_address(data, options), size: options[:size], number: data.length)
256
+ else
257
+ data.each_index do |i|
258
+ data_item = data[i]
259
+ # do separate writes for each 32-bit word
260
+ read_memory(extract_address(data_item, options) + i * (options[:size] / 8), size: options[:size])
261
+ end
262
+ end
263
+ else
264
+ if options[:optimize]
265
+ read_memory(extract_address(data, options), size: options[:size], number: options[:number])
266
+ else
267
+ read_memory(extract_address(data, options), number: (options[:size] / 8))
268
+ end
269
+ end
244
270
  end
245
271
  alias_method :read_longword, :read32
246
272
  alias_method :read_32, :read32
@@ -341,11 +367,41 @@ module OrigenDebuggers
341
367
 
342
368
  # Other methods can expose unique features of a given debugger
343
369
  module Custom
370
+ def set_interface(interface)
371
+ # set interface and reset
372
+ value = interface == :swd ? 1 : 0 # set interface : JTAG=0, SWD=1
373
+ dw "si #{value}"
374
+ # pull a reset now
375
+ dw 'RSetType 2' # reset via reset pin which should be same as manual reset pin
376
+ # toggle. Also forces CPU to halt when it comes out of reset
377
+ dw 'r' # reset and halts the device (prob not needed)
378
+ dw 'halt' # halt core just in case
379
+ end
380
+
381
+ def halt
382
+ dw 'halt'
383
+ end
384
+
385
+ def quit
386
+ dw 'q'
387
+ end
388
+
344
389
  def read_memory(address, options = {})
345
390
  options = {
346
- number_of_bytes: 1
391
+ number: 1, # number of items to read
392
+ size: 8 # number of bits in each item
347
393
  }.merge(options)
348
- dw "mem 0x#{address.to_s(16).upcase}, #{options[:number_of_bytes]}"
394
+
395
+ if options[:size] == 32
396
+ dw "mem32 0x#{address.to_s(16).upcase}, #{options[:number].to_hex}"
397
+ elsif options[:size] == 16
398
+ dw "mem16 0x#{address.to_s(16).upcase}, #{options[:number].to_hex}"
399
+ elsif options[:size] == 8
400
+ dw "mem 0x#{address.to_s(16).upcase}, #{options[:number].to_hex}"
401
+ # not sure difference between mem and mem8
402
+ else
403
+ fail 'You must supply a valid :size option!'
404
+ end
349
405
  end
350
406
  end
351
407
  include Custom
data/pattern/_workout.rb CHANGED
@@ -34,11 +34,38 @@ ss "Verify write16"
34
34
  $tester.write16 0x55AA, :address => 0x12
35
35
  ss "Verify write32"
36
36
  $tester.write32 0x55AA_3344, :address => 0x12
37
+
38
+ ss "Verify read8"
39
+ $tester.read8 0x55, :address => 0x12
40
+ ss "Verify read16"
41
+ $tester.read16 0x55AA, :address => 0x12
42
+ ss "Verify read32"
43
+ $tester.read32 0x55AA_3344, :address => 0x12
44
+ ss "Verify read32, optimized"
45
+ $tester.read32 0x55AA_3344, address: 0x12, optimize:true
46
+
47
+ ss "Verify Array of 32-bit data"
48
+ $tester.read32 [0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF], address: 0x12
49
+ ss "Verify Array of 32-bit data, optimized"
50
+ $tester.read32 [0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF], address: 0x12, optimize: true
51
+
37
52
  ss "Verify write with a register"
38
53
  $tester.write $dut.reg(:reg32)
39
54
  ss "Verify write with a data value"
40
55
  $tester.write 0x55, :address => 0x12, :size => 8
41
56
  ss "Verify read with a register"
42
57
  $tester.read $dut.reg(:reg32)
43
- ss "Verify read with a data value"
58
+ ss "Verify read with a register, optimized"
59
+ $tester.read $dut.reg(:reg32), optimize: true
60
+ ss "Verify read with register and following 3 words, optimized"
61
+ $tester.read $dut.reg(:reg32), number: 4, optimize: true
62
+ ss "Verify read with an 8-bit data value"
44
63
  $tester.read 0x55, :address => 0x12, :size => 8
64
+ ss "Verify read with a 16-bit data value"
65
+ $tester.read 0x5555, :address => 0x12, :size => 16
66
+ ss "Verify read with a 32-bit data value"
67
+ $tester.read 0x55555555, :address => 0x12, :size => 32
68
+
69
+
70
+ ss "Verify delay of 10k mS"
71
+ $tester.delay(10000)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: origen_debuggers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen McGinty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-01 00:00:00.000000000 Z
11
+ date: 2017-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: origen
@@ -112,10 +112,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  version: 1.8.11
113
113
  requirements: []
114
114
  rubyforge_project:
115
- rubygems_version: 2.2.2
115
+ rubygems_version: 2.6.7
116
116
  signing_key:
117
117
  specification_version: 4
118
118
  summary: Provides Origen tester models to drive bench debuggers such as the Segger
119
119
  J-Link.
120
120
  test_files: []
121
- has_rdoc: