diff --git a/docs/development/debug.md b/docs/development/debug.md new file mode 100644 index 000000000..5a9a1f39a --- /dev/null +++ b/docs/development/debug.md @@ -0,0 +1,59 @@ +# Debugging + +#### Prerequisites + +```bash +source .venv/bin/activate +pip install pebble-tool +``` + +**Explanation:** +- `pbl` = **internal** tool in this project (located in `python_libs/pbl/`) +- `pebble-tool` = **public** package from PyPI (https://github.com/coredevices/pebble-tool) +- `pbl` requires `pebble-tool` to work (see `python_libs/pbl/pbl/__init__.py` line 3) +- Only install `pebble-tool`, `pbl` is already in the project + +```{tip} +Remember to have Pebble core mobile app with LAN developer connection enabled. +``` + +## Logs + +#### Usage + +```bash +pebble logs --phone 192.168.1.100 +``` + +## Getting Coredumps + +#### Usage + +```bash +pbl coredump --phone 192.168.1.100 +``` + +#### Notes + +- Coredump is saved as `pebble_coredump_YYYY-MM-DD_HH-MM-SS.core` + +## Read Coredumps + +#### Convert a Pebble core dump to an ELF file. + +```bash +tools/readcore.py .core core.elf +``` + +#### Debug with GDB + +```bash +arm-none-eabi-gdb build/src/fw/tintin_fw.elf core.elf +``` +#### Commands inside GDB + +```bash +(gdb) pbl help +``` + + diff --git a/docs/development/qemu.md b/docs/development/qemu.md index fa6f717b8..4810ba411 100644 --- a/docs/development/qemu.md +++ b/docs/development/qemu.md @@ -86,6 +86,7 @@ The steps here are similar that of real hardware: ./waf build ./waf qemu_image_spi ``` +(not inside Qemu repo, this is for PebbleOS repo) where `$BOARD` is any STM32 based board. diff --git a/docs/index.md b/docs/index.md index 9314c4a07..9d0cfc80b 100644 --- a/docs/index.md +++ b/docs/index.md @@ -90,6 +90,7 @@ development/getting_started.md development/options.md development/building_fw.md development/prf.md +development/debug.md development/qemu.md ``` diff --git a/tools/analyze_coredump.py b/tools/analyze_coredump.py index 4df402ba9..51df9dcb6 100755 --- a/tools/analyze_coredump.py +++ b/tools/analyze_coredump.py @@ -18,7 +18,7 @@ def find_gdb_executable(): """Find an available arm-none-eabi-gdb with Python support.""" - candidates = ["arm-none-eabi-gdb-py", "arm-none-eabi-gdb-py3"] + candidates = ["arm-none-eabi-gdb-py", "arm-none-eabi-gdb-py3", "arm-none-eabi-gdb"] for candidate in candidates: if shutil.which(candidate): return candidate @@ -36,7 +36,7 @@ def __init__(self, elf_file, coredump_file, output_file=None): self.gdb_executable = find_gdb_executable() if not self.gdb_executable: raise RuntimeError( - "Could not find arm-none-eabi-gdb-py or arm-none-eabi-gdb-py3. " + "Could not find arm-none-eabi-gdb-py, arm-none-eabi-gdb-py3, or arm-none-eabi-gdb. " "Please ensure one of these is installed and in PATH." ) @@ -174,7 +174,7 @@ def analyze(self): except FileNotFoundError: print( f"Error: {self.gdb_executable} not found. " - "Please ensure arm-none-eabi-gdb-py or arm-none-eabi-gdb-py3 is installed and in PATH." + "Please ensure arm-none-eabi-gdb-py, arm-none-eabi-gdb-py3, or arm-none-eabi-gdb is installed and in PATH." ) return False except Exception as e: