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

PebbleOS

  • Overview
  • Contributing
  • Start here
  • Development
  • System
    • Architecture overview
    • Kernel
    • Subsystems
    • Drivers
    • Services
    • Libraries
    • Third-party
    • Application SDK
  • Hardware
  • Community
  • Reference
  • Firmware API Reference

Building the SDK

The SDK is generated by the firmware build, from the firmware’s own headers, so it always matches the firmware it is built with.

The generator

The generator (tools/generate_native_sdk/generate_pebble_native_sdk_files.py) runs automatically as part of the firmware build (normal variant only — PRF and test builds skip it). It exports the white-listed functions, typedefs and #defines from the firmware tree and produces the files needed to build native watchapps, all under build/:

  • build/sdk/<platform>/include/pebble.h — typedefs, defines and function prototypes for apps (plus pebble_worker.h for background workers and a few version/fonts headers). Exported declarations are copied verbatim and use pbl/kernel/compiler.h macros rather than raw __attribute__; the generator rewrites those into their GCC spellings, so the SDK ships no firmware headers. Only macros that alias an attribute or forward their arguments to a builtin can be exported.

  • build/sdk/<platform>/lib/libpebble.a — static library containing trampolines that call the exported functions in flash

  • build/fw/pebble.auto.c — g_pbl_system_tbl, the table of function pointers the trampolines use to find an exported function’s address; compiled into the firmware image

Packaging

The rest of the distribution is packaged by the firmware build’s sdk target, which fills in the same build/sdk/ tree:

pbl configure --board $BOARD
pbl build sdk

tools/cmake/sdk.py copies the common files from sdk/ into build/sdk/common/ — the app project templates under sdk/defaults/, and the tools and resource pipeline the app build shares with the firmware — and bundles sdk/waftools/ into the waf binary app developers use to build their apps. That waf is the only one left in the tree: everything it needs lives under sdk/, and it is built out of tree, so packaging leaves the checkout untouched.

Generated from PebbleOS 3a7b71785. This page is maintained in the pebbleos repository: docs/sdk/building.md.

Overview

  • The generator
  • Packaging