To build this project, you’ll need:
cbor
, intelhex
, click
and cryptography
modules for the mcuboot
tool (see requirements.txt)
venv
)
python -m venv .venv
source .venv/bin/activate
python -m pip install wheel
python -m pip install -r tools/mcuboot/requirements.txt
npm install lv_font_conv
git clone https://github.com/InfiniTimeOrg/InfiniTime.git
cd InfiniTime
git submodule update --init
mkdir build
cd build
CMake configures the project according to variables you specify the command line. The variables are:
Variable | Description | Example |
---|---|---|
ARM_NONE_EABI_TOOLCHAIN_PATH | path to the toolchain directory | -DARM_NONE_EABI_TOOLCHAIN_PATH=/home/jf/nrf52/gcc-arm-none-eabi-10.3-2021.10/ |
NRF5_SDK_PATH | path to the NRF52 SDK | -DNRF5_SDK_PATH=/home/jf/nrf52/Pinetime/sdk |
CMAKE_BUILD_TYPE (*) | Build type (Release or Debug). Release is applied by default if this variable is not specified. | -DCMAKE_BUILD_TYPE=Debug |
BUILD_DFU (**) | Build DFU files while building (needs adafruit-nrfutil). | -DBUILD_DFU=1 |
BUILD_RESOURCES (**) | Generate external resource while building (needs lv_font_conv and lv_img_conv. | -DBUILD_RESOURCES=1 |
TARGET_DEVICE | Target device, used for hardware configuration. Allowed: PINETIME, MOY-TFK5, MOY-TIN5, MOY-TON5, MOY-UNK |
-DTARGET_DEVICE=PINETIME (Default) |
By default, this variable is set to Release. It compiles the code with size and speed optimizations. We use this value for all the binaries we publish when we release new versions of InfiniTime.
The Debug mode disables all optimizations, which makes the code easier to debug. However, the binary size will likely be too big to fit in the internal flash memory. If you want to build and debug a Debug binary, you’ll need to disable some parts of the code. For example, the icons for the Navigation app use a lot of memory space. You can comment the content of m_iconMap
in the Navigation application to free some memory.
DFU files are the files you’ll need to install your build of InfiniTime using OTA (over-the-air) mechanism. To generate the DFU file, the Python tool adafruit-nrfutil is needed on your system. Check that this tool is properly installed before enabling this option.
cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=... -DNRF5_SDK_PATH=...
During the project generation, CMake created the following targets:
If you just want to build the project and run it on the Pinetime, using pinetime-app is recommended. See this page for more info about bootloader support.
Build:
make -j pinetime-app
List of files generated:
Binary files are generated into the folder src
:
The same files are generated for pinetime-recovery and pinetime-recoveryloader
These files are needed by the Pine64 factory to flash InfiniTime as the default firmware on the PineTimes.
Two files are needed: an HEX (.hex) file that contains the content of the internal flash memory (bootloader + InfiniTime) and a binary (.bin) file that contains the content of the external flash memory (recovery firmware).
First, convert the bootloader to hex:
<ARM TOOLCHAIN>/bin/arm-none-eabi-objcopy -I binary -O ihex ./bootloader.bin ./bootloader.hex
where bootloader.bin
is the last stable version of the bootloader.
Then, convert the MCUBoot image of InfiniTime:
<ARM TOOLCHAIN>/bin/arm-none-eabi-objcopy -I binary -O ihex --change-addresses 0x8000 ./pinetime-mcuboot-app-image-1.6.0.bin ./pinetime-mcuboot-app-image-1.6.0.hex
where pinetime-mcuboot-app-image-1.6.0.bin
is the bin of the last MCUBoot image of InfiniTime.
Pay attention to the parameter --change-addresses 0x8000
. It’s needed to ensure the image will be flashed at the offset expected by the bootloader (0x8000).
Finally, merge them together with mergehex:
/opt/mergehex/mergehex -m ./bootloader.hex ./pinetime-mcuboot-app-image-1.6.0.hex -o merged-internal.hex
This file must be flashed at offset 0x00 of the internal memory of the NRF52832.
This file is the MCUBoot image of the last stable version of the recovery firmware. It must be flashed at offset 0x00 of the external SPINOR flash memory.