Skip to content

Commit 57e625d

Browse files
Unify docker devcontainer with dockerfile used for CI (#1587)
* Only use one Dockerfile and build.sh script for both docker and devcontainer * Remove all now unneccessary tasks and scripts * Update to clang-format-14 * Move devcontainer.json into root folder * Fix conditional statements in Dockerfile * Move .devcontainer/README into doc/usingDevcontainers * Remove obsolete VSCode Task * Change standard compiler path to the correct compiler * Set GDB Path for debugging * Hide broken buttons from CMake Extension * Refactor .devcontainer * Remove unneccessary postBuildCommand * Add devcontainer dependencies to all docker images * Add Devcontainer Debug launch config * Add an additional c_cpp_properties config as a fallback for devcontainer * Remove obsolete Docker Argument * Fix wrong C/Cpp versions * Fix silent fail of gdb, add libncurses5
1 parent 9a5f516 commit 57e625d

15 files changed

+115
-237
lines changed

.devcontainer.json

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.154.2/containers/cpp
3+
{
4+
"build": {
5+
"dockerfile": "docker/Dockerfile"
6+
},
7+
"customizations": {
8+
"vscode": {
9+
"settings": {
10+
// Set *default* container specific settings.json values on container create.
11+
"terminal.integrated.profiles.linux": {
12+
"bash": {
13+
"path": "/bin/bash"
14+
}
15+
},
16+
"terminal.integrated.defaultProfile.linux": "bash",
17+
"editor.formatOnSave": true,
18+
// FIXME: This and the Dockerfile might get out of sync
19+
"clang-format.executable": "clang-format-14"
20+
},
21+
// Add the IDs of extensions you want installed when the container is created.
22+
"extensions": [
23+
"ms-vscode.cpptools",
24+
"ms-vscode.cmake-tools",
25+
"marus25.cortex-debug",
26+
"notskm.clang-tidy",
27+
"mjohns.clang-format"
28+
]
29+
}
30+
},
31+
"remoteUser": "infinitime"
32+
}

.devcontainer/Dockerfile

-66
This file was deleted.

.devcontainer/build.sh

-87
This file was deleted.

.devcontainer/build_app.sh

-2
This file was deleted.

.devcontainer/create_build_openocd.sh

-3
This file was deleted.

.devcontainer/devcontainer.json

-38
This file was deleted.

.devcontainer/make_build_dir.sh

-2
This file was deleted.

.vscode/c_cpp_properties.json

+21-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
{
2+
"env": {
3+
// TODO: This is a duplication of the configuration set in /docker/build.sh!
4+
"TOOLS_DIR": "/opt",
5+
"GCC_ARM_PATH": "gcc-arm-none-eabi-10.3-2021.10"
6+
},
27
"configurations": [
38
{
49
"name": "nrfCC",
@@ -14,7 +19,22 @@
1419
"intelliSenseMode": "linux-gcc-arm",
1520
"configurationProvider": "ms-vscode.cpp-tools",
1621
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
22+
},
23+
{
24+
"name": "nrfCC Devcontainer",
25+
"includePath": [
26+
"${workspaceFolder}/**",
27+
"${workspaceFolder}/src/**",
28+
"${workspaceFolder}/src"
29+
],
30+
"defines": [],
31+
"compilerPath": "${TOOLS_DIR}/${GCC_ARM_PATH}/bin/arm-none-eabi-gcc",
32+
"cStandard": "c99",
33+
"cppStandard": "c++20",
34+
"intelliSenseMode": "linux-gcc-arm",
35+
"configurationProvider": "ms-vscode.cpp-tools",
36+
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
1737
}
1838
],
1939
"version": 4
20-
}
40+
}

.vscode/cmake-kits.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[
2+
{
3+
"name": "InfiniTime Compiler",
4+
"environmentSetupScript": "${workspaceFolder}/docker/build.sh"
5+
}
6+
]

.vscode/launch.json

+32-13
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
{
1+
{
22
"version": "0.1.0",
33
"configurations": [
44
{
55
"name": "Debug - Openocd docker Remote",
6-
"type":"cortex-debug",
7-
"cortex-debug.armToolchainPath":"${env:ARM_NONE_EABI_TOOLCHAIN_PATH}/bin",
6+
"type": "cortex-debug",
87
"cwd": "${workspaceRoot}",
98
"executable": "${command:cmake.launchTargetPath}",
109
"request": "launch",
1110
"servertype": "external",
12-
// This may need to be arm-none-eabi-gdb depending on your system
13-
"gdbPath" : "${env:ARM_NONE_EABI_TOOLCHAIN_PATH}/bin/arm-none-eabi-gdb",
11+
"gdbPath": "${env:ARM_NONE_EABI_TOOLCHAIN_PATH}/bin/arm-none-eabi-gdb",
1412
// Connect to an already running OpenOCD instance
1513
"gdbTarget": "host.docker.internal:3333",
1614
"svdFile": "${workspaceRoot}/nrf52.svd",
17-
"runToMain": true,
15+
"runToEntryPoint": "main",
1816
// Work around for stopping at main on restart
1917
"postRestartCommands": [
2018
"break main",
@@ -23,18 +21,16 @@
2321
},
2422
{
2523
"name": "Debug - Openocd Local",
26-
"type":"cortex-debug",
27-
"cortex-debug.armToolchainPath":"${env:ARM_NONE_EABI_TOOLCHAIN_PATH}/bin",
24+
"type": "cortex-debug",
2825
"cwd": "${workspaceRoot}",
2926
"executable": "${command:cmake.launchTargetPath}",
3027
"request": "launch",
3128
"servertype": "openocd",
32-
// This may need to be arm-none-eabi-gdb depending on your system
33-
"gdbPath" : "${env:ARM_NONE_EABI_TOOLCHAIN_PATH}/bin/arm-none-eabi-gdb",
29+
"gdbPath": "${env:ARM_NONE_EABI_TOOLCHAIN_PATH}/bin/arm-none-eabi-gdb",
3430
// Connect to an already running OpenOCD instance
3531
"gdbTarget": "localhost:3333",
3632
"svdFile": "${workspaceRoot}/nrf52.svd",
37-
"runToMain": true,
33+
"runToEntryPoint": "main",
3834
// Work around for stopping at main on restart
3935
"postRestartCommands": [
4036
"break main",
@@ -51,14 +47,37 @@
5147
"showDevDebugOutput": false,
5248
"servertype": "openocd",
5349
"runToMain": true,
50+
// Work around for stopping at main on restart
51+
"postRestartCommands": [
52+
"break main",
53+
"continue"
54+
],
5455
// Only use armToolchainPath if your arm-none-eabi-gdb is not in your path (some GCC packages does not contain arm-none-eabi-gdb)
5556
"armToolchainPath": "${workspaceRoot}/../gcc-arm-none-eabi-10.3-2021.10/bin",
5657
"svdFile": "${workspaceRoot}/nrf52.svd",
5758
"configFiles": [
5859
"interface/stlink.cfg",
5960
"target/nrf52.cfg"
6061
],
61-
}
62-
62+
},
63+
{
64+
"name": "Debug - Openocd Devcontainer",
65+
"type": "cortex-debug",
66+
"cwd": "${workspaceRoot}",
67+
"executable": "${command:cmake.launchTargetPath}",
68+
"request": "launch",
69+
"servertype": "external",
70+
// FIXME: This is hardcoded. I have no idea how to use the values set in build.sh here
71+
"gdbPath": "/opt/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-gdb",
72+
// Connect to an already running OpenOCD instance
73+
"gdbTarget": "host.docker.internal:3333",
74+
"svdFile": "${workspaceRoot}/nrf52.svd",
75+
"runToEntryPoint": "main",
76+
// Work around for stopping at main on restart
77+
"postRestartCommands": [
78+
"break main",
79+
"continue"
80+
]
81+
},
6382
]
6483
}

.vscode/settings.json

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
{
22
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
33
"cmake.configureArgs": [
4-
"-DARM_NONE_EABI_TOOLCHAIN_PATH=${env:ARM_NONE_EABI_TOOLCHAIN_PATH}",
5-
"-DNRF5_SDK_PATH=${env:NRF5_SDK_PATH}",
4+
"-DARM_NONE_EABI_TOOLCHAIN_PATH=${env:TOOLS_DIR}/${env:GCC_ARM_PATH}",
5+
"-DNRF5_SDK_PATH=${env:TOOLS_DIR}/${env:NRF_SDK_VER}",
66
],
7+
"cmake.statusbar.advanced": {
8+
"launch": {
9+
"visibility": "hidden"
10+
},
11+
"launchTarget": {
12+
"visibility": "hidden"
13+
},
14+
"debug": {
15+
"visibility": "hidden"
16+
}
17+
},
718
"cmake.generator": "Unix Makefiles",
819
"clang-tidy.buildPath": "build/compile_commands.json",
920
"files.associations": {

0 commit comments

Comments
 (0)