From 23a0e197b946cf1599d68b87d4c0f8cae76d77b2 Mon Sep 17 00:00:00 2001 From: Alexander Lerach Date: Fri, 13 Sep 2024 16:37:47 +0200 Subject: [PATCH] Fixed task switching --- src/emdbg/debug/px4/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/emdbg/debug/px4/base.py b/src/emdbg/debug/px4/base.py index f45d9d6..05f23b4 100644 --- a/src/emdbg/debug/px4/base.py +++ b/src/emdbg/debug/px4/base.py @@ -62,7 +62,8 @@ def write_registers(self, values: dict[str, int]): if name in ["sp", "r13"]: name = "msp" if name == "msp": - self.write_register("r13", value) + # NuttX stores the SP incorrectly (is off by 4 bytes) + self.write_register("r13", value + 4) # Remove double FP registers if name.startswith("d"): continue self.write_register(name, value)