How open-smartwatch/open-smartwatch-os works
Project type and purpose
• This repository is the firmware and toolchain for an open‑source smartwatch OS (“open‑smartwatch-os”), plus a host‑side emulator.
• Key indicators:
• In README: build instructions using PlatformIO and CMake (for emulator).
• File tree: “src/”, “include/”, “lib/”, and “platformio.ini” for embedded firmware; “emulator/” and “CMakeLists.txt” for host emulator; “scripts/” for asset pre‑build; “data/” and “docs/” for sample apps and documentation.
File structure
• Top‑level directories:
• /: public headers for OS HAL, devices, services, UI, Lua bindings, and assets
• src/: implementation of HAL, drivers, OS core, animations, apps, services, Lua integration
• lib/: bundled third‑party libraries (Lua interpreter, graphics, sensors)
• emulator/: host emulator code reimplementing Arduino/ESP32 APIs, plus unit/UI tests
• scripts/: Python and shell scripts to generate code from assets, capture screenshots
• data/: sample Lua scripts and libraries for watch apps
• platformio.ini & CMakeLists.txt: build configurations
• Patterns:
• Firmware uses a layered architecture: HAL → Drivers → OS Core → Services → Applications
• Emulator is a parallel CMake project that fakes hardware layers using SDL2/ImGUI
• Scripts preprocess assets (images, maps) into C headers, plugged into include/assets and src/assets
README for additional insights
• The README describes two build flows:
• Firmware: PlatformIO for multiple watch hardware variants
• Emulator: CMake + SDL2 for rapid UI and unit/UI test development
• It mentions key components:
• Lua scripting support via SWIG
• Screen server feature for screenshots
• OS console commands via serial
• Testing: unit/UI tests in emulator/src/tests