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