2021-02-28 05:38:57 +01:00
|
|
|
#
|
2021-04-27 11:49:21 +02:00
|
|
|
# buildroot/share/PlatformIO/scripts/STM32F103VE_longer.py
|
2021-02-28 05:38:57 +01:00
|
|
|
# Customizations for env:STM32F103VE_longer
|
|
|
|
#
|
2021-04-27 11:49:21 +02:00
|
|
|
import os,marlin
|
2019-11-10 04:34:12 +01:00
|
|
|
|
2019-08-13 02:50:34 +02:00
|
|
|
# Rename ${PROGNAME}.bin and save it as 'project.bin' (No encryption on the Longer3D)
|
2019-07-15 01:05:24 +02:00
|
|
|
def encrypt(source, target, env):
|
|
|
|
firmware = open(target[0].path, "rb")
|
2021-04-27 11:49:21 +02:00
|
|
|
renamed = open(target[0].dir.path + '/project.bin', "wb")
|
2019-07-15 01:05:24 +02:00
|
|
|
length = os.path.getsize(target[0].path)
|
|
|
|
position = 0
|
|
|
|
try:
|
|
|
|
while position < length:
|
|
|
|
byte = firmware.read(1)
|
2021-04-27 11:49:21 +02:00
|
|
|
renamed.write(byte)
|
2019-07-15 01:05:24 +02:00
|
|
|
position += 1
|
|
|
|
finally:
|
|
|
|
firmware.close()
|
2021-04-27 11:49:21 +02:00
|
|
|
renamed.close()
|
2019-08-13 02:50:34 +02:00
|
|
|
|
2021-04-27 11:49:21 +02:00
|
|
|
marlin.add_post_action(encrypt);
|