summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.devcontainer/Dockerfile17
-rw-r--r--.devcontainer/README.md60
-rw-r--r--[-rwxr-xr-x].devcontainer/build.sh0
-rw-r--r--[-rwxr-xr-x].devcontainer/create_build_openocd.sh0
-rw-r--r--.devcontainer/devcontainer.json1
-rw-r--r--.devcontainer/make_build_dir.sh2
-rw-r--r--.gitignore2
-rw-r--r--.vscode/c_cpp_properties.json15
-rw-r--r--.vscode/cmake-variants.json62
-rw-r--r--.vscode/launch.json46
-rw-r--r--.vscode/settings.json65
-rw-r--r--.vscode/tasks.json44
12 files changed, 245 insertions, 69 deletions
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
index 55f30136..4534c7e2 100644
--- a/.devcontainer/Dockerfile
+++ b/.devcontainer/Dockerfile
@@ -1,4 +1,4 @@
-FROM ubuntu:18.04
+FROM ubuntu:latest
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update -qq \
@@ -18,12 +18,20 @@ RUN apt-get update -qq \
dos2unix \
clang-format \
clang-tidy \
+ locales \
+ libncurses5 \
# aarch64 packages
libffi-dev \
libssl-dev \
python3-dev \
rustc \
&& rm -rf /var/cache/apt/* /var/lib/apt/lists/*;
+
+#SET LOCALE
+RUN locale-gen en_US.UTF-8
+ENV LANG en_US.UTF-8
+ENV LANGUAGE en_US:en
+ENV LC_ALL en_US.UTF-8
RUN pip3 install adafruit-nrfutil
# required for McuBoot
@@ -32,9 +40,10 @@ RUN pip3 install setuptools_rust
WORKDIR /opt/
# build.sh knows how to compile but it problimatic on Win10
COPY build.sh .
+RUN chmod +x build.sh
# create_build_openocd.sh uses cmake to crate to build directory
COPY create_build_openocd.sh .
-
+RUN chmod +x create_build_openocd.sh
# Lets get each in a separate docker layer for better downloads
# GCC
# RUN bash -c "source /opt/build.sh; GetGcc;"
@@ -51,4 +60,6 @@ RUN pip3 install -r ./mcuboot/scripts/requirements.txt
RUN adduser infinitime
-ENV SOURCES_DIR /workspaces/Pinetime
+ENV NRF5_SDK_PATH /opt/nRF5_SDK_15.3.0_59ac345
+ENV ARM_NONE_EABI_TOOLCHAIN_PATH /opt/gcc-arm-none-eabi-9-2020-q2-update
+ENV SOURCES_DIR /workspaces/InfiniTime
diff --git a/.devcontainer/README.md b/.devcontainer/README.md
new file mode 100644
index 00000000..ff9307b2
--- /dev/null
+++ b/.devcontainer/README.md
@@ -0,0 +1,60 @@
+# VScode devcontainer
+This is a docker-based interactive development environment using VSCode and Docker Devcontainers removing the need to install any tools locally*
+
+
+
+## Requirements
+
+- VScode
+ - [Remote - Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension
+- Docker
+- OpenOCD - For debugging
+
+## Using
+
+### Code editing, and building.
+
+1. Clone InifiniTime and update submodules
+2. Launch VSCode
+3. Open InifiTime directory,
+4. Allow VSCode to open folder with devcontainer.
+
+After this the environment will be built if you do not currently have a container setup, it will install all the necessary tools and extra VSCode extensions.
+
+In order to build InfiniTime we need to run the initial submodule init and Cmake commands.
+
+#### Manually
+
+ You can use the VSCode terminal to run the CMake commands as outlined in the [build instructions](blob/develop/doc/buildAndProgram.md)
+
+#### Script
+
+The dev enviroment comes with some scripts to make this easier, They are located in /opt/.
+
+There are also VSCode tasks provided should you desire to use those.
+
+The task BuildInit will update submodules and configure for openocd
+
+
+
+### Build
+
+You can use the build.sh script located in /opt/
+
+There will also eventually be a Build task. - Not written yet
+
+
+
+### Debugging
+
+Docker on windows does not support passing USB devices to the underlying WSL2 subsystem, To get around this we use openocd in server mode running on the host.
+
+`openocd -f <yourinterface> -f <nrf52.cfg target file>`
+
+This will launch openocd in server mode and attach it to the MCU.
+
+The default launch.json file expects openocd to be listening on port 3333, edit if needed
+
+
+## Current Issues
+Currently WSL2 Has some real performance issues with IO on a windows host. Accessing files on the virtualized filesystem is much faster. Using VSCodes "clone in container" feature of the Remote - Containers will get around this. After the container is built you will need to update the submodules and follow the build isntructions like normal \ No newline at end of file
diff --git a/.devcontainer/build.sh b/.devcontainer/build.sh
index 8f0d0fa9..8f0d0fa9 100755..100644
--- a/.devcontainer/build.sh
+++ b/.devcontainer/build.sh
diff --git a/.devcontainer/create_build_openocd.sh b/.devcontainer/create_build_openocd.sh
index c5bff5c8..c5bff5c8 100755..100644
--- a/.devcontainer/create_build_openocd.sh
+++ b/.devcontainer/create_build_openocd.sh
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 90b6eceb..223b651f 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -19,6 +19,7 @@
"extensions": [
"ms-vscode.cpptools",
"ms-vscode.cmake-tools",
+ "marus25.cortex-debug"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
diff --git a/.devcontainer/make_build_dir.sh b/.devcontainer/make_build_dir.sh
index 0b86b307..76240037 100644
--- a/.devcontainer/make_build_dir.sh
+++ b/.devcontainer/make_build_dir.sh
@@ -1,2 +1,2 @@
#!/bin/bash
-cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=Release -DUSE_OPENOCD=1 -DARM_NONE_EABI_TOOLCHAIN_PATH=/opt/gcc-arm-none-eabi-9-2020-q2-update -DNRF5_SDK_PATH=/opt/nRF5_SDK_15.3.0_59ac345 /workspaces/Pinetime
+cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=Release -DUSE_OPENOCD=1 -DARM_NONE_EABI_TOOLCHAIN_PATH=/opt/gcc-arm-none-eabi-9-2020-q2-update -DNRF5_SDK_PATH=/opt/nRF5_SDK_15.3.0_59ac345 ${SOURCES_DIR}
diff --git a/.gitignore b/.gitignore
index 2f9ac181..6de76a9e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,7 +4,7 @@
# CMake
cmake-build-*
-cmake-*
+cmake-*/
CMakeFiles
**/CMakeCache.txt
cmake_install.cmake
diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json
index b409ec98..f5c74b3a 100644
--- a/.vscode/c_cpp_properties.json
+++ b/.vscode/c_cpp_properties.json
@@ -1,15 +1,18 @@
{
"configurations": [
{
- "name": "Linux",
+ "name": "nrfCC",
"includePath": [
- "${workspaceFolder}/**"
+ "${workspaceFolder}/**",
+ "${workspaceFolder}/src/**",
+ "${workspaceFolder}/src"
],
"defines": [],
- "compilerPath": "/usr/bin/gcc",
- "cStandard": "gnu11",
- "cppStandard": "gnu++14",
- "intelliSenseMode": "linux-gcc-x64",
+ "compilerPath": "${env:ARM_NONE_EABI_TOOLCHAIN_PATH}/bin/arm-none-eabi-gcc",
+ "cStandard": "c11",
+ "cppStandard": "c++14",
+ "intelliSenseMode": "linux-gcc-arm",
+ "configurationProvider": "ms-vscode.cmake-tools",
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
}
],
diff --git a/.vscode/cmake-variants.json b/.vscode/cmake-variants.json
new file mode 100644
index 00000000..d00e638e
--- /dev/null
+++ b/.vscode/cmake-variants.json
@@ -0,0 +1,62 @@
+{
+ "buildType": {
+ "default": "release",
+ "choices": {
+ "debug": {
+ "short": "Debug",
+ "long": "Emit debug information without performing optimizations",
+ "buildType": "Debug"
+ },
+ "release": {
+ "short": "Release",
+ "long": "Perform optimizations",
+ "buildType": "Release"
+ }
+ }
+ },
+ "programmer":{
+ "default": "OpenOCD",
+ "choices":{
+ "OpenOCD":{
+ "short":"OpenOCD",
+ "long": "Use OpenOCD",
+ "settings":{
+ "USE_OPENOCD":1
+ }
+ },
+ "JLink":{
+ "short":"JLink",
+ "long": "Use JLink",
+ "settings":{
+ "USE_JLINK":1
+ }
+ },
+ "GDB":{
+ "short":"GDB",
+ "long": "Use GDB",
+ "settings":{
+ "USE_GDB_CLIENT":1
+ }
+ }
+ }
+ },
+ "DFU": {
+ "default": "no",
+ "choices": {
+ "no": {
+ "short": "No DFU",
+ "long": "Do not build DFU",
+ "settings": {
+ "BUILD_DFU":0
+ }
+ },
+ "yes": {
+ "short": "Build DFU",
+ "long": "Build DFU",
+ "settings": {
+ "BUILD_DFU":1
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 00000000..78fc1180
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,46 @@
+ {
+ "version": "0.1.0",
+ "configurations": [
+ {
+ "name": "Debug - Openocd docker Remote",
+ "type":"cortex-debug",
+ "cortex-debug.armToolchainPath":"${env:COMPILER_DIR}/bin",
+ "cwd": "${workspaceRoot}",
+ "executable": "${command:cmake.launchTargetPath}",
+ "request": "launch",
+ "servertype": "external",
+ // This may need to be arm-none-eabi-gdb depending on your system
+ "gdbPath" : "${env:COMPILER_DIR}/bin/arm-none-eabi-gdb",
+ // Connect to an already running OpenOCD instance
+ "gdbTarget": "host.docker.internal:3333",
+ "svdFile": "${workspaceRoot}/nrf52.svd",
+ "runToMain": true,
+ // Work around for stopping at main on restart
+ "postRestartCommands": [
+ "break main",
+ "continue"
+ ]
+ },
+ {
+ "name": "Debug - Openocd Local",
+ "type":"cortex-debug",
+ "cortex-debug.armToolchainPath":"${env:COMPILER_DIR}/bin",
+ "cwd": "${workspaceRoot}",
+ "executable": "${command:cmake.launchTargetPath}",
+ "request": "launch",
+ "servertype": "openocd",
+ // This may need to be arm-none-eabi-gdb depending on your system
+ "gdbPath" : "${env:COMPILER_DIR}/bin/arm-none-eabi-gdb",
+ // Connect to an already running OpenOCD instance
+ "gdbTarget": "localhost:3333",
+ "svdFile": "${workspaceRoot}/nrf52.svd",
+ "runToMain": true,
+ // Work around for stopping at main on restart
+ "postRestartCommands": [
+ "break main",
+ "continue"
+ ]
+ }
+
+ ]
+} \ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 05b11756..3b686626 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,59 +1,8 @@
{
- "files.associations": {
- "chrono": "cpp",
- "list": "cpp",
- "array": "cpp",
- "atomic": "cpp",
- "bit": "cpp",
- "*.tcc": "cpp",
- "cctype": "cpp",
- "charconv": "cpp",
- "clocale": "cpp",
- "cmath": "cpp",
- "condition_variable": "cpp",
- "cstdarg": "cpp",
- "cstddef": "cpp",
- "cstdint": "cpp",
- "cstdio": "cpp",
- "cstdlib": "cpp",
- "cstring": "cpp",
- "ctime": "cpp",
- "cwchar": "cpp",
- "cwctype": "cpp",
- "deque": "cpp",
- "unordered_map": "cpp",
- "vector": "cpp",
- "exception": "cpp",
- "algorithm": "cpp",
- "functional": "cpp",
- "iterator": "cpp",
- "memory": "cpp",
- "memory_resource": "cpp",
- "netfwd": "cpp",
- "numeric": "cpp",
- "optional": "cpp",
- "random": "cpp",
- "ratio": "cpp",
- "string": "cpp",
- "string_view": "cpp",
- "system_error": "cpp",
- "tuple": "cpp",
- "type_traits": "cpp",
- "utility": "cpp",
- "fstream": "cpp",
- "initializer_list": "cpp",
- "iosfwd": "cpp",
- "iostream": "cpp",
- "istream": "cpp",
- "limits": "cpp",
- "mutex": "cpp",
- "new": "cpp",
- "ostream": "cpp",
- "sstream": "cpp",
- "stdexcept": "cpp",
- "streambuf": "cpp",
- "thread": "cpp",
- "cinttypes": "cpp",
- "typeinfo": "cpp"
- }
-} \ No newline at end of file
+ "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
+ "cmake.configureArgs": [
+ "-DARM_NONE_EABI_TOOLCHAIN_PATH=${env:ARM_NONE_EABI_TOOLCHAIN_PATH}",
+ "-DNRF5_SDK_PATH=${env:NRF5_SDK_PATH}",
+ ],
+ "cmake.generator": "Unix Makefiles"
+}
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
new file mode 100644
index 00000000..17f51f5e
--- /dev/null
+++ b/.vscode/tasks.json
@@ -0,0 +1,44 @@
+{
+ "version": "2.0.0",
+ "tasks": [
+ {
+ "label": "create openocd build",
+ "type": "shell",
+ "command": "/opt/create_build_openocd.sh",
+ "group": {
+ "kind": "build",
+ "isDefault": true
+ },
+ "presentation": {
+ "reveal": "always",
+ "panel": "shared"
+ },
+ "problemMatcher": []
+ },
+ {
+ "label": "update submodules",
+ "type": "shell",
+ "command": "git submodule update --init",
+ "options": {
+ "cwd": "${workspaceFolder}"
+ },
+ "group": {
+ "kind": "build",
+ "isDefault": true
+ },
+ "presentation": {
+ "reveal": "always",
+ "panel": "shared"
+ },
+ "problemMatcher": []
+ },
+ {
+ "label": "BuildInit",
+ "dependsOn": [
+ "update submodules",
+ "create openocd build"
+ ],
+ "problemMatcher": []
+ }
+ ]
+} \ No newline at end of file