Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions docs/development/debug.md
Original file line number Diff line number Diff line change
@@ -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 <coredump_file>.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
```


1 change: 1 addition & 0 deletions docs/development/qemu.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ development/getting_started.md
development/options.md
development/building_fw.md
development/prf.md
development/debug.md
development/qemu.md
```

Expand Down
6 changes: 3 additions & 3 deletions tools/analyze_coredump.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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."
)

Expand Down Expand Up @@ -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:
Expand Down
Loading