My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

fix_framework_weakness.py 1.1KB

1234567891011121314151617181920212223242526272829
  1. from os.path import join, isfile
  2. import shutil
  3. from pprint import pprint
  4. Import("env")
  5. if env.MarlinFeatureIsEnabled("POSTMORTEM_DEBUGGING"):
  6. FRAMEWORK_DIR = env.PioPlatform().get_package_dir("framework-arduinoststm32-maple")
  7. patchflag_path = join(FRAMEWORK_DIR, ".exc-patching-done")
  8. # patch file only if we didn't do it before
  9. if not isfile(patchflag_path):
  10. print("Patching libmaple exception handlers")
  11. original_file = join(FRAMEWORK_DIR, "STM32F1", "cores", "maple", "libmaple", "exc.S")
  12. backup_file = join(FRAMEWORK_DIR, "STM32F1", "cores", "maple", "libmaple", "exc.S.bak")
  13. src_file = join("buildroot", "share", "PlatformIO", "scripts", "exc.S")
  14. assert isfile(original_file) and isfile(src_file)
  15. shutil.copyfile(original_file, backup_file)
  16. shutil.copyfile(src_file, original_file);
  17. def _touch(path):
  18. with open(path, "w") as fp:
  19. fp.write("")
  20. env.Execute(lambda *args, **kwargs: _touch(patchflag_path))
  21. print("Done patching exception handler")
  22. print("Libmaple modified and ready for post mortem debugging")