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
    • Build system
    • Samples
    • Emulator and simulator
    • Testing
    • Debugging
    • Conventions
  • System
    • Architecture overview
    • Kernel
      • Threads
      • Syscalls
      • Interrupts
      • Time and delays
      • Work queues
      • Boot
      • Idle
      • Memory
      • Fatal errors and assertions
      • Reboot and power-off
      • Print
      • Compiler abstraction
      • Kernel internals
    • Drivers
    • Subsystems
    • Libraries
    • Third-party
  • Hardware
    • Boards
    • Board Add-ons
    • Programmers
  • Community
    • Contribution Guidelines
  • Reference
    • Reference
    • Kconfig options

Threads

pbl_thread_create() takes a struct pbl_thread_attr: entry, priority, privileged flag, a caller-owned stack and up to two struct pbl_mpu_regions that are switched in with the thread, on top of the stack guards the kernel adds. With CONFIG_USERSPACE it also takes the memory the thread’s syscalls may use and the stack they run on (Syscalls).

Introspection

debug.h covers what core dumps, fault handling, stack checks and telemetry need: a thread walk, where a blocked thread is (its saved PC and return address, and whether it ran unprivileged), stack bounds and high-water marks, and a run-time stats snapshot. The registers of each thread in a core dump come from the architecture’s core dump support, in the layout of the dump format.

Samples

Kernel: Threads creates threads above and below main()’s priority, and Kernel: Message queues passes messages between two.

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

Overview

  • Introspection
  • Samples