Skip to content

Commit

Permalink
Merge branch 'develop' of JF/PineTime into master
Browse files Browse the repository at this point in the history
  • Loading branch information
JF002 authored and Gitea committed Sep 26, 2020
2 parents be05997 + 3e612e7 commit b6a910e
Show file tree
Hide file tree
Showing 90 changed files with 2,317 additions and 7,775 deletions.
202 changes: 202 additions & 0 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
# GitHub Action to build FreeRTOS Firmware for PineTime Smart Watch
# Based on https://github.com/lupyuen/pinetime-lab/blob/master/doc/buildAndProgram.md

name: C/C++ CI

# Run this workflow on every push and pull request on "master" branch
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

# Steps to be run for the workflow
jobs:
build:

# Run these steps on Ubuntu
runs-on: ubuntu-latest

steps:
- name: Install cmake
uses: lukka/[email protected]

- name: Check cache for Embedded Arm Toolchain arm-none-eabi-gcc
id: cache-toolchain
uses: actions/cache@v2
env:
cache-name: cache-toolchain
with:
path: ${{ runner.temp }}/arm-none-eabi
key: ${{ runner.os }}-build-${{ env.cache-name }}
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}

- name: Install Embedded Arm Toolchain arm-none-eabi-gcc
if: steps.cache-toolchain.outputs.cache-hit != 'true' # Install toolchain if not found in cache
uses: fiam/[email protected]
with:
# GNU Embedded Toolchain for Arm release name, in the V-YYYY-qZ format (e.g. "9-2019-q4")
release: 8-2019-q3
# Directory to unpack GCC to. Defaults to a temporary directory.
directory: ${{ runner.temp }}/arm-none-eabi

- name: Check cache for nRF5 SDK
id: cache-nrf5sdk
uses: actions/cache@v2
env:
cache-name: cache-nrf5sdk
with:
path: ${{ runner.temp }}/nrf5_sdk
key: ${{ runner.os }}-build-${{ env.cache-name }}
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}

- name: Install nRF5 SDK
if: steps.cache-nrf5sdk.outputs.cache-hit != 'true' # Install SDK if not found in cache
run: cd ${{ runner.temp }} && curl https://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v15.x.x/nRF5_SDK_15.3.0_59ac345.zip -o nrf5_sdk.zip && unzip nrf5_sdk.zip && mv nRF5_SDK_15.3.0_59ac345 nrf5_sdk

- name: Checkout source files
uses: actions/checkout@v2

- name: Show files
run: set ; pwd ; ls -l

- name: CMake
run: mkdir -p build && cd build && cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=${{ runner.temp }}/arm-none-eabi -DNRF5_SDK_PATH=${{ runner.temp }}/nrf5_sdk -DUSE_OPENOCD=1 ../

- name: Make
# For debugging builds, remove option "-j" for clearer output. Add "--trace" to see details.
run: cd build && make -j pinetime-app

- name: Find output
run: find . -name pinetime-app.out

- name: Upload built firmware
uses: actions/upload-artifact@v2
with:
# Artifact name (optional)
name: pinetime-app.out
# A file, directory or wildcard pattern that describes what to upload
path: build/src/pinetime-app.out

# Embedded Arm Toolchain and nRF5 SDK will only be cached if the build succeeds.
# So make sure that the first build always succeeds, e.g. comment out the "Make" step.

# Sample compile command:
# [100%] Building CXX object src/CMakeFiles/pinetime-app.dir/drivers/TwiMaster.cpp.o
# cd /home/runner/work/pinetime-lab/pinetime-lab/build/src && /home/runner/work/_temp/arm-none-eabi/bin/arm-none-eabi-c++ --sysroot=/home/runner/work/_temp/arm-none-eabi/bin \
# -DBOARD_PCA10040 \
# -DCONFIG_GPIO_AS_PINRESET \
# -DDEBUG \
# -DDEBUG_NRF_USER \
# -DFREERTOS \
# -DNIMBLE_CFG_CONTROLLER \
# -DNRF52 \
# -DNRF52832 \
# -DNRF52832_XXAA \
# -DNRF52_PAN_12 \
# -DNRF52_PAN_15 \
# -DNRF52_PAN_20 \
# -DNRF52_PAN_31 \
# -DNRF52_PAN_36 \
# -DNRF52_PAN_51 \
# -DNRF52_PAN_54 \
# -DNRF52_PAN_55 \
# -DNRF52_PAN_58 \
# -DNRF52_PAN_64 \
# -DNRF52_PAN_74 \
# -DOS_CPUTIME_FREQ \
# -D__HEAP_SIZE=8192 \
# -D__STACK_SIZE=8192 \
# -I/home/runner/work/pinetime-lab/pinetime-lab/src/. \
# -I/home/runner/work/pinetime-lab/pinetime-lab/src/.. \
# -I/home/runner/work/pinetime-lab/pinetime-lab/src/libs \
# -I/home/runner/work/pinetime-lab/pinetime-lab/src/FreeRTOS \
# -I/home/runner/work/pinetime-lab/pinetime-lab/src/libs/date/includes \
# -I/home/runner/work/pinetime-lab/pinetime-lab/src/libs/mynewt-nimble/porting/npl/freertos/include \
# -I/home/runner/work/pinetime-lab/pinetime-lab/src/libs/mynewt-nimble/nimble/include \
# -I/home/runner/work/pinetime-lab/pinetime-lab/src/libs/mynewt-nimble/porting/nimble/include \
# -I/home/runner/work/pinetime-lab/pinetime-lab/src/libs/mynewt-nimble/nimble/host/include \
# -I/home/runner/work/pinetime-lab/pinetime-lab/src/libs/mynewt-nimble/nimble/controller/include \
# -I/home/runner/work/pinetime-lab/pinetime-lab/src/libs/mynewt-nimble/nimble/transport/ram/include \
# -I/home/runner/work/pinetime-lab/pinetime-lab/src/libs/mynewt-nimble/nimble/drivers/nrf52/include \
# -I/home/runner/work/pinetime-lab/pinetime-lab/src/libs/mynewt-nimble/ext/tinycrypt/include \
# -I/home/runner/work/pinetime-lab/pinetime-lab/src/libs/mynewt-nimble/nimble/host/services/gap/include \
# -I/home/runner/work/pinetime-lab/pinetime-lab/src/libs/mynewt-nimble/nimble/host/services/gatt/include \
# -I/home/runner/work/pinetime-lab/pinetime-lab/src/libs/mynewt-nimble/nimble/host/util/include \
# -I/home/runner/work/pinetime-lab/pinetime-lab/src/libs/mynewt-nimble/nimble/host/store/ram/include \
# -I/home/runner/work/_temp/nrf5_sdk/components/drivers_nrf/nrf_soc_nosd \
# -I/home/runner/work/_temp/nrf5_sdk/components \
# -I/home/runner/work/_temp/nrf5_sdk/components/boards \
# -I/home/runner/work/_temp/nrf5_sdk/components/softdevice/common \
# -I/home/runner/work/_temp/nrf5_sdk/integration/nrfx \
# -I/home/runner/work/_temp/nrf5_sdk/integration/nrfx/legacy \
# -I/home/runner/work/_temp/nrf5_sdk/modules/nrfx \
# -I/home/runner/work/_temp/nrf5_sdk/modules/nrfx/drivers/include \
# -I/home/runner/work/_temp/nrf5_sdk/modules/nrfx/hal \
# -I/home/runner/work/_temp/nrf5_sdk/modules/nrfx/mdk \
# -I/home/runner/work/_temp/nrf5_sdk/external/freertos/source/include \
# -I/home/runner/work/_temp/nrf5_sdk/components/toolchain/cmsis/include \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/atomic \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/atomic_fifo \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/atomic_flags \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/balloc \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/bootloader/ble_dfu \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/cli \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/crc16 \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/crc32 \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/crypto \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/csense \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/csense_drv \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/delay \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/ecc \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/experimental_section_vars \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/experimental_task_manager \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/fds \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/fstorage \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/gfx \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/gpiote \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/hardfault \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/hci \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/led_softblink \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/log \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/log/src \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/low_power_pwm \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/mem_manager \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/memobj \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/mpu \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/mutex \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/pwm \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/pwr_mgmt \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/queue \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/ringbuf \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/scheduler \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/sdcard \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/slip \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/sortlist \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/spi_mngr \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/stack_guard \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/strerror \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/svc \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/timer \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/usbd \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/usbd/class/audio \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/usbd/class/cdc \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/usbd/class/cdc/acm \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/usbd/class/hid \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/usbd/class/hid/generic \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/usbd/class/hid/kbd \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/usbd/class/hid/mouse \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/usbd/class/msc \
# -I/home/runner/work/_temp/nrf5_sdk/components/libraries/util \
# -I/home/runner/work/_temp/nrf5_sdk/external/segger_rtt \
# -I/home/runner/work/_temp/nrf5_sdk/external/fprintf \
# -I/home/runner/work/_temp/nrf5_sdk/external/thedotfactory_fonts -O3 \
# -DNDEBUG -MP -MD -mthumb -mabi=aapcs -Wall -g3 \
# -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin \
# --short-enums -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 \
# -Wreturn-type -Werror=return-type -O3 -std=gnu++11 \
# -o CMakeFiles/pinetime-app.dir/drivers/TwiMaster.cpp.o \
# -c /home/runner/work/pinetime-lab/pinetime-lab/src/drivers/TwiMaster.cpp

# /home/runner/work/pinetime-lab/pinetime-lab/src/drivers/TwiMaster.cpp:1:10: fatal error: sdk/integration/nrfx/nrfx_log.h: No such file or directory
# #include <sdk/integration/nrfx/nrfx_log.h>
18 changes: 16 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
.idea
cmake-build-*
.idea/
cmake-build-*/
**/CMakeCache.txt
CMakeFiles/

core
sdk
src/Version.h
docker/post_build.sh

# Linux
**/.directory
**/*.swp

# OSX/MacOS
**/.DS_Store

# Windows
**/thumbs.db
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.10)
project(pinetime VERSION 0.7.1 LANGUAGES C CXX ASM)
project(pinetime VERSION 0.8.2 LANGUAGES C CXX ASM)

set(NRF_TARGET "nrf52")

Expand Down Expand Up @@ -65,5 +65,7 @@ endif()

set(VERSION_EDIT_WARNING "// Do not edit this file, it is automatically generated by CMAKE!")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/Version.h.in ${CMAKE_CURRENT_SOURCE_DIR}/src/Version.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docker/post_build.sh.in ${CMAKE_CURRENT_SOURCE_DIR}/docker/post_build.sh)


add_subdirectory(src)
50 changes: 30 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*https://www.pine64.org/pinetime/*

The **Pinetime** smartwatch is built around the NRF52832 MCU (512KB Flash, 64KB RAM), a 240*240 LCD display driven by the ST7789 controller, an accelerometer, a heartrate sensor and a vibrator.
The **Pinetime** smartwatch is built around the NRF52832 MCU (512KB Flash, 64KB RAM), a 240*240 LCD display driven by the ST7789 controller, an accelerometer, a heart rate sensor, and a vibration motor.

# InfiniTime
![InfiniTime logo](images/infinitime-logo.jpg "InfiniTime Logo")
Expand All @@ -19,65 +19,75 @@ The goal of this project is to design an open-source firmware for the Pinetime s
- Using **[LittleVGL/LVGL 6.1.2](https://lvgl.io/)** as UI library...
- ... and **[NimBLE 1.3.0](https://github.com/apache/mynewt-nimble)** as BLE stack.

##Overview
## Overview

![Pinetime screens](images/0.7.0/montage.jpg "PinetimeScreens")

As of now, here is the list of achievements of this project:

- Fast and optimized LCD driver
- BLE communication
- Rich user interface via display, touchpanel and push button
- Time synchronisation via BLE
- Rich user interface via display, touchscreen and pushbutton
- Time synchronization via BLE
- Notification via BLE
- Multiple 'apps' :
* Clock (displays the date, time, battery level, ble connection status, heart rate and step count)
* Clock (displays the date, time, battery level, BLE connection status, heart rate and step count)
* Heart rate
* Motion
* System info (displays various info : BLE MAC, build date/time, uptime, version,...)
* Brightess (allows the user to configure the brightness of the display)
- Supported by 2 companion apps (developpments ongoing):
* [Gadgetbridge](https://codeberg.org/Freeyourgadget/Gadgetbridge/src/branch/pinetime-jf) (on Android)
* System info (displays various info : BLE MAC, build date/time, uptime, version, ...)
* Brightness (allows the user to configure the brightness of the display)
- Supported by 2 companion apps (development is in progress):
* [Gadgetbridge](https://codeberg.org/Freeyourgadget/Gadgetbridge/) (on Android)
* [Amazfish](https://openrepos.net/content/piggz/amazfish) (on SailfishOS)
- **[Experimental]** OTA (Over-the-air) update via BLE
- **[Experimental]** Bootloader based on [MCUBoot](https://juullabs-oss.github.io/mcuboot/)

## Documentation

### Develop
- [Generate the fonts and symbols](src/DisplayApp/Fonts/Readme.md)

### Build, flash and debug
- [Project branches](doc/branches.md)
- [Versioning](doc/versioning.md)
- [Files included in the release notes](doc/filesInReleaseNotes.md)
- [Build the project](doc/buildAndProgram.md)
- [Build the project with Docker](doc/buildWithDocker.md)
- [Bootloader, OTA and DFU](./bootloader/README.md)
- [Stub using NRF52-DK](./doc/PinetimeStubWithNrf52DK.md)
- Logging with JLink RTT.
- Using files from the releases


### Contribute
- [How to contribute ?](doc/contribute.md)

### API
- [BLE implementation and API](./doc/ble.md)

### Architecture and technical topics
- [Memory analysis](./doc/MemoryAnalysis.md)

### Using the firmware
- Integration with Gadgetbridge
- Integration with AmazFish
- Integration with NRFConnect
- Firmware update, OTA
- [Integration with Gadgetbridge](doc/CompanionApps/Gadgetbridge.md)
- [Integration with AmazFish](doc/CompanionApps/Amazfish.md)
- [Firmware update, OTA](doc/CompanionApps/NrfconnectOTA.md)


## TODO - contribute

This project is far from beeing finished, and there are still a lot of things to do for this project to become a firmware usable by the general public.
This project is far from being finished, and there are still a lot of things to do for this project to become a firmware usable by the general public.

Here a quick list out of my head of things to do for this project:

- Improve BLE communication stability and reliability
- Improve OTA and MCUBoot bootloader
- Add more functionalities : Alarm, chrono, configuration, activities, heart rate logging, games,...
- Add more functionalities : Alarm, chronometer, configuration, activities, heart rate logging, games,...
- Add more BLE functionalities : call notifications, agenda, configuration, data logging,...
- Measure power consumption and improve battery life
- Improve documentation, take better pictures and video than mine
- Improve the UI
- Create companion app for multiple OSes (Linux, Android, IoS) and platforms (desktop, ARM, mobile). Do not forget the other devices from Pine64 like [the Pinephone](https://www.pine64.org/pinephone/) and the [Pinebook Pro](https://www.pine64.org/pinebook-pro/).
- Design a simple CI (preferably selfhosted and easy to reproduce).
- Create companion app for multiple OSes (Linux, Android, iOS) and platforms (desktop, ARM, mobile). Do not forget the other devices from Pine64 like [the Pinephone](https://www.pine64.org/pinephone/) and the [Pinebook Pro](https://www.pine64.org/pinebook-pro/).
- Design a simple CI (preferably self-hosted and easy to reproduce).

Do not hesitate to clone/fork the code, hack it and create pull-requests. I'll do my best to review and merge them :)

Expand All @@ -96,7 +106,7 @@ I’m not working alone on this project. First, many people create PR for this p
Here are some people I would like to highlight:

- [Atc1441](https://github.com/atc1441/) : He works on an Arduino based firmware for the Pinetime and many other smartwatches based on similar hardware. He was of great help when I was implementing support for the BMA421 motion sensor and I²C driver.
- [Koen](https://github.com/bosmoment) : He’s working on a firmware based on RiotOS. He integrated similar libs than me : NimBLE, LittleVGL,… His help was invaluable too!
- [Lup Yuen Lee](https://github.com/lupyuen) : He is everywhere : he works on a Rust firmware, buils a MCUBoot based bootloader for the Pinetime, design a Flutter based companion app for smartphones and write a lot of articles about the Pinetime!
- [Koen](https://github.com/bosmoment) : He’s working on a firmware based on RiotOS. He integrated similar libs as me : NimBLE, LittleVGL,… His help was invaluable too!
- [Lup Yuen Lee](https://github.com/lupyuen) : He is everywhere: he works on a Rust firmware, builds a MCUBoot based bootloader for the Pinetime, designs a Flutter based companion app for smartphones and writes a lot of articles about the Pinetime!

*If you feel like you should appear on this list, just get in touch with me or submit a PR :)*
Loading

0 comments on commit b6a910e

Please sign in to comment.