Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
# Conflicts:
#	doc/buildAndProgram.md
  • Loading branch information
JF002 committed Nov 11, 2021
2 parents f41aaad + a57fda6 commit f6d0ec4
Show file tree
Hide file tree
Showing 86 changed files with 2,079 additions and 441 deletions.
2 changes: 2 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Checks: '*,
-altera-unroll-loops,
-llvmlibc-callee-namespace,
-llvmlibc-restrict-system-libc-headers,
-llvm-header-guard,
-llvm-namespace-comment,
-google-build-using-namespace,
Expand All @@ -9,6 +10,7 @@ Checks: '*,
-fuchsia-statically-constructed-objects,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-pro-bounds-constant-array-index,
-cppcoreguidelines-pro-type-static-cast-downcast,
-cppcoreguidelines-pro-type-union-access,
-cppcoreguidelines-pro-type-cstyle-cast,
-cppcoreguidelines-pro-type-vararg,
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ RUN unzip -q /tmp/nRF5_SDK_15.3.0_59ac345 -d /opt
RUN rm /tmp/nRF5_SDK_15.3.0_59ac345
# McuBoot
# RUN bash -c "source /opt/build.sh; GetMcuBoot;"
RUN git clone https://github.com/JuulLabs-OSS/mcuboot.git
RUN git clone https://github.com/mcu-tools/mcuboot.git
RUN pip3 install -r ./mcuboot/scripts/requirements.txt

RUN adduser infinitime
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ GetGcc() {
}

GetMcuBoot() {
git clone https://github.com/JuulLabs-OSS/mcuboot.git "$TOOLS_DIR/mcuboot"
git clone https://github.com/mcu-tools/mcuboot.git "$TOOLS_DIR/mcuboot"
pip3 install -r "$TOOLS_DIR/mcuboot/scripts/requirements.txt"
}

Expand Down
58 changes: 58 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Bug Report
description: File a bug report
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
**Thanks for taking the time to fill out this bug report!**
*Please, before opening a bug report, check if similar issues already exist. In that case, use those issues to provide your feedback instead.*
- type: checkboxes
attributes:
options:
- label: I searched for similar bug reports and found none was relevant.
required: true
- type: input
id: desc-brief
attributes:
label: What happened?
description: A one-line description of the bug.
placeholder: "Ex. I woke up as a Kafkian insect this morning."
validations:
required: true
- type: input
id: desc-expected
attributes:
label: What should happen instead?
description: The behaviour you were expecting to see.
placeholder: "Ex. I was expecting to wake up as a human."
- type: textarea
id: desc-steps
attributes:
label: Reproduction steps
description: "How do you trigger this bug? Please walk us through it step by step."
validations:
required: true
- type: textarea
id: desc-long
attributes:
label: More details?
description: Give us more details about the bug and any personal attempts you made to fix it.
placeholder: Tell us more!
- type: input
id: version
attributes:
label: Version
description: |
What [version of the firmware](https://github.com/JF002/InfiniTime/blob/develop/doc/gettingStarted/gettingStarted-1.0.md#how-to-check-the-version-of-infinitime-and-the-bootloader) are you running?
If you are running an older version, please consider [updating to the latest firmware](https://github.com/JF002/InfiniTime/blob/develop/doc/gettingStarted/gettingStarted-1.0.md#how-to-update-your-pinetime).
If you are running directly from git, specify the branch or the commit hash directly.
placeholder: "Ex. v1.6.0 or develop or fc922b60"
validations:
required: true
- type: input
id: companion-app
attributes:
label: Companion app
description: Which companion app are you using (if relevant)?
placeholder: "Ex. Gadgetbridge v0.60.0, Siglo v0.9.4"
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Feature Request
description: File a feature request
labels: ["feature request"]
body:
- type: markdown
attributes:
value: |
**Thanks for taking the time to fill out this feature request!**
*Please, before opening a feature request, check if similar issues already exist. In that case, use those issues to provide your feedback instead.*
- type: checkboxes
attributes:
options:
- label: I searched for similar feature request and found none was relevant.
required: true
- type: markdown
attributes:
value: |
**Note:** keep in mind that, while InfiniTime is usable, it is still under heavy development and as such it is continuously evolving.
Some features you want to see implemented might not be compatible with the current state of the project, or might not even be suitable to include *in the firmware* of the watch.
- type: input
id: desc-brief
attributes:
label: Pitch us your idea!
description: A one-line elevator pitch of the feature you'd like to see implemented.
placeholder: "Ex. My dog wants InfiniTime on its smart collar."
validations:
required: true
- type: textarea
id: desc-long
attributes:
label: Description
description: |
Give us a detailed description of the feature you are proposing. Mockups or a description of the possible use cases are highly appreciated.
Tell us why this should be included in the firmware.
placeholder: "Ex. Here is a drawing of my dog wearing an InfiniTime collar and smiling."
- type: markdown
id: companion-app
attributes:
value: |
If this requires features missing from other software (for example a companion app), please take care of opening any relevant feature request over there as well.
8 changes: 8 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,14 @@ jobs:
name: pinetime-app.out
path: build/src/pinetime-app*.out

#########################################################################################
# Make but don't Upload the Recovery Firmware to be sure it builds correctly

- name: Make pinetime-recovery
run: |
cd build
make pinetime-recovery
#########################################################################################
# Finish

Expand Down
2 changes: 1 addition & 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 1.6.0 LANGUAGES C CXX ASM)
project(pinetime VERSION 1.7.0 LANGUAGES C CXX ASM)

set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 14)
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# InfiniTime

[![Build PineTime Firmware](https://github.com/JF002/InfiniTime/workflows/Build%20PineTime%20Firmware/badge.svg?branch=master)](https://github.com/JF002/InfiniTime/actions)
[![Build PineTime Firmware](https://github.com/InfiniTimeOrg/InfiniTime/workflows/Build%20PineTime%20Firmware/badge.svg?branch=master)](https://github.com/InfiniTimeOrg/InfiniTime/actions)

![InfiniTime logo](images/infinitime-logo.jpg "InfiniTime Logo")

Expand Down Expand Up @@ -65,14 +65,15 @@ As of now, here is the list of achievements of this project:
* [Amazfish](https://openrepos.net/content/piggz/amazfish) (on SailfishOS and Linux)
* [Siglo](https://github.com/alexr4535/siglo) (on Linux)
* **[Experimental]** [WebBLEWatch](https://hubmartin.github.io/WebBLEWatch/) Synchronize time directly from your web browser. [video](https://youtu.be/IakiuhVDdrY)
* **[Experimental]** [Infini-iOS](https://github.com/xan-m/Infini-iOS) (on iOS)
* **[Experimental]** [InfiniLink](https://github.com/xan-m/InfiniLink) (on iOS)
- OTA (Over-the-air) update via BLE
- [Bootloader](https://github.com/JF002/pinetime-mcuboot-bootloader) based on [MCUBoot](https://juullabs-oss.github.io/mcuboot/)
- [Bootloader](https://github.com/JF002/pinetime-mcuboot-bootloader) based on [MCUBoot](https://www.mcuboot.com)

## Documentation

### Develop

- [Rough structure of the code](doc/code/Intro.md)
- [How to implement an application](doc/code/Apps.md)
- [Generate the fonts and symbols](src/displayapp/fonts/README.md)
- [Creating a stopwatch in Pinetime(article)](https://pankajraghav.com/2021/04/03/PINETIME-STOPCLOCK.html)

Expand Down
4 changes: 2 additions & 2 deletions bootloader/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# About this bootloader
The [bootloader](https://github.com/lupyuen/pinetime-rust-mynewt/tree/master/libs/pinetime_boot/src) is mostly developed by [Lup Yuen](https://github.com/lupyuen). It is based on [MCUBoot](https://juullabs-oss.github.io/mcuboot/) and [Mynewt](https://mynewt.apache.org/).
The [bootloader](https://github.com/lupyuen/pinetime-rust-mynewt/tree/master/libs/pinetime_boot/src) is mostly developed by [Lup Yuen](https://github.com/lupyuen). It is based on [MCUBoot](https://www.mcuboot.com) and [Mynewt](https://mynewt.apache.org/).

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.

Expand Down Expand Up @@ -86,7 +86,7 @@ make pinetime-mcuboot-app

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

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:
It must me converted into a MCUBoot image using *imgtool.py* from [MCUBoot](https://github.com/mcu-tools/mcuboot/tree/master/scripts). Simply checkout the project and run the script <mcuboot root>/scripts/imgtool.py with the following command line:

`
imgtool.py create --align 4 --version 1.0.0 --header-size 32 --slot-size 475136 --pad-header <build directory>/src/pinetime-mcuboot-app.bin image.bin
Expand Down
18 changes: 9 additions & 9 deletions doc/MemoryAnalysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The PineTime is equipped with the following memories:

Note that the NRF52832 cannot execute code stored in the external flash : we need to store the whole firmware in the internal flash memory, and use the external one to store graphicals assets, fonts...

This document describes how the RAM and Flash memories are used in InfiniTime and how to analyze and monitor their usage. It was written in the context of [this memory analysis effort](https://github.com/JF002/InfiniTime/issues/313).
This document describes how the RAM and Flash memories are used in InfiniTime and how to analyze and monitor their usage. It was written in the context of [this memory analysis effort](https://github.com/InfiniTimeOrg/InfiniTime/issues/313).

## Code sections
A binary is composed of multiple sections. Most of the time, these sections are : .text, .rodata, .data and .bss but more sections can be defined in the linker script.
Expand Down Expand Up @@ -38,7 +38,7 @@ In this analysis, I used [Linkermapviz](https://github.com/PromyLOPh/linkermapvi

Using this tool, you can easily see the size of each symbol relative to the other one, and check what is using most of the space,...

Also, as Linkermapviz is written in Python, you can easily modify it to adapt it to your firmware, export data in another format,... For example, [I modified it to parse the contents of the MAP file and export it in a CSV file](https://github.com/JF002/InfiniTime/issues/313#issuecomment-842338620). I could later on open this file in LibreOffice Calc and use sort/filter functionality to search for specific symbols in specific files...
Also, as Linkermapviz is written in Python, you can easily modify it to adapt it to your firmware, export data in another format,... For example, [I modified it to parse the contents of the MAP file and export it in a CSV file](https://github.com/InfiniTimeOrg/InfiniTime/issues/313#issuecomment-842338620). I could later on open this file in LibreOffice Calc and use sort/filter functionality to search for specific symbols in specific files...

### Puncover
[Puncover](https://github.com/HBehrens/puncover) is another useful tools that analyses the binary file generated by the compiler (the .out file that contains all debug information). It provides valuable information about the symbols (data and code): name, position, size, max stack of each functions, callers, callees...
Expand Down Expand Up @@ -69,8 +69,8 @@ This way, you can easily check what needs to be optimized : we should find a way
It's always a good idea to check the flash memory space when working on the project : this way, you can easily check that your developments are using a reasonable amount of space.

### Links
- Analysis with linkermapviz : https://github.com/JF002/InfiniTime/issues/313#issuecomment-842338620
- Analysis with Puncover : https://github.com/JF002/InfiniTime/issues/313#issuecomment-847311392
- Analysis with linkermapviz : https://github.com/InfiniTimeOrg/InfiniTime/issues/313#issuecomment-842338620
- Analysis with Puncover : https://github.com/InfiniTimeOrg/InfiniTime/issues/313#issuecomment-847311392

## RAM
RAM memory contains all the data that can be modified at run-time: variables, stack, heap...
Expand All @@ -93,7 +93,7 @@ int main() {
In Infinitime 1.1, the biggest buffers are the buffers allocated for LVGL (14KB) and the one for FreeRTOS (16KB). Nimble also allocated 9KB of RAM.

### Stack
The stack will be used for everything except tasks, which have their own stack allocated by FreeRTOS. The stack is 8192B and is allocated in the [linker script](https://github.com/JF002/InfiniTime/blob/develop/nrf_common.ld#L148).
The stack will be used for everything except tasks, which have their own stack allocated by FreeRTOS. The stack is 8192B and is allocated in the [linker script](https://github.com/InfiniTimeOrg/InfiniTime/blob/develop/nrf_common.ld#L148).
An easy way to monitor its usage is by filling the section with a known pattern at boot time, then use the firmware and dump the memory. You can then check the maximum stack usage by checking the address from the beginning of the stack that were overwritten.

#### Fill the stack section by a known pattern:
Expand Down Expand Up @@ -197,10 +197,10 @@ On the following dump, the maximum stack usage is 520 bytes (0xFFFF - 0xFDF8):
According to my experimentations, we don't use the stack that much, and 8192 bytes is probably way too big for InfiniTime!

#### Links
- https://github.com/JF002/InfiniTime/issues/313#issuecomment-851035070
- https://github.com/InfiniTimeOrg/InfiniTime/issues/313#issuecomment-851035070

### Heap
The heap is declared in the [linker script](https://github.com/JF002/InfiniTime/blob/develop/nrf_common.ld#L136) and its current size is 8192 bytes. The heap is used for dynamic memory allocation(`malloc()`, `new`...).
The heap is declared in the [linker script](https://github.com/InfiniTimeOrg/InfiniTime/blob/develop/nrf_common.ld#L136) and its current size is 8192 bytes. The heap is used for dynamic memory allocation(`malloc()`, `new`...).

Heap monitoring is not easy, but it seems that we can use the following code to know the current usage of the heap:

Expand Down Expand Up @@ -239,7 +239,7 @@ Using this technique, I was able to trace all malloc calls at boot (boot -> digi
- hr task = 304

#### Links
- https://github.com/JF002/InfiniTime/issues/313#issuecomment-851035625
- https://github.com/InfiniTimeOrg/InfiniTime/issues/313#issuecomment-851035625
- https://www.embedded.com/mastering-stack-and-heap-for-system-reliability-part-1-calculating-stack-size/
- https://www.embedded.com/mastering-stack-and-heap-for-system-reliability-part-2-properly-allocating-stacks/
- https://www.embedded.com/mastering-stack-and-heap-for-system-reliability-part-3-avoiding-heap-errors/
Expand All @@ -263,7 +263,7 @@ For example a simple lv_label needs **~140 bytes** of memory.

I tried to monitor this max value while going through all the apps of InfiniTime 1.1 : the max value I've seen is **5660 bytes**. It means that we could probably **reduce the size of the buffer from 14KB to 6 - 10 KB** (we have to take the fragmentation of the memory into account).
### Links
- https://github.com/JF002/InfiniTime/issues/313#issuecomment-850890064
- https://github.com/InfiniTimeOrg/InfiniTime/issues/313#issuecomment-850890064


## FreeRTOS heap and task stack
Expand Down
17 changes: 17 additions & 0 deletions doc/MotionService.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Motion Service
## Introduction
The motion service exposes step count and raw X/Y/Z motion value as READ and NOTIFY characteristics.

## Service
The service UUID is **00020000-78fc-48fe-8e23-433b3a1942d0**

## Characteristics
### Step count (UUID 00020001-78fc-48fe-8e23-433b3a1942d0)
The current number of steps represented as a single `uint32_t` (4 bytes) value.

### Raw motion values (UUID 00020002-78fc-48fe-8e23-433b3a1942d0)
The current raw motion values. This is a 3 `int16_t` array:

- [0] : X
- [1] : Y
- [2] : Z
10 changes: 5 additions & 5 deletions doc/NavigationService.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ manDist (string) - Manouvre Distance, the distance to the upcoming change
progress (uint8) - Percent complete of total route, value 0-100

## Service
The service UUID is c7e60001-78fc-48fe-8e23-433b3a1942d0
The service UUID is 00010000-78fc-48fe-8e23-433b3a1942d0

## Characteristics
## Flags (UUID c7e60002-78fc-48fe-8e23-433b3a1942d0)
## Flags (UUID 00010001-78fc-48fe-8e23-433b3a1942d0)
All included icons are from pure-maps, which provides the actual routing from the client. The icon names ultimately come from the mapbox project "direction-icons", See https://github.com/rinigus/pure-maps/tree/master/qml/icons/navigation See the end of this document for the full lsit of supported icon names.

## Narrative (UUID c7e60003-78fc-48fe-8e23-433b3a1942d0)
## Narrative (UUID 00010002-78fc-48fe-8e23-433b3a1942d0)
This is a client supplied string describing the upcoming instruction such as "At the roundabout take the first exit".

## Man Dist (UUID c7e60004-78fc-48fe-8e23-433b3a1942d0)
## Man Dist (UUID 00010003-78fc-48fe-8e23-433b3a1942d0)
This is a short string describing the distance to the upcoming instruction such as "50 m".

## Progress (UUID c7e60001=5-78fc-48fe-8e23-433b3a1942d0)
## Progress (UUID 00010004-78fc-48fe-8e23-433b3a1942d0)
The percent complete in a uint8. The watch displays this as an overall progress in a progress bar.

## Full icon list
Expand Down
Loading

0 comments on commit f6d0ec4

Please sign in to comment.