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.

STM32F1_create_variant.py 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #
  2. # STM32F1_create_variant.py
  3. #
  4. import os,shutil
  5. from SCons.Script import DefaultEnvironment
  6. from platformio import util
  7. def copytree(src, dst, symlinks=False, ignore=None):
  8. for item in os.listdir(src):
  9. s = os.path.join(src, item)
  10. d = os.path.join(dst, item)
  11. if os.path.isdir(s):
  12. shutil.copytree(s, d, symlinks, ignore)
  13. else:
  14. shutil.copy2(s, d)
  15. env = DefaultEnvironment()
  16. platform = env.PioPlatform()
  17. board = env.BoardConfig()
  18. FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoststm32-maple")
  19. assert os.path.isdir(FRAMEWORK_DIR)
  20. source_root = os.path.join("buildroot", "share", "PlatformIO", "variants")
  21. assert os.path.isdir(source_root)
  22. variant = board.get("build.variant")
  23. variant_dir = os.path.join(FRAMEWORK_DIR, "STM32F1", "variants", variant)
  24. source_dir = os.path.join(source_root, variant)
  25. assert os.path.isdir(source_dir)
  26. if os.path.isdir(variant_dir):
  27. shutil.rmtree(variant_dir)
  28. if not os.path.isdir(variant_dir):
  29. os.mkdir(variant_dir)
  30. copytree(source_dir, variant_dir)