srec 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/srec.rb +27 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17e7683e7f20cc5387a2430210ad96f0b0d1e321
|
4
|
+
data.tar.gz: 373e63647343c83b0b13a6fb7d467915bf75f957
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3135453cdb5672a4d1be1b0552de321102a9776a48d21c8705b88b19c826ad9d17d96cacaef06318667c983000af99c749ebfaff3943c2a3241977f162df5b6d
|
7
|
+
data.tar.gz: 434bebbe7e4ad3a6bfa5c93c0b040a545cd8d3b584869373dacf2e2636be471dc453c2a358c722a1e5712bb0e272db4e03fcc3cd5564738729fbeca42c58d484
|
data/lib/srec.rb
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
require "pp"
|
5
5
|
|
6
6
|
class Srec
|
7
|
+
attr_accessor :min,:max
|
7
8
|
def initialize(hash={})
|
8
9
|
if hash[:file]
|
9
10
|
if not File.exist? hash[:file]
|
@@ -18,6 +19,8 @@ class Srec
|
|
18
19
|
@lines=@data.split "\n"
|
19
20
|
@mem={}
|
20
21
|
@bytes=0
|
22
|
+
@min=nil
|
23
|
+
@max=nil
|
21
24
|
@lines.each do |l|
|
22
25
|
if l[0]=='S'
|
23
26
|
type=l[1].to_i
|
@@ -42,6 +45,8 @@ class Srec
|
|
42
45
|
@bytes+=b.size
|
43
46
|
if [1,2,3].include? type
|
44
47
|
@mem[addr]=b
|
48
|
+
@min=addr if not @min or addr<@min
|
49
|
+
@max=(addr+b.length) if not @max or addr+b.length>@max
|
45
50
|
elsif [7,8,9].include? type
|
46
51
|
@boot=b
|
47
52
|
elsif type==0
|
@@ -51,8 +56,9 @@ class Srec
|
|
51
56
|
end
|
52
57
|
end
|
53
58
|
end
|
54
|
-
puts "'#{@info}': #{@mem.length} Records, #{@bytes} Bytes"
|
59
|
+
puts "'#{@info}': #{@mem.length} Records, #{@bytes} Bytes [#{@min.to_s(16)}..#{@max.to_s(16)}]"
|
55
60
|
end
|
61
|
+
|
56
62
|
def to_blocks min,max,size
|
57
63
|
blks={}
|
58
64
|
@mem.each do |a,b|
|
@@ -70,4 +76,24 @@ class Srec
|
|
70
76
|
end
|
71
77
|
blks
|
72
78
|
end
|
79
|
+
|
80
|
+
def self.diff b,b_old
|
81
|
+
todo={}
|
82
|
+
b.each do |k,v|
|
83
|
+
if b_old[k]
|
84
|
+
dc=0
|
85
|
+
v.each_with_index do |byte,i|
|
86
|
+
if byte!=b_old[k][i]
|
87
|
+
#printf "diff %d:%d %02X -- %02X\n",k,i,byte,b_old[k][i]
|
88
|
+
dc+=1
|
89
|
+
end
|
90
|
+
end
|
91
|
+
if dc==0
|
92
|
+
next
|
93
|
+
end
|
94
|
+
end
|
95
|
+
todo[k]=v
|
96
|
+
end
|
97
|
+
todo
|
98
|
+
end
|
73
99
|
end
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: srec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ari Siitonen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: Pure Ruby Motorola s-record support
|
14
|
-
|
13
|
+
description: Pure Ruby Motorola s-record support -- library to access and manipulate
|
14
|
+
srec-files
|
15
15
|
email: jalopuuverstas@gmail.com
|
16
16
|
executables: []
|
17
17
|
extensions: []
|
@@ -41,5 +41,5 @@ rubyforge_project:
|
|
41
41
|
rubygems_version: 2.2.2
|
42
42
|
signing_key:
|
43
43
|
specification_version: 4
|
44
|
-
summary: Pure Ruby Motorola s-record support
|
44
|
+
summary: Pure Ruby Motorola s-record support
|
45
45
|
test_files: []
|