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.

create_custom_upload_command_DFU.py 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #
  2. # Builds custom upload command
  3. # 1) Run platformio as a subprocess to find a COM port
  4. # 2) Build the upload command
  5. # 3) Exit and let upload tool do the work
  6. #
  7. # This script runs between completion of the library/dependencies installation and compilation.
  8. #
  9. # Will continue on if a COM port isn't found so that the compilation can be done.
  10. #
  11. import os
  12. import sys
  13. from SCons.Script import DefaultEnvironment
  14. import platform
  15. current_OS = platform.system()
  16. env = DefaultEnvironment()
  17. build_type = os.environ.get("BUILD_TYPE", 'Not Set')
  18. if not(build_type == 'upload' or build_type == 'traceback' or build_type == 'Not Set') :
  19. env.Replace(UPLOAD_PROTOCOL = 'teensy-gui') # run normal Teensy2 scripts
  20. else:
  21. if current_OS == 'Windows':
  22. avrdude_conf_path = env.get("PIOHOME_DIR") + '\\packages\\toolchain-atmelavr\\etc\\avrdude.conf'
  23. source_path = env.get("PROJECTBUILD_DIR") + '\\' + env.get("PIOENV") + '\\firmware.hex'
  24. upload_string = 'avrdude -p usb1286 -c flip1 -C ' + avrdude_conf_path + ' -U flash:w:' + source_path + ':i'
  25. else:
  26. source_path = env.get("PROJECTBUILD_DIR") + '/' + env.get("PIOENV") + '/firmware.hex'
  27. upload_string = 'avrdude -p usb1286 -c flip1 -U flash:w:' + source_path + ':i'
  28. env.Replace(
  29. UPLOADCMD = upload_string,
  30. MAXIMUM_RAM_SIZE = 8192,
  31. MAXIMUM_SIZE = 130048
  32. )