This is an old revision of the document!
Table of Contents
PineTime - 24/02/22 - 19:35
https://wiki.pine64.org/wiki/PineTime
This document is very much a work in progress, None of it is warranted as Correct, Accurate or Optimal.. Suggestions very welcome.
Requirements
- PineTime Dev kit
- ST-Link programmer
- POGO Pin connector for ST-LINK or soldering skills
Setup OpenOCD to use the ST-Link
Triple check the wiring! The wiring on this page is misleading
https://github.com/InfiniTimeOrg/InfiniTime/blob/develop/doc/openOCD.md
Better wiring info here
https://wiki.pine64.org/wiki/PineTime_Devkit_Wiring
Simple Updater - To check ST-Link is working
https://github.com/lupyuen/pinetime-updater
cd ~/Documents/PineTime/pinetime-updater ./run.sh
Build tools and Flash Setup
https://github.com/InfiniTimeOrg/InfiniTime/blob/develop/doc/buildAndProgram.md
Dependencies
Environment setup
Install
CMake - Build make configurations
cd ~/Documents/PineTime/InfiniTime/build cmake -DARM_NONE_EABI_TOOLCHAIN_PATH=/opt/gcc-arm-none-eabi-9-2020-q2-update/ -DNRF5_SDK_PATH=/opt/nRFSDK -DUSE_OPENOCD=1 ../ sudo apt-get install ninja-build sudo apt-get install ninja-build
Seems to ignore ST-Link flags(?)
Make - Build the firmware with the support of the bootloader (based on MCUBoot)
https://github.com/InfiniTimeOrg/InfiniTime/blob/develop/bootloader/README.md
make -j pinetime-mcuboot-app
Flash Config File - flash_bootloader_app.ocd
init program /home/nicolas/Documents/PineTime/InfiniTime/build/src/pinetime-mcuboot-app-image-1.8.0.bin verify 0x00008000 reset
Flash
cd ~/Documents/PineTime sudo openocd -f ./openocd-stlink.ocd -f ./flash_bootloader_app.ocd
Development
https://docs.infinitime.io/en/latest/developer-documentation/index.html#how-to-implement-an-app
Github Cloud Build
With the build working locally from the command line I tried this Github cloud build. Note these articles are old and things have moved on.
https://lupyuen.github.io/pinetime-rust-mynewt/articles/cloud#add-github-actions-to-our-fork
I used the develop work flow main.yml on my fork, all runs well.
nRF Connect For Mobile app to upload the DFU file or use GadgetBridge.
VSCode Setup
https://github.com/InfiniTimeOrg/InfiniTime/blob/develop/doc/buildWithVScode.md
pip3 install –user adafruit-nrfutil
Ensure the MCUBoot python tools are already installed
Cmake tools extension configuration run chmod u+x YourScriptFileName.sh Cmake: Configure Environment Environment variables to pass to CMake during configure.
ARM_NONE_EABI_TOOLCHAIN_PATH /opt/gcc-arm-none-eabi-9-2020-q2-update NRF5_SDK_PATH /opt/nRFSDK
C_cpp_properties.json
“compilerPath”: “/opt/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-gcc”,
Build
Successfully builds from VSCode
Simulator Setup
https://github.com/InfiniTimeOrg/InfiniSim
Build simulator version
cd ~/Documents/PineTimeSim/InfiniSim cmake -S . -B build cmake --build build -j4 --clean-first # Clean first if needed
Run simulator
./build/infinisim --hide-status
Commands
Left mouse button: simulates your finger, just click to tap, click and drag to swipe Right mouse button: simulates the hardware button (for example turn the screen off or on again)
Using the keyboard the following events can be triggered:
- r … enable ringing
- R … disable ringing
- m … let motor run for 100 ms
- M … let motor run for 255 ms
- n … send notification
- N … clear all notifications
- b … connect Bluetooth
- B … disconnect Bluetooth
- v … increase battery voltage and percentage
- V … decrease battery voltage and percentage
- c … charging,
- C … not charging
- l … increase brightness level
- L … lower brightness level
- p … enable print lvgl memory usage to terminal
- P … disable print memory usage
- s … increase step count by 500 steps
- S … decrease step count by 500 steps
- h … set heartrate running, and on further presses increase by 10 bpm
- H … stop heartrate
F7 compiles the project F5 launches the simulator
Next
- Debugging?
- Multiple BLE connections? Handling of BLE messages
- Make hard wired powered dev board?
Development
InfiniTime uses LVGL Dev 7.11
Repo
https://github.com/lvgl/lvgl/tree/release/v7
Doc
https://docs.lvgl.io/7.11/widgets/label.html
Install Ninja sudo apt-get install ninja-build
cd ~/Documents/PineTimeSim/InfiniSim/InfiniTime
Notes to be looked at!
Linux BLE daemon https://gitea.arsenm.dev/Arsen6331/itd
[T] <KieranC> pinetime-mcuboot-app.bin is different from pinetime-mcuboot-app-image.bin, the latter contains a header which is needed to boot using the bootloader [T] <Avamander> pinetime-app.bin however you can flash at 0x0 and it replaces/skips the bootloader, nice fast debugging! [T] <KieranC> You can flash the former at 0x0 and boot without the bootloader but it won't boot if flashed at 0x8 [T] <Jasmin2o22> Thx mate, perfect (re @KieranC: [M] <jf002> > <@p64protocolbot4:matrix.org> [T] <KieranC> Forwarded from KieranC: I'm doing openocd -f interface/stlink.cfg -f target/nrf52.cfg -c 'init' -c 'program bootloader.bin' -c 'reset' then openocd -f interface/stlink.cfg -f target/nrf52.cfg -c 'init' -c 'program src/pinetime-mcuboot-app-1.6.0.bin' -c 'reset' You need to flash a file called pinetime
