Browse Source

Fix MKS Robin python script (for Travis CI) (#15523)

Tanguy Pruvot 5 years ago
parent
commit
f06602ff7e

+ 1
- 1
.travis.yml View File

33
   - TEST_PLATFORM="jgaurora_a5s_a1"
33
   - TEST_PLATFORM="jgaurora_a5s_a1"
34
   - TEST_PLATFORM="STM32F103VE_longer"
34
   - TEST_PLATFORM="STM32F103VE_longer"
35
   - TEST_PLATFORM="STM32F407VE_black"
35
   - TEST_PLATFORM="STM32F407VE_black"
36
+  - TEST_PLATFORM="mks_robin"
36
 
37
 
37
   # Put lengthy tests last
38
   # Put lengthy tests last
38
   - TEST_PLATFORM="LPC1768"
39
   - TEST_PLATFORM="LPC1768"
42
   #- TEST_PLATFORM="at90usb1286_cdc"
43
   #- TEST_PLATFORM="at90usb1286_cdc"
43
   #- TEST_PLATFORM="at90usb1286_dfu"
44
   #- TEST_PLATFORM="at90usb1286_dfu"
44
   #- TEST_PLATFORM="STM32F103CB_malyan"
45
   #- TEST_PLATFORM="STM32F103CB_malyan"
45
-  #- TEST_PLATFORM="mks_robin"
46
   #- TEST_PLATFORM="mks_robin_lite"
46
   #- TEST_PLATFORM="mks_robin_lite"
47
   #- TEST_PLATFORM="mks_robin_mini"
47
   #- TEST_PLATFORM="mks_robin_mini"
48
   #- TEST_PLATFORM="mks_robin_nano"
48
   #- TEST_PLATFORM="mks_robin_nano"

+ 3
- 0
buildroot/share/PlatformIO/scripts/mks_robin.py View File

10
 # Encrypt ${PROGNAME}.bin and save it as 'Robin.bin'
10
 # Encrypt ${PROGNAME}.bin and save it as 'Robin.bin'
11
 def encrypt(source, target, env):
11
 def encrypt(source, target, env):
12
     import os
12
     import os
13
+    import sys
13
 
14
 
14
     key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E]
15
     key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E]
15
 
16
 
22
             byte = firmware.read(1)
23
             byte = firmware.read(1)
23
             if position >= 320 and position < 31040:
24
             if position >= 320 and position < 31040:
24
                 byte = chr(ord(byte) ^ key[position & 31])
25
                 byte = chr(ord(byte) ^ key[position & 31])
26
+                if sys.version_info[0] > 2:
27
+                    byte = bytes(byte, 'latin1')
25
             robin.write(byte)
28
             robin.write(byte)
26
             position += 1
29
             position += 1
27
     finally:
30
     finally:

+ 3
- 0
buildroot/share/PlatformIO/scripts/mks_robin_lite.py View File

10
 # Encrypt ${PROGNAME}.bin and save it as 'mksLite.bin'
10
 # Encrypt ${PROGNAME}.bin and save it as 'mksLite.bin'
11
 def encrypt(source, target, env):
11
 def encrypt(source, target, env):
12
     import os
12
     import os
13
+    import sys
13
 
14
 
14
     key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E]
15
     key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E]
15
 
16
 
22
             byte = firmware.read(1)
23
             byte = firmware.read(1)
23
             if position >= 320 and position < 31040:
24
             if position >= 320 and position < 31040:
24
                 byte = chr(ord(byte) ^ key[position & 31])
25
                 byte = chr(ord(byte) ^ key[position & 31])
26
+                if sys.version_info[0] > 2:
27
+                    byte = bytes(byte, 'latin1')
25
             robin.write(byte)
28
             robin.write(byte)
26
             position += 1
29
             position += 1
27
     finally:
30
     finally:

+ 3
- 0
buildroot/share/PlatformIO/scripts/mks_robin_mini.py View File

10
 # Encrypt ${PROGNAME}.bin and save it as 'Robin_mini.bin'
10
 # Encrypt ${PROGNAME}.bin and save it as 'Robin_mini.bin'
11
 def encrypt(source, target, env):
11
 def encrypt(source, target, env):
12
     import os
12
     import os
13
+    import sys
13
 
14
 
14
     key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E]
15
     key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E]
15
 
16
 
22
             byte = firmware.read(1)
23
             byte = firmware.read(1)
23
             if position >= 320 and position < 31040:
24
             if position >= 320 and position < 31040:
24
                 byte = chr(ord(byte) ^ key[position & 31])
25
                 byte = chr(ord(byte) ^ key[position & 31])
26
+                if sys.version_info[0] > 2:
27
+                    byte = bytes(byte, 'latin1')
25
             robin.write(byte)
28
             robin.write(byte)
26
             position += 1
29
             position += 1
27
     finally:
30
     finally:

+ 3
- 0
buildroot/share/PlatformIO/scripts/mks_robin_nano.py View File

10
 # Encrypt ${PROGNAME}.bin and save it as 'Robin_nano.bin'
10
 # Encrypt ${PROGNAME}.bin and save it as 'Robin_nano.bin'
11
 def encrypt(source, target, env):
11
 def encrypt(source, target, env):
12
     import os
12
     import os
13
+    import sys
13
 
14
 
14
     key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E]
15
     key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E]
15
 
16
 
22
             byte = firmware.read(1)
23
             byte = firmware.read(1)
23
             if position >= 320 and position < 31040:
24
             if position >= 320 and position < 31040:
24
                 byte = chr(ord(byte) ^ key[position & 31])
25
                 byte = chr(ord(byte) ^ key[position & 31])
26
+                if sys.version_info[0] > 2:
27
+                    byte = bytes(byte, 'latin1')
25
             robin.write(byte)
28
             robin.write(byte)
26
             position += 1
29
             position += 1
27
     finally:
30
     finally:

Loading…
Cancel
Save