origen_memory_image 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d364a5cedbccf382fae2a6bf7732604387fbdaf1
4
- data.tar.gz: 87baaf7587ea2ee10562844104638ccc1bc46252
3
+ metadata.gz: dbd9fff5f4d4a999086de046e0c99a016a475f15
4
+ data.tar.gz: a06173b18adeab5d1ce72f919cfa6b239bc04712
5
5
  SHA512:
6
- metadata.gz: d6873cb75247b6fbc0924706c982f6b0d7edf980b8137d791e48c7a3344336254f85b5e352a6ced1170c9b3a112614cc47a0375d6d9dcfdf0e3496cba3a7d218
7
- data.tar.gz: c4afd730adea6589dce1bb53cf243283c39a66b6257681db1888c4e84274abdd3704453b74de010b647ba97b9acec4ef31d12d26041e9b1f10c952f606bbc1c8
6
+ metadata.gz: 549bd0444aa5942e410d5ceece65c21bed5d4561932e1632e9ca605838f8599eafeb4dd50cf6b24616564645b90b3eaf67550e6a6ea86d07fb2f2b6be38f7298
7
+ data.tar.gz: cb109a9dc9fa36c486e8026ea5804ce7dd721882ecb2da6e76e63e915c6a07fcb6abd3ef3973632d1a8b766a4050ef0e94702135f669c5e7226bda6c1ce4b308
data/config/commands.rb CHANGED
@@ -1,14 +1,12 @@
1
1
  # This file should be used to extend the origen command line tool with tasks
2
2
  # specific to your application.
3
- # The comments below should help to get started and you can also refer to
4
- # lib/origen/commands.rb in your Origen core workspace for more examples and
5
- # inspiration.
6
3
  #
7
4
  # Also see the official docs on adding commands:
8
- # http://origen.freescale.net/origen/latest/guides/custom/commands/
5
+ # http://origen-sdk.org/origen/guides/custom/commands/
9
6
 
10
7
  # Map any command aliases here, for example to allow origen -x to refer to a
11
8
  # command called execute you would add a reference as shown below:
9
+
12
10
  aliases ={
13
11
  # "-x" => "execute",
14
12
  }
@@ -17,76 +15,37 @@ aliases ={
17
15
  # the above alias table and should not be removed.
18
16
  @command = aliases[@command] || @command
19
17
 
20
- # Smome helper methods to enable test coverage, these will eventually be
21
- # added to Origen Core, but they need to be here for now
22
- def path_to_coverage_report
23
- require 'pathname'
24
- Pathname.new("#{Origen.root}/coverage/index.html").relative_path_from(Pathname.pwd)
25
- end
26
-
27
- def enable_coverage(name, merge=true)
28
- if ARGV.delete("-c") || ARGV.delete("--coverage")
29
- require 'simplecov'
30
- SimpleCov.start do
31
- command_name name
32
- add_filter "DO_NOT_HAND_MODIFY" # Exclude all imports
33
-
34
- at_exit do
35
- SimpleCov.result.format!
36
- puts ""
37
- puts "To view coverage report:"
38
- puts " firefox #{path_to_coverage_report} &"
39
- puts ""
40
- end
41
- end
42
- yield
43
- else
44
- yield
45
- end
46
- end
47
-
48
18
  # Now branch to the specific task code
49
19
  case @command
50
20
 
51
21
  # Run the unit tests
52
22
  when "specs"
53
- enable_coverage("specs") do
54
- ARGV.unshift "spec"
55
- require "rspec"
56
- # For some unidentified reason Rspec does not autorun on this version
57
- if RSpec::Core::Version::STRING && RSpec::Core::Version::STRING == "2.11.1"
58
- RSpec::Core::Runner.run ARGV
59
- else
60
- require "rspec/autorun"
61
- end
62
- end
63
- exit 0 # This will never be hit on a fail, RSpec will automatically exit 1
23
+ require "rspec"
24
+ exit RSpec::Core::Runner.run(['spec'])
64
25
 
65
26
  # Run the example-based (diff) tests
66
27
  #when "examples"
67
28
  # Origen.load_application
68
29
  # status = 0
69
- # enable_coverage("examples") do
70
30
  #
71
- # # Compiler tests
72
- # ARGV = %w(templates/example.txt.erb -t debug -r approved)
73
- # load "origen/commands/compile.rb"
74
- # # Pattern generator tests
75
- # #ARGV = %w(some_pattern -t debug -r approved)
76
- # #load "#{Origen.top}/lib/origen/commands/generate.rb"
31
+ # # Compiler tests
32
+ # ARGV = %w(templates/example.txt.erb -t debug -r approved)
33
+ # load "origen/commands/compile.rb"
34
+ # # Pattern generator tests
35
+ # #ARGV = %w(some_pattern -t debug -r approved)
36
+ # #load "#{Origen.top}/lib/origen/commands/generate.rb"
77
37
  #
78
- # if Origen.app.stats.changed_files == 0 &&
79
- # Origen.app.stats.new_files == 0 &&
80
- # Origen.app.stats.changed_patterns == 0 &&
81
- # Origen.app.stats.new_patterns == 0
38
+ # if Origen.app.stats.changed_files == 0 &&
39
+ # Origen.app.stats.new_files == 0 &&
40
+ # Origen.app.stats.changed_patterns == 0 &&
41
+ # Origen.app.stats.new_patterns == 0
82
42
  #
83
- # Origen.app.stats.report_pass
84
- # else
85
- # Origen.app.stats.report_fail
86
- # status = 1
87
- # end
88
- # puts ""
43
+ # Origen.app.stats.report_pass
44
+ # else
45
+ # Origen.app.stats.report_fail
46
+ # status = 1
89
47
  # end
48
+ # puts
90
49
  # exit status # Exit with a 1 on the event of a failure per std unix result codes
91
50
 
92
51
  # Always leave an else clause to allow control to fall back through to the
@@ -100,8 +59,4 @@ else
100
59
  EOT
101
60
  # examples Run the examples (tests), -c will enable coverage
102
61
 
103
- # Uncomment the following and update the path with the file
104
- # that handles the commands that are shared from this plugin
105
- #require "#{Origen.app_root}/config/shared_commands"
106
-
107
62
  end
data/config/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module OrigenMemoryImage
2
2
  MAJOR = 0
3
3
  MINOR = 5
4
- BUGFIX = 0
4
+ BUGFIX = 2
5
5
  DEV = nil
6
6
 
7
7
  VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
@@ -28,9 +28,26 @@ module OrigenMemoryImage
28
28
  def to_a(options = {})
29
29
  options = {
30
30
  flip_endianness: false,
31
- data_width_in_bytes: 4
31
+ data_width_in_bytes: 4,
32
+ crop: []
32
33
  }.merge(options)
33
34
  data = extract_addr_data(options)
35
+
36
+ if options[:crop].count > 0
37
+ cropped_data = []
38
+ data.each do |addr, data|
39
+ case options[:crop].count
40
+ when 1
41
+ cropped_data.push([addr, data]) if addr >= options[:crop][0]
42
+ when 2
43
+ cropped_data.push([addr, data]) if addr >= options[:crop][0] && addr <= options[:crop][1]
44
+ else
45
+ fail 'crop option can only be array of size 1 or 2'
46
+ end
47
+ end
48
+ data = cropped_data
49
+ end
50
+
34
51
  if options[:flip_endianness] || options[:endianness_change]
35
52
  data.map do |v|
36
53
  [v[0], flip_endianness(v[1], 4)]
@@ -79,14 +79,20 @@ my_srec.start_address # => 0x3000_F000
79
79
  ~~~
80
80
 
81
81
  The <code>to_a</code> method returns the file content as an array of address/data pairs,
82
- this method supports options to set the data width and to flip the data endianness:
82
+ this method supports options to set the data width, flip the data endianness, and crop the data
83
+ between starting and ending address:
83
84
 
84
85
  ~~~ruby
85
- my_srec.to_a # => [[0x3000_F000, 0x11223344], [0x3000_F004, 0x55667788], ...]
86
+ my_srec.to_a # => [[0x3000_F000, 0x11223344], [0x3000_F004, 0x55667788], [0x3000_F008, 0x99AABBCC], ...]
86
87
 
87
- my_srec.to_a(flip_endianness: true) # => [[0x3000_F000, 0x44332211], [0x3000_F004, 0x88776655], ...]
88
+ my_srec.to_a(flip_endianness: true) # => [[0x3000_F000, 0x44332211], [0x3000_F004, 0x88776655], [0x3000_F008, 0x99AABBCC], ...]
89
+
90
+ my_srec.to_a(data_width_in_bytes: 2) # => [[0x3000_F000, 0x1122], [0x3000_F002, 0x3344], [0x3000_F004, 0x5566], ...]
91
+
92
+ my_srec.to_a(crop: [0x3000_F004]) # => [[0x3000_F004, 0x55667788], [0x3000_F008, 0x99AABBCC], ...]
93
+
94
+ my_srec.to_a(crop: [0x3000_F000, 0x3000_F004]) # => [[0x3000_F000, 0x11223344], [0x3000_F004, 0x55667788]]
88
95
 
89
- my_srec.to_a(data_width_in_bytes: 2) # => [[0x3000_F000, 0x1122], [0x3000_F002, 0x3344], [0x3000_F004, 0x5566], ...]
90
96
  ~~~
91
97
 
92
98
  Such an array can be iterated on like this to separate the address and data:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: origen_memory_image
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
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-08-07 00:00:00.000000000 Z
11
+ date: 2016-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: origen