origen_arm_debug 1.0.2 → 1.1.0

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: e5dd246d4525d4ced61bb06b8bccca56084e3ed9
4
- data.tar.gz: ef1eaa8501694c28aa03227326a2da6cf2e3c9b2
3
+ metadata.gz: e947a1abfa51a87475064a20b02b28a7e51dd720
4
+ data.tar.gz: 47840a0bc06b60f0dce4f030a6ae23c9d020e0ce
5
5
  SHA512:
6
- metadata.gz: 3d194a9455d7c34f0dfa0bf366f1aaa31e094f0eb470d3c209557faa4651a7edd70d8e1293630984c4a7d9b6eb73588410c80a446bc9532dad04c272d30e54af
7
- data.tar.gz: cec545de10b7f3bbe7f2c93b7f1c6053b074c583e3b42f24f8ca38c197decfd4e0b71e50fb407359ee6c317d267225138fedce4cb29f5eaaa550ee30cd158285
6
+ metadata.gz: d8679bb32de39d88f9fded1871c9bb47eec607dc8ab3c0f498a7f99d7d05d64719c831fc28df450806814fcc28277a8d3433cca5d931e8dbd50f42d8e1b8115f
7
+ data.tar.gz: cba98e60b245a3113719b7baec378482f5677307bb9a6e0685d1b9d1dccfc0c372d8cc9f1c41355e1db4c54ab40ae31af2c438d78315b95e936bb10fc782b9f4
data/config/commands.rb CHANGED
@@ -30,6 +30,8 @@ when "examples" # , "test"
30
30
  load "#{Origen.top}/lib/origen/commands/generate.rb"
31
31
  ARGV = %w(workout -t swd -e j750 -r approved)
32
32
  load "#{Origen.top}/lib/origen/commands/generate.rb"
33
+ ARGV = %w(workout -t config_test -e j750 -r approved/config_test)
34
+ load "#{Origen.top}/lib/origen/commands/generate.rb"
33
35
 
34
36
  if Origen.app.stats.changed_files == 0 &&
35
37
  Origen.app.stats.new_files == 0 &&
data/config/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module OrigenARMDebug
2
2
  MAJOR = 1
3
- MINOR = 0
4
- BUGFIX = 2
3
+ MINOR = 1
4
+ BUGFIX = 0
5
5
  DEV = nil
6
6
 
7
7
  VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
@@ -20,7 +20,8 @@ module OrigenARMDebug
20
20
  end
21
21
 
22
22
  if options[:jtag] || parent.respond_to?(:jtag)
23
- dps << sub_block(:jtag_dp, class_name: 'JTAG_DP')
23
+ options[:class_name] = 'JTAG_DP'
24
+ dps << sub_block(:jtag_dp, options)
24
25
  end
25
26
 
26
27
  Array(options[:mem_aps]).each do |name, base_address|
@@ -2,8 +2,19 @@ module OrigenARMDebug
2
2
  class JTAG_DP
3
3
  include Origen::Model
4
4
 
5
+ attr_reader :dpacc_select, :apacc_select
6
+
5
7
  def initialize(options = {})
6
- add_reg :ir, 0, size: 4
8
+ options = {
9
+ ir_size: 4,
10
+ idcode_select: 0b1110,
11
+ abort_select: 0b1000,
12
+ dpacc_select: 0b1010,
13
+ apacc_select: 0b1011
14
+ }.merge(options)
15
+ @dpacc_select = options[:dpacc_select]
16
+ @apacc_select = options[:apacc_select]
17
+ add_reg :ir, 0, size: options[:ir_size]
7
18
 
8
19
  # Virtual reg used to represent all of the various 35-bit scan chains
9
20
  reg :dr, 0, size: 35 do |reg|
@@ -12,7 +23,7 @@ module OrigenARMDebug
12
23
  reg.bit 0, :rnw
13
24
  end
14
25
 
15
- reg :idcode, 0b1110, access: :ro do |reg|
26
+ reg :idcode, options[:idcode_select], access: :ro do |reg|
16
27
  reg.bit 31..28, :version
17
28
  reg.bit 27..12, :partno
18
29
  reg.bit 11..1, :designer
@@ -42,7 +53,7 @@ module OrigenARMDebug
42
53
 
43
54
  add_reg :rdbuff, 0xC, access: :ro, reset: 0
44
55
 
45
- reg :abort, 0b1000, access: :wo do |reg|
56
+ reg :abort, options[:abort_select], access: :wo do |reg|
46
57
  reg.bit 0, :dapabort
47
58
  end
48
59
  end
@@ -33,7 +33,7 @@ module OrigenARMDebug
33
33
  dr[0].write(0)
34
34
  dr[2..1].write(reg.offset >> 2)
35
35
  dr[34..3].copy_all(reg)
36
- ir.write!(0b1010)
36
+ ir.write!(dpacc_select)
37
37
  dut.jtag.write_dr(dr)
38
38
 
39
39
  else
@@ -55,7 +55,7 @@ module OrigenARMDebug
55
55
  dr[0].write(0)
56
56
  dr[2..1].write(reg.offset >> 2)
57
57
  dr[34..3].copy_all(reg)
58
- ir.write!(0b1011)
58
+ ir.write!(apacc_select)
59
59
  dut.jtag.write_dr(dr, options)
60
60
  end
61
61
  end
@@ -86,7 +86,7 @@ module OrigenARMDebug
86
86
  dr[0].write(1)
87
87
  dr[2..1].write(reg.offset >> 2)
88
88
  dr[34..3].write(0)
89
- ir.write!(0b1010)
89
+ ir.write!(dpacc_select)
90
90
  dut.jtag.write_dr(dr)
91
91
 
92
92
  # Part 2 - Now read real data from RDBUFF (DP-Reg)
@@ -117,7 +117,7 @@ module OrigenARMDebug
117
117
  dr[0].write(1)
118
118
  dr[2..1].write(reg.offset >> 2)
119
119
  dr[34..3].write(0)
120
- ir.write!(0b1011)
120
+ ir.write!(apacc_select)
121
121
  dut.jtag.write_dr(dr)
122
122
 
123
123
  # Calling AP should provide any delay parameter for wait states between AP read request
@@ -133,7 +133,7 @@ module OrigenARMDebug
133
133
  dr[2..1].write(rdbuff.offset >> 2)
134
134
  dr[34..3].copy_all(reg)
135
135
  options[:mask] = options[:mask] << 3 unless options[:mask].nil?
136
- ir.write!(0b1010)
136
+ ir.write!(dpacc_select)
137
137
  dut.jtag.read_dr(dr, options)
138
138
  end
139
139
  end
@@ -13,7 +13,7 @@ module OrigenARMDebugDev
13
13
  # @example
14
14
  # $dut = OrigenARMDebugDev::DUT.new
15
15
  #
16
- def initialize
16
+ def initialize(options = {})
17
17
  add_reg :test, 0
18
18
 
19
19
  reg :test2, 0 do |reg|
@@ -5,7 +5,7 @@ module OrigenARMDebugDev
5
5
 
6
6
  # Adds jtag-required pins to the simple dut model
7
7
  # Returns nothing.
8
- def initialize
8
+ def initialize(options = {})
9
9
  super
10
10
  add_pin :tclk
11
11
  add_pin :tdi
@@ -15,18 +15,19 @@ module OrigenARMDebugDev
15
15
  add_pin :swd_clk
16
16
  add_pin :swd_dio
17
17
 
18
+ options[:class_name] = 'OrigenARMDebug::DAP'
19
+ options[:mem_aps] = {
20
+ mem_ap: {
21
+ base_address: 0x00000000,
22
+ latency: 16,
23
+ apreg_access_wait: 8,
24
+ apmem_access_wait: 8,
25
+ csw_reset: 0x23000040
26
+ },
27
+ mdm_ap: 0x01000000
28
+ }
18
29
  # Specify (customize) ARM Debug implementation details
19
- sub_block :arm_debug, class_name: 'OrigenARMDebug::DAP',
20
- mem_aps: {
21
- mem_ap: {
22
- base_address: 0x00000000,
23
- latency: 16,
24
- apreg_access_wait: 8,
25
- apmem_access_wait: 8,
26
- csw_reset: 0x23000040
27
- },
28
- mdm_ap: 0x01000000
29
- }
30
+ sub_block :arm_debug, options
30
31
  end
31
32
  end
32
33
  end
@@ -28,11 +28,10 @@ if your app is a plugin.
28
28
 
29
29
  ### How To Use
30
30
 
31
- Include the <code>OrigenARMDebug</code> module in your DUT class, then hook it up
32
- to the Origen register API via
31
+ The most common way to use the Arm Debugger plugin is through the Origen register API via
33
32
  <code>read_register</code> and <code>write_register</code> methods.
34
33
 
35
- You must also include a compatible physical driver depending on what debug
34
+ You must include a compatible physical driver depending on what debug
36
35
  interface your device has, one of the following can be used:
37
36
 
38
37
  * [JTAG](http://origen-sdk.org/jtag)
@@ -41,9 +40,8 @@ interface your device has, one of the following can be used:
41
40
  ~~~ruby
42
41
  class DUT
43
42
  include Origen::TopLevel
44
- include OrigenARMDebug
45
43
 
46
- # Also include the required physical driver, JTAG in this example
44
+ # Include the required physical driver, JTAG in this example
47
45
  include OrigenJTAG
48
46
 
49
47
  def initialize
@@ -55,7 +53,11 @@ class DUT
55
53
  # Simple example using default wait-states and latency:
56
54
  # mem_ap: APSEL = 0x00 (base_address[31:24])
57
55
  # mem2_ap: APSEL = 0x01 (base_address[31:24])
58
- sub_block :arm_debug, class_name: 'OrigenARMDebug::DAP', mem_aps: { mem_ap: 0x00000000, mem2_ap: 0x01000000 }
56
+ mem_aps = {
57
+ mem_ap: { base_address: 0x00000000 }
58
+ mem2_ap: { base_address: 0x10000000 }
59
+ }
60
+ sub_block :arm_debug, class_name: 'OrigenARMDebug::DAP', mem_aps: mem_aps
59
61
  end
60
62
 
61
63
  # Hook the ARMDebug module into the register API, any register read
@@ -97,6 +99,41 @@ You can also adjust the intermediate wait-states and latency parameters:
97
99
  dut.arm_debug.ahb_ap.apmem_access_wait = 16
98
100
  dut.arm_debug.ahb_ap.apreg_access_wait = 12
99
101
  dut.arm_debug.ahb_ap.latency = 8
102
+
103
+ # You can define these at instantiation as well
104
+ mem_aps = {
105
+ mem_ap: { base_address: 0x00000000, latency: 8, apreg_access_wait: 12, apmem_access_wait: 16 }
106
+ mem2_ap: { base_address: 0x10000000, latency: 8, apreg_access_wait: 12, apmem_access_wait: 16 }
107
+ }
108
+ sub_block :arm_debug, class_name: 'OrigenARMDebug::DAP', mem_aps: mem_aps
109
+ ~~~
110
+
111
+ When used with the JTAG physical driver the default IR size is 4 and the default register select values are:
112
+
113
+ ~~~
114
+ idcode_select = 0b1110
115
+ abort_select = 0b1000
116
+ dpacc_select = 0b1010
117
+ apacc_select = 0b1011
118
+ ~~~
119
+
120
+ You can set non-default values at instantiation like this:
121
+
122
+ ~~~ruby
123
+ mem_aps = {
124
+ mem_ap: { base_address: 0x00000000 }
125
+ mem2_ap: { base_address: 0x10000000 }
126
+ }
127
+ instantiation_options[:class_name] = 'OrigenARMDebug::DAP'
128
+ instantiation_options[:mem_aps] = mem_aps
129
+
130
+ instantiation_options[:ir_size] = 8
131
+ instantiation_options[:idcode_select] = 0xFE
132
+ instantiation_options[:abort_select] = 0xF8
133
+ instantiation_options[:dpacc_select] = 0xFA
134
+ instantiation_options[:apacc_select] = 0xFB
135
+
136
+ sub_block :arm_debug, instantiation_options
100
137
  ~~~
101
138
 
102
139
  ### Company Customization
@@ -0,0 +1,238 @@
1
+ % render "layouts/basic.html" do
2
+
3
+ %# HTML tags can be embedded in mark down files if you want to do specific custom
4
+ %# formatting like this, but in most cases that is not required.
5
+ <h1><%= Origen.app.namespace %> <span style="font-size: 14px">(<%= Origen.app.version %>)</span></h1>
6
+
7
+ ### Purpose
8
+
9
+ This library provides register and memory read/write and debug control capability via the ARM Debug Interface v5 Spec.
10
+
11
+ ### How To Import
12
+
13
+ In your Gemfile add:
14
+
15
+ ~~~ruby
16
+ gem "origen_arm_debug", ">= <%= Origen.app.version %>"
17
+ ~~~
18
+
19
+ or if your application is a plugin add this to your <code>.gemspec</code>
20
+
21
+ ~~~ruby
22
+ spec.add_development_dependency "origen_arm_debug", ">= <%= Origen.app.version %>"
23
+ ~~~
24
+
25
+ __NOTE:__ You will also need to include <code>require 'origen_arm_debug'</code> somewhere in your environment
26
+ if your app is a plugin.
27
+
28
+
29
+ ### How To Use
30
+
31
+ The most common way to use the Arm Debugger plugin is through the Origen register API via
32
+ <code>read_register</code> and <code>write_register</code> methods.
33
+
34
+ You must include a compatible physical driver depending on what debug
35
+ interface your device has, one of the following can be used:
36
+
37
+ * [JTAG](http://origen-sdk.org/jtag)
38
+ * [Single Wire Debug](http://origen-sdk.org/swd)
39
+
40
+ ~~~ruby
41
+ class DUT
42
+ include Origen::TopLevel
43
+
44
+ # Include the required physical driver, JTAG in this example
45
+ include OrigenJTAG
46
+
47
+ def initialize
48
+ reg :myreg, 0x0012, size: 16 do |reg|
49
+ reg.bits 15..8, :upper_byte
50
+ reg.bits 7..0, :lower_byte
51
+ end
52
+
53
+ # Simple example using default wait-states and latency:
54
+ # mem_ap: APSEL = 0x00 (base_address[31:24])
55
+ # mem2_ap: APSEL = 0x01 (base_address[31:24])
56
+ mem_aps = {
57
+ mem_ap: { base_address: 0x00000000 }
58
+ mem2_ap: { base_address: 0x10000000 }
59
+ }
60
+ sub_block :arm_debug, class_name: 'OrigenARMDebug::DAP', mem_aps: mem_aps
61
+ end
62
+
63
+ # Hook the ARMDebug module into the register API, any register read
64
+ # requests will use the ARM Debug protocol by default
65
+ def read_register(reg, options={})
66
+ arm_debug.mem_ap.read_register(reg, options)
67
+ end
68
+
69
+ # As above for write requests
70
+ def write_register(reg, options={})
71
+ arm_debug.mem_ap.write_register(reg, options)
72
+ end
73
+ end
74
+
75
+ DUT.new.myreg.write!(0x55AA) # => Will generate the required vectors using the ARM debug protocol
76
+ ~~~
77
+
78
+ You can access the lower-level API using conventional Origen register transactions:
79
+
80
+ ~~~ruby
81
+ arm_debug.sw_dp.idcode.read!(0x2BA01477)
82
+ arm_debug.sw_dp.ctrlstat.write!(0x5000_0000) # Power-up
83
+ arm_debug.sw_dp.ctrlstat.read!(0xF0000000) # Verify
84
+ arm_debug.ahb_ap.idr.read!(0x24770011)
85
+ arm_debug.sw_dp.select.write!(0) # Select AHB-AP, bank 0
86
+
87
+ # Set the SIZE field of CSW to 0x2 (32-bit transfers) + AddrInc=1
88
+ arm_debug.ahb_ap.csw.write!(0x23000052)
89
+ ~~~
90
+
91
+ You can also adjust the intermediate wait-states and latency parameters:
92
+
93
+ * [AP.apreg_access_wait](http://origen-sdk.org/arm_debug/api/OrigenARMDebug/AP.html#apreg_access_wait-instance_method)
94
+ * [MemAP.apmem_access_wait](http://origen-sdk.org/arm_debug/api/OrigenARMDebug/MemAP.html#apmem_access_wait-instance_method)
95
+ * [MemAP.latency](http://origen-sdk.org/arm_debug/api/OrigenARMDebug/MemAP.html#latency-instance_method)
96
+
97
+ ~~~ruby
98
+ # Assuming ahb_ap has been previously defined
99
+ dut.arm_debug.ahb_ap.apmem_access_wait = 16
100
+ dut.arm_debug.ahb_ap.apreg_access_wait = 12
101
+ dut.arm_debug.ahb_ap.latency = 8
102
+
103
+ # You can define these at instantiation as well
104
+ mem_aps = {
105
+ mem_ap: { base_address: 0x00000000, latency: 8, apreg_access_wait: 12, apmem_access_wait: 16 }
106
+ mem2_ap: { base_address: 0x10000000, latency: 8, apreg_access_wait: 12, apmem_access_wait: 16 }
107
+ }
108
+ sub_block :arm_debug, class_name: 'OrigenARMDebug::DAP', mem_aps: mem_aps
109
+ ~~~
110
+
111
+ When used with the JTAG physical driver these are the default IR size 4 and the default register select values are:
112
+
113
+ ~~~
114
+ idcode_select = 0b1110
115
+ abort_select = 0b1000
116
+ dpacc_select = 0b1010
117
+ apacc_select = 0b1011
118
+ ~~~
119
+
120
+ You can set non-default values at instantiation like this:
121
+
122
+ ~~~ruby
123
+ mem_aps = {
124
+ mem_ap: { base_address: 0x00000000 }
125
+ mem2_ap: { base_address: 0x10000000 }
126
+ }
127
+ instantiation_options[:class_name] = 'OrigenARMDebug::DAP'
128
+ instantiation_options[:mem_aps] = mem_aps
129
+
130
+ instantiation_options[:ir_size] = 8
131
+ instantiation_options[:idcode_select] = 0xFE
132
+ instantiation_options[:abort_select] = 0xF8
133
+ instantiation_options[:dpacc_select] = 0xFA
134
+ instantiation_options[:apacc_select] = 0xFB
135
+
136
+ sub_block :arm_debug, instantiation_options
137
+ ~~~
138
+
139
+ ### Company Customization
140
+
141
+ It may be the case that your application needs additional, customized Access Ports (AP) which are allowed but
142
+ not defined by the standard ARM Debug Interface. The following example shows how you can use the generic AP
143
+ class as a starting point and add extra registers as defined by your specific implementation.
144
+
145
+ ~~~ruby
146
+ require 'origen_arm_debug'
147
+ module ARMDebugCOMPANY
148
+ # New AP class inherited from generic AP class provided by origen_arm_debug
149
+ class CustomAP < OrigenARMDebug::AP
150
+ # Initialize AP parameters and registers
151
+ def initialize(options = {})
152
+ super
153
+
154
+ instantiate_registers(options)
155
+
156
+ # Standard AP-register latency for most devices. Can be overriden by
157
+ # top-level if necessary
158
+ @apreg_access_wait = 8
159
+ end
160
+
161
+ # Add example registers associated with CustomAP.
162
+ #
163
+ # Custom registers can also be added by ARMDebug owner with add_reg or
164
+ # overloading entire instantiate_registers methd
165
+ #
166
+ # Ex: arm_debug.company_ap.add_reg(:custom_reg_3, 0x08)
167
+ def instantiate_registers(options = {})
168
+ add_reg :custom_reg_1, 0x00
169
+ add_reg :custom_reg_2, 0x04
170
+ end
171
+ end
172
+ end
173
+
174
+
175
+ class DUT
176
+ include Origen::TopLevel
177
+ include ARMDebugCOMPANY
178
+
179
+ # Also include the required physical driver, JTAG in this example
180
+ include OrigenJTAG
181
+
182
+ def initialize
183
+ reg :myreg, 0x0012, size: 16 do |reg|
184
+ reg.bits 15..8, :upper_byte
185
+ reg.bits 7..0, :lower_byte
186
+ end
187
+
188
+ # Some standard AP parameters values
189
+ std_memap_config = { latency: 16, apreg_access_wait: 8, apmem_access_wait: 8, csw_reset: 0x23000040 }
190
+
191
+ # 2 MemAPs using standard parameters (above)
192
+ mem_aps = {
193
+ mem_ap_0: { base_address: 0x00000000 }.merge(std_memap_config), # AP Select = 0x00
194
+ mem_ap_1: { base_address: 0x01000000 }.merge(std_memap_config), # AP Select = 0x01
195
+ }
196
+
197
+ # Add Company-Customized AP class @ APSEL = 0x04
198
+ custom_ap = {
199
+ company_ap: { class_name: 'ARMDebugCOMPANY::CustomAP', base_address: 0x04000000, apreg_access_wait: 8 }
200
+ }
201
+
202
+ sub_block :arm_debug, class_name: 'OrigenARMDebug::DAP',
203
+ base_address: 0,
204
+ mem_aps: mem_aps,
205
+ aps: custom_ap
206
+ end
207
+ end
208
+ DUT.new.arm_debug.company_ap.custom_reg_1.write!(0x55AA)
209
+ ~~~
210
+
211
+ ### How To Setup a Development Environment
212
+
213
+ [Clone the repository from Github](https://github.com/Origen-SDK/origen_arm_debug).
214
+
215
+ An instance of the OrigenARMDebug driver is hooked up to a dummy DUT
216
+ object for use in the console:
217
+
218
+ ~~~
219
+ origen i
220
+
221
+ > dut.arm_debug
222
+ => #<OrigenARMDebug::Driver:0x0000001ee48e78>
223
+ ~~~
224
+
225
+ Follow the instructions here if you want to make a 3rd party app
226
+ workspace use your development copy of the OrigenARMDebug plugin:
227
+ [Setting up a Plugin Development Environment](http://origen-sdk.org/origen/guides/plugins)
228
+
229
+ This plugin also contains a test suite, makes sure this passes before committing
230
+ any changes!
231
+
232
+ ~~~
233
+ origen examples
234
+ ~~~
235
+
236
+ <%= disqus_comments %>
237
+
238
+ % end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: origen_arm_debug
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ronnie Lajaunie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-16 00:00:00.000000000 Z
11
+ date: 2018-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: origen
@@ -101,6 +101,7 @@ files:
101
101
  - lib/origen_arm_debug_dev/dut_swd.rb
102
102
  - pattern/workout.rb
103
103
  - templates/web/index.md.erb
104
+ - templates/web/index.md.erb~
104
105
  - templates/web/layouts/_basic.html.erb
105
106
  - templates/web/partials/_navbar.html.erb
106
107
  - templates/web/release_notes.md.erb
@@ -130,3 +131,4 @@ specification_version: 4
130
131
  summary: Provides an Origen API to perform register read and write operations via
131
132
  the ARM_DEBUG protocol.
132
133
  test_files: []
134
+ has_rdoc: