PebbleOS is the firmware that runs on Pebble watches. Its source is developed in the open at github.com/coredevices/pebbleos under the Apache License 2.0. This section of the site is for developers who want to build, run or change the firmware itself. To write watchapps and watchfaces, start with Installing the Pebble SDK and the Guides instead.
The pages under PebbleOS documentation are
generated from the docs/ directory of the pebbleos repository on every build
of this site, from the main branch. The same content is published at
pebbleos-core.readthedocs.io. Each
imported page ends with the PebbleOS commit it was generated from and a link to
its source file.
The steps below take a build from nothing to running in the emulator and installed on a watch. Each step links to the imported page that covers it, so the instructions themselves come from the pebbleos repository.
pbl configure lists
the boards and options it accepts, and the
Emulator page
installs apps into the running emulator. To try the firmware without
building anything, open the Playground..pbz with
pbl bundle, and install it in one of three
ways: sideload the file
with the Pebble app
(Firmware Update Debug > Sideload FW, with debug options shown); send
it through the
Developer Connection as described in
Sideloading with the pebble tool;
or, on a board with its debug connector exposed, flash it with
pbl flash.Read Installing a Custom Build before step 2.
A firmware change can modify or overwrite the bootloader or the recovery firmware (PRF). If either stops working, the watch can no longer take an update over Bluetooth and can only be reprogrammed through its debug connector. Keep changes away from the bootloader and PRF, and test in the emulator before flashing a watch.
When a firmware fails to start, the bootloader records the attempt in the
boot bits and after repeated failures boots PRF instead. From PRF the Pebble
mobile app installs a firmware again. To get to PRF by hand, hold Back,
Up and Select together for five seconds, or run pebble fw enter-prf.
If the bootloader or PRF has been erased, the watch can only be programmed through its debug connector: over SWD with openocd on Pebble 2 Duo, and over the serial adapter with sftool, which does not depend on the bootloader, on Pebble Time 2 and Pebble Round 2. A sealed watch has no accessible debug connector; Programmers covers the boards that connect to one.
The firmware is configured for one board at a time with
pbl configure --board <board>. The repository at main defines these boards:
| Board | Watch | Platform | SoC |
|---|---|---|---|
asterix |
Pebble 2 Duo | flint | Nordic nRF52840 |
obelix |
Pebble Time 2 | emery | SiFli SF32LB52 |
getafix |
Pebble Round 2 | gabbro | SiFli SF32LB52 |
qemu_flint |
Emulator | flint | QEMU, Cortex-M4 |
qemu_emery |
Emulator | emery | QEMU, Cortex-M33 |
qemu_gabbro |
Emulator | gabbro | QEMU, Cortex-M33 |
The platform column is the name the SDK uses for the same hardware, for
example in targetPlatforms in package.json. The
Hardware Information
guide lists what each platform has, such as display size and sensors.
Hardware revisions are selected with an @ suffix, for example
pbl configure --board obelix@pvt. The revisions each board supports are
listed in boards/<board>/<board>.yml. The repository has no board
definitions for the watches made by Pebble Technology Corporation (the aplite,
basalt, chalk and diorite platforms).
Note: The imported documentation has a board page for Asterix only. The
obelix,getafixand QEMU boards are documented by theirKconfiganddefconfigfiles in the repository.
Translations of the firmware's menus, settings and system messages are made at translate.repebble.com. The site runs Weblate with a Pebble extension that previews each string with the PebbleOS text renderer, checks that the watch fonts cover the characters a language needs, and builds draft language packs so a translation can be tried on a watch before it is reviewed.
To translate:
Language packs are built from the site. The pblpack command line tool that
built language packs from .po files is deprecated and no longer the way to
produce them. See the
launch post for the
background.
Watchapps do not link against the firmware. The firmware build generates the
app SDK from its own sources: pebble.h with the exported declarations, and
libpebble.a with trampolines that call into the firmware through a function
table compiled into the firmware image. Apps run as unprivileged processes
and reach OS state through syscalls. The imported
Exporting a function page
describes how a firmware function becomes an SDK API.
The SDK that developers install with pebble sdk install is built from a
firmware release. The C API reference on this site at /docs/c/ is
generated from the pebbleos release tag recorded in the site's
EMERY_SDK_VERSION file. The firmware documentation in this section tracks
main, so it can describe functions that are not yet in a released SDK.
The Pebble mobile app pairs with the watch over Bluetooth, installs apps and
firmware updates, and runs the PebbleKit JS side of apps. During development
it also carries the
Developer Connection
that the pebble tool uses to install and debug apps on a watch. Its source
is at github.com/coredevices/mobileapp.
Changes to the firmware are often paired with changes to the Pebble mobile app, for example a new Pebble Protocol endpoint or a change to how firmware is installed. The mobile app can connect to a PebbleOS emulator over TCP in place of a watch, so both sides of a change can be tested without hardware. Testing with the Pebble Mobile App covers running the phone app against the emulator. The Mobile App section covers building the app and sending changes to its repository.
Note: Two different things are called an SDK. The Pebble SDK builds watchapps. The PebbleOS SDK at github.com/coredevices/PebbleOS-SDK is the toolchain bundle for building the firmware: the ARM GNU toolchain, Pebble QEMU and flashing tools. The imported pages mean the second one.
pbl tool and its commands, the build system,
testing, the emulator and debugging.include/: kernel, drivers,
services and subsystems. It describes interfaces inside the firmware; the
C API reference is the one to use when writing apps.The Contribution Guidelines cover getting a change merged.