File: part2-3.txt

package info (click to toggle)
intelhex 2.3.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 472 kB
  • sloc: python: 3,200; makefile: 86; sh: 15
file content (30 lines) | stat: -rw-r--r-- 1,282 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Basic data inspection
*********************
You can get or modify some data by address in the usual way: 
via Python indexing operations::

    >>> print ih[0] # read data from address 0

When you need to work with 16-bit data stored in 8-bit Intel HEX files 
you need to use class ``IntelHex16bit``. This class is derived from IntelHex 
and has all its methods. Some of methods have been modified to implement 
16-bit behaviour.

**NOTE:** ``IntelHex16bit`` class despite its name **can't handle** real HEX16 
files. Initially ``IntelHex16bit`` has been created as helper class to work with
HEX files for Microchip's PIC16 family firmware. It may or may not work for
your purpose.

This class assumes the data is in Little Endian byte order. 
The data can be accessed exactly like above, except that data returned will be 
16 bits, and the addresses should be word addresses.

Another useful inspection tool is the dump command. This will output 
the entire contents of the hex file to stdout or to a specified file object
like so::

    >>> ih.dump() # dump contents of ih to stdout in tabular hexdump format

    >>> f = open('hexdump.txt', 'w') # open file for writing
    >>> ih.dump(f)                   # dump to file object
    >>> f.close()                    # close file