origen_debuggers 0.5.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 +7 -0
- data/config/application.rb +75 -0
- data/config/commands.rb +63 -0
- data/config/development.rb +17 -0
- data/config/environment.rb +32 -0
- data/config/users.rb +18 -0
- data/config/version.rb +8 -0
- data/lib/origen_debuggers/base.rb +17 -0
- data/lib/origen_debuggers/j_link.rb +351 -0
- data/lib/origen_debuggers/p_and_e.rb +309 -0
- data/lib/origen_debuggers/p_e/jtag_end.txt +1 -0
- data/lib/origen_debuggers/p_e/none.txt +0 -0
- data/lib/origen_debuggers/test/dut.rb +34 -0
- data/lib/origen_debuggers.rb +3 -0
- data/pattern/_workout.rb +44 -0
- data/pattern/jlink_workout.rb +5 -0
- data/pattern/pe_low_level.rb +9 -0
- data/templates/web/index.md.erb +66 -0
- data/templates/web/layouts/_basic.html.erb +16 -0
- data/templates/web/partials/_navbar.html.erb +22 -0
- data/templates/web/release_notes.md.erb +5 -0
- metadata +107 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 74c4e99f28fcc05473705a1f542348caa1c2f45a
|
4
|
+
data.tar.gz: 0c2ef5364b90d4681a253a32c5688981a7a11f92
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c8df34c5d6a5ea81ab1eb818e865db22dd9d3237313658a6aaa40734d8fad222c0a4cce2ee548236a1254b42cb754a1b765f59c3c54b83d7ea4fcbd1f5e96ecf
|
7
|
+
data.tar.gz: 28a013a2731b845b8fc98543985440f7d499f6a75a900d895606391b1838552bab8700fe696193221384278a059e97f8f867257aad354395740fe51a0c419d17
|
@@ -0,0 +1,75 @@
|
|
1
|
+
class OrigenDebuggersApplication < Origen::Application
|
2
|
+
|
3
|
+
# See http://origen.freescale.net/origen/latest/api/Origen/Application/Configuration.html
|
4
|
+
# for a full list of the configuration options available
|
5
|
+
|
6
|
+
# This information is used in headers and email templates, set it specific
|
7
|
+
# to your application
|
8
|
+
config.name = "Origen Debuggers"
|
9
|
+
config.initials = "OrigenDebuggers"
|
10
|
+
config.rc_url = "git@github.com:Origen-SDK/origen_debuggers.git"
|
11
|
+
config.release_externally = true
|
12
|
+
|
13
|
+
config.web_directory = "git@github.com:Origen-SDK/Origen-SDK.github.io.git/debuggers"
|
14
|
+
config.web_domain = "http://origen-sdk.org/debuggers"
|
15
|
+
|
16
|
+
# When false Origen will be less strict about checking for some common coding errors,
|
17
|
+
# it is recommended that you leave this to true for better feedback and easier debug.
|
18
|
+
# This will be the default setting in Origen v3.
|
19
|
+
config.strict_errors = true
|
20
|
+
|
21
|
+
config.semantically_version = true
|
22
|
+
|
23
|
+
# By default all generated output will end up in ./output.
|
24
|
+
# Here you can specify an alternative directory entirely, or make it dynamic such that
|
25
|
+
# the output ends up in a setup specific directory.
|
26
|
+
#config.output_directory do
|
27
|
+
# "#{Origen.root}/output/#{$dut.class}"
|
28
|
+
#end
|
29
|
+
|
30
|
+
# Similary for the reference files, generally you want to setup the reference directory
|
31
|
+
# structure to mirror that of your output directory structure.
|
32
|
+
#config.reference_directory do
|
33
|
+
# "#{Origen.root}/.ref/#{$dut.class}"
|
34
|
+
#end
|
35
|
+
|
36
|
+
config.lint_test = {
|
37
|
+
# Require the lint tests to pass before allowing a release to proceed
|
38
|
+
run_on_tag: true,
|
39
|
+
# Auto correct violations where possible whenever 'origen lint' is run
|
40
|
+
auto_correct: true,
|
41
|
+
# Limit the testing for large legacy applications
|
42
|
+
#level: :easy,
|
43
|
+
# Run on these directories/files by default
|
44
|
+
#files: ["lib", "config/application.rb"],
|
45
|
+
}
|
46
|
+
|
47
|
+
# Ensure that all tests pass before allowing a release to continue
|
48
|
+
def validate_release
|
49
|
+
if !system("origen examples")
|
50
|
+
puts "Sorry but you can't release with failing tests, please fix them and try again."
|
51
|
+
exit 1
|
52
|
+
else
|
53
|
+
puts "All tests passing, proceeding with release process!"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Run the tests before deploying to generate test coverage numbers
|
58
|
+
def before_deploy_site
|
59
|
+
Dir.chdir Origen.root do
|
60
|
+
system "origen examples -c"
|
61
|
+
#system "origen specs -c"
|
62
|
+
dir = "#{Origen.root}/web/output/coverage"
|
63
|
+
FileUtils.remove_dir(dir, true) if File.exists?(dir)
|
64
|
+
system "mv #{Origen.root}/coverage #{dir}"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# This will automatically deploy your documentation after every tag
|
69
|
+
def after_release_email(tag, note, type, selector, options)
|
70
|
+
command = "origen web compile --remote --api"
|
71
|
+
Dir.chdir Origen.root do
|
72
|
+
system command
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
data/config/commands.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# This file should be used to extend the origen command line tool with tasks
|
2
|
+
# specific to your application.
|
3
|
+
#
|
4
|
+
# Also see the official docs on adding commands:
|
5
|
+
# http://origen-sdk.org/origen/guides/custom/commands/
|
6
|
+
|
7
|
+
# Map any command aliases here, for example to allow origen -x to refer to a
|
8
|
+
# command called execute you would add a reference as shown below:
|
9
|
+
aliases ={
|
10
|
+
# "-x" => "execute",
|
11
|
+
}
|
12
|
+
|
13
|
+
# The requested command is passed in here as @command, this checks it against
|
14
|
+
# the above alias table and should not be removed.
|
15
|
+
@command = aliases[@command] || @command
|
16
|
+
|
17
|
+
# Now branch to the specific task code
|
18
|
+
case @command
|
19
|
+
|
20
|
+
## Run the unit tests
|
21
|
+
#when "specs"
|
22
|
+
# require "rspec"
|
23
|
+
# exit RSpec::Core::Runner.run(['spec'])
|
24
|
+
|
25
|
+
# Run the example-based (diff) tests
|
26
|
+
when "examples"
|
27
|
+
Origen.load_application
|
28
|
+
status = 0
|
29
|
+
|
30
|
+
# Compiler tests
|
31
|
+
#ARGV = %w(templates/example.txt.erb -t debug -r approved)
|
32
|
+
#load "origen/commands/compile.rb"
|
33
|
+
# Pattern generator tests
|
34
|
+
ARGV = %w(regression.list -t jlink -r approved)
|
35
|
+
load "#{Origen.top}/lib/origen/commands/generate.rb"
|
36
|
+
|
37
|
+
ARGV = %w(pe_regression.list -t pe -r approved)
|
38
|
+
load "#{Origen.top}/lib/origen/commands/generate.rb"
|
39
|
+
|
40
|
+
if Origen.app.stats.changed_files == 0 &&
|
41
|
+
Origen.app.stats.new_files == 0 &&
|
42
|
+
Origen.app.stats.changed_patterns == 0 &&
|
43
|
+
Origen.app.stats.new_patterns == 0
|
44
|
+
|
45
|
+
Origen.app.stats.report_pass
|
46
|
+
else
|
47
|
+
Origen.app.stats.report_fail
|
48
|
+
status = 1
|
49
|
+
end
|
50
|
+
puts
|
51
|
+
exit status # Exit with a 1 on the event of a failure per std unix result codes
|
52
|
+
|
53
|
+
# Always leave an else clause to allow control to fall back through to the
|
54
|
+
# Origen command handler.
|
55
|
+
# You probably want to also add the command details to the help shown via
|
56
|
+
# origen -h, you can do this be assigning the required text to @application_commands
|
57
|
+
# before handing control back to Origen. Un-comment the example below to get started.
|
58
|
+
else
|
59
|
+
@application_commands = <<-EOT
|
60
|
+
examples Run the examples (tests), -c will enable coverage
|
61
|
+
EOT
|
62
|
+
|
63
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# This file is similar to environment.rb and will be loaded
|
2
|
+
# automatically at the start of each invocation of Origen.
|
3
|
+
#
|
4
|
+
# However the major difference is that it will not be loaded
|
5
|
+
# if the application is imported by a 3rd party app - in that
|
6
|
+
# case only environment.rb is loaded.
|
7
|
+
#
|
8
|
+
# Therefore this file should be used to load anything you need
|
9
|
+
# to setup a development environment for this app, normally
|
10
|
+
# this would be used to load some dummy classes to instantiate
|
11
|
+
# your objects so that they can be tested and/or interacted with
|
12
|
+
# in the console.
|
13
|
+
module OrigenDebuggers
|
14
|
+
module Test
|
15
|
+
autoload :DUT, "origen_debuggers/test/dut"
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# This file will be required by Origen before your target is loaded, you
|
2
|
+
# can use this to require all of your files, which is the easiest way
|
3
|
+
# to get started. As your experience grows you may wish to require only the
|
4
|
+
# minimum files required to allow the target to be initialized and let
|
5
|
+
# each class require its own dependencies.
|
6
|
+
#
|
7
|
+
# It is recommended that you keep all of your application logic in lib/
|
8
|
+
# The lib directory has already been added to the search path and so any files
|
9
|
+
# in there can be referenced from here with a relative path.
|
10
|
+
#
|
11
|
+
# Note that pattern files do not need to be referenced from here and these
|
12
|
+
# will be located automatically by origen.
|
13
|
+
|
14
|
+
# This says load the file "lib/pioneer.rb" the first time anyone makes a
|
15
|
+
# reference to the class name 'Pioneer'.
|
16
|
+
#autoload :Pioneer, "pioneer"
|
17
|
+
# This is generally preferable to using require which will load the file
|
18
|
+
# regardless of whether it is needed by the current target or not:
|
19
|
+
#require "pioneer"
|
20
|
+
# Sometimes you have to use require however:-
|
21
|
+
# 1. When defining a test program interface:
|
22
|
+
#require "interfaces/j750"
|
23
|
+
# 2. If you want to extend a class defined by an imported application, in
|
24
|
+
# this case your must use required and supply a full path (to distinguish
|
25
|
+
# it from the one in the parent application):
|
26
|
+
#require "#{Origen.root}/c90_top_level/p2"
|
27
|
+
module OrigenDebuggers
|
28
|
+
autoload :Base, "origen_debuggers/base"
|
29
|
+
autoload :JLink, "origen_debuggers/j_link"
|
30
|
+
autoload :PEmicro, "origen_debuggers/p_and_e"
|
31
|
+
end
|
32
|
+
require "origen_debuggers"
|
data/config/users.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# This file defines the users associated with your project, it is basically the
|
2
|
+
# mailing list for release notes.
|
3
|
+
#
|
4
|
+
# You can split your users into "admin" and "user" groups, the main difference
|
5
|
+
# between the two is that admin users will get all tag emails, users will get
|
6
|
+
# emails on external/official releases only.
|
7
|
+
#
|
8
|
+
# Users are also prohibited from running the "origen tag" task, but this is
|
9
|
+
# really just to prevent a casual user from executing it inadvertently and is
|
10
|
+
# not intended to be a serious security gate.
|
11
|
+
module Origen
|
12
|
+
module Users
|
13
|
+
def users
|
14
|
+
@users ||= [
|
15
|
+
]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/config/version.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module OrigenDebuggers
|
2
|
+
# This is base class of all debuggers, any methods/attributes
|
3
|
+
# defined here will be available to all
|
4
|
+
class Base < Origen::Tester::CommandBasedTester
|
5
|
+
# Returns true if the debugger supports JTAG
|
6
|
+
def jtag?
|
7
|
+
respond_to?(:write_dr)
|
8
|
+
end
|
9
|
+
|
10
|
+
# Concept of a cycle not supported, print out an error to the output
|
11
|
+
# file to alert the user that execution has hit code that is not
|
12
|
+
# compatible with a command based tester.
|
13
|
+
def cycle(*args)
|
14
|
+
cc '*** Cycle called ***'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,351 @@
|
|
1
|
+
module OrigenDebuggers
|
2
|
+
# Driver for the Segger J-Link debugger: http://www.segger.com/debug-probes.html
|
3
|
+
#
|
4
|
+
# For reference here is the complete command list for this debugger. Note that while
|
5
|
+
# not recommended any of these can be called directly from an application by using the
|
6
|
+
# dw (direct write) method, e.g.
|
7
|
+
#
|
8
|
+
# $tester.dw "hwinfo"
|
9
|
+
# $tester.dw "mem 0x1234, 10"
|
10
|
+
#
|
11
|
+
# Available commands are:
|
12
|
+
# ----------------------
|
13
|
+
# f Firmware info
|
14
|
+
# h halt
|
15
|
+
# g go
|
16
|
+
# Sleep Waits the given time (in milliseconds). Syntax: Sleep <delay>
|
17
|
+
# s Single step the target chip
|
18
|
+
# st Show hardware status
|
19
|
+
# hwinfo Show hardware info
|
20
|
+
# mem Read memory. Syntax: mem <Addr>, <NumBytes> (hex)
|
21
|
+
# mem8 Read 8-bit items. Syntax: mem8 <Addr>, <NumBytes> (hex)
|
22
|
+
# mem16 Read 16-bit items. Syntax: mem16 <Addr>, <NumItems> (hex)
|
23
|
+
# mem32 Read 32-bit items. Syntax: mem32 <Addr>, <NumItems> (hex)
|
24
|
+
# w1 Write 8-bit items. Syntax: w1 <Addr>, <Data> (hex)
|
25
|
+
# w2 Write 16-bit items. Syntax: w2 <Addr>, <Data> (hex)
|
26
|
+
# w4 Write 32-bit items. Syntax: w4 <Addr>, <Data> (hex)
|
27
|
+
# erase Erase internal flash of selected device. Syntax: Erase
|
28
|
+
# wm Write test words. Syntax: wm <NumWords>
|
29
|
+
# is Identify length of scan chain select register
|
30
|
+
# ms Measure length of scan chain. Syntax: ms <Scan chain>
|
31
|
+
# mr Measure RTCK react time. Syntax: mr
|
32
|
+
# q Quit
|
33
|
+
# qc Close JLink connection and quit
|
34
|
+
# r Reset target (RESET)
|
35
|
+
# rx Reset target (RESET). Syntax: rx <DelayAfterReset>
|
36
|
+
# RSetType Set the current reset type. Syntax: RSetType <type>
|
37
|
+
# Regs Display contents of registers
|
38
|
+
# wreg Write register. Syntax: wreg <RegName>, <Value>
|
39
|
+
# moe Shows mode-of-entry, meaning: Reason why CPU is halted
|
40
|
+
# SetBP Set breakpoint. Syntax: SetBP <addr> [A/T] [S/H]
|
41
|
+
# SetWP Set Watchpoint. Syntax: <Addr> [R/W] [<Data> [<D-Mask>] [A-Mask]]
|
42
|
+
# ClrBP Clear breakpoint. Syntax: ClrBP <BP_Handle>
|
43
|
+
# ClrWP Clear watchpoint. Syntax: ClrWP <WP_Handle>
|
44
|
+
# VCatch Write vector catch. Syntax: VCatch <Value>
|
45
|
+
# loadbin Load binary file into target memory.
|
46
|
+
# Syntax: loadbin <filename>, <addr>
|
47
|
+
# savebin Saves target memory into binary file.
|
48
|
+
# Syntax: savebin <filename>, <addr>, <NumBytes>
|
49
|
+
# verifybin Verfies if the specified binary is already in the target memory at th
|
50
|
+
# e specified address.
|
51
|
+
# Syntax: verifybin <filename>, <addr>
|
52
|
+
# SetPC Set the PC to specified value. Syntax: SetPC <Addr>
|
53
|
+
# le Change to little endian mode
|
54
|
+
# be Change to big endian mode
|
55
|
+
# log Enables log to file. Syntax: log <filename>
|
56
|
+
# unlock Unlocks a device. Syntax: unlock <DeviceName>
|
57
|
+
# Type unlock without <DeviceName> to get a list
|
58
|
+
# of supported device names.
|
59
|
+
# nRESET has to be connected
|
60
|
+
# term Test command to visualize printf output from the target device,
|
61
|
+
# using DCC (SEGGER DCC handler running on target)
|
62
|
+
# ReadAP Reads a CoreSight AP register.
|
63
|
+
# Note: First read returns the data of the previous read.
|
64
|
+
# An additional read of DP reg 3 is necessary to get the data.
|
65
|
+
# ReadDP Reads a CoreSight DP register.
|
66
|
+
# Note: For SWD data is returned immediately.
|
67
|
+
# For JTAG the data of the previous read is returned.
|
68
|
+
# An additional read of DP reg 3 is necessary to get the data.
|
69
|
+
# WriteAP Writes a CoreSight AP register.
|
70
|
+
# WriteDP Writes a CoreSight DP register.
|
71
|
+
# SWDSelect Selects SWD as interface and outputs
|
72
|
+
# the JTAG -> SWD swichting sequence.
|
73
|
+
# SWDReadAP Reads a CoreSight AP register via SWD.
|
74
|
+
# Note: First read returns the data of the previous read.
|
75
|
+
# An additional read of DP reg 3 is necessary to get the data.
|
76
|
+
# SWDReadDP Reads a CoreSight DP register via SWD.
|
77
|
+
# Note: Correct data is returned immediately.
|
78
|
+
# SWDWriteAP Writes a CoreSight AP register via SWD.
|
79
|
+
# SWDWriteDP Writes a CoreSight DP register via SWD.
|
80
|
+
# Device Selects a specific device J-Link shall connect to
|
81
|
+
# and performs a reconnect.
|
82
|
+
# In most cases explicit selection of the device is not necessary.
|
83
|
+
# Selecting a device enables the user to make use of the J-Link
|
84
|
+
# flash programming functionality as well as using unlimited
|
85
|
+
# breakpoints in flash memory.
|
86
|
+
# For some devices explicit device selection is mandatory in order
|
87
|
+
# to allow the DLL to perform special handling needed by the device.
|
88
|
+
# ExpDevList Exports the device names from the DLL internal
|
89
|
+
# device list to a text file
|
90
|
+
# Syntax: ExpDevList <Filename>
|
91
|
+
# PowerTrace Perform power trace (not supported by all models)
|
92
|
+
# Syntax: PowerTrace <LogFile> [<ChannelMask> <RefCountSel>]
|
93
|
+
# <LogFile>: File to store power trace data to
|
94
|
+
# <ChannelMask>: 32-bit mask to specify what channels shall be enabled
|
95
|
+
# <SampleFreq>: Sampling frequency in Hz (0 == max)
|
96
|
+
# <RefCountSel>: 0: No reference count
|
97
|
+
# 1: Number of bytes transmitted on SWO
|
98
|
+
# ---- CP15 ------------
|
99
|
+
# rce Read CP15. Syntax: rce <Op1>, <CRn>, <CRm>, <Op2>
|
100
|
+
# wce Write CP15. Syntax: wce <Op1>, <CRn>, <CRm>, <Op2>, <Data>
|
101
|
+
# ---- ICE -------------
|
102
|
+
# Ice Show state of the embedded ice macrocell (ICE breaker)
|
103
|
+
# ri Read Ice reg. Syntax: ri <RegIndex>(hex)
|
104
|
+
# wi Write Ice reg. Syntax: wi <RegIndex>, <Data>(hex)
|
105
|
+
# ---- TRACE -----------
|
106
|
+
# TAddBranch TRACE - Add branch instruction to trace buffer. Paras:<Addr>,<BAddr>
|
107
|
+
# TAddInst TRACE - Add (non-branch) instruction to trace buffer. Syntax: <Addr>
|
108
|
+
# TClear TRACE - Clear buffer
|
109
|
+
# TSetSize TRACE - Set Size of trace buffer
|
110
|
+
# TSetFormat TRACE - SetFormat
|
111
|
+
# TSR TRACE - Show Regions (and analyze trace buffer)
|
112
|
+
# TStart TRACE - Start
|
113
|
+
# TStop TRACE - Stop
|
114
|
+
# ---- SWO -------------
|
115
|
+
# SWOSpeed SWO - Show supported speeds
|
116
|
+
# SWOStart SWO - Start
|
117
|
+
# SWOStop SWO - Stop
|
118
|
+
# SWOStat SWO - Display SWO status
|
119
|
+
# SWORead SWO - Read and display SWO data
|
120
|
+
# SWOShow SWO - Read and analyze SWO data
|
121
|
+
# SWOFlush SWO - Flush data
|
122
|
+
# SWOView SWO - View terminal data
|
123
|
+
# ---- PERIODIC --------
|
124
|
+
# PERConf PERIODIC - Configure
|
125
|
+
# PERStart PERIODIC - Start
|
126
|
+
# PERStop PERIODIC - Stop
|
127
|
+
# PERStat PERIODIC - Display status
|
128
|
+
# PERRead PERIODIC - Read and display data
|
129
|
+
# PERShow PERIODIC - Read and analyze data
|
130
|
+
# ---- File I/O --------
|
131
|
+
# fwrite Write file to emulator
|
132
|
+
# fread Read file from emulator
|
133
|
+
# fshow Read and display file from emulator
|
134
|
+
# fdelete Delete file on emulator
|
135
|
+
# fsize Display size of file on emulator
|
136
|
+
# ---- Test ------------
|
137
|
+
# TestHaltGo Run go/halt 1000 times
|
138
|
+
# TestStep Run step 1000 times
|
139
|
+
# TestCSpeed Measure CPU speed.
|
140
|
+
# Parameters: [<RAMAddr>]
|
141
|
+
# TestWSpeed Measure download speed into target memory.
|
142
|
+
# Parameters: [<Addr> [<Size>]]
|
143
|
+
# TestRSpeed Measure upload speed from target memory.
|
144
|
+
# Parameters: [<Addr> [<Size>] [<NumBlocks>]]
|
145
|
+
# TestNWSpeed Measure network download speed.
|
146
|
+
# Parameters: [<NumBytes> [<NumReps>]]
|
147
|
+
# TestNRSpeed Measure network upload speed.
|
148
|
+
# Parameters: [<NumBytes> [<NumReps>]]
|
149
|
+
# ---- JTAG ------------
|
150
|
+
# Config Set number of IR/DR bits before ARM device.
|
151
|
+
# Syntax: Config <IRpre>, <DRpre>
|
152
|
+
# speed Set JTAG speed. Syntax: speed <freq>|auto|adaptive, e.g. speed 2000,
|
153
|
+
# speed a
|
154
|
+
# i Read JTAG Id (Host CPU)
|
155
|
+
# wjc Write JTAG command (IR). Syntax: wjc <Data>(hex)
|
156
|
+
# wjd Write JTAG data (DR). Syntax: wjd <Data64>(hex), <NumBits>(dec)
|
157
|
+
# RTAP Reset TAP Controller using state machine (111110)
|
158
|
+
# wjraw Write Raw JTAG data. Syntax: wjraw <NumBits(dec)>, <tms>, <tdi>
|
159
|
+
# rt Reset TAP Controller (nTRST)
|
160
|
+
# ---- JTAG-Hardware ---
|
161
|
+
# c00 Create clock with TDI = TMS = 0
|
162
|
+
# c Clock
|
163
|
+
# tck0 Clear TCK
|
164
|
+
# tck1 Set TCK
|
165
|
+
# 0 Clear TDI
|
166
|
+
# 1 Set TDI
|
167
|
+
# t0 Clear TMS
|
168
|
+
# t1 Set TMS
|
169
|
+
# trst0 Clear TRST
|
170
|
+
# trst1 Set TRST
|
171
|
+
# r0 Clear RESET
|
172
|
+
# r1 Set RESET
|
173
|
+
# ---- Connection ------
|
174
|
+
# usb Connect to J-Link via USB. Syntax: usb <port>, where port is 0..3
|
175
|
+
# ip Connect to J-Link ARM Pro or J-Link TCP/IP Server via TCP/IP.
|
176
|
+
# Syntax: ip <ip_addr>
|
177
|
+
# ---- Configuration ---
|
178
|
+
# si Select target interface. Syntax: si <Interface>,
|
179
|
+
# where 0=JTAG and 1=SWD.
|
180
|
+
# power Switch power supply for target. Syntax: power <State> [perm],
|
181
|
+
# where State is either On or Off. Example: power on perm
|
182
|
+
# wconf Write configuration byte. Syntax: wconf <offset>, <data>
|
183
|
+
# rconf Read configuration bytes. Syntax: rconf
|
184
|
+
# ipaddr Show/Assign IP address and subnetmask of/to the connected J-Link.
|
185
|
+
# gwaddr Show/Assign network gateway address of/to the connected J-Link.
|
186
|
+
# dnsaddr Show/Assign network DNS server address of/to the connected J-Link.
|
187
|
+
# conf Show configuration of the connected J-Link.
|
188
|
+
# ecp Enable the J-Link control panel.
|
189
|
+
# calibrate Calibrate the target current measurement.
|
190
|
+
# selemu Select a emulator to communicate with,
|
191
|
+
# from a list of all emulators which are connected to the host
|
192
|
+
# The interfaces to search on, can be specified
|
193
|
+
# Syntax: selemu [<Interface0> <Interface1> ...]
|
194
|
+
# ShowEmuList Shows a list of all emulators which are connected to the host.
|
195
|
+
# The interfaces to search on, can be specified.
|
196
|
+
# Syntax: ShowEmuList [<Interface0> <Interface1> ...]
|
197
|
+
# ----------------------
|
198
|
+
# NOTE: Specifying a filename in command line
|
199
|
+
# will start J-Link Commander in script mode.
|
200
|
+
class JLink < Base
|
201
|
+
def initialize
|
202
|
+
super
|
203
|
+
# The minimum time unit is 1ms
|
204
|
+
set_timeset('default', 1_000_000)
|
205
|
+
@pat_extension = 'jlk'
|
206
|
+
@comment_char = '//'
|
207
|
+
end
|
208
|
+
|
209
|
+
# All debuggers should try and support these methods
|
210
|
+
module Common_API
|
211
|
+
def delay(cycles)
|
212
|
+
dw "Sleep #{cycles_to_ms(cycles)}"
|
213
|
+
end
|
214
|
+
|
215
|
+
def write(reg_or_val, options = {})
|
216
|
+
send("write#{extract_size(reg_or_val, options)}".to_sym, reg_or_val, options)
|
217
|
+
end
|
218
|
+
alias_method :write_register, :write
|
219
|
+
|
220
|
+
def read(reg_or_val, options = {})
|
221
|
+
send("read#{extract_size(reg_or_val, options)}".to_sym, reg_or_val, options)
|
222
|
+
end
|
223
|
+
alias_method :read_register, :read
|
224
|
+
|
225
|
+
# Read 8 bits of data to the given byte address
|
226
|
+
def read8(data, options = {})
|
227
|
+
read_memory(extract_address(data, options), number_of_bytes: 1)
|
228
|
+
end
|
229
|
+
alias_method :read_byte, :read8
|
230
|
+
alias_method :read_8, :read8
|
231
|
+
|
232
|
+
# Read 16 bits of data to the given byte address
|
233
|
+
def read16(data, options = {})
|
234
|
+
read_memory(extract_address(data, options), number_of_bytes: 2)
|
235
|
+
end
|
236
|
+
alias_method :read_word, :read16
|
237
|
+
alias_method :read_16, :read16
|
238
|
+
|
239
|
+
# Read 32 bits of data to the given byte address
|
240
|
+
def read32(data, options = {})
|
241
|
+
read_memory(extract_address(data, options), number_of_bytes: 4)
|
242
|
+
end
|
243
|
+
alias_method :read_longword, :read32
|
244
|
+
alias_method :read_32, :read32
|
245
|
+
|
246
|
+
# Write 8 bits of data to the given byte address
|
247
|
+
def write8(data, options = {})
|
248
|
+
dw "w1 0x#{extract_address(data, options).to_s(16).upcase}, 0x#{extract_data(data, options).to_s(16).upcase}"
|
249
|
+
end
|
250
|
+
alias_method :write_byte, :write8
|
251
|
+
alias_method :write_8, :write8
|
252
|
+
|
253
|
+
# Write 16 bits of data to the given byte address
|
254
|
+
def write16(data, options = {})
|
255
|
+
dw "w2 0x#{extract_address(data, options).to_s(16).upcase}, 0x#{extract_data(data, options).to_s(16).upcase}"
|
256
|
+
end
|
257
|
+
alias_method :write_word, :write16
|
258
|
+
alias_method :write_16, :write16
|
259
|
+
|
260
|
+
# Write 32 bits of data to the given byte address
|
261
|
+
def write32(data, options = {})
|
262
|
+
dw "w4 0x#{extract_address(data, options).to_s(16).upcase}, 0x#{extract_data(data, options).to_s(16).upcase}"
|
263
|
+
end
|
264
|
+
alias_method :write_longword, :write32
|
265
|
+
alias_method :write_32, :write32
|
266
|
+
|
267
|
+
# @api private
|
268
|
+
def extract_size(reg_or_val, options = {})
|
269
|
+
size = options[:size] if options[:size]
|
270
|
+
unless size
|
271
|
+
if reg_or_val.respond_to?(:contains_bits?) && reg_or_val.contains_bits?
|
272
|
+
size = reg_or_val.size
|
273
|
+
end
|
274
|
+
end
|
275
|
+
fail 'You must supply an :size option if not providing a register!' unless size
|
276
|
+
unless [8, 16, 32].include?(size)
|
277
|
+
fail 'Only a size of 8, 16 or 32 is supported!'
|
278
|
+
end
|
279
|
+
size
|
280
|
+
end
|
281
|
+
|
282
|
+
# @api private
|
283
|
+
def extract_data(reg_or_val, options = {})
|
284
|
+
return options[:data] if options[:data]
|
285
|
+
return reg_or_val.data if reg_or_val.respond_to?(:data)
|
286
|
+
reg_or_val
|
287
|
+
end
|
288
|
+
|
289
|
+
# @api private
|
290
|
+
def extract_address(reg_or_val, options = {})
|
291
|
+
addr = options[:addr] || options[:address]
|
292
|
+
return addr if addr
|
293
|
+
addr = reg_or_val.address if reg_or_val.respond_to?(:address)
|
294
|
+
fail 'You must supply an :address option if not providing a register!' unless addr
|
295
|
+
addr
|
296
|
+
end
|
297
|
+
end
|
298
|
+
include Common_API
|
299
|
+
|
300
|
+
# If the debugger supports JTAG definitely add these methods, this provides
|
301
|
+
# instant compatibility with any application that uses a JTAG based protocol
|
302
|
+
module JTAG_API
|
303
|
+
# Write the given value, register or bit collection to the data register
|
304
|
+
def write_dr(reg_or_val, options = {})
|
305
|
+
if reg_or_val.respond_to?(:data)
|
306
|
+
data = reg_or_val.data
|
307
|
+
size = options[:size] || reg_or_val.size
|
308
|
+
else
|
309
|
+
data = reg_or_val
|
310
|
+
size = options[:size]
|
311
|
+
end
|
312
|
+
dw "wjd 0x#{data.to_s(16).upcase}, #{size}\nc" # the extra clock cycle is needed here to opperate correctly on certain devices
|
313
|
+
# the added clock cycle means that the JLink opperation matches the atp tester opperation (J750 etc)
|
314
|
+
# some devices may function without the addition, however an extra clock cycle in "run-Test/idle" is unlikely to
|
315
|
+
# break anything so has been added universally.
|
316
|
+
end
|
317
|
+
|
318
|
+
# Read the given value, register or bit collection from the data register
|
319
|
+
def read_dr(reg_or_val, options = {})
|
320
|
+
# Can't read the DR via J-Link
|
321
|
+
end
|
322
|
+
|
323
|
+
# Write the given value, register or bit collection to the instruction register
|
324
|
+
def write_ir(reg_or_val, options = {})
|
325
|
+
if reg_or_val.respond_to?(:data)
|
326
|
+
data = reg_or_val.data
|
327
|
+
else
|
328
|
+
data = reg_or_val
|
329
|
+
end
|
330
|
+
dw "wjc 0x#{data.to_s(16).upcase}"
|
331
|
+
end
|
332
|
+
|
333
|
+
# Read the given value, register or bit collection from the instruction register
|
334
|
+
def read_ir(reg_or_val, options = {})
|
335
|
+
# Can't read the IR via J-Link
|
336
|
+
end
|
337
|
+
end
|
338
|
+
include JTAG_API
|
339
|
+
|
340
|
+
# Other methods can expose unique features of a given debugger
|
341
|
+
module Custom
|
342
|
+
def read_memory(address, options = {})
|
343
|
+
options = {
|
344
|
+
number_of_bytes: 1
|
345
|
+
}.merge(options)
|
346
|
+
dw "mem 0x#{address.to_s(16).upcase}, #{options[:number_of_bytes]}"
|
347
|
+
end
|
348
|
+
end
|
349
|
+
include Custom
|
350
|
+
end
|
351
|
+
end
|
@@ -0,0 +1,309 @@
|
|
1
|
+
module OrigenDebuggers
|
2
|
+
# Driver for the P&E Microsystems debugger: http://www.pemicro.com
|
3
|
+
#
|
4
|
+
# For reference here is a command list for this debugger. Note, many commands can be
|
5
|
+
# altered using additional opperands, see help for details. Note that while
|
6
|
+
# not recommended any of these can be called directly from an application by using the
|
7
|
+
# dw (direct write) method, e.g.
|
8
|
+
#
|
9
|
+
# $tester.dw "****"
|
10
|
+
# $tester.dw "****"
|
11
|
+
#
|
12
|
+
# Available commands are:
|
13
|
+
#
|
14
|
+
# write_ir write "raw" jtag to the instruction register
|
15
|
+
# write_dr write "raw" jtag to the data register
|
16
|
+
#
|
17
|
+
# ADDSPR Sets user-defined SPR name to equal user-defined SPR number.
|
18
|
+
# ASCIIF3 (ASCIIF6) Toggle the F3(F6) memory window between showing hexadecimal bytes and ASCII characters. Nonprintable characters are shown as an ASCII period ('.').
|
19
|
+
# ASM Assemble instructions.
|
20
|
+
# BELL Sound Bell
|
21
|
+
# BF Block fill memory.
|
22
|
+
# BGND_TIME Starts processor execution at the current Program Counter and logs time since the last BGND instruction each time a BGND instruction is encountered.
|
23
|
+
# BR Set instruction breakpoint.
|
24
|
+
# CAPTURE Open a capture file named 'filename'.
|
25
|
+
# CAPTUREOFF Turn off capturing and close the current capture file.
|
26
|
+
# CLEARMAP Remove all symbolic mapfile names.
|
27
|
+
# CLEARSYMBOL Remove all temporary symbols.
|
28
|
+
# CLEARVAR Clears variables list from Variables window.
|
29
|
+
# CODE Show disassembled code in the code window starting at address add. If you specify an address in the middle of an intended instruction, improper results may occur.
|
30
|
+
# COLORS Change Debugger Colors
|
31
|
+
# COUNT Counts the number of times breakpoints in internal counter table are executed. Allows optional stop and start parameters to be set.
|
32
|
+
# COUNTER Add or subtract a location from the internal counter table. Using this command with no address shows the current counters.
|
33
|
+
# CR Set Condition Register.
|
34
|
+
# CTR Set Counter Register
|
35
|
+
# DASM Disassemble Instructions
|
36
|
+
# DUMP_TRACE Dump current trace buffer.
|
37
|
+
# DUMP Dumps memory to screen.
|
38
|
+
# EVAL Evaluate expression.
|
39
|
+
# EXECUTE_OPCODE Treats numeric parameter as an opcode and executes it.
|
40
|
+
# EXIT Exit debugger.
|
41
|
+
# FPSCR Set Floating Point Status And Control Register
|
42
|
+
# FR(x) Set Floating Point Register.
|
43
|
+
# G or GO Begin program execution.
|
44
|
+
# GOALL Begin program execution for multi-core devices..
|
45
|
+
# GOEXIT Begin program execution without breakpoints and terminate debugger software.
|
46
|
+
# GOTIL Execute until address.
|
47
|
+
# GOTILROM Execute fast single steps without updating the screen, until the address is reached. This is the fastest way to breakpoint in ROM.
|
48
|
+
# HELP Bring up the help window.
|
49
|
+
# HGO Begin Program Execution
|
50
|
+
# HGOALL Begin Program Execution For Multi-Core Devices
|
51
|
+
# HLOAD Load ELF/DWARF/S19/MAP Object And Debug Information
|
52
|
+
# HLOADMAP Load DWARF/MAP Debug Info Only
|
53
|
+
# HSTEP High-Level Language Source Step
|
54
|
+
# HSTEPALL High-Level Language Source Step For Multi-Core Devices
|
55
|
+
# HSTEPFOR High-Level Language Step Forever
|
56
|
+
# LOADDESK Loads the visual layout for the debugger from the last instance it was saved, such as with the SAVEDESK command.
|
57
|
+
# LOAD_BIN Load a binary file of byte. The default filename extension is .BIN.
|
58
|
+
# LOADV_BIN Perform LOAD_BIN command, verify using the same file.
|
59
|
+
# LOGFILE Open/Close Log File
|
60
|
+
# LR Set Link Register
|
61
|
+
# MACRO Execute a Batch File
|
62
|
+
# MACROEND Stop Saving Commands to File
|
63
|
+
# MACROSTART Save Debug Commands to File
|
64
|
+
# MACS Bring up a window with a list of macros. These are files with the extension .ICD (such as the STARTUP.ICD macro). Use the arrow keys and the <ENTER> key or cancel with the <ESC> key.
|
65
|
+
# MD Set Memory Window 1 to a specific address.
|
66
|
+
# MD2 Set Memory Window 2 to a specific address.
|
67
|
+
# MM Memory modify.
|
68
|
+
# MSR Set Machine Status Register
|
69
|
+
# NOBR Clear all break points.
|
70
|
+
# PC Set Program Counter.
|
71
|
+
# QUIET Turn off (on) refresh of memory based windows.
|
72
|
+
# QUIT Exit debugger.
|
73
|
+
# R Display and edit registers (requires REG software).
|
74
|
+
# R(x) Set General Purpose Register R(x).
|
75
|
+
# REM Place comment in macro file.
|
76
|
+
# RESET Force reset of device into background mode.
|
77
|
+
# RTVAR Displays a specified address and its contents in the Variables window for viewing during code execution and while the part is running (real time).
|
78
|
+
# SAVEDESK Saves the current visual layout of the debugger.
|
79
|
+
# SERIAL Set up parameters for dumb terminal.
|
80
|
+
# SERIALOFF Disable the status window as a dumb terminal.
|
81
|
+
# SERIALON Enable the status window as a dumb terminal.
|
82
|
+
# SHOWCODE Display Code at Address
|
83
|
+
# SHOWMMU Displays MMU Information
|
84
|
+
# SHOWPC Display Code at PC
|
85
|
+
# SHOWSPR Displays SPR Information
|
86
|
+
# SHOWTRACE Allows the user to view this trace buffer after having executed the TRACE command.
|
87
|
+
# SNAPSHOT Send snapshot of screen to capture file.
|
88
|
+
# SOURCEPATH Search for source code.
|
89
|
+
# SPR Display/modify the value of the special purpose register at address add.
|
90
|
+
# SS Execute source step(s)..
|
91
|
+
# ST Execute single step in assembly.
|
92
|
+
# STATUS Show registers.
|
93
|
+
# STEP Same as ST.
|
94
|
+
# STEPALL Execute single step in assembly for multi-core devices.
|
95
|
+
# STEPFOR Step forever on assembly level.
|
96
|
+
# STEPTIL Step until address on the assembly level.
|
97
|
+
# SYMBOL Add user symbol.
|
98
|
+
# TIME Displays real time elapsed during execution of code
|
99
|
+
# _TR Add register field description to the VAR Window
|
100
|
+
# TRACE Monitors execution of the CPU and logs instructions.
|
101
|
+
# UPLOAD_SREC Uloads S records to screen.
|
102
|
+
# VAR Display variable.
|
103
|
+
# VERIFY Compare the contents of program memory with an S-record file.
|
104
|
+
# VERSION Display the version number of the ICD software.
|
105
|
+
# WATCHDOG Disable the watchdog if active.
|
106
|
+
# WHEREIS Display symbol value.
|
107
|
+
# XER Set Integer Exception Register.
|
108
|
+
# ----------------------
|
109
|
+
|
110
|
+
class PEmicro < Base
|
111
|
+
def initialize
|
112
|
+
super
|
113
|
+
set_timeset('default', 1_000_000)
|
114
|
+
@pat_extension = 'mac'
|
115
|
+
@comment_char = ';'
|
116
|
+
@in_jtag = false
|
117
|
+
end
|
118
|
+
|
119
|
+
# All debuggers should try and support these methods
|
120
|
+
module Common_API
|
121
|
+
def delay(cycles)
|
122
|
+
dw 'jtag_end' if @in_jtag
|
123
|
+
@in_jtag = false
|
124
|
+
dw "delay #{cycles_to_ms(cycles)}"
|
125
|
+
end
|
126
|
+
|
127
|
+
def write(reg_or_val, options = {})
|
128
|
+
dw 'jtag_end' if @in_jtag
|
129
|
+
@in_jtag = false
|
130
|
+
send("write#{extract_size(reg_or_val, options)}".to_sym, reg_or_val, options)
|
131
|
+
end
|
132
|
+
alias_method :write_register, :write
|
133
|
+
|
134
|
+
def read(reg_or_val, options = {})
|
135
|
+
dw 'jtag_end' if @in_jtag
|
136
|
+
@in_jtag = false
|
137
|
+
send("read#{extract_size(reg_or_val, options)}".to_sym, reg_or_val, options)
|
138
|
+
end
|
139
|
+
alias_method :read_register, :read
|
140
|
+
|
141
|
+
# Read 8 bits of data to the given byte address
|
142
|
+
def read8(data, options = {})
|
143
|
+
dw 'jtag_end' if @in_jtag
|
144
|
+
@in_jtag = false
|
145
|
+
dw "DUMP.B #{(extract_address(data, options))} #{(extract_address(data, options))}"
|
146
|
+
end
|
147
|
+
alias_method :read_byte, :read8
|
148
|
+
alias_method :read_8, :read8
|
149
|
+
|
150
|
+
# Read 16 bits of data to the given byte address
|
151
|
+
def read16(data, options = {})
|
152
|
+
dw 'jtag_end' if @in_jtag
|
153
|
+
@in_jtag = false
|
154
|
+
dw "DUMP.W #{extract_address(data, options)} #{(extract_address(data, options))}"
|
155
|
+
end
|
156
|
+
alias_method :read_word, :read16
|
157
|
+
alias_method :read_16, :read16
|
158
|
+
|
159
|
+
# Read 32 bits of data to the given byte address
|
160
|
+
def read32(data, options = {})
|
161
|
+
dw 'jtag_end' if @in_jtag
|
162
|
+
@in_jtag = false
|
163
|
+
dw "DUMP.L #{(extract_address(data, options))} #{(extract_address(data, options))}"
|
164
|
+
end
|
165
|
+
alias_method :read_longword, :read32
|
166
|
+
alias_method :read_32, :read32
|
167
|
+
|
168
|
+
# Write 8 bits of data to the given byte address
|
169
|
+
def write8(data, options = {})
|
170
|
+
dw 'jtag_end' if @in_jtag
|
171
|
+
@in_jtag = false
|
172
|
+
dw "MM.B #{extract_address(data, options).to_s(16).upcase} #{extract_data(data, options).to_s(16).upcase}"
|
173
|
+
end
|
174
|
+
alias_method :write_byte, :write8
|
175
|
+
alias_method :write_8, :write8
|
176
|
+
|
177
|
+
# Write 16 bits of data to the given byte address
|
178
|
+
def write16(data, options = {})
|
179
|
+
dw 'jtag_end' if @in_jtag
|
180
|
+
@in_jtag = false
|
181
|
+
dw "MM.W #{extract_address(data, options).to_s(16).upcase} #{extract_data(data, options).to_s(16).upcase}"
|
182
|
+
end
|
183
|
+
alias_method :write_word, :write16
|
184
|
+
alias_method :write_16, :write16
|
185
|
+
|
186
|
+
# Write 32 bits of data to the given byte address
|
187
|
+
def write32(data, options = {})
|
188
|
+
dw 'jtag_end' if @in_jtag
|
189
|
+
@in_jtag = false
|
190
|
+
dw "MM.L #{extract_address(data, options).to_s(16).upcase} #{extract_data(data, options).to_s(16).upcase}"
|
191
|
+
end
|
192
|
+
alias_method :write_longword, :write32
|
193
|
+
alias_method :write_32, :write32
|
194
|
+
|
195
|
+
# @api private
|
196
|
+
def extract_size(reg_or_val, options = {})
|
197
|
+
size = options[:size] if options[:size]
|
198
|
+
unless size
|
199
|
+
if reg_or_val.respond_to?(:contains_bits?) && reg_or_val.contains_bits?
|
200
|
+
size = reg_or_val.size
|
201
|
+
end
|
202
|
+
end
|
203
|
+
fail 'You must supply an :size option if not providing a register!' unless size
|
204
|
+
unless [8, 16, 32].include?(size)
|
205
|
+
fail 'Only a size of 8, 16 or 32 is supported!'
|
206
|
+
end
|
207
|
+
size
|
208
|
+
end
|
209
|
+
|
210
|
+
# @api private
|
211
|
+
def extract_data(reg_or_val, options = {})
|
212
|
+
return options[:data] if options[:data]
|
213
|
+
return reg_or_val.data if reg_or_val.respond_to?(:data)
|
214
|
+
reg_or_val
|
215
|
+
end
|
216
|
+
|
217
|
+
# @api private
|
218
|
+
def extract_address(reg_or_val, options = {})
|
219
|
+
addr = options[:addr] || options[:address]
|
220
|
+
return addr if addr
|
221
|
+
addr = reg_or_val.address if reg_or_val.respond_to?(:address)
|
222
|
+
fail 'You must supply an :address option if not providing a register!' unless addr
|
223
|
+
addr
|
224
|
+
end
|
225
|
+
end
|
226
|
+
include Common_API
|
227
|
+
|
228
|
+
# If the debugger supports JTAG definitely add these methods, this provides
|
229
|
+
# instant compatibility with any application that uses a JTAG based protocol
|
230
|
+
module JTAG_API
|
231
|
+
# Write the given value, register or bit collection to the data register
|
232
|
+
def write_dr(reg_or_val, options = {})
|
233
|
+
dw 'jtag_start' unless @in_jtag
|
234
|
+
@in_jtag = true
|
235
|
+
if reg_or_val.respond_to?(:data)
|
236
|
+
data = reg_or_val.data
|
237
|
+
size = options[:size] || reg_or_val.size
|
238
|
+
else
|
239
|
+
data = reg_or_val
|
240
|
+
size = options[:size]
|
241
|
+
end
|
242
|
+
dw "jtag_dr #{size}t #{data.to_s(16).downcase}"
|
243
|
+
end
|
244
|
+
|
245
|
+
# Read the given value, register or bit collection from the data register
|
246
|
+
def read_dr(reg_or_val, options = {})
|
247
|
+
# Can't read the DR
|
248
|
+
end
|
249
|
+
|
250
|
+
# Write the given value, register or bit collection to the instruction register
|
251
|
+
def write_ir(reg_or_val, options = {})
|
252
|
+
dw 'jtag_start' unless @in_jtag
|
253
|
+
@in_jtag = true
|
254
|
+
size = options[:size] || 4 # Used to be hardcoded to 4 with no override capability
|
255
|
+
if reg_or_val.respond_to?(:data)
|
256
|
+
data = reg_or_val.data
|
257
|
+
else
|
258
|
+
data = reg_or_val
|
259
|
+
end
|
260
|
+
dw "jtag_ir #{size}t #{data.to_s(16).downcase}"
|
261
|
+
end
|
262
|
+
|
263
|
+
# Read the given value, register or bit collection from the instruction register
|
264
|
+
def read_ir(reg_or_val, options = {})
|
265
|
+
# Can't read the IR
|
266
|
+
end
|
267
|
+
end
|
268
|
+
include JTAG_API
|
269
|
+
|
270
|
+
# Other methods can expose unique features of a given debugger
|
271
|
+
module Custom
|
272
|
+
def set_pc(address)
|
273
|
+
dw 'jtag_end' if @in_jtag
|
274
|
+
@in_jtag = false
|
275
|
+
dw "PC $#{address.to_s(16).upcase}"
|
276
|
+
end
|
277
|
+
alias_method :setPC, :set_pc
|
278
|
+
|
279
|
+
def go
|
280
|
+
dw 'jtag_end' if @in_jtag
|
281
|
+
@in_jtag = false
|
282
|
+
dw 'GO'
|
283
|
+
end
|
284
|
+
|
285
|
+
def halt
|
286
|
+
dw "\n"
|
287
|
+
end
|
288
|
+
|
289
|
+
def exit_jtag # not expected to be typically used, should be automatically handled in code, unless manually doing dw "..." calls
|
290
|
+
dw 'jtag_end'
|
291
|
+
@in_jtag = false
|
292
|
+
end
|
293
|
+
|
294
|
+
def enter_jtag # not expected to be typically used, should be automatically handled in code, unless manually doing dw "..." calls
|
295
|
+
dw 'jtag_start'
|
296
|
+
@in_jtag = true
|
297
|
+
end
|
298
|
+
end
|
299
|
+
include Custom
|
300
|
+
|
301
|
+
def footer_template # if at the end of the file, and still in a jtag mode, close the jtag mode.
|
302
|
+
if @in_jtag
|
303
|
+
"#{Origen.root!}/lib/origen_debuggers/p_e/jtag_end.txt"
|
304
|
+
else
|
305
|
+
"#{Origen.root!}/lib/origen_debuggers/p_e/none.txt"
|
306
|
+
end
|
307
|
+
end
|
308
|
+
end
|
309
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
jtag_end
|
File without changes
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module OrigenDebuggers
|
2
|
+
module Test
|
3
|
+
# A simple DUT model used to test the debuggers
|
4
|
+
class DUT
|
5
|
+
include OrigenJTAG
|
6
|
+
include Origen::Pins
|
7
|
+
include Origen::Registers
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
add_pin :tclk
|
11
|
+
add_pin :tdi
|
12
|
+
add_pin :tdo
|
13
|
+
add_pin :tms
|
14
|
+
|
15
|
+
reg :reg32, 0x20 do
|
16
|
+
bits 31..0, :data
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# Hook the Nexus into the register API, any register read
|
21
|
+
# requests will use the Nexus by default
|
22
|
+
def read_register(reg, options = {})
|
23
|
+
# nexus.read_register(reg, options)
|
24
|
+
cc 'Needs to be enabled when a register protocol is available'
|
25
|
+
end
|
26
|
+
|
27
|
+
# As above for write requests
|
28
|
+
def write_register(reg, options = {})
|
29
|
+
# nexus.write_register(reg, options)
|
30
|
+
cc 'Needs to be enabled when a register protocol is available'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/pattern/_workout.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# These are common tests for all testers
|
2
|
+
ss "Verify a register API write"
|
3
|
+
$dut.reg(:reg32).write!(0x1234_5678)
|
4
|
+
|
5
|
+
ss "Verify a register API read"
|
6
|
+
$dut.reg(:reg32).read!
|
7
|
+
|
8
|
+
if $tester.jtag?
|
9
|
+
ss "Verify write_dr with a register"
|
10
|
+
$tester.write_dr $dut.reg(:reg32)
|
11
|
+
ss "Verify write_dr with a data value"
|
12
|
+
$tester.write_dr 0x1122, :size => 16
|
13
|
+
ss "Verify read_dr with a register"
|
14
|
+
$tester.read_dr $dut.reg(:reg32)
|
15
|
+
ss "Verify read_dr with a data value"
|
16
|
+
$tester.read_dr 0x1122, :size => 16
|
17
|
+
ss "Verify write_ir with a register"
|
18
|
+
$tester.write_ir $dut.reg(:reg32)
|
19
|
+
ss "Verify write_ir with a data value"
|
20
|
+
$tester.write_ir 0x1122, :size => 16
|
21
|
+
ss "Verify read_ir with a register"
|
22
|
+
$tester.read_ir $dut.reg(:reg32)
|
23
|
+
ss "Verify read_ir with a data value"
|
24
|
+
$tester.read_ir 0x1122, :size => 16
|
25
|
+
end
|
26
|
+
|
27
|
+
ss "Verify write_register method"
|
28
|
+
$tester.write_register $dut.reg(:reg32)
|
29
|
+
ss "Verify read_register method"
|
30
|
+
$tester.read_register $dut.reg(:reg32)
|
31
|
+
ss "Verify write8"
|
32
|
+
$tester.write8 0x55, :address => 0x12
|
33
|
+
ss "Verify write16"
|
34
|
+
$tester.write16 0x55AA, :address => 0x12
|
35
|
+
ss "Verify write32"
|
36
|
+
$tester.write32 0x55AA_3344, :address => 0x12
|
37
|
+
ss "Verify write with a register"
|
38
|
+
$tester.write $dut.reg(:reg32)
|
39
|
+
ss "Verify write with a data value"
|
40
|
+
$tester.write 0x55, :address => 0x12, :size => 8
|
41
|
+
ss "Verify read with a register"
|
42
|
+
$tester.read $dut.reg(:reg32)
|
43
|
+
ss "Verify read with a data value"
|
44
|
+
$tester.read 0x55, :address => 0x12, :size => 8
|
@@ -0,0 +1,66 @@
|
|
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.config.name %> <span style="font-size: 14px">(<%= Origen.app.version %>)</span></h1>
|
6
|
+
|
7
|
+
### Purpose
|
8
|
+
|
9
|
+
This plugin provides tester models to drive bench debuggers such as the Segger J-Link or PE Micro.
|
10
|
+
|
11
|
+
### How To Import
|
12
|
+
|
13
|
+
##### To use in an application:
|
14
|
+
|
15
|
+
Add the following to your application's <code>Gemfile</code>:
|
16
|
+
|
17
|
+
~~~ruby
|
18
|
+
gem 'origen_debuggers', '<%= Origen.app.version %>'
|
19
|
+
~~~
|
20
|
+
|
21
|
+
##### To use in a plugin:
|
22
|
+
|
23
|
+
Add the following to your plugin's gemspec:
|
24
|
+
|
25
|
+
~~~ruby
|
26
|
+
spec.add_runtime_dependency 'origen_debuggers', '~> <%= Origen.app.version.major %>', '>= <%= Origen.app.version %>'
|
27
|
+
~~~
|
28
|
+
|
29
|
+
and require the gem in your code:
|
30
|
+
|
31
|
+
~~~ruby
|
32
|
+
require 'origen_debuggers'
|
33
|
+
~~~
|
34
|
+
|
35
|
+
### How To Use
|
36
|
+
|
37
|
+
For JTAG based protocols all that should be required is to change the application target
|
38
|
+
to instantiate one of the debuggers that support JTAG, such as J-Link or P&E:
|
39
|
+
|
40
|
+
~~~ruby
|
41
|
+
$tester = OrigenDebuggers::JLink.new
|
42
|
+
# or
|
43
|
+
#$tester = OrigenDebuggers::PEmircro.new
|
44
|
+
~~~
|
45
|
+
|
46
|
+
Patterns should now generate a debugger command file without any additional application
|
47
|
+
modifications.
|
48
|
+
|
49
|
+
### How To Setup a Development Environment
|
50
|
+
|
51
|
+
[Clone the repository from Github](https://github.com/Origen-SDK/origen_debuggers).
|
52
|
+
|
53
|
+
Some patterns can be found in the pattern directory to exercise the debuggers.
|
54
|
+
|
55
|
+
Follow the instructions here if you want to make a 3rd party app
|
56
|
+
workspace use your development copy of the <%= Origen.app.config.initials %> plugin:
|
57
|
+
[Setting up a Plugin Development Environment](http://origen-sdk.org/origen/latest/guides/plugins)
|
58
|
+
|
59
|
+
This plugin also contains a test suite, make sure this passes before committing
|
60
|
+
any changes!
|
61
|
+
|
62
|
+
~~~
|
63
|
+
origen examples
|
64
|
+
~~~
|
65
|
+
|
66
|
+
% end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
title: <%= options[:title] || Origen.config.name %>
|
3
|
+
analytics: UA-64455560-1
|
4
|
+
---
|
5
|
+
<%= render "templates/web/partials/navbar.html", tab: options[:tab] %>
|
6
|
+
|
7
|
+
<div class="row">
|
8
|
+
%# The markdown attribute is important if you are going to include content written
|
9
|
+
%# in markdown, without this is will be included verbatim
|
10
|
+
<div class="span12" markdown="1">
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
<%= disqus_comments %>
|
14
|
+
|
15
|
+
</div>
|
16
|
+
</div>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<nav class="navbar navbar-inverse navbar-fixed-top">
|
2
|
+
<div class="container">
|
3
|
+
<div class="navbar-header">
|
4
|
+
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
|
5
|
+
<span class="sr-only">Toggle navigation</span>
|
6
|
+
<span class="icon-bar"></span>
|
7
|
+
<span class="icon-bar"></span>
|
8
|
+
<span class="icon-bar"></span>
|
9
|
+
</button>
|
10
|
+
<a class="navbar-brand" href="<%= path "/" %>">Home</a>
|
11
|
+
</div>
|
12
|
+
<div id="navbar" class="collapse navbar-collapse">
|
13
|
+
<ul class="nav navbar-nav">
|
14
|
+
<li class="<%= options[:tab] == :api ? 'active' : '' %>"><a href="<%= path "/api/" %>">API</a></li>
|
15
|
+
<li class="<%= options[:tab] == :coverage ? 'active' : '' %>"><a href="<%= path "/coverage" %>">Coverage</a></li>
|
16
|
+
<li class="<%= options[:tab] == :release ? 'active' : '' %>"><a href="<%= path "/release_notes" %>">Release Notes</a></li>
|
17
|
+
<li><a href="https://github.com/Origen-SDK/origen_debuggers">Github</a></li>
|
18
|
+
</ul>
|
19
|
+
<%= import "origen/web/logo.html" %>
|
20
|
+
</div><!--/.nav-collapse -->
|
21
|
+
</div>
|
22
|
+
</nav>
|
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: origen_debuggers
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stephen McGinty
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: origen
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.2.6
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.2.6
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: origen_doc_helpers
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.2.0
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.2.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: origen_jtag
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.12.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.12.0
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- stephen.f.mfcginty@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- config/application.rb
|
63
|
+
- config/commands.rb
|
64
|
+
- config/development.rb
|
65
|
+
- config/environment.rb
|
66
|
+
- config/users.rb
|
67
|
+
- config/version.rb
|
68
|
+
- lib/origen_debuggers.rb
|
69
|
+
- lib/origen_debuggers/base.rb
|
70
|
+
- lib/origen_debuggers/j_link.rb
|
71
|
+
- lib/origen_debuggers/p_and_e.rb
|
72
|
+
- lib/origen_debuggers/p_e/jtag_end.txt
|
73
|
+
- lib/origen_debuggers/p_e/none.txt
|
74
|
+
- lib/origen_debuggers/test/dut.rb
|
75
|
+
- pattern/_workout.rb
|
76
|
+
- pattern/jlink_workout.rb
|
77
|
+
- pattern/pe_low_level.rb
|
78
|
+
- templates/web/index.md.erb
|
79
|
+
- templates/web/layouts/_basic.html.erb
|
80
|
+
- templates/web/partials/_navbar.html.erb
|
81
|
+
- templates/web/release_notes.md.erb
|
82
|
+
homepage: http://origen-sdk.org/debuggers
|
83
|
+
licenses: []
|
84
|
+
metadata: {}
|
85
|
+
post_install_message:
|
86
|
+
rdoc_options: []
|
87
|
+
require_paths:
|
88
|
+
- lib
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 1.9.3
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 1.8.11
|
99
|
+
requirements: []
|
100
|
+
rubyforge_project:
|
101
|
+
rubygems_version: 2.2.2
|
102
|
+
signing_key:
|
103
|
+
specification_version: 4
|
104
|
+
summary: Provides Origen tester models to drive bench debuggers such as the Segger
|
105
|
+
J-Link.
|
106
|
+
test_files: []
|
107
|
+
has_rdoc:
|