A ruby based lw hex file manipulator tool. Provides high level abstraction by providing access to different memory regions via named variables. Supports dumping the result to new file and even diff with the other files.
#!ruby
require "tinker"
image = Tinker.load_image "./original.hex", "./original.meta.yaml"
puts image.variables # lists all the variables read from 'original.meta.yaml' and instantiated from original.hex
image['volts_trip_setting'] = 225 # encodes 0xE1 inside the image at the address of the 'volts_trip_setting' variable
image['amps_trip_settings'] = 30
t.dump './modified.hex' # saves the modified image to the specified file
differences = Tinker.diff "./original.hex", './modified.hex', "pic16f1516"
puts differences
### output:
# ~ flash @ 0x3F00 : '0xE1' (original is '0xE6')
The "./original.meta.yaml" file contains the metadata of hex file (cpu, variables, etc.):
#!yaml
:meta:
:cpu: PIC16F1516
:data:
:volts_trip_setting:
:size: 2
:type: u16
:address: 16128
:value: 230
:memory_name: flash
:amps_trip_settings:
:size: 2
:type: u16
:address: 16132
:value: 10
:memory_name: flash
This meta file will be automagically generated by the datastore tool (if used to generate store variables).