Skip to content

Commit 9514cf8

Browse files
Archcady0xc0170
authored andcommitted
improve py code
1 parent d75c5db commit 9514cf8

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

tools/REALTEK_RTL8195AM.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ def prepend(image, image_prepend, toolchain, info):
5757
append_image_file(image, output)
5858

5959
elif toolchain == "IAR":
60-
write_fixed_width_value(int(info['size']), 8, output)
61-
write_fixed_width_value(int(info['addr']), 8, output)
60+
write_fixed_width_value(info['size'], 8, output)
61+
write_fixed_width_value(info['addr'], 8, output)
6262
write_fixed_width_value(RAM2_RSVD, 16, output)
6363
with open(image, "rb") as input:
64-
input.seek(int(info['addr']))
65-
output.write(input.read(int(info['size'])))
64+
input.seek(info['addr'])
65+
output.write(input.read(info['size']))
6666
output.close()
6767

6868
def parse_section(toolchain, elf, section):
@@ -107,9 +107,8 @@ def parse_section(toolchain, elf, section):
107107
info['size'] = 0x0
108108
return info
109109

110-
if not info['addr']:
111-
print "[ERROR] cannot find the address of section " + section
112-
elif not info['size']:
110+
print "[ERROR] cannot find the address of section " + section
111+
if not info['size']:
113112
if toolchain == "IAR":
114113
print "[WARNING] cannot find the size of section " + section
115114

0 commit comments

Comments
 (0)