summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJF <jf@codingfield.com>2020-11-10 19:32:36 (GMT)
committerJF <jf@codingfield.com>2020-11-10 19:32:36 (GMT)
commit04abc91f157f5925ffa404728291a69893acf8cf (patch)
tree5c887c6d22ba8d901022ebae395a7b6c165d9dc0 /doc
parent65ecb65b57bd55582c1aa1a5babd4d76df89e621 (diff)
parentf0e1f98823e41bfc2d9743fa8de70c882f26f93b (diff)
Merge branch 'develop' into master
Diffstat (limited to 'doc')
-rw-r--r--doc/MemoryAnalysis.md4
-rw-r--r--doc/buildAndProgram.md2
-rw-r--r--doc/companionapps/Amazfish.md (renamed from doc/CompanionApps/Amazfish.md)0
-rw-r--r--doc/companionapps/Gadgetbridge.md (renamed from doc/CompanionApps/Gadgetbridge.md)0
-rw-r--r--doc/companionapps/NrfconnectOTA.md (renamed from doc/CompanionApps/NrfconnectOTA.md)0
-rw-r--r--doc/companionapps/firmwareNoValidated.jpg (renamed from doc/CompanionApps/firmwareNoValidated.jpg)bin191501 -> 191501 bytes
-rw-r--r--doc/companionapps/firmwareValidated.jpg (renamed from doc/CompanionApps/firmwareValidated.jpg)bin212743 -> 212743 bytes
-rw-r--r--doc/companionapps/firmwareValidationApp.jpg (renamed from doc/CompanionApps/firmwareValidationApp.jpg)bin179828 -> 179828 bytes
-rw-r--r--doc/contribute.md22
-rw-r--r--doc/filesInReleaseNotes.md2
-rw-r--r--doc/openOCD.md105
11 files changed, 130 insertions, 5 deletions
diff --git a/doc/MemoryAnalysis.md b/doc/MemoryAnalysis.md
index 1bf6e24..95bd611 100644
--- a/doc/MemoryAnalysis.md
+++ b/doc/MemoryAnalysis.md
@@ -1,6 +1,6 @@
# Memory analysis
## FreeRTOS heap and task stack
-FreeRTOS statically allocate its own heap buffer in a global variable named `ucHeap`. This is an aray of *uint8_t*. Its size is specified by the definition `configTOTAL_HEAP_SIZE` in *FreeRTOSConfig.h*
+FreeRTOS statically allocate its own heap buffer in a global variable named `ucHeap`. This is an array of *uint8_t*. Its size is specified by the definition `configTOTAL_HEAP_SIZE` in *FreeRTOSConfig.h*
FreeRTOS uses this buffer to allocate memory for tasks stack and all the RTOS object created during runtime (timers, mutexes,...).
The function `xPortGetFreeHeapSize()` returns the amount of memory available in this *ucHeap* buffer. If this value reaches 0, FreeRTOS runs out of memory.
@@ -75,4 +75,4 @@ add_definitions(-D__STACK_SIZE=8192)
*TODO*
#Tools
- - https://github.com/eliotstock/memory : display the memory usage (FLASH/RAM) using the .map file from GCC. \ No newline at end of file
+ - https://github.com/eliotstock/memory : display the memory usage (FLASH/RAM) using the .map file from GCC.
diff --git a/doc/buildAndProgram.md b/doc/buildAndProgram.md
index 8472c62..4676281 100644
--- a/doc/buildAndProgram.md
+++ b/doc/buildAndProgram.md
@@ -18,7 +18,7 @@ CMake configures the project according to variables you specify the command line
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-9-2019-q4-major/`|
+**ARM_NONE_EABI_TOOLCHAIN_PATH**|path to the toolchain directory|`-DARM_NONE_EABI_TOOLCHAIN_PATH=/home/jf/nrf52/gcc-arm-none-eabi-9-2020-q2-update/`|
**NRF5_SDK_PATH**|path to the NRF52 SDK|`-DNRF5_SDK_PATH=/home/jf/nrf52/Pinetime/sdk`|
**USE_JLINK, USE_GDB_CLIENT and USE_OPENOCD**|Enable *JLink* mode, *GDB Client* (Black Magic Probe) mode or *OpenOCD* mode (set the one you want to use to `1`)|`-DUSE_JLINK=1`
**CMAKE_BUILD_TYPE**| Build type (Release or Debug). Release is applied by default if this variable is not specified.|`-DCMAKE_BUILD_TYPE=Debug`
diff --git a/doc/CompanionApps/Amazfish.md b/doc/companionapps/Amazfish.md
index eb9daa0..eb9daa0 100644
--- a/doc/CompanionApps/Amazfish.md
+++ b/doc/companionapps/Amazfish.md
diff --git a/doc/CompanionApps/Gadgetbridge.md b/doc/companionapps/Gadgetbridge.md
index 1a25069..1a25069 100644
--- a/doc/CompanionApps/Gadgetbridge.md
+++ b/doc/companionapps/Gadgetbridge.md
diff --git a/doc/CompanionApps/NrfconnectOTA.md b/doc/companionapps/NrfconnectOTA.md
index 0fa3cd0..0fa3cd0 100644
--- a/doc/CompanionApps/NrfconnectOTA.md
+++ b/doc/companionapps/NrfconnectOTA.md
diff --git a/doc/CompanionApps/firmwareNoValidated.jpg b/doc/companionapps/firmwareNoValidated.jpg
index 28df7ea..28df7ea 100644
--- a/doc/CompanionApps/firmwareNoValidated.jpg
+++ b/doc/companionapps/firmwareNoValidated.jpg
Binary files differ
diff --git a/doc/CompanionApps/firmwareValidated.jpg b/doc/companionapps/firmwareValidated.jpg
index 0d6f99b..0d6f99b 100644
--- a/doc/CompanionApps/firmwareValidated.jpg
+++ b/doc/companionapps/firmwareValidated.jpg
Binary files differ
diff --git a/doc/CompanionApps/firmwareValidationApp.jpg b/doc/companionapps/firmwareValidationApp.jpg
index d78ad0c..d78ad0c 100644
--- a/doc/CompanionApps/firmwareValidationApp.jpg
+++ b/doc/companionapps/firmwareValidationApp.jpg
Binary files differ
diff --git a/doc/contribute.md b/doc/contribute.md
index 53c6ac0..40441cd 100644
--- a/doc/contribute.md
+++ b/doc/contribute.md
@@ -21,4 +21,24 @@ Then, you can submit a pull-request for review. Try to describe your pull reques
Other contributors can post comments about the pull request, maybe ask for more info or adjustements in the code.
-Once the pull request is reviewed an accepted, it'll be merge in **develop** and will be released in the next release version of the firmware. \ No newline at end of file
+Once the pull request is reviewed an accepted, it'll be merge in **develop** and will be released in the next release version of the firmware.
+
+# Coding convention
+## Language
+The language of this project is **C++**, and all new code must be written in C++. (Modern) C++ provides a lot of useful tools and functionalities that are beneficial for embedded software development like `constexpr`, `template` and anything that provides zero-cost abstraction.
+
+It's OK to include C code if this code comes from another library like FreeRTOS, NimBLE, LVGL or the NRF-SDK.
+
+## Coding style
+The most important rule to follow is to try to keep the code as easy to read and maintain as possible.
+
+ - **Identation** : 2 spaces, no tabulation
+ - **Opening brace** at the end of the line
+ - **Naming** : Choose self-describing variable name
+ - **class** : PascalCase
+ - **namespace** : PascalCase
+ - **variable** : camelCase, **no** prefix/suffix ('_', 'm_',...) for class members
+ - **Include guard** : `#pragma once` (no `#ifdef __MODULE__ / #define __MODULE__ / #endif`)
+ - **Includes** :
+ - files from the project : `#include "relative/path/to/the/file.h"`
+ - external files and std : `#include <file.h>` \ No newline at end of file
diff --git a/doc/filesInReleaseNotes.md b/doc/filesInReleaseNotes.md
index d293051..2fdfadf 100644
--- a/doc/filesInReleaseNotes.md
+++ b/doc/filesInReleaseNotes.md
@@ -42,7 +42,7 @@ This firmware is intended to be used with our [MCUBoot-based bootloader](../boot
The following files are not directly usable by the bootloader:
- - **pinetime-mcuboot-app.bin** : Output file of GCC containing debug symbols, useful is you want to debug the firmware using GDB.
+ - **pinetime-mcuboot-app.out** : Output file of GCC containing debug symbols, useful is you want to debug the firmware using GDB.
- **pinetime-mcuboot-app.hex** : Firmware in Intel HEX file format.
- **pinetime-mcuboot-app.bin** : Firmware in binary format.
- **pinetime-mcuboot-app.map** : Map file containing all the symbols, addresses in memory,...
diff --git a/doc/openOCD.md b/doc/openOCD.md
new file mode 100644
index 0000000..a199bd7
--- /dev/null
+++ b/doc/openOCD.md
@@ -0,0 +1,105 @@
+# OpenOCD and STLink
+OpenOCD (**Open O**n **C**hip **D**ebugger) is an open source tool that interfaces with many SWD/JTAG debugger to provide debugging and *in-system* programming for embedded target devices.
+
+It supports the **NRF52** (the CPU of the PineTime) and the **STLinkV2**, a cheap SWD debugger.
+
+It works on X86 computers, as well as ARM/ARM64 computers and SBC (like the RaspberryPi and Pine64 Pinebook Pro) !
+
+## Installation
+We will build OpenOCD from sources, as packages from Linux distributions are most of the time outdated and do not support the NRF52 correctly.
+
+ - Fetch the sources from GIT, and build and install it:
+
+```
+git clone https://git.code.sf.net/p/openocd/code openocd-code
+
+cd openocd-code
+
+./bootstrap
+./configure --enable-stlink
+make -j 4
+sudo make install
+```
+
+ - Configure UDEV to allow OpenOCD to open the interface to your STLinkV2:
+```
+sudo cp contrib/60-openocd.rules /etc/udev/rules.d/
+sudo udevadm control --reload-rules
+```
+
+ - You can now plug your STLinkV2 in a USB port and run OpenOCD to see if it's working correctly:
+
+```
+$ openocd -f interface/stlink.cfg -f target/nrf52.cfg
+Open On-Chip Debugger 0.10.0+dev-01411-g051e80812-dirty (2020-09-28-20:16)
+Licensed under GNU GPL v2
+For bug reports, read
+ http://openocd.org/doc/doxygen/bugs.html
+Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
+Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
+
+nRF52 device has a CTRL-AP dedicated to recover the device from AP lock.
+A high level adapter (like a ST-Link) you are currently using cannot access
+the CTRL-AP so 'nrf52_recover' command will not work.
+Do not enable UICR APPROTECT.
+
+Info : Listening on port 6666 for tcl connections
+Info : Listening on port 4444 for telnet connections
+Info : clock speed 1000 kHz
+Info : STLINK V2J34S7 (API v2) VID:PID 0483:3748
+Info : Target voltage: 3.294340
+Error: init mode failed (unable to connect to the target)
+```
+Ok, OpenOCD is running and it detects my STLinkV2. The last error shows that I've not connected the STLinkV2 to the PineTime.
+
+## Configuration files
+OpenOCD is configured using configuration files.
+First, we need a common configuration file for the project : **openocd-stlink.ocd**:
+```
+source [find interface/stlink.cfg]
+
+gdb_flash_program enable
+gdb_breakpoint_override hard
+
+source [find target/nrf52.cfg]
+```
+This file specifies to OpenOCD which debugger and target it will be connected to..
+
+Then, we use various *user files* to use OpenOCD to flash InfiniTime binary files.
+
+This files flashes the bootloader and the application firmware : **flash_bootloader_app.ocd**:
+```
+init
+
+program <build directory>/bootloader.bin verify 0x00000000
+program <build directory>/image-0.8.2.bin verify 0x00008000
+
+reset
+```
+
+And this one flashes the graphics flasher (it writes the bootloader graphics into the SPI NOR flash memory) : **flash_graphics.ocd**:
+```
+init
+
+program <build directory>/pinetime-graphics-0.8.2.bin verify 0x00000000
+
+reset
+```
+
+## Examples
+### Flash bootloader and application
+```
+openocd -f ./openocd-stlink.cfg -f ./flash_bootloader_app.ocd
+```
+
+### Flash graphics flasher
+```
+openocd -f ./openocd-stlink.cfg -f ./flash_graphics.ocd
+```
+
+## Connect the STLinkV2 to the PineTime
+Here is an example using the pogo pins:
+![SWD pinout](../images/swd_pinout.jpg)
+![Pogo pins](../images/pogopins.jpg)
+
+You can find more information about the SWD wiring [on the wiki](https://wiki.pine64.org/index.php?title=PineTime_devkit_wiring). \ No newline at end of file