1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-12-18 16:27:17 +00:00
MarlinFirmware/buildroot/share/PlatformIO/scripts/STM32F103VE_longer.py

23 lines
643 B
Python
Raw Normal View History

2021-02-28 04:38:57 +00:00
#
# buildroot/share/PlatformIO/scripts/STM32F103VE_longer.py
2021-02-28 04:38:57 +00:00
# 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);