build: Make print statements in scripts python3 compatible.
Signed-off-by: Johannes Krampf <johannes.krampf@googlemail.com>
This commit is contained in:
parent
24ef4fd0d2
commit
064fd069ef
|
@ -40,11 +40,11 @@ def main():
|
|||
if datasize > 128*1024:
|
||||
finalsize = 256*1024
|
||||
if datasize > finalsize:
|
||||
print "Error! ROM doesn't fit (%d > %d)" % (datasize, finalsize)
|
||||
print " You have to either increate the size (CONFIG_ROM_SIZE)"
|
||||
print " or turn off some features (such as hardware support not"
|
||||
print " needed) to make it fit. Trying a more recent gcc version"
|
||||
print " might work too."
|
||||
print("Error! ROM doesn't fit (%d > %d)" % (datasize, finalsize))
|
||||
print(" You have to either increate the size (CONFIG_ROM_SIZE)")
|
||||
print(" or turn off some features (such as hardware support not")
|
||||
print(" needed) to make it fit. Trying a more recent gcc version")
|
||||
print(" might work too.")
|
||||
sys.exit(1)
|
||||
|
||||
# Sanity checks
|
||||
|
@ -52,17 +52,17 @@ def main():
|
|||
end = symbols['code32flat_end'].offset
|
||||
expend = layoutrom.BUILD_BIOS_ADDR + layoutrom.BUILD_BIOS_SIZE
|
||||
if end != expend:
|
||||
print "Error! Code does not end at 0x%x (got 0x%x)" % (
|
||||
expend, end)
|
||||
print("Error! Code does not end at 0x%x (got 0x%x)" % (
|
||||
expend, end))
|
||||
sys.exit(1)
|
||||
if datasize > finalsize:
|
||||
print "Error! Code is too big (0x%x vs 0x%x)" % (
|
||||
datasize, finalsize)
|
||||
print("Error! Code is too big (0x%x vs 0x%x)" % (
|
||||
datasize, finalsize))
|
||||
sys.exit(1)
|
||||
expdatasize = end - start
|
||||
if datasize != expdatasize:
|
||||
print "Error! Unknown extra data (0x%x vs 0x%x)" % (
|
||||
datasize, expdatasize)
|
||||
print("Error! Unknown extra data (0x%x vs 0x%x)" % (
|
||||
datasize, expdatasize))
|
||||
sys.exit(1)
|
||||
|
||||
# Fix up CSM Compatibility16 table
|
||||
|
@ -83,10 +83,10 @@ def main():
|
|||
|
||||
# Print statistics
|
||||
runtimesize = end - symbols['code32init_end'].offset
|
||||
print "Total size: %d Fixed: %d Free: %d (used %.1f%% of %dKiB rom)" % (
|
||||
print("Total size: %d Fixed: %d Free: %d (used %.1f%% of %dKiB rom)" % (
|
||||
datasize, runtimesize, finalsize - datasize
|
||||
, (datasize / float(finalsize)) * 100.0
|
||||
, finalsize / 1024)
|
||||
, finalsize / 1024))
|
||||
|
||||
# Write final file
|
||||
f = open(outfile, 'wb')
|
||||
|
|
|
@ -182,12 +182,12 @@ def calc():
|
|||
elif insn.startswith('calll'):
|
||||
noteCall(cur, subfuncs, insnaddr, calladdr, stackusage + 4)
|
||||
else:
|
||||
print "unknown call", ref
|
||||
print("unknown call", ref)
|
||||
noteCall(cur, subfuncs, insnaddr, calladdr, stackusage)
|
||||
# Reset stack usage to preamble usage
|
||||
stackusage = cur[1]
|
||||
|
||||
#print "other", repr(line)
|
||||
#print("other", repr(line))
|
||||
|
||||
# Calculate maxstackusage
|
||||
for funcaddr, info in funcs.items():
|
||||
|
@ -199,7 +199,7 @@ def calc():
|
|||
funcaddrs = orderfuncs(funcs.keys(), funcs.copy())
|
||||
|
||||
# Show all functions
|
||||
print OUTPUTDESC
|
||||
print(OUTPUTDESC)
|
||||
for funcaddr in funcaddrs:
|
||||
name, basicusage, maxusage, yieldusage, maxyieldusage, count, calls = \
|
||||
funcs[funcaddr]
|
||||
|
@ -208,15 +208,15 @@ def calc():
|
|||
yieldstr = ""
|
||||
if maxyieldusage is not None:
|
||||
yieldstr = ",%d" % maxyieldusage
|
||||
print "\n%s[%d,%d%s]:" % (name, basicusage, maxusage, yieldstr)
|
||||
print("\n%s[%d,%d%s]:" % (name, basicusage, maxusage, yieldstr))
|
||||
for insnaddr, calladdr, stackusage in calls:
|
||||
callinfo = funcs.get(calladdr, ("<unknown>", 0, 0, 0, None))
|
||||
yieldstr = ""
|
||||
if callinfo[4] is not None:
|
||||
yieldstr = ",%d" % (stackusage + callinfo[4])
|
||||
print " %04s:%-40s [%d+%d,%d%s]" % (
|
||||
print(" %04s:%-40s [%d+%d,%d%s]" % (
|
||||
insnaddr, callinfo[0], stackusage, callinfo[1]
|
||||
, stackusage+callinfo[2], yieldstr)
|
||||
, stackusage+callinfo[2], yieldstr))
|
||||
|
||||
def main():
|
||||
calc()
|
||||
|
|
|
@ -10,7 +10,7 @@ import sys
|
|||
def main():
|
||||
data = sys.stdin.read()
|
||||
ords = map(ord, data)
|
||||
print "sum=%x\n" % sum(ords)
|
||||
print("sum=%x\n" % sum(ords))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -76,8 +76,8 @@ def fitSections(sections, fillsections):
|
|||
section.finalsegloc = addr
|
||||
fixedsections.append((addr, section))
|
||||
if section.align != 1:
|
||||
print "Error: Fixed section %s has non-zero alignment (%d)" % (
|
||||
section.name, section.align)
|
||||
print("Error: Fixed section %s has non-zero alignment (%d)" % (
|
||||
section.name, section.align))
|
||||
sys.exit(1)
|
||||
fixedsections.sort()
|
||||
firstfixed = fixedsections[0][0]
|
||||
|
@ -106,8 +106,8 @@ def fitSections(sections, fillsections):
|
|||
addpos = fixedsection.finalsegloc + fixedsection.size
|
||||
totalused += fixedsection.size
|
||||
nextfixedaddr = addpos + freespace
|
||||
# print "Filling section %x uses %d, next=%x, available=%d" % (
|
||||
# fixedsection.finalloc, fixedsection.size, nextfixedaddr, freespace)
|
||||
# print("Filling section %x uses %d, next=%x, available=%d" % (
|
||||
# fixedsection.finalloc, fixedsection.size, nextfixedaddr, freespace))
|
||||
while 1:
|
||||
canfit = None
|
||||
for fitsection in canrelocate:
|
||||
|
@ -115,8 +115,8 @@ def fitSections(sections, fillsections):
|
|||
# Can't fit and nothing else will fit.
|
||||
break
|
||||
fitnextaddr = alignpos(addpos, fitsection.align) + fitsection.size
|
||||
# print "Test %s - %x vs %x" % (
|
||||
# fitsection.name, fitnextaddr, nextfixedaddr)
|
||||
# print("Test %s - %x vs %x" % (
|
||||
# fitsection.name, fitnextaddr, nextfixedaddr))
|
||||
if fitnextaddr > nextfixedaddr:
|
||||
# This item can't fit.
|
||||
continue
|
||||
|
@ -130,9 +130,9 @@ def fitSections(sections, fillsections):
|
|||
fitsection.finalsegloc = addpos
|
||||
addpos = fitnextaddr
|
||||
totalused += fitsection.size
|
||||
# print " Adding %s (size %d align %d) pos=%x avail=%d" % (
|
||||
# print(" Adding %s (size %d align %d) pos=%x avail=%d" % (
|
||||
# fitsection[2], fitsection[0], fitsection[1]
|
||||
# , fitnextaddr, nextfixedaddr - fitnextaddr)
|
||||
# , fitnextaddr, nextfixedaddr - fitnextaddr))
|
||||
|
||||
# Report stats
|
||||
total = BUILD_BIOS_SIZE-firstfixed
|
||||
|
@ -273,12 +273,12 @@ def doLayout(sections, config, genreloc):
|
|||
size32flat = li.sec32fseg_start - li.sec32flat_start
|
||||
size32init = li.sec32flat_start - li.sec32init_start
|
||||
sizelow = sec32low_end - li.sec32low_start
|
||||
print "16bit size: %d" % size16
|
||||
print "32bit segmented size: %d" % size32seg
|
||||
print "32bit flat size: %d" % size32flat
|
||||
print "32bit flat init size: %d" % size32init
|
||||
print "Lowmem size: %d" % sizelow
|
||||
print "f-segment var size: %d" % size32fseg
|
||||
print("16bit size: %d" % size16)
|
||||
print("32bit segmented size: %d" % size32seg)
|
||||
print("32bit flat size: %d" % size32flat)
|
||||
print("32bit flat init size: %d" % size32init)
|
||||
print("Lowmem size: %d" % sizelow)
|
||||
print("f-segment var size: %d" % size32fseg)
|
||||
return li
|
||||
|
||||
|
||||
|
@ -458,8 +458,8 @@ def markRuntime(section, sections, chain=[]):
|
|||
or '.init.' in section.name or section.fileid != '32flat'):
|
||||
return
|
||||
if '.data.varinit.' in section.name:
|
||||
print "ERROR: %s is VARVERIFY32INIT but used from %s" % (
|
||||
section.name, chain)
|
||||
print("ERROR: %s is VARVERIFY32INIT but used from %s" % (
|
||||
section.name, chain))
|
||||
sys.exit(1)
|
||||
section.category = '32flat'
|
||||
# Recursively mark all sections this section points to
|
||||
|
|
|
@ -156,11 +156,11 @@ def main():
|
|||
try:
|
||||
import serial
|
||||
except ImportError:
|
||||
print """
|
||||
print("""
|
||||
Unable to find pyserial package ( http://pyserial.sourceforge.net/ ).
|
||||
On Linux machines try: yum install pyserial
|
||||
Or: apt-get install python-serial
|
||||
"""
|
||||
""")
|
||||
sys.exit(1)
|
||||
ser = serial.Serial(serialport, baud, timeout=0)
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue