Skip to content

Commit f160714

Browse files
authored
Merge branch 'main' into numeral-watch-face
2 parents 8762961 + 0fabfe9 commit f160714

File tree

109 files changed

+2204
-594
lines changed

Some content is hidden

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

109 files changed

+2204
-594
lines changed

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@
1414
*.bin binary
1515
*.jpg binary
1616
*.jpeg binary
17+
18+
# Declare (Unix-style) files that will always have LF line endings on checkout.
19+
*.sh text eol=lf

.github/workflows/main.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@ jobs:
3939
apt-get -y install --no-install-recommends python3-pil
4040
- name: Build
4141
shell: bash
42-
run: /opt/build.sh all
42+
run: |
43+
git config --global --add safe.directory /__w/InfiniTime/InfiniTime
44+
/opt/build.sh all
4345
- name: Output build size
4446
id: output-sizes
47+
shell: bash
4548
run: |
4649
. /opt/build.sh
4750
.github/workflows/getSize.sh "$BUILD_DIR"/src/pinetime-app-*.out >> $GITHUB_OUTPUT
@@ -159,6 +162,7 @@ jobs:
159162

160163
- name: Output build size
161164
id: output-sizes
165+
shell: bash
162166
run: |
163167
. /opt/build.sh
164168
.github/workflows/getSize.sh "$BUILD_DIR"/src/pinetime-app-*.out >> $GITHUB_OUTPUT

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,8 @@ src/arm-none-eabi
5050

5151
# clangd
5252
.cache/
53+
54+
# npm files
55+
node_modules
56+
package.json
57+
package-lock.json

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
cmake_minimum_required(VERSION 3.10)
22

33
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose Debug or Release")
4+
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
45

5-
project(pinetime VERSION 1.15.0 LANGUAGES C CXX ASM)
6+
project(pinetime VERSION 1.16.0 LANGUAGES C CXX ASM)
67

78
set(CMAKE_C_STANDARD 99)
89
set(CMAKE_CXX_STANDARD 20)

doc/SimpleWeatherService.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,25 @@ The host uses this characteristic to update the current weather information and
1717

1818
This characteristics accepts a byte array with the following 2-Bytes header:
1919

20-
- [0] Message Type :
20+
- [0] Message Type :
2121
- `0` : Current weather
2222
- `1` : Forecast
23-
- [1] Message Version : Version `0` is currently supported. Other versions might be added in future releases
23+
- [1] Message Version :
24+
- `0` : Currently supported
25+
- `1` : Adds support for sunrise and sunset
2426

25-
### Current Weather
27+
### Current Weather
2628

2729
The byte array must contain the following data:
2830

2931
- [0] : Message type = `0`
30-
- [1] : Message version = `0`
32+
- [1] : Message version = `1`
3133
- [2][3][4][5][6][7][8][9] : Timestamp (64 bits UNIX timestamp, number of seconds elapsed since 1 JAN 1970) in local time (the same timezone as the one used to set the time)
3234
- [10, 11] : Current temperature (°C * 100)
3335
- [12, 13] : Minimum temperature (°C * 100)
3436
- [14, 15] : Maximum temperature (°C * 100)
3537
- [16]..[47] : location (string, unused characters should be set to `0`)
36-
- [48] : icon ID
38+
- [48] : icon ID
3739
- 0 = Sun, clear sky
3840
- 1 = Few clouds
3941
- 2 = Clouds
@@ -43,6 +45,13 @@ The byte array must contain the following data:
4345
- 6 = Thunderstorm
4446
- 7 = Snow
4547
- 8 = Mist, smog
48+
- [49, 50] : Sunrise (number of minutes elapsed since midnight)
49+
- `0` sun already up when day starts
50+
- `-1` unknown
51+
- `-2` no sunrise (e.g. polar night)
52+
- [51, 52] : Sunset (number of minutes elapsed since midnight)
53+
- `-1` unknown
54+
- `-2` no sunset (e.g. polar day)
4655

4756
### Forecast
4857

doc/buildAndProgram.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
To build this project, you'll need:
66

77
- A cross-compiler : [ARM-GCC (10.3-2021.10)](https://developer.arm.com/downloads/-/gnu-rm)
8-
- The NRF52 SDK 15.3.0 : [nRF-SDK v15.3.0](https://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v15.x.x/nRF5_SDK_15.3.0_59ac345.zip)
8+
- The NRF52 SDK 15.3.0 : [nRF-SDK v15.3.0](https://nsscprodmedia.blob.core.windows.net/prod/software-and-other-downloads/sdks/nrf5/binaries/nrf5sdk153059ac345.zip)
99
- The Python 3 modules `cbor`, `intelhex`, `click` and `cryptography` modules for the `mcuboot` tool (see [requirements.txt](../tools/mcuboot/requirements.txt))
1010
- To keep the system clean, you can install python modules into a python virtual environment (`venv`)
1111
```sh

doc/buildWithDocker.md

Lines changed: 43 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,46 +15,37 @@ Based on Ubuntu 22.04 with the following build dependencies:
1515

1616
Before building, local repository must be fully initialized.
1717

18-
```
18+
```sh
1919
git clone https://github.com/InfiniTimeOrg/InfiniTime.git
2020
cd InfiniTime
2121
git submodule update --init
2222
```
2323

24-
## Run a container to build the project
25-
26-
The `infinitime-build` image contains all the dependencies you need.
27-
The default `CMD` will compile sources found in `/sources`, so you need only mount your code.
24+
## Provision the image
2825

29-
Before continuing, make sure you first build the image as indicated in the [Build the image](#build-the-image) section, or check the [Using the image from Docker Hub](#using-the-image-from-docker-hub) section if you prefer to use a pre-made image.
26+
Before continuing, the build image needs to be either build locally or pulled
27+
from Docker Hub, as described in the two sections below:
3028

31-
This example will build the firmware, generate the MCUBoot image and generate the DFU file.
32-
For cloning the repo, see [these instructions](../doc/buildAndProgram.md#clone-the-repo). Outputs will be written to **<project_root>/build/output**:
33-
34-
```bash
35-
cd <project_root> # e.g. cd ./work/Pinetime
36-
docker run --rm -it -v ${PWD}:/sources --user $(id -u):$(id -g) infinitime-build
37-
```
29+
### Build the image
3830

39-
By default, the container runs as `root`, which is not convenient as all the files generated by the build will also belong to `root`.
40-
The parameter `--user` overrides that default behavior.
41-
The command above will run as your current user.
31+
You can build the image yourself if you like!
4232

43-
If you only want to build a single CMake target, you can pass it in as the first parameter to the build script.
44-
This means calling the script explicitly as it will override the `CMD`.
45-
Here's an example for `pinetime-app`:
33+
The following commands must be run from the root of the project. This operation
34+
will take some time but, when done, a new image named `infinitime-build` is
35+
available.
4636

47-
```bash
48-
docker run --rm -it -v ${PWD}:/sources --user $(id -u):$(id -g) infinitime-build /opt/build.sh pinetime-app
37+
```sh
38+
docker build -t infinitime-build ./docker
4939
```
5040

51-
## Using the image from Docker Hub
41+
### Pull the image from Docker Hub
5242

53-
The image is available via Docker Hub for both the amd64 and arm64v8 architectures at [infinitime/infinitime-build](https://hub.docker.com/repository/docker/infinitime/infinitime-build).
43+
The image is available via Docker Hub for both the amd64 and arm64v8 architectures at
44+
[infinitime/infinitime-build](https://hub.docker.com/repository/docker/infinitime/infinitime-build).
5445

5546
You can run it using the following command:
5647

57-
```bash
48+
```sh
5849
docker run --rm -it -v ${PWD}:/sources --user $(id -u):$(id -g) infinitime/infinitime-build
5950
```
6051

@@ -64,12 +55,35 @@ The default `latest` tag *should* automatically identify the correct image archi
6455

6556
- For ARM64v8 (ARM64/aarch64) systems: `docker pull --platform linux/arm64 infinitime/infinitime-build`
6657

67-
## Build the image
58+
## Run a container to build the project
6859

69-
You can build the image yourself if you like!
60+
The `infinitime-build` image contains all the dependencies you need.
61+
The default `CMD` will compile sources found in `/sources`, so you need only mount your code.
7062

71-
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.
63+
This example will build the firmware, generate the MCUBoot image and generate the DFU file.
64+
Outputs will be written to **<project_root>/build/output**:
7265

73-
```bash
74-
docker build -t infinitime-build ./docker
66+
```sh
67+
cd <project_root> # e.g. cd ./work/Pinetime
68+
docker run --rm -it -v ${PWD}:/sources infinitime-build
69+
```
70+
71+
If the docker service is running as `root`, the build process inside the
72+
container also runs as `root`, which is not convenient as all the files
73+
generated by the build will also belong to `root`. The parameter `--user`
74+
overrides this behaviour. The command below ensures that all files are created
75+
as your current user:
76+
77+
78+
```sh
79+
cd <project_root> # e.g. cd ./work/Pinetime
80+
docker run --rm -it -v ${PWD}:/sources --user $(id -u):$(id -g) infinitime-build
81+
```
82+
83+
If you only want to build a single CMake target, you can pass it in as the first parameter to the build script.
84+
This means calling the script explicitly as it will override the `CMD`.
85+
Here's an example for `pinetime-app`:
86+
87+
```sh
88+
docker run --rm -it -v ${PWD}:/sources --user $(id -u):$(id -g) infinitime-build /opt/build.sh pinetime-app
7589
```

docker/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ RUN apt-get update -qq \
3333
libpixman-1-dev \
3434
libcairo2-dev \
3535
libpango-1.0-0 \
36-
ibpango1.0-dev \
36+
libpango1.0-dev \
3737
libpangocairo-1.0-0 \
3838
&& rm -rf /var/cache/apt/* /var/lib/apt/lists/*;
3939

@@ -68,5 +68,5 @@ RUN adduser infinitime
6868
# Configure Git to accept the /sources directory as safe
6969
RUN git config --global --add safe.directory /sources
7070

71-
ENV SOURCES_DIR /sources
71+
ENV SOURCES_DIR=/sources
7272
CMD ["/opt/build.sh"]

docker/build.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ export npm_config_cache="${NPM_DIR}"
1818
export BUILD_TYPE=${BUILD_TYPE:=Release}
1919
export GCC_ARM_VER=${GCC_ARM_VER:="10.3-2021.10"}
2020
export NRF_SDK_VER=${NRF_SDK_VER:="nRF5_SDK_15.3.0_59ac345"}
21+
# convert to lower case and remove _ and . character
22+
# the download URL uses the SLUG, but the extracted folder is named like the original value
23+
NRF_SDK_VER_SLUG=${NRF_SDK_VER,,}
24+
export NRF_SDK_VER_SLUG=${NRF_SDK_VER_SLUG//[_.]/}
2125

2226
MACHINE="$(uname -m)"
2327
[ "$MACHINE" = "arm64" ] && MACHINE="aarch64"
@@ -47,17 +51,29 @@ main() {
4751

4852
GetGcc() {
4953
wget -q https://developer.arm.com/-/media/Files/downloads/gnu-rm/$GCC_ARM_VER/$GCC_ARM_PATH-$MACHINE-linux.tar.bz2 -O - | tar -xj -C $TOOLS_DIR/
54+
if [ ! -d "$TOOLS_DIR/$GCC_ARM_PATH" ]; then
55+
echo "missing GCC path: $TOOLS_DIR/$GCC_ARM_PATH"
56+
return 1
57+
fi
5058
}
5159

5260
GetMcuBoot() {
5361
git clone https://github.com/mcu-tools/mcuboot.git "$TOOLS_DIR/mcuboot"
5462
pip3 install -r "$TOOLS_DIR/mcuboot/scripts/requirements.txt"
63+
if [ ! -d "$TOOLS_DIR/mcuboot" ]; then
64+
echo "missing mcuboot path: $TOOLS_DIR/mcuboot"
65+
return 1
66+
fi
5567
}
5668

5769
GetNrfSdk() {
58-
wget -q "https://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v15.x.x/$NRF_SDK_VER.zip" -O /tmp/$NRF_SDK_VER
70+
wget -q "https://nsscprodmedia.blob.core.windows.net/prod/software-and-other-downloads/sdks/nrf5/binaries/$NRF_SDK_VER_SLUG.zip" -O /tmp/$NRF_SDK_VER
5971
unzip -q /tmp/$NRF_SDK_VER -d "$TOOLS_DIR/"
6072
rm /tmp/$NRF_SDK_VER
73+
if [ ! -d "$TOOLS_DIR/$NRF_SDK_VER" ]; then
74+
echo "missing NRF_SDK path: $TOOLS_DIR/$NRF_SDK_VER"
75+
return 1
76+
fi
6177
}
6278

6379
CmakeGenerate() {

gcc_nrf52-mcuboot.ld

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
*/
1919

2020
SEARCH_DIR(.)
21-
GROUP(-lgcc -lc -lnosys)
2221

2322
MCUBOOT_SIZE = 0x8000;
2423
SCRATCH_SIZE = 0x1000;

0 commit comments

Comments
 (0)