My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

STM32F103VE_longer.py 1.1KB

123456789101112131415161718192021222324252627282930313233
  1. import os
  2. Import("env")
  3. # Relocate firmware from 0x08000000 to 0x08010000
  4. for define in env['CPPDEFINES']:
  5. if define[0] == "VECT_TAB_ADDR":
  6. env['CPPDEFINES'].remove(define)
  7. env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08010000"))
  8. custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/STM32F103VE_longer.ld")
  9. for i, flag in enumerate(env["LINKFLAGS"]):
  10. if "-Wl,-T" in flag:
  11. env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
  12. elif flag == "-T":
  13. env["LINKFLAGS"][i + 1] = custom_ld_script
  14. # Rename ${PROGNAME}.bin and save it as 'project.bin' (No encryption on the Longer3D)
  15. def encrypt(source, target, env):
  16. firmware = open(target[0].path, "rb")
  17. marlin_alfa = open(target[0].dir.path +'/project.bin', "wb")
  18. length = os.path.getsize(target[0].path)
  19. position = 0
  20. try:
  21. while position < length:
  22. byte = firmware.read(1)
  23. marlin_alfa.write(byte)
  24. position += 1
  25. finally:
  26. firmware.close()
  27. marlin_alfa.close()
  28. env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt);