pebble
  • Tutorials
  • Get the SDK
  • Guides
  • Documentation
  • PebbleOS
  • Mobile App
  • Examples
  • Index 01
  • Community
  • Blog
  • More
Privacy
Cookies
Publish

PebbleOS

  • Overview
  • Start here
    • Getting started guide
  • Pebble Firmware
    • Overview
    • Playground
    • Application SDK
  • Development
    • The pbl CLI
      • pbl configure
      • pbl build
      • pbl bundle
      • pbl menuconfig
      • pbl clean
      • pbl test
      • pbl itest
      • pbl samples
      • pbl sdk
      • pbl run
      • pbl console
      • pbl debug
      • pbl debugserver
      • pbl emulator
      • pbl image_resources
      • pbl image_recovery
      • pbl erase
      • pbl lab
      • pbl power
      • Extending pbl
    • Build system
    • Samples
    • Emulator and simulator
    • Testing
    • Debugging
    • Conventions
  • System
    • Architecture overview
    • Kernel
    • Drivers
    • Subsystems
    • Libraries
    • Third-party
  • Hardware
    • Boards
    • Board Add-ons
    • Programmers
  • Community
    • Contribution Guidelines
  • Reference
    • Reference
    • Kconfig options

pbl run

Run the firmware with the board’s runner: in the emulator for a QEMU board, as a host program or in a browser for a native board, or flashed to a watch.

pbl run

Arguments after -- go to the program the runner starts, e.g. QEMU:

pbl run -- -d guest_errors

In the emulator

On a QEMU board, the qemu runner launches the firmware in the emulator:

pbl configure --board qemu_pebble/m33
pbl build
pbl run

The flash image is rebuilt on every launch; --keep-flash-image keeps it, and with it installed apps, data and Bluetooth bondings.

The launched QEMU exposes:

  • An interactive QEMU monitor on the launching terminal (-monitor stdio)

  • A programmatic socket monitor (-monitor unix:build/qemu-mon.sock)

  • The serial console over TCP on localhost:12345, for pbl console, and for the Pebble protocol sessions of pbl emulator and the pebble tool

  • The serial protocol that drives the emulated hardware over TCP on localhost:12344, for pbl emulator and the pebble tool

UART1 output is also captured to uart1.log in the repository root. Emulator covers what the emulator models and how to operate it.

On the host

On the native board, the native runner starts the native simulator, with its external flash in pebbleos-flash.bin in the build directory, kept across runs, and the same two TCP ports as the emulator: the console on localhost:12345, which the terminal keeps as well, and the serial protocol that drives the simulated hardware on localhost:12344. Arguments after -- are the program’s own options, e.g. a window scale factor:

pbl configure --board native
pbl build
pbl run -- -s 2

--bt-hci connects the Bluetooth HCI UART of a CONFIG_NIMBLE_HCI_UART build to a controller, and --bt-addr gives the watch its Bluetooth address, as in the emulator.

In a browser

The wasm variant of the native board is run by the wasm runner: it serves the build directory on localhost, port 8000 or --http-port, and opens the page in a browser, unless --no-browser is given. Ctrl-C stops it; reloading the page picks up a rebuild.

pbl configure --board native/wasm
pbl build
pbl run

On a watch

On a watch, running the firmware is flashing it. With a programmer connected as the board’s page shows, the board’s runner writes it directly. The sftool runner talks to the watch over a serial port, given with --tty, e.g. /dev/ttyACM0 or /dev/tty.usbmodem1102:

pbl run --tty /dev/ttyACM0

With the watch in a lab file, its ports need not be given.

The first time, the system resources have to be written too. The sftool runner, and the openocd and nrfutil ones on asterix, take --resources; otherwise, image them over the serial console once the firmware is running, with pbl image_resources.

pbl run flashes every image of the build, such as the bootloader the firmware boots with (see Images). --image app flashes only the application.

A recovery firmware build is flashed to run, like any other. --provision installs it instead the way a watch is provisioned, where the bootloader takes it from: on asterix, whose bootloader copies the firmware into place, it is written to its partition of the external flash and the firmware is erased from the internal flash, so the bootloader copies the recovery firmware in on the next boot. On the SF32LB watches the recovery firmware runs from its partition, so it is flashed there either way.

When both firmware and resources are written, the watch boots into the main application; pbl console shows its logs.

A watch without a programmer is flashed through its phone with the phone runner, which reaches the Pebble app’s Developer Connection in one of three ways, picked with --via.

An Android phone connected over adb, the default, needs nothing else: the runner starts the Developer Connection itself and reaches it through an adb port forward. Pass --adb-serial when adb sees more than one phone:

pbl run -r phone

Any phone is reached through the cloud when signed in to the same account as pebble login, from the pebble tool installed separately:

pbl run -r phone --via cloud

A phone on the same network is reached directly: enable the Developer Connection in the Pebble app and pass the address it shows, which implies --via ip:

pbl run -r phone --address $IP

The runner packages the build into a pbl bundle, firmware and system resources together, so --resources is implied, and sends it to the app in one message. The app installs it over Bluetooth as it does any firmware update, rebooting the watch into PRF first when needed, e.g. when the bundle is for the slot the watch runs from, and reports its progress. The runner reconnects when the watch reboots and the connection drops.

On boards with two firmware slots, the watch writes the slot it does not run from, while PRF always writes slot 0: a slot 0 build, the default, always installs, while a slot 1 build only installs on a watch running from slot 0.

Older app versions cannot install bundles, and the runner stops with an error asking to update the app.

Options

pbl run [-h] [-b DIR] [--dry-run] [--lab FILE] [--watch NAME]
        [--wait [SECONDS]] [--resources] [--provision] [--image NAME]
        [-r {native,nrfutil,openocd,phone,probe-rs,qemu,sftool,wasm}]
        [--tty TTY] [--probe VID:PID[:SERIAL]] [--keep-flash-image]
        [--decoration NAME] [--sunlight] [--bt-hci CHARDEV]
        [--bt-addr ADDRESS] [--http-port HTTP_PORT] [--no-browser]
        [--via {adb,cloud,ip}] [--address ADDRESS] [--adb-serial ADB_SERIAL]
--resources

When flashing a device, also flash the system resources

--provision

When flashing a recovery firmware build, write it where the bootloader installs it from and erase the firmware, as a watch is provisioned, instead of flashing it to run

--image NAME

When flashing a device, flash only this image of the build, e.g. app to leave the bootloader as it is (repeatable)

-r, --runner {native,nrfutil,openocd,phone,probe-rs,qemu,sftool,wasm}

Override the board’s runner

--tty TTY

Serial port for the sftool and probe-rs runners (default: the lab’s)

--probe VID:PID[:SERIAL]

Debug probe for the probe-rs runner (default: the lab’s)

--keep-flash-image

Keep the emulator’s SPI flash image, and the apps and data in it, instead of rebuilding it

--decoration NAME

SDL decoration the emulator draws around the screen, or ‘none’ (default: the build’s first)

--sunlight

Show the colors as a watch’s panel does in sunlight

--bt-hci CHARDEV

H4 Bluetooth controller for builds with CONFIG_NIMBLE_HCI_UART, e.g. the serial port /dev/cu.usbmodem1101

--bt-addr ADDRESS

Random static Bluetooth address the watch uses, e.g. C0:00:00:00:00:01, instead of its controller’s

--http-port HTTP_PORT

Port the wasm runner serves the page on (default: 8000)

--no-browser

Do not open the page the wasm runner serves in a browser

--via {adb,cloud,ip}

How the phone runner reaches the phone’s Developer Connection: adb (Android, the default), cloud (signed in with ‘pebble login’) or ip (implied by –address)

--address ADDRESS

Phone address (Developer Connection) for the phone runner

--adb-serial ADB_SERIAL

Serial of the Android phone for the phone runner, when adb sees several

Generated from PebbleOS 7416f78a1. This page is maintained in the pebbleos repository: docs/pbl/run.md.

Overview

  • In the emulator
  • On the host
  • In a browser
  • On a watch
  • Options