Parses Intel HEX files and gives metadata about the file and records.
See http://en.wikipedia.org/wiki/Intel_HEX for information on the file format
Add this line to your application's Gemfile:
gem 'hex_file'
And then execute:
$ bundle
Or install it yourself as:
$ gem install hex_file
info = HexFile::Info.new(File.open('myfile.hex', 'r'))
info.format
# I8HEX
info.binary_size
# 12134
info.records.each do |record|
puts record.data_size
puts record.byte_count
puts record.address
puts record.type
puts record.data
puts record.checksum
puts record.ok? # true if checksum correct
end
Also there is a bin script that gives a summary
$ hex_file_info myfile.hex
Format: I32HEX
Records: 7133
Binary Size (bytes): 113918
Note if you're an rbenv user, don't forget to rbenv rehash
after installing the gem to make the hex_file_info
script available.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request