|
1 | 1 | #!/usr/bin/env python |
| 2 | +# Copyright (c) 2016, Pycom Limited. |
| 3 | +# |
| 4 | +# This software is licensed under the GNU GPL version 3 or any |
| 5 | +# later version, with permitted additional terms. For more information |
| 6 | +# see the Pycom Licence v1.0 document supplied with this file, or |
| 7 | +# available at https://www.pycom.io/opensource/licensing |
2 | 8 |
|
3 | 9 | import struct |
4 | 10 | import time |
@@ -59,9 +65,9 @@ def hexdump(src, length=32): |
59 | 65 | lines = [] |
60 | 66 | for c in range(0, len(src), length): |
61 | 67 | chars = src[c:c+length] |
62 | | - hex = ' '.join(['%02x' % x for x in chars]) |
63 | | - printable = ''.join(['%s' % ((x <= 127 and FILTER[x]) or '.') for x in chars]) |
64 | | - lines.append('%04x %-*s %s\n' % (c, length*3, hex, printable)) |
| 68 | + hex = ' '.join(["%02x" % ord(x) for x in chars]) |
| 69 | + printable = ''.join(["%s" % ((ord(x) <= 127 and FILTER[ord(x)]) or '.') for x in chars]) |
| 70 | + lines.append("%04x %-*s %s\n" % (c, length*3, hex, printable)) |
65 | 71 | print(''.join(lines)) |
66 | 72 |
|
67 | 73 |
|
@@ -374,17 +380,11 @@ def start(elf, elfsize, serial, baud=3686400, retry=None, debug=None, AT=True, p |
374 | 380 |
|
375 | 381 | while True: |
376 | 382 | try: |
377 | | - if debug: print('running m.wipe') |
378 | 383 | m.wipe() |
379 | | - if debug: print('running m.reset') |
380 | 384 | m.reset() |
381 | | - if debug: print('running m.open_session') |
382 | 385 | m.open_session() |
383 | | - if debug: print('running push(m)') |
384 | 386 | push(m) |
385 | | - if debug: print('running dev.set_timeout(2)') |
386 | 387 | dev.set_timeout(2) |
387 | | - if debug: print('running m.reset(True)') |
388 | 388 | m.reset(True) |
389 | 389 | return True |
390 | 390 | except MException as ex: |
|
0 commit comments