File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change 1
- def print_section ( start , end ):
2
- print "[0x%08X - 0x%08X]" % ( start , end )
1
+ from intelhex import IntelHex
2
+ from cStringIO import StringIO
3
3
4
- def print_sections (h ):
4
+
5
+ def sections (h ):
5
6
start , last_address = None , None
6
7
for a in h .addresses ():
7
8
if last_address is None :
8
9
start , last_address = a , a
9
10
continue
10
11
11
12
if a > last_address + 1 :
12
- print_section (start , last_address )
13
+ yield (start , last_address )
13
14
start = a
14
15
15
16
last_address = a
16
17
17
18
if start :
18
- print_section (start , last_address )
19
+ yield (start , last_address )
20
+
21
+
22
+ def print_sections (h ):
23
+ for s in sections (h ):
24
+ print "[0x%08X - 0x%08X]" % s
25
+
26
+
27
+ def decode (record ):
28
+ h = IntelHex ()
29
+ f = StringIO (record )
30
+ h .loadhex (f )
31
+ h .dump ()
You can’t perform that action at this time.
0 commit comments