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