2021-04-27 11:49:21 +02:00
|
|
|
#
|
|
|
|
# buildroot/share/PlatformIO/scripts/mks_encrypt.py
|
|
|
|
#
|
|
|
|
# Apply encryption and save as 'build.firmware' for these environments:
|
|
|
|
# - env:mks_robin_stm32
|
|
|
|
# - env:flsun_hispeedv1
|
|
|
|
# - env:mks_robin_nano35_stm32
|
|
|
|
#
|
2020-07-30 08:43:19 +02:00
|
|
|
Import("env")
|
|
|
|
|
|
|
|
from SCons.Script import DefaultEnvironment
|
|
|
|
board = DefaultEnvironment().BoardConfig()
|
|
|
|
|
2021-04-27 11:49:21 +02:00
|
|
|
if 'firmware' in board.get("build").keys():
|
2020-07-30 08:43:19 +02:00
|
|
|
|
2021-04-27 11:49:21 +02:00
|
|
|
import marlin
|
|
|
|
|
|
|
|
# Encrypt ${PROGNAME}.bin and save it as build.firmware
|
|
|
|
def encrypt(source, target, env):
|
|
|
|
marlin.encrypt_mks(source, target, env, "build.firmware")
|
|
|
|
|
|
|
|
marlin.add_post_action(encrypt);
|
2020-07-30 08:43:19 +02:00
|
|
|
|
|
|
|
else:
|
2021-04-27 11:49:21 +02:00
|
|
|
|
|
|
|
import sys
|
|
|
|
print("You need to define output file via board_build.firmware = 'filename' parameter", file=sys.stderr)
|
|
|
|
env.Exit(1);
|