---
title: "Building the SDK"
canonical_url: https://developer.repebble.com/pebbleos/docs/sdk/building/
last_updated: 2026-10-21
sdk_version: 4.33.1
---
# Building the SDK

Source: https://developer.repebble.com/pebbleos/docs/sdk/building/

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, `typedef`s and `#define`s 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 $BOARDpbl 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](https://github.com/coredevices/pebbleos/commit/3a7b71785fd439666c4a8bc116f561140e8dec01). This page is maintained in the pebbleos repository: [docs/sdk/building.md](https://github.com/coredevices/pebbleos/blob/3a7b71785fd439666c4a8bc116f561140e8dec01/docs/sdk/building.md).
