intel_hex 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/intel_hex/record.rb +9 -9
- data/lib/intel_hex/version.rb +1 -1
- metadata +34 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f4dfc549e66964b205d64f063f38c1dc091e8bfc92755076c9f267d72f50422
|
4
|
+
data.tar.gz: 87e987fd8decf8520c5648ea524d0e79da09c0950a8713c887e8afc66ece629c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec5dd2ac67f7387f4602f2806633f0a26e717ed9a27b35f0ac01baee8a70856a485cbd63fb6a597841b0c29c14653d50daf8c1bb5a225bbd03d2106b73b65317
|
7
|
+
data.tar.gz: cfdace7c69d4f52cea5728b9d38851c6f0da2dc8f6e6e0669d05f99829296c17668e6fb0298d69b38673d5197c2c23a2205500e405a94cdce30b27b9efc2d819
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# An Intel hex file parser, for Ruby
|
2
2
|
|
3
|
-
|
3
|
+
[![rspec test status](https://github.com/jeremycole/intel_hex/actions/workflows/rspec.yml/badge.svg)](https://github.com/jeremycole/intel_hex/actions/workflows/rspec.yml)
|
4
4
|
|
5
|
-
[
|
5
|
+
See the [Wikipedia page on Intel HEX](https://en.wikipedia.org/wiki/Intel_HEX).
|
data/lib/intel_hex/record.rb
CHANGED
@@ -4,10 +4,15 @@ module IntelHex
|
|
4
4
|
class MisformattedFileError < RuntimeError; end
|
5
5
|
|
6
6
|
class ValidationError < StandardError; end
|
7
|
+
|
7
8
|
class InvalidTypeError < ValidationError; end
|
9
|
+
|
8
10
|
class InvalidLengthError < ValidationError; end
|
11
|
+
|
9
12
|
class InvalidOffsetError < ValidationError; end
|
13
|
+
|
10
14
|
class InvalidDataError < ValidationError; end
|
15
|
+
|
11
16
|
class InvalidChecksumError < ValidationError; end
|
12
17
|
|
13
18
|
class Record
|
@@ -40,7 +45,7 @@ module IntelHex
|
|
40
45
|
|
41
46
|
offset = line[3..6].to_i(16)
|
42
47
|
type = TYPES[line[7..8].to_i(16)]
|
43
|
-
data = line[9...data_end].
|
48
|
+
data = line[9...data_end].chars.each_slice(2).map { |a| a.join.to_i(16) }
|
44
49
|
checksum = line[data_end..(data_end + 2)].to_i(16)
|
45
50
|
|
46
51
|
Record.new(type, length, offset, data, checksum, line: line, validate: true)
|
@@ -58,7 +63,7 @@ module IntelHex
|
|
58
63
|
|
59
64
|
def self.type_with_value(type, value)
|
60
65
|
record = Record.new(type)
|
61
|
-
record.send(
|
66
|
+
record.send("#{type}=".to_sym, value)
|
62
67
|
record
|
63
68
|
end
|
64
69
|
|
@@ -78,12 +83,7 @@ module IntelHex
|
|
78
83
|
type_with_value(:sla, value)
|
79
84
|
end
|
80
85
|
|
81
|
-
attr_reader :length
|
82
|
-
attr_reader :offset
|
83
|
-
attr_reader :type
|
84
|
-
attr_reader :data
|
85
|
-
attr_reader :checksum
|
86
|
-
attr_reader :line
|
86
|
+
attr_reader :length, :offset, :type, :data, :checksum, :line
|
87
87
|
|
88
88
|
# rubocop:disable Metrics/ParameterLists
|
89
89
|
def initialize(type, length = 0, offset = 0, data = [], checksum = nil, line: nil, validate: false)
|
@@ -100,7 +100,7 @@ module IntelHex
|
|
100
100
|
# rubocop:enable Metrics/ParameterLists
|
101
101
|
|
102
102
|
def data_s
|
103
|
-
|
103
|
+
"[#{data.map { |b| '%02x' % b }.join(' ')}]"
|
104
104
|
end
|
105
105
|
|
106
106
|
def value_s
|
data/lib/intel_hex/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: intel_hex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Cole
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -24,6 +24,34 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubocop
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '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'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubocop-rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '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'
|
27
55
|
description: An Intel hex file parser for (e.g. AVR) working with firmware files
|
28
56
|
email: jeremy@jcole.us
|
29
57
|
executables:
|
@@ -50,7 +78,10 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
50
78
|
requirements:
|
51
79
|
- - ">="
|
52
80
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
81
|
+
version: '2.6'
|
82
|
+
- - "<"
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '4'
|
54
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
86
|
requirements:
|
56
87
|
- - ">="
|