mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-07-07 15:07:26 -06:00
Postmortem Debugging to serial port (#20492)
This commit is contained in:
parent
fb8b421aac
commit
8d28853774
34 changed files with 1286 additions and 740 deletions
29
buildroot/share/PlatformIO/scripts/fix_framework_weakness.py
Normal file
29
buildroot/share/PlatformIO/scripts/fix_framework_weakness.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
from os.path import join, isfile
|
||||
import shutil
|
||||
from pprint import pprint
|
||||
|
||||
Import("env")
|
||||
|
||||
if env.MarlinFeatureIsEnabled("POSTMORTEM_DEBUGGING"):
|
||||
FRAMEWORK_DIR = env.PioPlatform().get_package_dir("framework-arduinoststm32-maple")
|
||||
patchflag_path = join(FRAMEWORK_DIR, ".exc-patching-done")
|
||||
|
||||
# patch file only if we didn't do it before
|
||||
if not isfile(patchflag_path):
|
||||
print("Patching libmaple exception handlers")
|
||||
original_file = join(FRAMEWORK_DIR, "STM32F1", "cores", "maple", "libmaple", "exc.S")
|
||||
backup_file = join(FRAMEWORK_DIR, "STM32F1", "cores", "maple", "libmaple", "exc.S.bak")
|
||||
src_file = join("buildroot", "share", "PlatformIO", "scripts", "exc.S")
|
||||
|
||||
assert isfile(original_file) and isfile(src_file)
|
||||
shutil.copyfile(original_file, backup_file)
|
||||
shutil.copyfile(src_file, original_file);
|
||||
|
||||
def _touch(path):
|
||||
with open(path, "w") as fp:
|
||||
fp.write("")
|
||||
|
||||
env.Execute(lambda *args, **kwargs: _touch(patchflag_path))
|
||||
print("Done patching exception handler")
|
||||
|
||||
print("Libmaple modified and ready for post mortem debugging")
|
Loading…
Add table
Add a link
Reference in a new issue