mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-07-07 23:17:28 -06:00
🏗️ Refactor build encrypt / rename (#22124)
This commit is contained in:
parent
a9faf9effa
commit
90dc41139f
8 changed files with 59 additions and 63 deletions
|
@ -1,23 +1,18 @@
|
|||
#
|
||||
# stm32_bootloader.py
|
||||
#
|
||||
import os,sys,shutil,marlin
|
||||
import os,sys,marlin
|
||||
Import("env")
|
||||
|
||||
from SCons.Script import DefaultEnvironment
|
||||
board = DefaultEnvironment().BoardConfig()
|
||||
|
||||
#
|
||||
# Copy the firmware.bin file to build.firmware, no encryption
|
||||
#
|
||||
def noencrypt(source, target, env):
|
||||
firmware = os.path.join(target[0].dir.path, board.get("build.firmware"))
|
||||
shutil.copy(target[0].path, firmware)
|
||||
board_keys = board.get("build").keys()
|
||||
|
||||
#
|
||||
# For build.offset define LD_FLASH_OFFSET, used by ldscript.ld
|
||||
#
|
||||
if 'offset' in board.get("build").keys():
|
||||
if 'offset' in board_keys:
|
||||
LD_FLASH_OFFSET = board.get("build.offset")
|
||||
marlin.relocate_vtab(LD_FLASH_OFFSET)
|
||||
|
||||
|
@ -35,9 +30,13 @@ if 'offset' in board.get("build").keys():
|
|||
env["LINKFLAGS"][i] = "-Wl,--defsym=LD_MAX_DATA_SIZE=" + str(maximum_ram_size - 40)
|
||||
|
||||
#
|
||||
# Only copy the file if there's no encrypt
|
||||
# For build.rename simply rename the firmware file.
|
||||
#
|
||||
board_keys = board.get("build").keys()
|
||||
if 'firmware' in board_keys and ('encrypt' not in board_keys or board.get("build.encrypt") == 'No'):
|
||||
import marlin
|
||||
marlin.add_post_action(noencrypt)
|
||||
if 'rename' in board_keys:
|
||||
|
||||
def rename_target(source, target, env):
|
||||
firmware = os.path.join(target[0].dir.path, board.get("build.rename"))
|
||||
import shutil
|
||||
shutil.copy(target[0].path, firmware)
|
||||
|
||||
marlin.add_post_action(rename_target)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue