🐛 Fix Lerdge build / encrypt (#24391)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
Bob Kuhn 2022-06-23 23:58:26 -05:00 committed by Scott Lahteine
parent 645c7dc370
commit 12a869e2ad
5 changed files with 70 additions and 70 deletions

View file

@ -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)

View file

@ -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

View file

@ -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)
#

View file

@ -89,22 +89,22 @@ board_upload.offset_address = 0x08005000
# Uses HAL STM32 to support Marlin UI for TFT screen with optional touch panel
#
[env:mks_robin]
extends = stm32_variant
board = genericSTM32F103ZE
board_build.variant = MARLIN_F103Zx
board_build.encrypt = Robin.bin
board_build.offset = 0x7000
build_flags = ${stm32_variant.build_flags}
-DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5
build_unflags = ${stm32_variant.build_unflags}
-DUSBCON -DUSBD_USE_CDC
extends = stm32_variant
board = genericSTM32F103ZE
board_build.variant = MARLIN_F103Zx
board_build.encrypt_mks = Robin.bin
board_build.offset = 0x7000
build_flags = ${stm32_variant.build_flags}
-DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5
build_unflags = ${stm32_variant.build_unflags}
-DUSBCON -DUSBD_USE_CDC
#
# MKS Robin E3/E3D (STM32F103RCT6) with TMC2209
#
[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
extends = env:mks_robin
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}

View file

@ -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}
@ -302,24 +302,24 @@ build_flags = ${stm_flash_drive.build_flags}
# Lerdge base
#
[lerdge_common]
extends = stm32_variant
board = marlin_STM32F407ZGT6
board_build.variant = MARLIN_LERDGE
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
buildroot/share/PlatformIO/scripts/lerdge.py
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 = ${stm32_variant.extra_scripts}
buildroot/share/PlatformIO/scripts/lerdge.py
#
# Lerdge X (STM32F407VE)
#
[env:LERDGEX]
extends = lerdge_common
board_build.encrypt = Lerdge_X_firmware_force.bin
extends = lerdge_common
board_build.crypt_lerdge = Lerdge_X_firmware_force.bin
#
# Lerdge X with USB Flash Drive Support
@ -333,8 +333,8 @@ build_flags = ${stm_flash_drive.build_flags} ${lerdge_common.build_flags}
# Lerdge S (STM32F407ZG)
#
[env:LERDGES]
extends = lerdge_common
board_build.encrypt = Lerdge_firmware_force.bin
extends = lerdge_common
board_build.crypt_lerdge = Lerdge_firmware_force.bin
#
# Lerdge S with USB Flash Drive Support
@ -348,9 +348,9 @@ build_flags = ${stm_flash_drive.build_flags} ${lerdge_common.build_flags}
# Lerdge K (STM32F407ZG)
#
[env:LERDGEK]
extends = lerdge_common
board_build.encrypt = Lerdge_K_firmware_force.bin
build_flags = ${lerdge_common.build_flags} -DLERDGEK
extends = lerdge_common
board_build.crypt_lerdge = Lerdge_K_firmware_force.bin
build_flags = ${lerdge_common.build_flags} -DLERDGEK
#
# Lerdge K with USB Flash Drive Support
@ -364,17 +364,17 @@ build_flags = ${stm_flash_drive.build_flags} ${lerdge_common.build_flags}
# RUMBA32
#
[env:rumba32]
extends = stm32_variant
board = rumba32_f446ve
board_build.variant = MARLIN_F446VE
board_build.offset = 0x0000
build_flags = ${stm32_variant.build_flags}
-Os -DHAL_PCD_MODULE_ENABLED
-DDISABLE_GENERIC_SERIALUSB
-DHAL_UART_MODULE_ENABLED
-DTIMER_SERIAL=TIM9
monitor_speed = 500000
upload_protocol = dfu
extends = stm32_variant
board = rumba32_f446ve
board_build.variant = MARLIN_F446VE
board_build.offset = 0x0000
build_flags = ${stm32_variant.build_flags}
-Os -DHAL_PCD_MODULE_ENABLED
-DDISABLE_GENERIC_SERIALUSB
-DHAL_UART_MODULE_ENABLED
-DTIMER_SERIAL=TIM9
monitor_speed = 500000
upload_protocol = dfu
#
# MKS Robin Pro V2
@ -547,17 +547,17 @@ build_unflags = -DUSBD_USE_CDC
# TH3D EZBoard v2.0 (STM32F405RGT6 ARM Cortex-M4)
#
[env:TH3D_EZBoard_V2]
extends = stm32_variant
board = genericSTM32F405RG
board_build.variant = MARLIN_TH3D_EZBOARD_V2
board_build.encrypt = firmware.bin
board_build.offset = 0xC000
extends = stm32_variant
board = genericSTM32F405RG
board_build.variant = MARLIN_TH3D_EZBOARD_V2
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
debug_tool = stlink
upload_protocol = stlink
extra_scripts = ${stm32_variant.extra_scripts}
buildroot/share/PlatformIO/scripts/openblt.py
build_flags = ${stm32_variant.build_flags} -DHSE_VALUE=12000000U -O0
debug_tool = stlink
upload_protocol = stlink
extra_scripts = ${stm32_variant.extra_scripts}
buildroot/share/PlatformIO/scripts/openblt.py
#
# BOARD_MKS_ROBIN_NANO_V1_3_F4