|
@@ -39,6 +39,9 @@ parser.add_argument("ifile", help="Input application binary (binary)")
|
39
|
39
|
parser.add_argument("ofile", help="Output header file (binary)")
|
40
|
40
|
parser.add_argument("-a", "--addr", help="Load address of the application image",
|
41
|
41
|
type=any_int, default=0x10004000)
|
|
42
|
+parser.add_argument("-m", "--map", help="Map file to scan for application image section")
|
|
43
|
+parser.add_argument("-s", "--section", help="Section name to look for in map file",
|
|
44
|
+ default=".app_bin")
|
42
|
45
|
args = parser.parse_args()
|
43
|
46
|
|
44
|
47
|
try:
|
|
@@ -46,7 +49,22 @@ try:
|
46
|
49
|
except:
|
47
|
50
|
sys.exit("Could not open input file '{}'".format(args.ifile))
|
48
|
51
|
|
49
|
|
-vtor = args.addr
|
|
52
|
+if args.map:
|
|
53
|
+ vtor = None
|
|
54
|
+ with open(args.map) as mapfile:
|
|
55
|
+ for line in mapfile:
|
|
56
|
+ if line.startswith(args.section):
|
|
57
|
+ parts = line.split()
|
|
58
|
+ if len(parts)>1:
|
|
59
|
+ vtor = int(parts[1],0)
|
|
60
|
+ print('found address 0x%x for %s in %s'%(vtor,args.section,args.map))
|
|
61
|
+ break
|
|
62
|
+
|
|
63
|
+ if vtor is None:
|
|
64
|
+ sys.exit("Could not find section {} in {}".format(args.section,args.map))
|
|
65
|
+else:
|
|
66
|
+ vtor = args.addr
|
|
67
|
+
|
50
|
68
|
size = len(idata)
|
51
|
69
|
crc = binascii.crc32(idata)
|
52
|
70
|
|