Quellcode durchsuchen

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

Tanguy Pruvot vor 4 Jahren
Ursprung
Commit
f06602ff7e

+ 1
- 1
.travis.yml Datei anzeigen

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

+ 3
- 0
buildroot/share/PlatformIO/scripts/mks_robin.py Datei anzeigen

@@ -10,6 +10,7 @@ env.Replace(LDSCRIPT_PATH="buildroot/share/PlatformIO/ldscripts/mks_robin.ld")
10 10
 # Encrypt ${PROGNAME}.bin and save it as 'Robin.bin'
11 11
 def encrypt(source, target, env):
12 12
     import os
13
+    import sys
13 14
 
14 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,6 +23,8 @@ def encrypt(source, target, env):
22 23
             byte = firmware.read(1)
23 24
             if position >= 320 and position < 31040:
24 25
                 byte = chr(ord(byte) ^ key[position & 31])
26
+                if sys.version_info[0] > 2:
27
+                    byte = bytes(byte, 'latin1')
25 28
             robin.write(byte)
26 29
             position += 1
27 30
     finally:

+ 3
- 0
buildroot/share/PlatformIO/scripts/mks_robin_lite.py Datei anzeigen

@@ -10,6 +10,7 @@ env.Replace(LDSCRIPT_PATH="buildroot/share/PlatformIO/ldscripts/mks_robin_lite.l
10 10
 # Encrypt ${PROGNAME}.bin and save it as 'mksLite.bin'
11 11
 def encrypt(source, target, env):
12 12
     import os
13
+    import sys
13 14
 
14 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,6 +23,8 @@ def encrypt(source, target, env):
22 23
             byte = firmware.read(1)
23 24
             if position >= 320 and position < 31040:
24 25
                 byte = chr(ord(byte) ^ key[position & 31])
26
+                if sys.version_info[0] > 2:
27
+                    byte = bytes(byte, 'latin1')
25 28
             robin.write(byte)
26 29
             position += 1
27 30
     finally:

+ 3
- 0
buildroot/share/PlatformIO/scripts/mks_robin_mini.py Datei anzeigen

@@ -10,6 +10,7 @@ env.Replace(LDSCRIPT_PATH="buildroot/share/PlatformIO/ldscripts/mks_robin_mini.l
10 10
 # Encrypt ${PROGNAME}.bin and save it as 'Robin_mini.bin'
11 11
 def encrypt(source, target, env):
12 12
     import os
13
+    import sys
13 14
 
14 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,6 +23,8 @@ def encrypt(source, target, env):
22 23
             byte = firmware.read(1)
23 24
             if position >= 320 and position < 31040:
24 25
                 byte = chr(ord(byte) ^ key[position & 31])
26
+                if sys.version_info[0] > 2:
27
+                    byte = bytes(byte, 'latin1')
25 28
             robin.write(byte)
26 29
             position += 1
27 30
     finally:

+ 3
- 0
buildroot/share/PlatformIO/scripts/mks_robin_nano.py Datei anzeigen

@@ -10,6 +10,7 @@ env.Replace(LDSCRIPT_PATH="buildroot/share/PlatformIO/ldscripts/mks_robin_nano.l
10 10
 # Encrypt ${PROGNAME}.bin and save it as 'Robin_nano.bin'
11 11
 def encrypt(source, target, env):
12 12
     import os
13
+    import sys
13 14
 
14 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,6 +23,8 @@ def encrypt(source, target, env):
22 23
             byte = firmware.read(1)
23 24
             if position >= 320 and position < 31040:
24 25
                 byte = chr(ord(byte) ^ key[position & 31])
26
+                if sys.version_info[0] > 2:
27
+                    byte = bytes(byte, 'latin1')
25 28
             robin.write(byte)
26 29
             position += 1
27 30
     finally:

Laden…
Abbrechen
Speichern