Prusa MINI Firmware overview
mks_robin_nano Namespace Reference

Functions

def encrypt (source, target, env)
 

Variables

 LDSCRIPT_PATH
 

Function Documentation

◆ encrypt()

def mks_robin_nano.encrypt (   source,
  target,
  env 
)
11 def encrypt(source, target, env):
12  import os
13  import sys
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]
16 
17  firmware = open(target[0].path, "rb")
18  robin = open(target[0].dir.path +'/Robin_nano.bin', "wb")
19  length = os.path.getsize(target[0].path)
20  position = 0
21  try:
22  while position < length:
23  byte = firmware.read(1)
24  if position >= 320 and position < 31040:
25  byte = chr(ord(byte) ^ key[position & 31])
26  if sys.version_info[0] > 2:
27  byte = bytes(byte, 'latin1')
28  robin.write(byte)
29  position += 1
30  finally:
31  firmware.close()
32  robin.close()
33 env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt);

Variable Documentation

◆ LDSCRIPT_PATH

mks_robin_nano.LDSCRIPT_PATH
mks_robin_nano.encrypt
def encrypt(source, target, env)
Definition: mks_robin_nano.py:11