PineTime doesn't run Linux... But that's OK!

PineTime Smart Watch

📝 19 Jun 2020

Update 13 Jul 2020: 1️⃣   We are getting ready to factory-preload PineTime with open source InfiniTime FreeRTOS firmware (ported by JF002) and MCUBoot Bootloader (ported by lupyuen)... 2️⃣   PineTime Owners may use the nRF Connect mobile app (Android / iOS) to update PineTime's firmware and sync PineTime's date/time... 3️⃣   PineTime will be shipped without Flash ROM protection... 4️⃣   We no longer need a Raspberry Pi to remove Flash ROM protection, but I recommend getting an ST-Link v2 (or compatible) for flashing via SWD... 5️⃣   Get your PineTime Dev Kit today!

PineTime Smart Watch works great with open source embedded software platforms like Arduino, FreeRTOS, RIOT, Mynewt, wasp-os, Zephyr, ... None of which are based on Linux!

Think of PineTime as a supercharged BBC micro:bit (or Arduino Uno) that comes with Bluetooth LE, colour LCD display (240 x 240), touchscreen, heart rate sensor and accelerometer.

PineTime is incredibly hackable: Flash our own firmware, build our own watch faces, render graphics on the touchscreen, ... The PineTime FOSS Community is always happy to help you hack PineTime!

C is the most common language for coding PineTime. If you're familiar with Python, try coding PineTime with MicroPython on wasp-os.

If you're into cutting edge coding, check out Rust Embedded (and Real Time For the Masses) on PineTime.

1 Some PineTime wiring needed

PineTime ships as a Developer Kit... Get ready to do some wiring!

Some newbies find it tricky to connect to the SWD Port inside PineTime, please chat with us online for tips.

I recommend using a Raspberry Pi to remove Flash ROM protection from PineTime (this step is mandatory), also to flash and debug the PineTime firmware.

Advanced firmware coders will find ST-Link V2 more efficient for flashing and debugging the firmware. (Though ST-Link V2 can't be used for removing Flash ROM protection)

Check out the PineTime Updater for wired flashing

Check out the Pogo Pins that we're testing

2 Wireless tools are coming

Programming PineTime the wired way sounds tedious, but we're heading the wireless way...

After installing the wasp-os or Arduino firmware on PineTime (the wired way), we may update the wasp-os / Arduino firmware wirelessly over Bluetooth LE. (wasp-os also exposes the REPL interface wirelessly)

The PineTime FOSS Community is now extending this wireless capability to other types of PineTime firmware, like FreeRTOS, Mynewt and Zephyr.

We have ported to PineTime the open source MCUBoot Bootloader, and we have to hope to have it preloaded on PineTime watches soon.

The new bootloader will let you switch firmware wirelessly, like from Mynewt to FreeRTOS. Great for trying out all kinds of experimental firmware created by the PineTime FOSS Community!

With firmware updates over Bluetooth LE, PineTime programming will become so much easier!

Check out Wireless Firmware Updates for PineTime

3 PineTime Companion App

Today we use a mix of mobile apps for firmware flashing and data syncing with PineTime, like DaFlasher and nRF Connect.

The open source PineTime Companion App is under development now. It will run on Android and iOS (via Flutter) and on Linux phones like PinePhone (via Wayland and LVGL). It will probably run on Raspberry Pi and Pinebook Pro too!

The Companion App will update PineTime firmware, sync the date and time, chart your heart rate, push your mobile notifications to PineTime, ... And let you control your smart home gadgets with PineTime!

Check out the PineTime Companion App

4 Build PineTime Firmware in the Cloud

Programming the firmware of our gadgets (like PineTime Smart Watch) has always been cumbersome...

  1. Get a proper computer (Windows tends to be problematic)

  2. Install the right tools and libraries to cross-compile our firmware (Depends on our operating system)

  3. If the build fails, tweak the build scripts (It's probably just Windows)

  4. If the build still fails... We're stuck!

Now we have a new way to build firmware in the Cloud with GitHub Actions...

  1. Create a fork of the PineTime source code repository in GitHub

  2. Check in our updated source files to GitHub

  3. Wait 2 Minutes

  4. Out comes a piping-hot New Firmware Image for testing on PineTime!

This makes coding a lot simpler for newcomers!

Check out GitHub Actions for PineTime

5 Programming with PineTime

Assuming that we know C++, the easiest way to start coding is to look at the existing PineTime code and tweak it.

All we need... Is a Web Browser!

  1. Follow the instructions in this article...

    "Build PineTime Firmware in the Cloud with GitHub Actions"

  2. Go ahead and create a Fork of the PineTime Source Code in GitHub, as explained in the doc...

    "Create a Fork"

  3. Add the main.yml file, like the doc says...

    "Add GitHub Actions"

  4. According to the doc we'll edit a C++ source file: Clock.cpp

    When we change the message to "LOVE", we're actually changing the PineTime Watch Face, modifying the way it operates...

    "Modify the Source Code"

  5. Study the C++ code inside Clock.cpp

    Ponder, meditate and understand how the Watch Face is rendered.

    All functions and objects named lv_... come from the LVGL Library

    We call the LVGL Library to render Widgets on the Watch Face, like Buttons and Labels.

    LVGL Documentation

  6. When we're ready, make some changes to the source code in Clock.cpp to create our own PineTime Watch Face.

    GitHub will automatically recompile the firmware.

    We'll find the results of the compilation under the Actions section of our GitHub Fork...

    "Our Firmware Build"

  7. We'll soon we able to preview PineTime Watch Faces in a web browser (Check later for updates)...

    "PineTime Watch Face Simulator"

  8. Finally we flash our Watch Face to PineTime over Bluetooth...

    "Test Our PineTime Fimware"

This runs all in the Cloud, so we don't even need a PineTime to create our own Watch Face!

Custom PineTime Watch Face created in C++ by SravanSenthiln1: PineTime Watch Face Simulator vs Real PineTime

Custom PineTime Watch Face created in C++ by SravanSenthiln1: PineTime Watch Face Simulator vs Real PineTime

6 What's Next

The PineTime FOSS Community has accomplished so much over the past 6 months because we're all volunteers passionate about PineTime.

You're welcome to join us and make the open source PineTime software even better!

Chat with us on Matrix, Discord, Telegram and IRC

PineTime Wiki

Got a question, comment or suggestion? Create an Issue or submit a Pull Request here...

pinetime-rust-mynewt/rust/ app/src/pinetime.md