🔨 Offset/encrypt/rename for Maple STM32F1 (#22477)

This commit is contained in:
Tanguy Pruvot 2021-08-01 21:43:31 +02:00 committed by Scott Lahteine
parent 0bbe85d3e7
commit eeac85642f
3 changed files with 3 additions and 24 deletions

View file

@ -1,22 +0,0 @@
#
# buildroot/share/PlatformIO/scripts/STM32F103VE_longer.py
# Customizations for env:STM32F103VE_longer
#
import os,marlin
# Rename ${PROGNAME}.bin and save it as 'project.bin' (No encryption on the Longer3D)
def encrypt(source, target, env):
firmware = open(target[0].path, "rb")
renamed = open(target[0].dir.path + '/project.bin', "wb")
length = os.path.getsize(target[0].path)
position = 0
try:
while position < length:
byte = firmware.read(1)
renamed.write(byte)
position += 1
finally:
firmware.close()
renamed.close()
marlin.add_post_action(encrypt);

View file

@ -29,7 +29,7 @@ extra_scripts = ${common.extra_scripts}
extends = common_stm32
extra_scripts = ${common_stm32.extra_scripts}
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
buildroot/share/PlatformIO/scripts/offset_and_rename.py
buildroot/share/PlatformIO/scripts/offset_and_rename.py
#
# USB Flash Drive mix-ins for STM32

View file

@ -36,6 +36,7 @@ platform_packages = tool-stm32duino
extra_scripts = ${common.extra_scripts}
pre:buildroot/share/PlatformIO/scripts/fix_framework_weakness.py
pre:buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py
buildroot/share/PlatformIO/scripts/offset_and_rename.py
#
# STM32F103RC
@ -178,10 +179,10 @@ platform = ${common_stm32f1.platform}
extends = common_stm32f1
board = genericSTM32F103VE
board_build.address = 0x08010000
board_build.rename = project.bin
board_build.ldscript = STM32F103VE_longer.ld
extra_scripts = ${common_stm32f1.extra_scripts}
buildroot/share/PlatformIO/scripts/custom_board.py
buildroot/share/PlatformIO/scripts/STM32F103VE_longer.py
build_flags = ${common_stm32f1.build_flags}
-DMCU_STM32F103VE -DSTM32F1xx -USERIAL_USB -DU20 -DTS_V12
build_unflags = ${common_stm32f1.build_unflags}