🔨 Trigorilla Pro disk based update (#24591)

This commit is contained in:
J.C. Nelson 2022-08-05 22:09:46 -07:00 committed by Scott Lahteine
parent 98095ddad6
commit e06340abd1
3 changed files with 36 additions and 6 deletions

View File

@ -590,7 +590,7 @@
#elif MB(CREALITY_V25S1) #elif MB(CREALITY_V25S1)
#include "stm32f1/pins_CREALITY_V25S1.h" // STM32F1 env:STM32F103RE_creality_smartPro env:STM32F103RE_creality_smartPro_maple #include "stm32f1/pins_CREALITY_V25S1.h" // STM32F1 env:STM32F103RE_creality_smartPro env:STM32F103RE_creality_smartPro_maple
#elif MB(TRIGORILLA_PRO) #elif MB(TRIGORILLA_PRO)
#include "stm32f1/pins_TRIGORILLA_PRO.h" // STM32F1 env:trigorilla_pro env:trigorilla_pro_maple #include "stm32f1/pins_TRIGORILLA_PRO.h" // STM32F1 env:trigorilla_pro env:trigorilla_pro_maple env:trigorilla_pro_disk
#elif MB(FLY_MINI) #elif MB(FLY_MINI)
#include "stm32f1/pins_FLY_MINI.h" // STM32F1 env:FLY_MINI env:FLY_MINI_maple #include "stm32f1/pins_FLY_MINI.h" // STM32F1 env:FLY_MINI env:FLY_MINI_maple
#elif MB(FLSUN_HISPEED) #elif MB(FLSUN_HISPEED)

View File

@ -4,7 +4,9 @@
# #
import pioutil import pioutil
if pioutil.is_pio_build(): if pioutil.is_pio_build():
import struct,uuid import struct,uuid,marlin
board = marlin.env.BoardConfig()
def calculate_crc(contents, seed): def calculate_crc(contents, seed):
accumulating_xor_value = seed; accumulating_xor_value = seed;
@ -104,12 +106,21 @@ if pioutil.is_pio_build():
# Encrypt ${PROGNAME}.bin and save it as 'update.cbd' # Encrypt ${PROGNAME}.bin and save it as 'update.cbd'
def encrypt(source, target, env): def encrypt(source, target, env):
from pathlib import Path from pathlib import Path
fwpath = Path(target[0].path) fwpath = Path(target[0].path)
fwsize = fwpath.stat().st_size fwsize = fwpath.stat().st_size
fwfile = fwpath.open("rb")
upfile = Path(target[0].dir.path, 'update.cbd').open("wb")
encrypt_file(fwfile, upfile, fwsize)
import marlin enname = board.get("build.crypt_chitu")
enpath = Path(target[0].dir.path)
fwfile = fwpath.open("rb")
enfile = (enpath / enname).open("wb")
print(f"Encrypting {fwpath} to {enname}")
encrypt_file(fwfile, enfile, fwsize)
fwfile.close()
enfile.close()
fwpath.unlink()
marlin.relocate_firmware("0x08008800") marlin.relocate_firmware("0x08008800")
marlin.add_post_action(encrypt); marlin.add_post_action(encrypt);

View File

@ -378,12 +378,31 @@ build_flags = ${stm32_variant.build_flags}
build_unflags = ${stm32_variant.build_unflags} build_unflags = ${stm32_variant.build_unflags}
-DUSBCON -DUSBD_USE_CDC -DUSBCON -DUSBD_USE_CDC
#
# TRIGORILLA PRO DISK BASED (STM32F103ZET6)
# Builds for Trigorilla to update from SD
#
[env:trigorilla_pro_disk]
extends = stm32_variant
board = genericSTM32F103ZE
board_build.crypt_chitu = update.zw
board_build.variant = MARLIN_F103Zx
board_build.offset = 0x8800
build_flags = ${stm32_variant.build_flags}
-DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5
build_unflags = ${stm32_variant.build_unflags}
-DUSBCON -DUSBD_USE_CDC
extra_scripts = ${stm32_variant.extra_scripts}
buildroot/share/PlatformIO/scripts/chitu_crypt.py
# #
# Chitu boards like Tronxy X5s (STM32F103ZET6) # Chitu boards like Tronxy X5s (STM32F103ZET6)
# #
[env:chitu_f103] [env:chitu_f103]
extends = stm32_variant extends = stm32_variant
board = genericSTM32F103ZE board = genericSTM32F103ZE
board_build.crypt_chitu = update.cbd
board_build.variant = MARLIN_F103Zx board_build.variant = MARLIN_F103Zx
board_build.offset = 0x8800 board_build.offset = 0x8800
build_flags = ${stm32_variant.build_flags} build_flags = ${stm32_variant.build_flags}