Skip to content

Commit 1d940af

Browse files
JF002Gitea
authored andcommitted
Merge branch 'develop' of JF/PineTime into master
2 parents 04abc91 + 50ae0ae commit 1d940af

126 files changed

Lines changed: 1899 additions & 779 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
# Download and Cache Dependencies
3131

3232
- name: Install cmake
33-
uses: lukka/get-cmake@v3.18.0
33+
uses: lukka/get-cmake@v3.18.3
3434

3535
- name: Check cache for Embedded Arm Toolchain arm-none-eabi-gcc
3636
id: cache-toolchain
@@ -142,7 +142,7 @@ jobs:
142142
- name: Upload DFU package
143143
uses: actions/upload-artifact@v2
144144
with:
145-
name: pinetime-mcuboot-app-dfu.zip
145+
name: pinetime-mcuboot-app-dfu
146146
path: build/src/pinetime-mcuboot-app-dfu/*
147147

148148
#########################################################################################
@@ -168,4 +168,4 @@ jobs:
168168
find . -name "pinetime-mcuboot-app.*" -ls
169169
170170
# Embedded Arm Toolchain and nRF5 SDK will only be cached if the build succeeds.
171-
# So make sure that the first build always succeeds, e.g. comment out the "Make" step.
171+
# So make sure that the first build always succeeds, e.g. comment out the "Make" step.

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
.idea/
22
# CMake
3-
cmake-build-*/
4-
CMakeFiles/
3+
cmake-build-*
4+
cmake-*
5+
CMakeFiles
56
**/CMakeCache.txt
67
cmake_install.cmake
78
Makefile
9+
build
10+
tools
811

912
# Resulting binary files
1013
*.a

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.10)
2-
project(pinetime VERSION 0.9.0 LANGUAGES C CXX ASM)
2+
project(pinetime VERSION 0.10.0 LANGUAGES C CXX ASM)
33

44
set(NRF_TARGET "nrf52")
55

@@ -65,7 +65,7 @@ endif()
6565

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

7070

7171
add_subdirectory(src)

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11

22
# PineTime
3+
4+
![Build PineTime Firmware](https://github.com/JF002/Pinetime/workflows/Build%20PineTime%20Firmware/badge.svg?branch=master)
5+
36
> The PineTime is a free and open source smartwatch capable of running custom-built open operating systems. Some of the notable features include a heart rate monitor, a week-long battery as well as a capacitive touch IPS display that is legible in direct sunlight. It is a fully community driven side-project, which means that it will ultimately be up to the developers and end-users to determine when they deem the PineTime ready to ship.
47
58
> We envision the PineTime as a companion for not only your PinePhone but also for your favorite devices — any phone, tablet, or even PC.
@@ -44,6 +47,9 @@ As of now, here is the list of achievements of this project:
4447

4548
## Documentation
4649

50+
### Getting started
51+
- [Flash, upgrade (OTA), time synchronization,...](doc/gettingStarted/gettingStarted.md)
52+
4753
### Develop
4854
- [Generate the fonts and symbols](src/displayapp/fonts/Readme.md)
4955

@@ -69,9 +75,9 @@ As of now, here is the list of achievements of this project:
6975
- [Memory analysis](./doc/MemoryAnalysis.md)
7076

7177
### Using the firmware
72-
- [Integration with Gadgetbridge](doc/CompanionApps/Gadgetbridge.md)
73-
- [Integration with AmazFish](doc/CompanionApps/Amazfish.md)
74-
- [Firmware update, OTA](doc/CompanionApps/NrfconnectOTA.md)
78+
- [Integration with Gadgetbridge](doc/companionapps/Gadgetbridge.md)
79+
- [Integration with AmazFish](doc/companionapps/Amazfish.md)
80+
- [Firmware update, OTA](doc/companionapps/NrfconnectOTA.md)
7581

7682

7783
## TODO - contribute

bootloader/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ The [bootloader](https://github.com/lupyuen/pinetime-rust-mynewt/tree/master/lib
33

44
The goal of this project is to provide a common bootloader for multiple (all?) Pinetime projects. It allows to upgrade the current bootloader and even replace the current application by another one that supports the same bootloader.
55

6-
As we wanted this bootloader to be as universal as possible, we decided that it should **not** integrate a BLE stack and provide OTA capabilities.
6+
As we wanted this bootloader to be as universal as possible, we decided that it should **not** integrate a BLE stack and provide OTA capabilities.
77

88
Integrating a BLE stack for the OTA functionality would have used to much memory space and/or forced all the firmware developers to use the same BLE stack as the bootloader.
99

@@ -18,7 +18,7 @@ MCUBoot is run at boot time. In normal operation, it just jumps to the reset han
1818

1919
But MCUBoot does much more than that : it can upgrade the firmware that is currently running by a new one, and it is also able to revert to the previous version of the firmware in case the new one does not run propertly.
2020

21-
To do this, it uses 2 memory 'slots' :
21+
To do this, it uses 2 memory 'slots' :
2222
- **The primary slot** : it contains the current firmware, the one that will be executed by MCUBoot
2323
- **The secondary slot** : it is used to store the upgraded version of the firmware, when available.
2424

@@ -37,13 +37,13 @@ Note than MCUBoot **does not** provide any means to download and store the new v
3737
# Degraded cases
3838
This chapter describes degraded cases that are handled by our bootloader and those that are not supported.
3939

40-
Case | Current bootloader | Solution
40+
Case | Current bootloader | Solution
4141
-----|--------------------|----------------------------------------------
42-
Data got corrupted during file transfert | [OK] Application firmware does a CRC check before applying the update, and does not proceed if it fails. | N/A
43-
New firmware does not run at all (bad file) (1) | [NOK] MCU executes unknown instructions and will most likely end up in an infinite loop or freeze in an error handler. The bootloader does not run, it can do nothing, the MCU is stucked until next reset | [OK] The bootloader starts the watchdog just before running the new firmware. This way, the watchdog will reset the MCU after ~7s because the firmware does not refresh it. Bootloader reverts to the previous version of the firmware during the reset.
42+
Data got corrupted during file transfer | [OK] Application firmware does a CRC check before applying the update, and does not proceed if it fails. | N/A
43+
New firmware does not run at all (bad file) (1) | [NOK] MCU executes unknown instructions and will most likely end up in an infinite loop or freeze in an error handler. The bootloader does not run, it can do nothing, the MCU is stucked until next reset | [OK] The bootloader starts the watchdog just before running the new firmware. This way, the watchdog will reset the MCU after ~7s because the firmware does not refresh it. Bootloader reverts to the previous version of the firmware during the reset.
4444
New firmware runs, does not set the valid bit and does not refresh the watchdog | [NOK] The new firmware runs until the next reset. The bootloader will be able to revert to the previous firmware only during the next reset. If the new firmware does not run properly and does not reset, the bootloader can do nothing until the next reset | [OK] The bootloader starts the watchdog just before running the new firmware. This way, the watchdog will reset the MCU after ~7s because the firmware does not refresh it. Bootloader reverts to the previous version of the firmware during the reset.
4545
New firmware does not run properly, does not set the valid bit but refreshes the watchdog | [NOK] The bootloader will be able to revert to the previous firmware only during the next reset. If the new firmware does not run properly and does not reset, the bootloader can do nothing until the next reset | [~] Wait for the battery to drain. The CPU will reset the next time the device is charged and will be able to rollback to the previous version.
46-
New firmware does not run properly but sets the valid bit and refreshes the watchdog | [NOK] The bootloader won't revert to the previous version because the valid flag is set | [~] Wait for the battery to drain. The CPU will reset the next time the device is charged. Then, the bootloader must provide a way for the user to force the rollback to the previous version
46+
New firmware does not run properly but sets the valid bit and refreshes the watchdog | [NOK] The bootloader won't revert to the previous version because the valid flag is set | [~] Wait for the battery to drain. The CPU will reset the next time the device is charged. Then, the bootloader must provide a way for the user to force the rollback to the previous version
4747

4848
*(1) I've observed this when I tried to run a firmware built to run from offset 0 while it was flashed at offset 0x8000 in memory (bad vector table).*
4949

@@ -59,7 +59,7 @@ The SPI Flash memory is not accessible via the SWD debugger. Use the firmware 'p
5959
$ make pinetime-graphics
6060
```
6161

62-
- Program (using OpenOCD for example) :
62+
- Program (using OpenOCD for example) :
6363
```
6464
program pinetime-graphics.bin 0
6565
```
@@ -84,7 +84,7 @@ Build the binary compatible with the booloader:
8484
make pinetime-mcuboot-app
8585
`
8686

87-
The binary is located in *<build directory>/src/pinetime-mcuboot-app.bin*.
87+
The binary is located in *<build directory>/src/pinetime-mcuboot-app.bin*.
8888

8989
It must me converted into a MCUBoot image using *imgtool.py* from [MCUBoot](https://github.com/JuulLabs-OSS/mcuboot/tree/master/scripts). Simply checkout the project and run the script <mcuboot root>/scripts/imgtool.py with the following command line:
9090

doc/buildWithDocker.md

Lines changed: 56 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,73 @@
11
# Build the project using Docker
2-
A [Docker image (Dockerfile)](../docker) containing all the build environment is available for X86_64 and AMD64 architectures. This image makes the build of the firmware and the generation of the DFU file for OTA.
32

4-
## Build the image
5-
The image is not (yet) available on DockerHub, you need to build it yourself, which is quite easy. The following commands must be run from the root of the project.
3+
A [Docker image (Dockerfile)](../docker) containing all the build environment is available for X86_64 and AMD64 architectures. These images make the build of the firmware and the generation of the DFU file for OTA quite easy, as well as preventing clashes with any other toolchains or development environments you may have installed.
4+
5+
Based on Ubuntu 18.04 with the following build dependencies:
6+
7+
* ARM GCC Toolchain
8+
* nRF SDK
9+
* MCUBoot
10+
* adafruit-nrfutil
11+
12+
## Run a container to build the project
13+
14+
The `infinitime-build` image contains all the dependencies you need. The default `CMD` will compile sources found in `/sources`, so you need only mount your code.
15+
16+
This example will build the firmware, generate the MCUBoot image and generate the DFU file. Outputs will be written to **<project_root>/build/output**:
617

7-
If you are running on a x86_64 computer :
18+
```bash
19+
cd <project_root> # e.g. cd ./work/Pinetime
20+
docker run --rm -it -v $(pwd):/sources infinitime-build
821
```
9-
docker image build -t infinitime-build --build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g) docker/x86_64/
22+
23+
If you only want to build a single CMake target, you can pass it in as the first parameter to the build script. This means calling the script explicitly as it will override the `CMD`. Here's an example For `pinetime-app`:
24+
25+
```bash
26+
docker run --rm -it -v $(pwd):/sources infinitime-build /opt/build.sh pinetime-app
1027
```
1128

12-
And if your are running on an ARM64 device (tested on RaspberryPi4 and Pine64 PineBookPro):
29+
The image is built using 1000:1000 for the user id and group id. If this is different to your user or group ids (run `id -u` and `id -g` to find out what your id values are if you are unsure), you will need to override them via the `--user` parameter in order to prevent permission errors with the output files (and the cmake build cache).
30+
31+
Running with this image is the same as above, you just specify the ids to `docker run`
32+
33+
```bash
34+
docker run --rm -it -v $(pwd):/sources --user $(id -u):$(id -g) pfeerick/infinitime-build
1335
```
14-
docker image build -t infinitime-build --build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g) docker/arm64/
36+
37+
Or you can specify your user id and group id (by number, not by name) directly:
38+
39+
```bash
40+
docker run --rm -it -v $(pwd):/sources --user 1234:1234 infinitime-build
1541
```
1642

17-
This operation will take some time. It builds a Docker image based on Ubuntu, install some packages, download the ARM toolchain, the NRF SDK, MCUBoot and adafruit-nrfutil.
43+
## Using the image from Docker Hub
1844

19-
When this is done, a new image named *infinitime-build* is available.
45+
The image is avaiable via Docker Hub for both the amd64 and arm64v8 architectures at [pfeerick/infinitime-build](https://hub.docker.com/repository/docker/pfeerick/infinitime-build).
2046

21-
## Run a container to build the project:
47+
It can be pulled (downloaded) using the following command:
2248

23-
```
24-
docker run --rm -v <project_root>:/sources infinitime-build
49+
```bash
50+
docker pull pfeerick/infinitime-build
2551
```
2652

27-
Replace *<project_root>* by the path of the root of the project on your computer. For example:
53+
The default `latest` tag *should* automatically identify the correct image architecture, but if for some reason Docker does not, you can specify it manually:
2854

29-
```
30-
docker run --rm -v /home/jf/git/PineTime:/sources infinitime-build
55+
* For AMD64 (x86_64) systems: `docker pull pfeerick/infinitime-build:amd64`
56+
57+
* For ARM64v8 (ARM64/aarch64) systems: `docker pull pfeerick/infinitime-build:arm64v8`
58+
59+
## Build the image
60+
61+
You can build the image yourself if you like!
62+
63+
The following commands must be run from the root of the project. This operation will take some time but, when done, a new image named *infinitime-build* is available.
64+
65+
```bash
66+
docker image build -t infinitime-build ./docker
3167
```
3268

33-
This will start a container, build the firmware and generate the MCUBoot image and the DFU file. The output of the build is stored in **<project_root>/built/output**.
69+
The `PUID` and `PGID` build arguments are used to set the user and group ids used in the container, meaning you will not need to specify it later unless they change for some reason. Specifying them is not mandatory, as this can be over-ridden at build time via the `--user` flag, but doing so will make the command you need to run later a bit shorter. In the below examples, they are set to your current user id and group id automatically. You can specify them manually, but they must be specified by number, not by name.
70+
71+
```bash
72+
docker image build -t infinitime-build --build-arg PUID=$(id -u) --build-arg PGID=$(id -g) ./docker
73+
```

doc/gettingStarted/dfuFile.png

17.6 KB
Loading
37 KB
Loading
42.4 KB
Loading
29 KB
Loading

0 commit comments

Comments
 (0)