My Marlin configs for Fabrikator Mini and CTC i3 Pro B

STM32F103VE_longer.py 1.1KB

1234567891011121314151617181920212223242526272829303132333435
  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. import os
  17. firmware = open(target[0].path, "rb")
  18. marlin_alfa = open(target[0].dir.path +'/project.bin', "wb")
  19. length = os.path.getsize(target[0].path)
  20. position = 0
  21. try:
  22. while position < length:
  23. byte = firmware.read(1)
  24. marlin_alfa.write(byte)
  25. position += 1
  26. finally:
  27. firmware.close()
  28. marlin_alfa.close()
  29. env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt);