mbed-os
Dependents: cobaLCDJoyMotor_Thread odometry_omni_3roda_v3 odometry_omni_3roda_v1 odometry_omni_3roda_v2 ... more
Diff: tools/dev/intel_hex_utils.py
- Revision:
- 0:b74591d5ab33
diff -r 000000000000 -r b74591d5ab33 tools/dev/intel_hex_utils.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/dev/intel_hex_utils.py Mon Dec 11 17:54:04 2017 +0000 @@ -0,0 +1,31 @@ +from intelhex import IntelHex +from cStringIO import StringIO + + +def sections(h): + start, last_address = None, None + for a in h.addresses(): + if last_address is None: + start, last_address = a, a + continue + + if a > last_address + 1: + yield (start, last_address) + start = a + + last_address = a + + if start: + yield (start, last_address) + + +def print_sections(h): + for s in sections(h): + print "[0x%08X - 0x%08X]" % s + + +def decode(record): + h = IntelHex() + f = StringIO(record) + h.loadhex(f) + h.dump()