rpicsim 0.2.5 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Introduction.md +1 -1
- data/README.md +1 -1
- data/docs/KnownIssues.md +1 -1
- data/docs/RSpecIntegration.md +1 -1
- data/docs/SupportedMPLABXVersions.md +1 -0
- data/lib/rpicsim/flaws.rb +1 -12
- data/lib/rpicsim/instruction.rb +7 -4
- data/lib/rpicsim/rspec/be_predicate.rb +10 -5
- data/lib/rpicsim/rspec/sim_diagnostics.rb +67 -36
- data/lib/rpicsim/sim.rb +1 -1
- data/lib/rpicsim/version.rb +1 -1
- metadata +46 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd4ff6f54bf53d46e52ab338f4cf495a099e2de5
|
4
|
+
data.tar.gz: 5f5dc6b5693fbaca9e88699a1e340fe9c36b11b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8effea68fe1786bf5d6517eaa6284827ff85867343de19ffd424ea81e1875175e92d8cd23ea4e0fa0504a890f0dacce649fa766e4e391bd0e8097393a2f40705
|
7
|
+
data.tar.gz: b9be314ea31c1885fa570386ab6e59ab94d0e9c7364d6a89bd4026891087d2722e9125c23aef5843445dd9c285da1014762c1f32facd6ec9ee0e4d1b0effafbb
|
data/Introduction.md
CHANGED
@@ -51,7 +51,7 @@ RPicSim is distributed as a Ruby gem named `rpicsim`. To install RPicSim, run:
|
|
51
51
|
jgem install rpicsim
|
52
52
|
|
53
53
|
|
54
|
-
RPicSim has been tested with MPLAB X v1.85, v1.90, v1.95, v2.00, and v2.
|
54
|
+
RPicSim has been tested with MPLAB X v1.85, v1.90, v1.95, v2.00, v2.05, and v2.10.
|
55
55
|
However, it uses a lot of undocumented and internal features of the Microchip Java libraries, so it will probably need to be updated as new versions of MPLAB X are released.
|
56
56
|
|
57
57
|
RPicSim is not intended to replace formal specifications, code reviews, and rigorous testing of your firmware on actual hardware.
|
data/README.md
CHANGED
@@ -53,7 +53,7 @@ RPicSim is distributed as a Ruby gem named `rpicsim`. To install RPicSim, run:
|
|
53
53
|
jgem install rpicsim
|
54
54
|
|
55
55
|
|
56
|
-
RPicSim has been tested with MPLAB X v1.85, v1.90, v1.95, v2.00, and v2.
|
56
|
+
RPicSim has been tested with MPLAB X v1.85, v1.90, v1.95, v2.00, v2.05, and v2.10.
|
57
57
|
However, it uses a lot of undocumented and internal features of the Microchip Java libraries, so it will probably need to be updated as new versions of MPLAB X are released.
|
58
58
|
|
59
59
|
RPicSim is not intended to replace formal specifications, code reviews, and rigorous testing of your firmware on actual hardware.
|
data/docs/KnownIssues.md
CHANGED
@@ -123,7 +123,7 @@ RAM watcher is useless because all of RAM seems to change on every step
|
|
123
123
|
----
|
124
124
|
_Type: MPLAB X bug_
|
125
125
|
|
126
|
-
_MPLAB X versions affected: 1.95
|
126
|
+
_MPLAB X versions affected: 1.95 and later_
|
127
127
|
|
128
128
|
This issue is tested in `spec/mplab/memory_attach_spec.rb`.
|
129
129
|
If you want to use the {file:RamWatcher.md RAM watcher}, you should use MPLAB X version 1.85 or 1.90.
|
data/docs/RSpecIntegration.md
CHANGED
@@ -113,7 +113,7 @@ This information can help when you are {file:Debugging.md debugging} issues.
|
|
113
113
|
Better RSpec error messages
|
114
114
|
----
|
115
115
|
|
116
|
-
RPicSim also overrides some of RSpec's error messages to be better.
|
116
|
+
If you are using RSpec 2.x, RPicSim also overrides some of RSpec's error messages to be better.
|
117
117
|
|
118
118
|
For example, instead of just saying an error message like "expected driving_high? to return true, got false", RSpec will actually say what object it called `driving_high?` on.
|
119
119
|
This feature is important when you are using {file:PersistentExpectations.md persistent expectations} and want to know which expectation failed, because the stack trace will not help.
|
@@ -7,6 +7,7 @@ RPicSim uses code in MPLAB X to actually perform the PIC simulation. Therefore,
|
|
7
7
|
- 1.95
|
8
8
|
- 2.00
|
9
9
|
- 2.05
|
10
|
+
- 2.10
|
10
11
|
|
11
12
|
The different versions of MPLAB X have different problems that affect the simulation. For more information, see the {file:KnownIssues.md Known issues page}.
|
12
13
|
|
data/lib/rpicsim/flaws.rb
CHANGED
@@ -51,27 +51,17 @@ module RPicSim
|
|
51
51
|
add(:fr_memory_attach_useless) do |flaw|
|
52
52
|
flaw.affects_version '1.85', false
|
53
53
|
flaw.affects_version '1.90', false
|
54
|
-
flaw.affects_version '1.95', true
|
55
|
-
flaw.affects_version '2.00', true
|
56
|
-
flaw.affects_version '2.05', true
|
57
54
|
flaw.probably_affects_other_versions true
|
58
55
|
end
|
59
56
|
|
60
57
|
add(:firmware_cannot_write_user_id0) do |flaw|
|
61
58
|
flaw.affects_version '1.85', true
|
62
59
|
flaw.affects_version '1.90', true
|
63
|
-
flaw.affects_version '1.95', false
|
64
|
-
flaw.affects_version '2.00', false
|
65
|
-
flaw.affects_version '2.05', false
|
66
60
|
flaw.probably_affects_other_versions false
|
67
61
|
end
|
68
62
|
|
69
63
|
add(:adc_midrange) do |flaw|
|
70
64
|
flaw.affects_version '1.85', :no_middle_values
|
71
|
-
flaw.affects_version '1.90', :bad_modulus
|
72
|
-
flaw.affects_version '1.95', :bad_modulus
|
73
|
-
flaw.affects_version '2.00', :bad_modulus
|
74
|
-
flaw.affects_version '2.05', :bad_modulus
|
75
65
|
flaw.probably_affects_other_versions :bad_modulus
|
76
66
|
end
|
77
67
|
|
@@ -80,8 +70,7 @@ module RPicSim
|
|
80
70
|
flaw.affects_version '1.90', true
|
81
71
|
flaw.affects_version '1.95', true
|
82
72
|
flaw.affects_version '2.00', true
|
83
|
-
flaw.
|
84
|
-
flaw.probably_affects_other_versions :false
|
73
|
+
flaw.probably_affects_other_versions false
|
85
74
|
end
|
86
75
|
end
|
87
76
|
end
|
data/lib/rpicsim/instruction.rb
CHANGED
@@ -205,6 +205,13 @@ module RPicSim
|
|
205
205
|
transitions.map(&:next_address)
|
206
206
|
end
|
207
207
|
|
208
|
+
# Returns true if this is actually a valid instruction. Invalid
|
209
|
+
# instructions can occur when disassembling bytes that are not actually
|
210
|
+
# instructions.
|
211
|
+
def valid?
|
212
|
+
@valid
|
213
|
+
end
|
214
|
+
|
208
215
|
private
|
209
216
|
|
210
217
|
# For certain opcodes, this method gets over-written.
|
@@ -222,10 +229,6 @@ module RPicSim
|
|
222
229
|
Transition.new(self, addr, @instruction_store, attrs)
|
223
230
|
end
|
224
231
|
|
225
|
-
def valid?
|
226
|
-
@valid
|
227
|
-
end
|
228
|
-
|
229
232
|
private
|
230
233
|
|
231
234
|
# Returns the address indicated by the operand 'k'.
|
@@ -1,12 +1,17 @@
|
|
1
1
|
# We override some parts of RSpec to provide better error messages.
|
2
|
+
# This is only needed for RSpec 2.x, since th messages improved in RSpec 3.x
|
2
3
|
# Instead of 'expected driving_high? to return true, got false' RSpec will actually
|
3
4
|
# tell us what object it called driving_high on.
|
4
5
|
class RSpec::Matchers::BuiltIn::BePredicate
|
5
|
-
|
6
|
-
|
7
|
-
|
6
|
+
if instance_methods.include?(:failure_message_for_should)
|
7
|
+
# RSpec 2.x
|
8
|
+
|
9
|
+
def failure_message_for_should
|
10
|
+
"expected `#{actual.inspect}.#{predicate}#{args_to_s}` to return true, got #{@result.inspect}"
|
11
|
+
end
|
8
12
|
|
9
|
-
|
10
|
-
|
13
|
+
def failure_message_for_should_not
|
14
|
+
"expected `#{actual.inspect}.#{predicate}#{args_to_s}` to return false, got #{@result.inspect}"
|
15
|
+
end
|
11
16
|
end
|
12
17
|
end
|
@@ -1,51 +1,82 @@
|
|
1
1
|
# If an example fails, store some diagnostic information about the state of the
|
2
2
|
# simulation so we can print it later.
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
end
|
3
|
+
|
4
|
+
module RPicSim::RSpec::SimDiagnostics
|
5
|
+
def self.store_diagnostics(example, sim)
|
6
|
+
if sim.respond_to? :cycle_count
|
7
|
+
example.metadata[:sim_cycle_count] = sim.cycle_count
|
8
|
+
end
|
9
|
+
if sim.respond_to? :stack_trace
|
10
|
+
example.metadata[:sim_stack_trace] = sim.stack_trace
|
12
11
|
end
|
13
12
|
end
|
14
|
-
end
|
15
|
-
|
16
|
-
require 'rspec/core/formatters/base_text_formatter'
|
17
|
-
RSpec::Core::Formatters::BaseTextFormatter
|
18
13
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
# the other ones.
|
23
|
-
class RSpec::Core::Formatters::BaseTextFormatter
|
24
|
-
alias_method :dump_backtrace_without_sim_diagnostics, :dump_backtrace
|
25
|
-
|
26
|
-
def dump_backtrace(example)
|
27
|
-
dump_backtrace_without_sim_diagnostics(example)
|
28
|
-
dump_sim_diagnostics(example)
|
14
|
+
def self.write_diagnostics(example, output, padding)
|
15
|
+
write_cycle_count(example, output, padding)
|
16
|
+
write_sim_stack_trace(example, output, padding)
|
29
17
|
end
|
30
18
|
|
31
|
-
|
32
|
-
|
33
|
-
|
19
|
+
# Looks inside the metadata for the given RSpec example to see if a
|
20
|
+
# simulation stack trace was recorded. If so, it outputs it with the
|
21
|
+
# appropriate indentation.
|
22
|
+
def self.write_sim_stack_trace(example, output, padding)
|
23
|
+
sim_stack_trace = example.metadata[:sim_stack_trace] or return
|
24
|
+
output.puts
|
25
|
+
output.puts padding + 'Simulation stack trace:'
|
26
|
+
sim_stack_trace.output(output, padding)
|
34
27
|
end
|
35
28
|
|
36
|
-
def
|
29
|
+
def self.write_cycle_count(example, output, padding)
|
37
30
|
cycle_count = example.metadata[:sim_cycle_count] or return
|
38
31
|
output.puts
|
39
|
-
output.printf
|
32
|
+
output.printf padding + "Simulation cycle count: %d\n", cycle_count
|
40
33
|
end
|
34
|
+
end
|
41
35
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
36
|
+
RSpec.configure do |config|
|
37
|
+
config.after(:each) do
|
38
|
+
ex = if RSpec.respond_to?(:current_example)
|
39
|
+
RSpec.current_example # RSpec 3.x and 2.99
|
40
|
+
else
|
41
|
+
example # RSpec 2.x
|
42
|
+
end
|
43
|
+
if @sim && ex.exception
|
44
|
+
RPicSim::RSpec::SimDiagnostics.store_diagnostics(example, @sim)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
if defined?(RSpec::Core::Notifications)
|
50
|
+
# RSpec 3.x
|
51
|
+
|
52
|
+
require 'stringio'
|
53
|
+
class RSpec::Core::Notifications::FailedExampleNotification
|
54
|
+
alias_method :fully_formatted_without_sim_diagnostics, :fully_formatted
|
55
|
+
def fully_formatted(*args)
|
56
|
+
formatted = fully_formatted_without_sim_diagnostics(*args)
|
57
|
+
sio = StringIO.new
|
58
|
+
padding = ' '
|
59
|
+
RPicSim::RSpec::SimDiagnostics.write_diagnostics(example, sio, padding)
|
60
|
+
formatted << sio.string
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
else
|
65
|
+
# RSpec 2.x
|
66
|
+
|
67
|
+
require 'rspec/core/formatters/base_text_formatter'
|
68
|
+
RSpec::Core::Formatters::BaseTextFormatter
|
69
|
+
|
70
|
+
# We enhance rspec's backtrace so it will also show us the stack trace of the
|
71
|
+
# simulation, if available. These monkey patches are broken up into three
|
72
|
+
# different functions so you can easily customize any of them without messing up
|
73
|
+
# the other ones.
|
74
|
+
class RSpec::Core::Formatters::BaseTextFormatter
|
75
|
+
alias_method :dump_backtrace_without_sim_diagnostics, :dump_backtrace
|
76
|
+
def dump_backtrace(example)
|
77
|
+
dump_backtrace_without_sim_diagnostics(example)
|
78
|
+
RPicSim::RSpec::SimDiagnostics.write_diagnostics(example, output, long_padding)
|
79
|
+
end
|
50
80
|
end
|
81
|
+
|
51
82
|
end
|
data/lib/rpicsim/sim.rb
CHANGED
@@ -33,7 +33,7 @@ module RPicSim
|
|
33
33
|
# You must call {#use_device} before calling this.
|
34
34
|
def use_file(filename)
|
35
35
|
raise "The device needs to be specified before filename (e.g. 'use_device \"PIC10F322\"')" unless @device
|
36
|
-
@filename = filename
|
36
|
+
@filename = filename.to_s
|
37
37
|
load_program_file
|
38
38
|
end
|
39
39
|
|
data/lib/rpicsim/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rpicsim
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pololu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -16,50 +16,11 @@ executables: []
|
|
16
16
|
extensions: []
|
17
17
|
extra_rdoc_files: []
|
18
18
|
files:
|
19
|
-
-
|
20
|
-
-
|
21
|
-
- lib/rpicsim/composite_memory.rb
|
22
|
-
- lib/rpicsim/flaws.rb
|
23
|
-
- lib/rpicsim/instruction.rb
|
24
|
-
- lib/rpicsim/label.rb
|
25
|
-
- lib/rpicsim/memory.rb
|
26
|
-
- lib/rpicsim/memory_watcher.rb
|
27
|
-
- lib/rpicsim/mplab.rb
|
28
|
-
- lib/rpicsim/pin.rb
|
29
|
-
- lib/rpicsim/program_counter.rb
|
30
|
-
- lib/rpicsim/program_file.rb
|
31
|
-
- lib/rpicsim/rspec.rb
|
32
|
-
- lib/rpicsim/search.rb
|
33
|
-
- lib/rpicsim/sim.rb
|
34
|
-
- lib/rpicsim/stack_pointer.rb
|
35
|
-
- lib/rpicsim/stack_trace.rb
|
36
|
-
- lib/rpicsim/variable.rb
|
37
|
-
- lib/rpicsim/variable_set.rb
|
38
|
-
- lib/rpicsim/version.rb
|
39
|
-
- lib/rpicsim/mplab/mplab_assembly.rb
|
40
|
-
- lib/rpicsim/mplab/mplab_device_info.rb
|
41
|
-
- lib/rpicsim/mplab/mplab_disassembler.rb
|
42
|
-
- lib/rpicsim/mplab/mplab_instruction.rb
|
43
|
-
- lib/rpicsim/mplab/mplab_loader.rb
|
44
|
-
- lib/rpicsim/mplab/mplab_memory.rb
|
45
|
-
- lib/rpicsim/mplab/mplab_nmmr_info.rb
|
46
|
-
- lib/rpicsim/mplab/mplab_observer.rb
|
47
|
-
- lib/rpicsim/mplab/mplab_pin.rb
|
48
|
-
- lib/rpicsim/mplab/mplab_processor.rb
|
49
|
-
- lib/rpicsim/mplab/mplab_program_file.rb
|
50
|
-
- lib/rpicsim/mplab/mplab_register.rb
|
51
|
-
- lib/rpicsim/mplab/mplab_sfr_info.rb
|
52
|
-
- lib/rpicsim/mplab/mplab_simulator.rb
|
53
|
-
- lib/rpicsim/rspec/be_predicate.rb
|
54
|
-
- lib/rpicsim/rspec/helpers.rb
|
55
|
-
- lib/rpicsim/rspec/persistent_expectations.rb
|
56
|
-
- lib/rpicsim/rspec/sim_diagnostics.rb
|
57
|
-
- lib/rpicsim/storage/memory_integer.rb
|
58
|
-
- lib/rpicsim/storage/register.rb
|
19
|
+
- .yardopts
|
20
|
+
- Gemfile
|
59
21
|
- Introduction.md
|
60
22
|
- LICENSE.txt
|
61
23
|
- README.md
|
62
|
-
- Gemfile
|
63
24
|
- docs/ChangeLog.md
|
64
25
|
- docs/Contributing.md
|
65
26
|
- docs/Debugging.md
|
@@ -78,8 +39,8 @@ files:
|
|
78
39
|
- docs/Pins.md
|
79
40
|
- docs/PreventingCallStackOverflow.md
|
80
41
|
- docs/QuickStartGuide.md
|
81
|
-
- docs/RamWatcher.md
|
82
42
|
- docs/RSpecIntegration.md
|
43
|
+
- docs/RamWatcher.md
|
83
44
|
- docs/Running.md
|
84
45
|
- docs/Stubbing.md
|
85
46
|
- docs/SupportedCompilers.md
|
@@ -88,7 +49,46 @@ files:
|
|
88
49
|
- docs/SupportedOperatingSystems.md
|
89
50
|
- docs/UnitTesting.md
|
90
51
|
- docs/Variables.md
|
91
|
-
- .
|
52
|
+
- lib/rpicsim.rb
|
53
|
+
- lib/rpicsim/call_stack_info.rb
|
54
|
+
- lib/rpicsim/composite_memory.rb
|
55
|
+
- lib/rpicsim/flaws.rb
|
56
|
+
- lib/rpicsim/instruction.rb
|
57
|
+
- lib/rpicsim/label.rb
|
58
|
+
- lib/rpicsim/memory.rb
|
59
|
+
- lib/rpicsim/memory_watcher.rb
|
60
|
+
- lib/rpicsim/mplab.rb
|
61
|
+
- lib/rpicsim/mplab/mplab_assembly.rb
|
62
|
+
- lib/rpicsim/mplab/mplab_device_info.rb
|
63
|
+
- lib/rpicsim/mplab/mplab_disassembler.rb
|
64
|
+
- lib/rpicsim/mplab/mplab_instruction.rb
|
65
|
+
- lib/rpicsim/mplab/mplab_loader.rb
|
66
|
+
- lib/rpicsim/mplab/mplab_memory.rb
|
67
|
+
- lib/rpicsim/mplab/mplab_nmmr_info.rb
|
68
|
+
- lib/rpicsim/mplab/mplab_observer.rb
|
69
|
+
- lib/rpicsim/mplab/mplab_pin.rb
|
70
|
+
- lib/rpicsim/mplab/mplab_processor.rb
|
71
|
+
- lib/rpicsim/mplab/mplab_program_file.rb
|
72
|
+
- lib/rpicsim/mplab/mplab_register.rb
|
73
|
+
- lib/rpicsim/mplab/mplab_sfr_info.rb
|
74
|
+
- lib/rpicsim/mplab/mplab_simulator.rb
|
75
|
+
- lib/rpicsim/pin.rb
|
76
|
+
- lib/rpicsim/program_counter.rb
|
77
|
+
- lib/rpicsim/program_file.rb
|
78
|
+
- lib/rpicsim/rspec.rb
|
79
|
+
- lib/rpicsim/rspec/be_predicate.rb
|
80
|
+
- lib/rpicsim/rspec/helpers.rb
|
81
|
+
- lib/rpicsim/rspec/persistent_expectations.rb
|
82
|
+
- lib/rpicsim/rspec/sim_diagnostics.rb
|
83
|
+
- lib/rpicsim/search.rb
|
84
|
+
- lib/rpicsim/sim.rb
|
85
|
+
- lib/rpicsim/stack_pointer.rb
|
86
|
+
- lib/rpicsim/stack_trace.rb
|
87
|
+
- lib/rpicsim/storage/memory_integer.rb
|
88
|
+
- lib/rpicsim/storage/register.rb
|
89
|
+
- lib/rpicsim/variable.rb
|
90
|
+
- lib/rpicsim/variable_set.rb
|
91
|
+
- lib/rpicsim/version.rb
|
92
92
|
homepage: https://github.com/pololu/rpicsim
|
93
93
|
licenses:
|
94
94
|
- MIT
|
@@ -111,7 +111,7 @@ requirements:
|
|
111
111
|
- JRuby
|
112
112
|
- MPLAB X
|
113
113
|
rubyforge_project:
|
114
|
-
rubygems_version: 2.
|
114
|
+
rubygems_version: 2.3.0
|
115
115
|
signing_key:
|
116
116
|
specification_version: 4
|
117
117
|
summary: RPicSim provides an interface to the MPLAB X PIC simulator that allows you to write simulator-based automated tests of PIC firmware with Ruby and RSpec.
|