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.

fix_framework_weakness.py 1.2KB

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