diff --git a/README.md b/README.md index 41e5d4ab..7c52cb44 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,13 @@ Fast open-source firmware for the [PineTime smartwatch](https://www.pine64.org/p - [Getting started with InfiniTime](doc/gettingStarted/gettingStarted-1.0.md) - [Updating the software](doc/gettingStarted/updating-software.md) - [About the firmware and bootloader](doc/gettingStarted/about-software.md) + ### Companion apps + - [Gadgetbridge](https://gadgetbridge.org/) (Android) - [AmazFish](https://openrepos.net/content/piggz/amazfish/) (SailfishOS) - [Siglo](https://github.com/alexr4535/siglo) (Linux) - - [InfiniLink](https://github.com/InfiniTimeOrg/InfiniLink) **[Experimental]** **[Unmaintained, looking for developers/maintainers]** (iOS) + - [InfiniLink](https://github.com/InfiniTimeOrg/InfiniLink) (iOS) **[Looking for a new maintainer]** - [ITD](https://gitea.arsenm.dev/Arsen6331/itd) (Linux) ## Development @@ -24,37 +26,36 @@ Fast open-source firmware for the [PineTime smartwatch](https://www.pine64.org/p - [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) - [Tips on designing an app UI](doc/ui_guidelines.md) - -### InfiniSim Simulator -Use the [InfiniSim Simulator](https://github.com/InfiniTimeOrg/InfiniSim) to experience the `InfiniTime` user interface directly on your PC, to shorten the time until you get your hands on a real [PineTime smartwatch](https://www.pine64.org/pinetime/). -Or use it to develop new Watchfaces, new Screens, or quickly iterate on the user interface. + - [Bootloader, OTA and DFU](bootloader/README.md) + - [Versioning](doc/versioning.md) + - [Project branches](doc/branches.md) + - [Files included in the release notes](doc/filesInReleaseNotes.md) ### Contributing - - [How to contribute?](/doc/contribute.md) - - [Coding conventions](/doc/coding-convention.md) + + - [How to contribute?](doc/contribute.md) + - [Coding conventions](doc/coding-convention.md) ### Build, flash and debug - - [Project branches](doc/branches.md) - - [Versioning](doc/versioning.md) - - [Files included in the release notes](doc/filesInReleaseNotes.md) + - [InfiniTime simulator](https://github.com/InfiniTimeOrg/InfiniSim) - [Build the project](doc/buildAndProgram.md) - - [Flash the firmware using OpenOCD and STLinkV2](doc/openOCD.md) - - [Flash the firmware using SWD interface](doc/SWD.md) - [Build the project with Docker](doc/buildWithDocker.md) - [Build the project with VSCode](doc/buildWithVScode.md) - - [Bootloader, OTA and DFU](./bootloader/README.md) - - [Stub using NRF52-DK](./doc/PinetimeStubWithNrf52DK.md) + - [Flash the firmware using OpenOCD and STLinkV2](doc/openOCD.md) + - [Flash the firmware using SWD interface](doc/SWD.md) + - [Flash the firmware using JLink](doc/jlink.md) + - [Flash the firmware using GDB](doc/gdb.md) + - [Stub using NRF52-DK](doc/PinetimeStubWithNrf52DK.md) ### API - - [BLE implementation and API](./doc/ble.md) + - [BLE implementation and API](doc/ble.md) ### Architecture and technical topics - - [Memory analysis](./doc/MemoryAnalysis.md) + - [Memory analysis](doc/MemoryAnalysis.md) ## Licenses @@ -75,5 +76,3 @@ Here are some people I would like to highlight: - [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. - [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! - [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! - -*If you feel like you should appear on this list, just get in touch with me or submit a PR :)* diff --git a/doc/ble.md b/doc/ble.md index 7e3c873a..bd9e66f5 100644 --- a/doc/ble.md +++ b/doc/ble.md @@ -2,8 +2,6 @@ ## Introduction This page describes the BLE implementation and API built in this firmware. -**Note**: I'm a beginner in BLE related technologies and the information in this document reflects my current knowledge and understanding of the BLE stack. This information might be erroneous or incomplete. Feel free to submit a PR if you think you can improve it. - --- ### Table of Contents diff --git a/doc/buildAndProgram.md b/doc/buildAndProgram.md index a1961ee4..510f053d 100644 --- a/doc/buildAndProgram.md +++ b/doc/buildAndProgram.md @@ -17,7 +17,7 @@ To build this project, you'll need: - install npm (commonly done via the package manager, ensure node's version is at least 12) - install lv_font_conv: `npm install lv_font_conv` -## Build steps +## Build steps ### Clone the repo ``` git clone https://github.com/InfiniTimeOrg/InfiniTime.git @@ -95,6 +95,7 @@ The same files are generated for **pinetime-recovery** and **pinetime-recoverylo ### Program and run + #### Using CMake targets These target have been configured during the project generation by CMake according to the parameters you provided to the command line. @@ -108,134 +109,6 @@ Flash the application: make FLASH_pinetime-app ``` -### Using JLink -Start JLinkExe: -``` -$ /opt/SEGGER/JLink/JLinkExe -device nrf52 -if swd -speed 4000 -autoconnect 1 -SEGGER J-Link Commander V6.70d (Compiled Apr 16 2020 17:59:37) -DLL version V6.70d, compiled Apr 16 2020 17:59:25 - -Connecting to J-Link via USB...O.K. -Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Mar 17 2020 14:43:00 -Hardware version: V1.00 -S/N: 682579153 -License(s): RDI, FlashBP, FlashDL, JFlash, GDB -VTref=3.300V -Device "NRF52" selected. - - -Connecting to target via SWD -InitTarget() start -InitTarget() end -Found SW-DP with ID 0x2BA01477 -DPIDR: 0x2BA01477 -Scanning AP map to find all available APs -AP[2]: Stopped AP scan as end of AP map has been reached -AP[0]: AHB-AP (IDR: 0x24770011) -AP[1]: JTAG-AP (IDR: 0x02880000) -Iterating through AP map to find AHB-AP to use -AP[0]: Core found -AP[0]: AHB-AP ROM base: 0xE00FF000 -CPUID register: 0x410FC241. Implementer code: 0x41 (ARM) -Found Cortex-M4 r0p1, Little endian. -FPUnit: 6 code (BP) slots and 2 literal slots -CoreSight components: -ROMTbl[0] @ E00FF000 -ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS-M7 -ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT -ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB -ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM -ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU -ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM -Cortex-M4 identified. -J-Link> -``` - -Use the command loadfile to program the .hex file: -``` -J-Link>loadfile pinetime-app.hex -Downloading file [pinetime-app.hex]... -Comparing flash [100%] Done. -Erasing flash [100%] Done. -Programming flash [100%] Done. -Verifying flash [100%] Done. -J-Link: Flash download: Bank 0 @ 0x00000000: 1 range affected (4096 bytes) -J-Link: Flash download: Total time needed: 0.322s (Prepare: 0.043s, Compare: 0.202s, Erase: 0.003s, Program: 0.064s, Verify: 0.000s, Restore: 0.007s) -O.K. -``` - -Then reset (r) and start (g) the CPU: -``` -J-Link>r -Reset delay: 0 ms -Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit. -Reset: Halt core after reset via DEMCR.VC_CORERESET. -Reset: Reset device via AIRCR.SYSRESETREQ. -J-Link>g -``` - -#### JLink RTT -RTT is a feature from Segger's JLink devices that allows bidirectional communication between the debugger and the target. This feature can be used to get the logs from the embedded software on the development computer. - - - Program the MCU with the code (see above) - - Start JLinkExe - -``` -$ JLinkExe -device nrf52 -if swd -speed 4000 -autoconnect 1 -``` - -Start JLinkRTTClient -``` -$ JLinkRTTClient -``` - -### Using GDB and Black Magic Probe (BMP) -Enter the following command into GDB: - -``` -target extended-remote /dev/ttyACM0 -monitor swdp_scan -attach 1 -file ./pinetime-app-full.hex -load -run -``` - -Example : -``` -$ /home/jf/nrf52/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-gdb - -(gdb) target extended-remote /dev/ttyACM0 -Remote debugging using /dev/ttyACM0 -(gdb) monitor swdp_scan -Target voltage: ABSENT! -Available Targets: -No. Att Driver - 1 Nordic nRF52 M3/M4 - 2 Nordic nRF52 Access Port - -(gdb) attach 1 -Attaching to Remote target -warning: No executable has been specified and target does not support -determining executable automatically. Try using the "file" command. -0xfffffffe in ?? () -(gdb) file ./pinetime-app-full.hex -A program is being debugged already. -Are you sure you want to change the file? (y or n) y -Reading symbols from ./pinetime-app-full.hex... -(No debugging symbols found in ./pinetime-app-full.hex) -(gdb) load -Loading section .sec1, size 0xb00 lma 0x0 -Loading section .sec2, size 0xf000 lma 0x1000 -Loading section .sec3, size 0x10000 lma 0x10000 -Loading section .sec4, size 0x5150 lma 0x20000 -Loading section .sec5, size 0xa000 lma 0x26000 -Loading section .sec6, size 0x10000 lma 0x30000 -Loading section .sec7, size 0xdf08 lma 0x40000 -Start address 0x0, load size 314200 -Transfer rate: 45 KB/sec, 969 bytes/write. -``` - ### How to generate files needed by the factory These files are needed by the Pine64 factory to flash InfiniTime as the default firmware on the PineTimes. diff --git a/doc/gdb.md b/doc/gdb.md new file mode 100644 index 00000000..eb9b73f1 --- /dev/null +++ b/doc/gdb.md @@ -0,0 +1,48 @@ +# Flashing the firmware with GDB and Black Magic Probe (BMP) + +Enter the following command into GDB: + +``` +target extended-remote /dev/ttyACM0 +monitor swdp_scan +attach 1 +file ./pinetime-app-full.hex +load +run +``` + +Example : +``` +$ /home/jf/nrf52/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-gdb + +(gdb) target extended-remote /dev/ttyACM0 +Remote debugging using /dev/ttyACM0 +(gdb) monitor swdp_scan +Target voltage: ABSENT! +Available Targets: +No. Att Driver + 1 Nordic nRF52 M3/M4 + 2 Nordic nRF52 Access Port + +(gdb) attach 1 +Attaching to Remote target +warning: No executable has been specified and target does not support +determining executable automatically. Try using the "file" command. +0xfffffffe in ?? () +(gdb) file ./pinetime-app-full.hex +A program is being debugged already. +Are you sure you want to change the file? (y or n) y +Reading symbols from ./pinetime-app-full.hex... +(No debugging symbols found in ./pinetime-app-full.hex) +(gdb) load +Loading section .sec1, size 0xb00 lma 0x0 +Loading section .sec2, size 0xf000 lma 0x1000 +Loading section .sec3, size 0x10000 lma 0x10000 +Loading section .sec4, size 0x5150 lma 0x20000 +Loading section .sec5, size 0xa000 lma 0x26000 +Loading section .sec6, size 0x10000 lma 0x30000 +Loading section .sec7, size 0xdf08 lma 0x40000 +Start address 0x0, load size 314200 +Transfer rate: 45 KB/sec, 969 bytes/write. +``` + diff --git a/doc/jlink.md b/doc/jlink.md new file mode 100644 index 00000000..eebcac49 --- /dev/null +++ b/doc/jlink.md @@ -0,0 +1,82 @@ +# Flashing the firmware with JLink + +Start JLinkExe: +``` +$ /opt/SEGGER/JLink/JLinkExe -device nrf52 -if swd -speed 4000 -autoconnect 1 +SEGGER J-Link Commander V6.70d (Compiled Apr 16 2020 17:59:37) +DLL version V6.70d, compiled Apr 16 2020 17:59:25 + +Connecting to J-Link via USB...O.K. +Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Mar 17 2020 14:43:00 +Hardware version: V1.00 +S/N: 682579153 +License(s): RDI, FlashBP, FlashDL, JFlash, GDB +VTref=3.300V +Device "NRF52" selected. + + +Connecting to target via SWD +InitTarget() start +InitTarget() end +Found SW-DP with ID 0x2BA01477 +DPIDR: 0x2BA01477 +Scanning AP map to find all available APs +AP[2]: Stopped AP scan as end of AP map has been reached +AP[0]: AHB-AP (IDR: 0x24770011) +AP[1]: JTAG-AP (IDR: 0x02880000) +Iterating through AP map to find AHB-AP to use +AP[0]: Core found +AP[0]: AHB-AP ROM base: 0xE00FF000 +CPUID register: 0x410FC241. Implementer code: 0x41 (ARM) +Found Cortex-M4 r0p1, Little endian. +FPUnit: 6 code (BP) slots and 2 literal slots +CoreSight components: +ROMTbl[0] @ E00FF000 +ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS-M7 +ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT +ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB +ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM +ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU +ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM +Cortex-M4 identified. +J-Link> +``` + +Use the command loadfile to program the .hex file: +``` +J-Link>loadfile pinetime-app.hex +Downloading file [pinetime-app.hex]... +Comparing flash [100%] Done. +Erasing flash [100%] Done. +Programming flash [100%] Done. +Verifying flash [100%] Done. +J-Link: Flash download: Bank 0 @ 0x00000000: 1 range affected (4096 bytes) +J-Link: Flash download: Total time needed: 0.322s (Prepare: 0.043s, Compare: 0.202s, Erase: 0.003s, Program: 0.064s, Verify: 0.000s, Restore: 0.007s) +O.K. +``` + +Then reset (r) and start (g) the CPU: +``` +J-Link>r +Reset delay: 0 ms +Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit. +Reset: Halt core after reset via DEMCR.VC_CORERESET. +Reset: Reset device via AIRCR.SYSRESETREQ. +J-Link>g +``` + +# JLink RTT +RTT is a feature from Segger's JLink devices that allows bidirectional communication between the debugger and the target. This feature can be used to get the logs from the embedded software on the development computer. + + - Program the MCU with the code (see above) + - Start JLinkExe + +``` +$ JLinkExe -device nrf52 -if swd -speed 4000 -autoconnect 1 +``` + +Start JLinkRTTClient +``` +$ JLinkRTTClient +``` +