Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,10 @@ src/arm-none-eabi
node_modules
package.json
package-lock.json

# Toolchain and External dependencies
sdk-toolchain/

# Developer files
CMakeUserPresets.json
compile_commands.json
23 changes: 23 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"version": 6,
"configurePresets": [
{
"binaryDir": "build/${presetName}",
"name": "Release",
"displayName": "Release build",
"cacheVariables": {
"ARM_NONE_EABI_TOOLCHAIN_PATH": "${fileDir}/sdk-toolchain/gcc-arm-none-eabi-10.3-2021.10",
"NRF5_SDK_PATH": "${fileDir}/sdk-toolchain/nRF5_SDK_15.3.0_59ac345",
"CMAKE_BUILD_TYPE": "Release",
"BUILD_DFU": "1",
"BUILD_RESOURCES": "1"
}
}
],
"buildPresets": [
{
"name": "Release",
"configurePreset": "Release"
}
]
}
4 changes: 2 additions & 2 deletions doc/BLEFS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ There are two relevant UUIDs in this protocol: the version characteristic, and t

UUID: `adaf0100-4669-6c65-5472-616e73666572`

The version characteristic returns the version of the protocol to which the sender adheres. It returns a single unsigned 32-bit integer. The latest version at the time of writing this is 4.
The version characteristic returns the version of the protocol to which the sender adheres. It returns a single unsigned 16-bit integer. The latest version at the time of writing this is 4.

### Transfer

Expand Down Expand Up @@ -71,7 +71,7 @@ To begin writing to a file, a header must first be sent. The header packet shoul
- Unsigned 32-bit integer encoding the size of the file that will be sent
- File path: UTF-8 encoded string that is _not_ null terminated.

To continue reading the file after this initial packet, the following packet should be sent until all the data has been sent and a response had been received with 0 free space. No close command is required after the data has been received.
To continue writing the file after this initial packet, the following packet should be sent until all the data has been sent and a response had been received with 0 free space. No close command is required after the data has been received.

- Command (single byte): `0x22`
- Status: `0x01`
Expand Down
40 changes: 37 additions & 3 deletions doc/buildAndProgram.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ To build this project, you'll need:
python -m venv .venv
source .venv/bin/activate
python -m pip install wheel
python -m pip install -r tools/mcuboot/requirements.txt
python -m pip install -r tools/mcuboot/requirements.txt adafruit-nrfutil
```
- A reasonably recent version of CMake (I use 3.16.5)
- A reasonably recent version of CMake (minimum 3.10)
- lv_font_conv, to generate the font .c files
- see [lv_font_conv](https://github.com/lvgl/lv_font_conv#install-the-script)
- install npm (commonly done via the package manager, ensure node's version is at least 12)
Expand All @@ -24,7 +24,7 @@ To build this project, you'll need:

### Clone the repo

```
```sh
git clone https://github.com/InfiniTimeOrg/InfiniTime.git
cd InfiniTime
git submodule update --init
Expand All @@ -34,6 +34,40 @@ cd build

### Project generation using CMake

#### CMakePresets

Note that this requires CMake 3.19 or later to be installed.
This project provides a `CMakePresets.json` file, enabling easy and fast development with modern editors such as VSCode, neovim or CLion.
The `CMakePresets.json` file looks for the arm-gcc toolchain and NRF52 SDK in the `sdk-toolchain` directory.
So to download and extract these in the correct directory, do the following:

```sh
mkdir -p sdk-toolchain

# Get the nRF5 SDK
wget https://nsscprodmedia.blob.core.windows.net/prod/software-and-other-downloads/sdks/nrf5/binaries/nrf5sdk153059ac345.zip
mv nrf5sdk153059ac345.zip sdk-toolchain/
cd sdk-toolchain
unzip nrf5sdk153059ac345.zip
cd -

# Get the arm cross compiler (There's probably a more linux-y way of doing this though...)
wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2
mv gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2 sdk-toolchain/
cd sdk-toolchain
tar xjf gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2
cd -
```

To use the presets, simply call `cmake` like so (make sure you have activated the python virtual environment as described [above](##dependencies)):

```sh
cmake --preset Release
cmake --build build/Release
```

#### CMake Variables

CMake configures the project according to variables you specify the command line. The variables are:

Variable | Description | Example|
Expand Down
15 changes: 7 additions & 8 deletions src/systemtask/SystemTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,14 @@ void SystemTask::Work() {
if (state != SystemTaskState::GoingToSleep) {
break;
}
if (BootloaderVersion::IsValid()) {
// First versions of the bootloader do not expose their version and cannot initialize the SPI NOR FLASH
// if it's in sleep mode. Avoid bricked device by disabling sleep mode on these versions.
spiNorFlash.Sleep();
}

// Must keep SPI awake when still updating the display for always on
// Must keep SPI and flash awake when still updating the display for always on
if (msg == Messages::OnDisplayTaskSleeping) {
if (BootloaderVersion::IsValid()) {
// First versions of the bootloader do not expose their version and cannot initialize the SPI NOR FLASH
// if it's in sleep mode. Avoid bricked device by disabling sleep mode on these versions.
spiNorFlash.Sleep();
}
spi.Sleep();
}

Expand Down Expand Up @@ -409,14 +409,13 @@ void SystemTask::GoToRunning() {
// SPI only switched off when entering Sleeping, not AOD or GoingToSleep
if (state == SystemTaskState::Sleeping) {
spi.Wakeup();
spiNorFlash.Wakeup();
}

// Double Tap needs the touch screen to be in normal mode
if (!settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap)) {
touchPanel.Wakeup();
}

spiNorFlash.Wakeup();
}

displayApp.PushMessage(Pinetime::Applications::Display::Messages::GoToRunning);
Expand Down