🐛 Fix Lerdge build / encrypt (#24391)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
parent
a3629a7c28
commit
ad96c36730
@ -26,10 +26,10 @@ if pioutil.is_pio_build():
|
||||
input_file[i] = encryptByte(input_file[i])
|
||||
output_file.write(input_file)
|
||||
|
||||
# Encrypt ${PROGNAME}.bin and save it with the name given in build.encrypt
|
||||
# Encrypt ${PROGNAME}.bin and save it with the name given in build.crypt_lerdge
|
||||
def encrypt(source, target, env):
|
||||
fwpath = target[0].path
|
||||
enname = board.get("build.encrypt")
|
||||
enname = board.get("build.crypt_lerdge")
|
||||
print("Encrypting %s to %s" % (fwpath, enname))
|
||||
fwfile = open(fwpath, "rb")
|
||||
enfile = open(target[0].dir.path + "/" + enname, "wb")
|
||||
@ -41,9 +41,9 @@ if pioutil.is_pio_build():
|
||||
enfile.close()
|
||||
os.remove(fwpath)
|
||||
|
||||
if 'encrypt' in board.get("build").keys():
|
||||
if board.get("build.encrypt") != "":
|
||||
if 'crypt_lerdge' in board.get("build").keys():
|
||||
if board.get("build.crypt_lerdge") != "":
|
||||
marlin.add_post_action(encrypt)
|
||||
else:
|
||||
print("LERDGE builds require output file via board_build.encrypt = 'filename' parameter")
|
||||
print("LERDGE builds require output file via board_build.crypt_lerdge = 'filename' parameter")
|
||||
exit(1)
|
||||
|
@ -41,8 +41,8 @@ def custom_ld_script(ldname):
|
||||
elif flag == "-T":
|
||||
env["LINKFLAGS"][i + 1] = apath
|
||||
|
||||
# Encrypt ${PROGNAME}.bin and save it with a new name
|
||||
# Called by specific encrypt() functions, mostly for MKS boards
|
||||
# Encrypt ${PROGNAME}.bin and save it with a new name. This applies (mostly) to MKS boards
|
||||
# This PostAction is set up by offset_and_rename.py for envs with 'build.encrypt_mks'.
|
||||
def encrypt_mks(source, target, env, new_name):
|
||||
import sys
|
||||
|
||||
|
@ -39,15 +39,15 @@ if pioutil.is_pio_build():
|
||||
env["LINKFLAGS"][i] = "-Wl,--defsym=LD_MAX_DATA_SIZE=" + str(maximum_ram_size - 40)
|
||||
|
||||
#
|
||||
# For build.encrypt rename and encode the firmware file.
|
||||
# For build.encrypt_mks rename and encode the firmware file.
|
||||
#
|
||||
if 'encrypt' in board_keys:
|
||||
if 'encrypt_mks' in board_keys:
|
||||
|
||||
# Encrypt ${PROGNAME}.bin and save it with the name given in build.encrypt
|
||||
# Encrypt ${PROGNAME}.bin and save it with the name given in build.encrypt_mks
|
||||
def encrypt(source, target, env):
|
||||
marlin.encrypt_mks(source, target, env, board.get("build.encrypt"))
|
||||
marlin.encrypt_mks(source, target, env, board.get("build.encrypt_mks"))
|
||||
|
||||
if board.get("build.encrypt") != "":
|
||||
if board.get("build.encrypt_mks") != "":
|
||||
marlin.add_post_action(encrypt)
|
||||
|
||||
#
|
||||
|
@ -92,7 +92,7 @@ board_upload.offset_address = 0x08005000
|
||||
extends = stm32_variant
|
||||
board = genericSTM32F103ZE
|
||||
board_build.variant = MARLIN_F103Zx
|
||||
board_build.encrypt = Robin.bin
|
||||
board_build.encrypt_mks = Robin.bin
|
||||
board_build.offset = 0x7000
|
||||
build_flags = ${stm32_variant.build_flags}
|
||||
-DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5
|
||||
@ -104,7 +104,7 @@ build_unflags = ${stm32_variant.build_unflags}
|
||||
#
|
||||
[env:mks_robin_e3]
|
||||
extends = common_STM32F103RC_variant
|
||||
board_build.encrypt = Robin_e3.bin
|
||||
board_build.encrypt_mks = Robin_e3.bin
|
||||
board_build.offset = 0x5000
|
||||
board_upload.offset_address = 0x08005000
|
||||
build_flags = ${common_STM32F103RC_variant.build_flags}
|
||||
@ -206,7 +206,7 @@ build_unflags = ${stm32_variant.build_unflags} -DUSBD_USE_CDC
|
||||
extends = stm32_variant
|
||||
board = genericSTM32F103VE
|
||||
board_build.variant = MARLIN_F103Vx
|
||||
board_build.encrypt = Robin_mini.bin
|
||||
board_build.encrypt_mks = Robin_mini.bin
|
||||
board_build.offset = 0x7000
|
||||
board_upload.offset_address = 0x08007000
|
||||
build_flags = ${stm32_variant.build_flags}
|
||||
@ -222,7 +222,7 @@ build_unflags = ${stm32_variant.build_unflags}
|
||||
extends = stm32_variant
|
||||
board = genericSTM32F103VE
|
||||
board_build.variant = MARLIN_F103Vx
|
||||
board_build.encrypt = Robin_nano35.bin
|
||||
board_build.encrypt_mks = Robin_nano35.bin
|
||||
board_build.offset = 0x7000
|
||||
board_upload.offset_address = 0x08007000
|
||||
build_flags = ${stm32_variant.build_flags}
|
||||
@ -275,7 +275,7 @@ build_flags = ${stm32_variant.build_flags} -DSS_TIMER=4
|
||||
extends = stm32_variant
|
||||
board = genericSTM32F103VE
|
||||
board_build.variant = MARLIN_F103Vx
|
||||
board_build.encrypt = Robin_mini.bin
|
||||
board_build.encrypt_mks = Robin_mini.bin
|
||||
board_build.offset = 0x7000
|
||||
board_upload.offset_address = 0x08007000
|
||||
build_flags = ${stm32_variant.build_flags}
|
||||
@ -288,7 +288,7 @@ build_flags = ${stm32_variant.build_flags}
|
||||
extends = stm32_variant
|
||||
board = genericSTM32F103RC
|
||||
board_build.variant = MARLIN_F103Rx
|
||||
board_build.encrypt = mksLite.bin
|
||||
board_build.encrypt_mks = mksLite.bin
|
||||
board_build.offset = 0x5000
|
||||
board_upload.offset_address = 0x08005000
|
||||
|
||||
@ -297,14 +297,14 @@ board_upload.offset_address = 0x08005000
|
||||
#
|
||||
[env:mks_robin_lite3]
|
||||
extends = env:mks_robin_lite
|
||||
board_build.encrypt = mksLite3.bin
|
||||
board_build.encrypt_mks = mksLite3.bin
|
||||
|
||||
#
|
||||
# MKS Robin Pro (STM32F103ZET6)
|
||||
#
|
||||
[env:mks_robin_pro]
|
||||
extends = env:mks_robin
|
||||
board_build.encrypt = Robin_pro.bin
|
||||
board_build.encrypt_mks = Robin_pro.bin
|
||||
|
||||
#
|
||||
# MKS Robin E3p (STM32F103VET6)
|
||||
@ -314,7 +314,7 @@ board_build.encrypt = Robin_pro.bin
|
||||
extends = stm32_variant
|
||||
board = genericSTM32F103VE
|
||||
board_build.variant = MARLIN_F103Vx
|
||||
board_build.encrypt = Robin_e3p.bin
|
||||
board_build.encrypt_mks = Robin_e3p.bin
|
||||
board_build.offset = 0x7000
|
||||
board_upload.offset_address = 0x08007000
|
||||
build_flags = ${stm32_variant.build_flags}
|
||||
|
@ -113,7 +113,7 @@ extra_scripts = ${stm32_variant.extra_scripts}
|
||||
extends = stm32_variant
|
||||
board = marlin_STM32F407VGT6_CCM
|
||||
board_build.variant = MARLIN_F4x7Vx
|
||||
board_build.encrypt = firmware.srec
|
||||
board_build.encrypt_mks = firmware.srec
|
||||
board_build.offset = 0x10000
|
||||
board_upload.offset_address = 0x08010000
|
||||
build_flags = ${stm32_variant.build_flags}
|
||||
@ -305,13 +305,13 @@ build_flags = ${stm_flash_drive.build_flags}
|
||||
extends = stm32_variant
|
||||
board = marlin_STM32F407ZGT6
|
||||
board_build.variant = MARLIN_LERDGE
|
||||
board_build.crypt_lerdge = firmware.bin
|
||||
board_build.offset = 0x10000
|
||||
build_flags = ${stm32_variant.build_flags}
|
||||
-DSTM32F4 -DSTM32F4xx -DTARGET_STM32F4
|
||||
-DDISABLE_GENERIC_SERIALUSB -DARDUINO_ARCH_STM32 -DLERDGE_TFT35
|
||||
build_unflags = ${stm32_variant.build_unflags} -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483
|
||||
extra_scripts = ${common_stm32.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
extra_scripts = ${stm32_variant.extra_scripts}
|
||||
buildroot/share/PlatformIO/scripts/lerdge.py
|
||||
|
||||
#
|
||||
@ -319,7 +319,7 @@ extra_scripts = ${common_stm32.extra_scripts}
|
||||
#
|
||||
[env:LERDGEX]
|
||||
extends = lerdge_common
|
||||
board_build.encrypt = Lerdge_X_firmware_force.bin
|
||||
board_build.crypt_lerdge = Lerdge_X_firmware_force.bin
|
||||
|
||||
#
|
||||
# Lerdge X with USB Flash Drive Support
|
||||
@ -334,7 +334,7 @@ build_flags = ${stm_flash_drive.build_flags} ${lerdge_common.build_flags}
|
||||
#
|
||||
[env:LERDGES]
|
||||
extends = lerdge_common
|
||||
board_build.encrypt = Lerdge_firmware_force.bin
|
||||
board_build.crypt_lerdge = Lerdge_firmware_force.bin
|
||||
|
||||
#
|
||||
# Lerdge S with USB Flash Drive Support
|
||||
@ -349,7 +349,7 @@ build_flags = ${stm_flash_drive.build_flags} ${lerdge_common.build_flags}
|
||||
#
|
||||
[env:LERDGEK]
|
||||
extends = lerdge_common
|
||||
board_build.encrypt = Lerdge_K_firmware_force.bin
|
||||
board_build.crypt_lerdge = Lerdge_K_firmware_force.bin
|
||||
build_flags = ${lerdge_common.build_flags} -DLERDGEK
|
||||
|
||||
#
|
||||
@ -550,7 +550,7 @@ build_unflags = -DUSBD_USE_CDC
|
||||
extends = stm32_variant
|
||||
board = genericSTM32F405RG
|
||||
board_build.variant = MARLIN_TH3D_EZBOARD_V2
|
||||
board_build.encrypt = firmware.bin
|
||||
board_build.encrypt_mks = firmware.bin
|
||||
board_build.offset = 0xC000
|
||||
board_upload.offset_address = 0x0800C000
|
||||
build_flags = ${stm32_variant.build_flags} -DHSE_VALUE=12000000U -O0
|
||||
|
Loading…
Reference in New Issue
Block a user