mirror of
https://github.com/rene-dev/stmbl.git
synced 2026-02-06 02:02:34 +08:00
python3 stuff
This commit is contained in:
@@ -119,7 +119,7 @@ def parse_args():
|
||||
def dprint(*str):
|
||||
if args.verbose:
|
||||
for s in str:
|
||||
print s,
|
||||
print (s,)
|
||||
print
|
||||
|
||||
|
||||
@@ -189,5 +189,5 @@ if __name__ == '__main__':
|
||||
patch_elf()
|
||||
|
||||
except Exception as e:
|
||||
print e
|
||||
print (e)
|
||||
exit(1)
|
||||
|
||||
@@ -12,11 +12,11 @@ done = False
|
||||
|
||||
for port in serial.tools.list_ports.comports():
|
||||
if "483:5740" in port[2]:
|
||||
print "Reseting stmbl at " + port[2]
|
||||
print ("Reseting stmbl at " + port[2])
|
||||
stmbl = serial.Serial(port[0])
|
||||
stmbl.write('bootloader\n')
|
||||
stmbl.close()
|
||||
done = True
|
||||
|
||||
if not done:
|
||||
print "No boards found"
|
||||
print ("No boards found")
|
||||
|
||||
@@ -126,11 +126,11 @@ if __name__=='__main__':
|
||||
|
||||
# CRC32 with default polynom
|
||||
crc = CRC32().calc(arg[::-1])
|
||||
print "CRC32(%s) = 0x%08x" % (repr(arg), crc)
|
||||
print ("CRC32(%s) = 0x%08x" % (repr(arg), crc))
|
||||
assert(struct.pack('<L', crc) == check[::-1])
|
||||
|
||||
rcrc = CRC32().rcalc(arg[::-1], crc)
|
||||
print "RCRC32(%s, 0x%08x) = 0x%08x" % (repr(arg), crc, rcrc)
|
||||
print ("RCRC32(%s, 0x%08x) = 0x%08x" % (repr(arg), crc, rcrc))
|
||||
assert(rcrc == 0xffffffff)
|
||||
|
||||
|
||||
|
||||
16
tools/elf.py
16
tools/elf.py
@@ -301,18 +301,18 @@ class ELFObject:
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print "This is only a module test!"
|
||||
print ("This is only a module test!")
|
||||
elf = ELFObject()
|
||||
elf.fromFile(open("test.elf"))
|
||||
if elf.e_type != ELFObject.ET_EXEC:
|
||||
raise Exception("No executable")
|
||||
print elf
|
||||
print (elf)
|
||||
|
||||
#~ print repr(elf.getSection('.text').data)
|
||||
#~ print [(s.name, hex(s.sh_addr)) for s in elf.getSections()]
|
||||
print "-"*20
|
||||
for p in elf.sections: print p
|
||||
print "-"*20
|
||||
for p in elf.getSections(): print p
|
||||
print "-"*20
|
||||
for p in elf.getProgrammableSections(): print p
|
||||
print ("-"*20)
|
||||
for p in elf.sections: print (p)
|
||||
print ("-"*20)
|
||||
for p in elf.getSections(): print (p)
|
||||
print ("-"*20)
|
||||
for p in elf.getProgrammableSections(): print (p)
|
||||
|
||||
Reference in New Issue
Block a user