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

2.0.x
Tanguy Pruvot 5 years ago committed by Scott Lahteine
parent ee20f21a24
commit f06602ff7e

@ -33,6 +33,7 @@ env:
- TEST_PLATFORM="jgaurora_a5s_a1" - TEST_PLATFORM="jgaurora_a5s_a1"
- TEST_PLATFORM="STM32F103VE_longer" - TEST_PLATFORM="STM32F103VE_longer"
- TEST_PLATFORM="STM32F407VE_black" - TEST_PLATFORM="STM32F407VE_black"
- TEST_PLATFORM="mks_robin"
# Put lengthy tests last # Put lengthy tests last
- TEST_PLATFORM="LPC1768" - TEST_PLATFORM="LPC1768"
@ -42,7 +43,6 @@ env:
#- TEST_PLATFORM="at90usb1286_cdc" #- TEST_PLATFORM="at90usb1286_cdc"
#- TEST_PLATFORM="at90usb1286_dfu" #- TEST_PLATFORM="at90usb1286_dfu"
#- TEST_PLATFORM="STM32F103CB_malyan" #- TEST_PLATFORM="STM32F103CB_malyan"
#- TEST_PLATFORM="mks_robin"
#- TEST_PLATFORM="mks_robin_lite" #- TEST_PLATFORM="mks_robin_lite"
#- TEST_PLATFORM="mks_robin_mini" #- TEST_PLATFORM="mks_robin_mini"
#- TEST_PLATFORM="mks_robin_nano" #- TEST_PLATFORM="mks_robin_nano"

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

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

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

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

Loading…
Cancel
Save