Skip to content

Commit c2b6a8d

Browse files
authored
Fix markdown format with autoformatter (InfiniTimeOrg#1284)
1 parent c495db8 commit c2b6a8d

30 files changed

+523
-412
lines changed

.devcontainer/README.md

+10-15
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# VS Code Dev Container
2-
This is a docker-based interactive development environment using VS Code and Docker Dev Containers removing the need to install any tools locally*
3-
42

3+
This is a docker-based interactive development environment using VS Code and Docker Dev Containers removing the need to install any tools locally\*
54

65
## Requirements
76

@@ -16,45 +15,41 @@ This is a docker-based interactive development environment using VS Code and Doc
1615

1716
1. Clone InfiniTime and update submodules
1817
2. Launch VS Code
19-
3. Open InfiniTime directory,
20-
4. Allow VS Code to open folder with devcontainer.
18+
3. Open InfiniTime directory,
19+
4. Allow VS Code to open folder with devcontainer.
2120

22-
After this the environment will be built if you do not currently have a container setup, it will install all the necessary tools and extra VSCode extensions.
21+
After this the environment will be built if you do not currently have a container setup, it will install all the necessary tools and extra VSCode extensions.
2322

2423
In order to build InfiniTime we need to run the initial submodule init and CMake commands.
2524

26-
#### Manually
25+
#### Manually
2726

28-
You can use the VS Code terminal to run the CMake commands as outlined in the [build instructions](blob/develop/doc/buildAndProgram.md)
27+
You can use the VS Code terminal to run the CMake commands as outlined in the [build instructions](blob/develop/doc/buildAndProgram.md)
2928

3029
#### Script
3130

3231
The dev environment comes with some scripts to make this easier, They are located in /opt/.
3332

34-
There are also VS Code tasks provided should you desire to use those.
33+
There are also VS Code tasks provided should you desire to use those.
3534

3635
The task "update submodules" will update the git submodules
3736

38-
39-
4037
### Build
4138

4239
You can use the build.sh script located in /opt/
4340

4441
CMake is also configured and controls for the CMake plugin are available in VS Code
4542

46-
47-
4843
### Debugging
4944

5045
Docker on windows does not support passing USB devices to the underlying WSL2 subsystem, To get around this we use OpenOCD in server mode running on the host.
5146

5247
`openocd -f <yourinterface> -f <nrf52.cfg target file>`
5348

54-
This will launch OpenOCD in server mode and attach it to the MCU.
49+
This will launch OpenOCD in server mode and attach it to the MCU.
5550

5651
The default launch.json file expects OpenOCD to be listening on port 3333, edit if needed
5752

58-
5953
## Current Issues
60-
Currently WSL2 Has some real performance issues with IO on a windows host. Accessing files on the virtualized filesystem is much faster. Using VS Codes "clone in container" feature of the Remote - Containers will get around this. After the container is built you will need to update the submodules and follow the build instructions like normal
54+
55+
Currently WSL2 Has some real performance issues with IO on a windows host. Accessing files on the virtualized filesystem is much faster. Using VS Codes "clone in container" feature of the Remote - Containers will get around this. After the container is built you will need to update the submodules and follow the build instructions like normal

README.md

+38-37
Original file line numberDiff line numberDiff line change
@@ -8,71 +8,72 @@ Fast open-source firmware for the [PineTime smartwatch](https://www.pine64.org/p
88

99
## New to InfiniTime?
1010

11-
- [Getting started with InfiniTime](doc/gettingStarted/gettingStarted-1.0.md)
12-
- [Updating the software](doc/gettingStarted/updating-software.md)
13-
- [About the firmware and bootloader](doc/gettingStarted/about-software.md)
11+
- [Getting started with InfiniTime](doc/gettingStarted/gettingStarted-1.0.md)
12+
- [Updating the software](doc/gettingStarted/updating-software.md)
13+
- [About the firmware and bootloader](doc/gettingStarted/about-software.md)
1414

1515
### Companion apps
1616

17-
- [Gadgetbridge](https://gadgetbridge.org/) (Android)
18-
- [AmazFish](https://openrepos.net/content/piggz/amazfish/) (SailfishOS)
19-
- [Siglo](https://github.com/alexr4535/siglo) (Linux)
20-
- [InfiniLink](https://github.com/InfiniTimeOrg/InfiniLink) (iOS) **[Looking for a new maintainer]**
21-
- [ITD](https://gitea.arsenm.dev/Arsen6331/itd) (Linux)
17+
- [Gadgetbridge](https://gadgetbridge.org/) (Android)
18+
- [AmazFish](https://openrepos.net/content/piggz/amazfish/) (SailfishOS)
19+
- [Siglo](https://github.com/alexr4535/siglo) (Linux)
20+
- [InfiniLink](https://github.com/InfiniTimeOrg/InfiniLink) (iOS) **[Looking for a new maintainer]**
21+
- [ITD](https://gitea.arsenm.dev/Arsen6331/itd) (Linux)
2222

2323
## Development
2424

25-
- [InfiniTime Vision](doc/InfiniTimeVision.md)
26-
- [Rough structure of the code](doc/code/Intro.md)
27-
- [How to implement an application](doc/code/Apps.md)
28-
- [Generate the fonts and symbols](src/displayapp/fonts/README.md)
29-
- [Tips on designing an app UI](doc/ui_guidelines.md)
30-
- [Bootloader, OTA and DFU](bootloader/README.md)
31-
- [Versioning](doc/versioning.md)
32-
- [Project branches](doc/branches.md)
33-
- [Files included in the release notes](doc/filesInReleaseNotes.md)
25+
- [InfiniTime Vision](doc/InfiniTimeVision.md)
26+
- [Rough structure of the code](doc/code/Intro.md)
27+
- [How to implement an application](doc/code/Apps.md)
28+
- [Generate the fonts and symbols](src/displayapp/fonts/README.md)
29+
- [Tips on designing an app UI](doc/ui_guidelines.md)
30+
- [Bootloader, OTA and DFU](bootloader/README.md)
31+
- [Versioning](doc/versioning.md)
32+
- [Project branches](doc/branches.md)
33+
- [Files included in the release notes](doc/filesInReleaseNotes.md)
3434

3535
### Contributing
3636

37-
- [How to contribute?](doc/contribute.md)
38-
- [Coding conventions](doc/coding-convention.md)
37+
- [How to contribute?](doc/contribute.md)
38+
- [Coding conventions](doc/coding-convention.md)
3939

4040
### Build, flash and debug
4141

42-
- [InfiniTime simulator](https://github.com/InfiniTimeOrg/InfiniSim)
43-
- [Build the project](doc/buildAndProgram.md)
44-
- [Build the project with Docker](doc/buildWithDocker.md)
45-
- [Build the project with VSCode](doc/buildWithVScode.md)
46-
- [Flash the firmware using OpenOCD and STLinkV2](doc/openOCD.md)
47-
- [Flash the firmware using SWD interface](doc/SWD.md)
48-
- [Flash the firmware using JLink](doc/jlink.md)
49-
- [Flash the firmware using GDB](doc/gdb.md)
50-
- [Stub using NRF52-DK](doc/PinetimeStubWithNrf52DK.md)
42+
- [InfiniTime simulator](https://github.com/InfiniTimeOrg/InfiniSim)
43+
- [Build the project](doc/buildAndProgram.md)
44+
- [Build the project with Docker](doc/buildWithDocker.md)
45+
- [Build the project with VSCode](doc/buildWithVScode.md)
46+
- [Flash the firmware using OpenOCD and STLinkV2](doc/openOCD.md)
47+
- [Flash the firmware using SWD interface](doc/SWD.md)
48+
- [Flash the firmware using JLink](doc/jlink.md)
49+
- [Flash the firmware using GDB](doc/gdb.md)
50+
- [Stub using NRF52-DK](doc/PinetimeStubWithNrf52DK.md)
5151

5252
### API
5353

54-
- [BLE implementation and API](doc/ble.md)
54+
- [BLE implementation and API](doc/ble.md)
5555

5656
### Architecture and technical topics
5757

58-
- [Memory analysis](doc/MemoryAnalysis.md)
58+
- [Memory analysis](doc/MemoryAnalysis.md)
5959

6060
## Licenses
6161

6262
This project is released under the GNU General Public License version 3 or, at your option, any later version.
6363

6464
It integrates the following projects:
65-
- RTOS : **[FreeRTOS](https://freertos.org)** under the MIT license
66-
- UI : **[LittleVGL/LVGL](https://lvgl.io/)** under the MIT license
67-
- BLE stack : **[NimBLE](https://github.com/apache/mynewt-nimble)** under the Apache 2.0 license
68-
- Font : **[Jetbrains Mono](https://www.jetbrains.com/fr-fr/lp/mono/)** under the Apache 2.0 license
65+
66+
- RTOS : **[FreeRTOS](https://freertos.org)** under the MIT license
67+
- UI : **[LittleVGL/LVGL](https://lvgl.io/)** under the MIT license
68+
- BLE stack : **[NimBLE](https://github.com/apache/mynewt-nimble)** under the Apache 2.0 license
69+
- Font : **[Jetbrains Mono](https://www.jetbrains.com/fr-fr/lp/mono/)** under the Apache 2.0 license
6970

7071
## Credits
7172

7273
I’m not working alone on this project. First, many people create PR for this projects. Then, there is the whole #pinetime community : a lot of people all around the world who are hacking, searching, experimenting and programming the Pinetime. We exchange our ideas, experiments and code in the chat rooms and forums.
7374

7475
Here are some people I would like to highlight:
7576

76-
- [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.
77-
- [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!
78-
- [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!
77+
- [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.
78+
- [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!
79+
- [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!

bootloader/README.md

+28-23
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# About this bootloader
2+
23
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/).
34

45
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.
@@ -12,15 +13,17 @@ When it is run, this bootloader looks in the SPI flash memory if a new firmware
1213
As this bootloader does not provide any OTA capability, it is not able to actually download a new version of the application. Providing OTA functionality is thus the responsibility of the application firmware.
1314

1415
# About MCUBoot
16+
1517
MCUBoot is run at boot time. In normal operation, it just jumps to the reset handler of the application firmware to run it. Once the application firmware is running, MCUBoot does not run at all.
1618

1719
![MCUBoot boot sequence diagram](../doc/bootloader/boot.png "MCUBoot boot sequence diagram")
1820

1921
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 properly.
2022

2123
To do this, it uses 2 memory 'slots' :
22-
- **The primary slot** : it contains the current firmware, the one that will be executed by MCUBoot
23-
- **The secondary slot** : it is used to store the upgraded version of the firmware, when available.
24+
25+
- **The primary slot** : it contains the current firmware, the one that will be executed by MCUBoot
26+
- **The secondary slot** : it is used to store the upgraded version of the firmware, when available.
2427

2528
At boot time, MCUBoot detects that a new version of the firmware is available in the secondary slot and swaps them : the current version of the firmware is copied from the primary to the secondary slot and vice-versa.
2629

@@ -35,6 +38,7 @@ The next time MCUBoot will be run (after a MCU reset), MCUBoot will check if the
3538
Note than MCUBoot **does not** provide any means to download and store the new version of the firmware into the secondary slot. This must be implemented by the application firmware.
3639

3740
# Degraded cases
41+
3842
This chapter describes degraded cases that are handled by our bootloader and those that are not supported.
3943

4044
Case | Current bootloader | Solution
@@ -50,72 +54,73 @@ New firmware does not run properly but sets the valid bit and refreshes the watc
5054
# Using the bootloader
5155

5256
## Bootloader graphic
57+
5358
The bootloader loads a graphic (Pinetime logo) from the SPI Flash memory. If this graphic is not loaded in the memory, the LCD will display garbage (the content of the SPI flash memory).
5459

5560
The SPI Flash memory is not accessible via the SWD debugger. Use the firmware 'pinetime-graphics' to load the graphic into memory. All you have to do is build it and program it at address 0x00 :
5661

57-
- Build:
58-
```
59-
$ make pinetime-graphics
62+
- Build:
63+
64+
```sh
65+
make pinetime-graphics
6066
```
6167

62-
- Program (using OpenOCD for example) :
68+
- Program (using OpenOCD for example) :
69+
6370
```
6471
program pinetime-graphics.bin 0
6572
```
6673

67-
- Let it run for ~10s (it does nothing for 5 seconds, then write the logo into the SPI memory, then (slowly) displays it on the LCD).
74+
- Let it run for ~10s (it does nothing for 5 seconds, then write the logo into the SPI memory, then (slowly) displays it on the LCD).
6875

6976
## Bootloader binary
77+
7078
The binary comes from https://github.com/lupyuen/pinetime-rust-mynewt/releases/tag/v5.0.4
7179

7280
It must be flash at address **0x00** in the internal flash memory.
7381

7482
Using OpenOCD:
7583

76-
`
77-
program bootloader-5.0.4.bin 0
78-
`
84+
`program bootloader-5.0.4.bin 0`
7985

8086
## Application firmware image
87+
8188
Build the binary compatible with the booloader:
8289

83-
`
84-
make pinetime-mcuboot-app
85-
`
90+
`make pinetime-mcuboot-app`
8691

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

8994
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:
9095

91-
`
92-
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
93-
`
96+
```sh
97+
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
98+
```
9499

95100
The image must be then flashed at address **0x8000** in the internal flash memory.
96101

97102
Using OpenOCD:
98103

99-
`
100-
program image.bin 0x8000
101-
`
104+
`program image.bin 0x8000`
102105

103106
## OTA and DFU
107+
104108
Pack the image into a .zip file for the NRF DFU protocol:
105109

106-
`
110+
```sh
107111
adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application image.bin dfu.zip
108-
`
112+
```
109113

110114
Use NRFConnect or dfu.py (in <project root>/bootloader/ota-dfu-python) to upload the zip file to the device:
111115

112-
`
116+
```sh
113117
sudo dfu.py -z /home/jf/nrf52/bootloader/dfu.zip -a <pinetime MAC address> --legacy
114-
`
118+
```
115119

116120
**Note** : dfu.py is a slightly modified version of [this repo](https://github.com/daniel-thompson/ota-dfu-python).
117121

118122
### Firmware validation
123+
119124
Once the OTA is done, InfiniTime will reset the watch to apply the update. When the watch reboots, the new firmware is running.
120125

121126
One last step is needed to finalize the upgrade : the new firmware must be manually validated. If the watch resets while the image is not validated, the bootloader will automatically revert to the previous version of the firmware.

bootloader/ota-dfu-python/README.md

+23-24
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Python nRF5 OTA DFU Controller
22

33
So... this is my fork of dingara's fork of astronomer80's fork of
4-
foldedtoad's Python OTA DFU utility.
4+
foldedtoad's Python OTA DFU utility.
55

6-
My own contribution is little more than a brute force conversion to
7-
python3. It is sparsely tested so there are likely to be a few
6+
My own contribution is little more than a brute force conversion to
7+
python3. It is sparsely tested so there are likely to be a few
88
remaining bytes versus string bugs remaining in the places I didn't test
99
. I used it primarily as part of
10-
[wasp-os](https://github.com/daniel-thompson/wasp-os) as a way to
10+
[wasp-os](https://github.com/daniel-thompson/wasp-os) as a way to
1111
deliver OTA updates to nRF52-based smart watches, especially the
1212
[Pine64 PineTime](https://www.pine64.org/pinetime/).
1313

@@ -17,24 +17,24 @@ This is a Python program that uses `gatttool` (provided with the Linux BlueZ dri
1717

1818
### Main features:
1919

20-
* Perform OTA DFU to an nRF5 peripheral without an external USB BLE dongle.
21-
* Ability to detect if the peripheral is running in application mode or bootloader, and automatically switch if needed (buttonless).
22-
* Support for both Legacy (SDK <= 11) and Secure (SDK >= 12) bootloader.
20+
- Perform OTA DFU to an nRF5 peripheral without an external USB BLE dongle.
21+
- Ability to detect if the peripheral is running in application mode or bootloader, and automatically switch if needed (buttonless).
22+
- Support for both Legacy (SDK <= 11) and Secure (SDK >= 12) bootloader.
2323

2424
Before using this utility the nRF5 peripheral device needs to be programmed with a DFU bootloader (see Nordic Semiconductor documentation/examples for instructions on that).
2525

2626
## Prerequisites
2727

28-
* BlueZ 5.4 or above
29-
* Python 3.6
30-
* Python `pexpect` module (available via pip)
31-
* Python `intelhex` module (available via pip)
28+
- BlueZ 5.4 or above
29+
- Python 3.6
30+
- Python `pexpect` module (available via pip)
31+
- Python `intelhex` module (available via pip)
3232

3333
## Firmware Build Requirement
3434

35-
* Your nRF5 peripheral firmware build method will produce a firmware file ending with either `*.hex` or `*.bin`.
36-
* Your nRF5 firmware build method will produce an Init file ending with `.dat`.
37-
* The typical naming convention is `application.bin` and `application.dat`, but this utility will accept other names.
35+
- Your nRF5 peripheral firmware build method will produce a firmware file ending with either `*.hex` or `*.bin`.
36+
- Your nRF5 firmware build method will produce an Init file ending with `.dat`.
37+
- The typical naming convention is `application.bin` and `application.dat`, but this utility will accept other names.
3838

3939
## Generating init files
4040

@@ -75,14 +75,13 @@ You can use the `hcitool lescan` to figure out the address of a DFU target, for
7575
CD:E3:4A:47:1C:E4 <TARGET_NAME>
7676
CD:E3:4A:47:1C:E4 (unknown)
7777

78-
7978
## Example Output
8079

8180
================================
8281
== ==
8382
== DFU Server ==
8483
== ==
85-
================================
84+
================================
8685

8786
Sending file application.bin to CD:E3:4A:47:1C:E4
8887
bin array size: 60788
@@ -105,14 +104,14 @@ You can use the `hcitool lescan` to figure out the address of a DFU target, for
105104

106105
## TODO:
107106

108-
* Implement link-loss procedure for Legacy Controller.
109-
* Update example output in readme.
110-
* Add makefile examples.
111-
* More code cleanup.
107+
- Implement link-loss procedure for Legacy Controller.
108+
- Update example output in readme.
109+
- Add makefile examples.
110+
- More code cleanup.
112111

113112
## Info & References
114113

115-
* [Nordic Legacy DFU Service](http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v11.0.0/bledfu_transport_bleservice.html?cp=4_0_3_4_3_1_4_1)
116-
* [Nordic Legacy DFU sequence diagrams](http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v11.0.0/bledfu_transport_bleprofile.html?cp=4_0_3_4_3_1_4_0_1_6#ota_profile_pkt_rcpt_notif)
117-
* [Nordic Secure DFU bootloader](http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.2.0/lib_dfu_transport_ble.html?cp=4_0_1_3_5_2_2)
118-
* [nrfutil](https://github.com/NordicSemiconductor/pc-nrfutil)
114+
- [Nordic Legacy DFU Service](http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v11.0.0/bledfu_transport_bleservice.html?cp=4_0_3_4_3_1_4_1)
115+
- [Nordic Legacy DFU sequence diagrams](http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v11.0.0/bledfu_transport_bleprofile.html?cp=4_0_3_4_3_1_4_0_1_6#ota_profile_pkt_rcpt_notif)
116+
- [Nordic Secure DFU bootloader](http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.2.0/lib_dfu_transport_ble.html?cp=4_0_1_3_5_2_2)
117+
- [nrfutil](https://github.com/NordicSemiconductor/pc-nrfutil)

0 commit comments

Comments
 (0)