-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ide] vscode: support for tasks and intelliSense
- Loading branch information
Showing
5 changed files
with
187 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"configurations": [ | ||
%% for profile, config in profiles.items() | ||
{ | ||
"name": "{{ platform }}GCC ({{ profile | capitalize }})", | ||
"includePath": [ | ||
%% for path in include_paths | sort | ||
"${workspaceFolder}/{{ path | modm.windowsify(escape_level=1) }}"{% if not loop.last%},{% endif %} | ||
%% endfor | ||
], | ||
"defines": [ | ||
%% for define in config.cppdefines | sort | ||
"{{ define }}"{% if not loop.last%},{% endif %} | ||
%% endfor | ||
], | ||
"compilerPath": "{{ compiler_path }}", | ||
"compilerArgs": [ | ||
%% for flag in config.archflags | sort | ||
"{{ flag }}"{% if not loop.last%},{% endif %} | ||
%% endfor | ||
], | ||
"cStandard": "c17", | ||
"cppStandard": "c++20", | ||
"intelliSenseMode": "gcc-arm" | ||
}{% if not loop.last%},{% endif %} | ||
%% endfor | ||
], | ||
"version": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,42 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
%% for profile in profiles | ||
%% for config in configs | ||
{ | ||
"name": "modm debug configuration ({{ profile.name }}) for {{ partname }}", | ||
"cwd": "${workspaceRoot}", | ||
"executable": "{{ profile.executable }}", | ||
"name": "Debug ({{ config.profile | capitalize }}, {{ config.tool | capitalize }}, {{ partname }})", | ||
"cwd": "${workspaceFolder}", | ||
"executable": "{{ config.executable }}", | ||
"request": "launch", | ||
"type": "cortex-debug", | ||
"servertype": "openocd", | ||
"device": "{{ partname }}", | ||
"runToMain": true, | ||
%% if with_freertos | ||
"rtos": "FreeRTOS", | ||
%% endif | ||
"configFiles": [ | ||
%% for openocd_config_file in openocd_config_files | ||
"{{ openocd_config_file }}"{% if not loop.last %},{% endif %} | ||
%% for cfg in openocd_cfg | ||
"{{ cfg }}"{% if not loop.last %},{% endif %} | ||
%% endfor | ||
] | ||
}{% if not loop.last %},{% endif %} | ||
], | ||
%% if with_rtt | ||
"rttConfig": { | ||
"enabled": true, | ||
"address": "0x{{"%0x" % rtt_ram.start}}", | ||
"searchSize": {{ rtt_ram.size }}, | ||
"searchId": "modm.rtt.modm", | ||
"polling_interval": 1, | ||
"decoders": [ | ||
%% for id in rtt_channels | ||
{ | ||
"port": {{id}}, | ||
"type": "console" | ||
}, | ||
%% endfor | ||
] | ||
}, | ||
%% endif | ||
}, | ||
%% endfor | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,33 @@ | ||
# Visual Studio Code (VSCode) | ||
|
||
[Visual Studio Code (VSCode)][VSCode] is a popular IDE with an integrated debugger UI. | ||
Together with the [Cortex-Debug][] extension it works great for Cortex-M targets. | ||
[Visual Studio Code (VSCode)][VSCode] is a popular IDE with an integrated | ||
debugger UI. | ||
|
||
The blog [mcuoneclipse.com has a nice post][mcuoneclipse-vscode-debug] on how to setup | ||
and use Visual Studio Code for C/C++ with ARM Cortex-M properly. | ||
This module provides configuration files to integrate building, debugging, | ||
uploading and code completion into the IDE: | ||
|
||
This module generates a `.vscode/` folder with the following files: | ||
- `.vscode/tasks.json`: If the `modm:build:scons` and `modm:build:make` module | ||
are included, this file wraps the building and uploading commands by profile. | ||
You can invoke them by Ctl+Shift+B (macOS: Cmd+Shift+B). | ||
- `.vscode/c_cpp_properties.json`: Configures IntelliSense for better code | ||
completion and for using the correct system headers. You need the | ||
[C/C++ extension][] installed. | ||
- `.vscode/launch.json`: Configures the [Cortex-Debug][] extension to start the | ||
debugger with a single click from the IDE. | ||
|
||
- `launch.json`: configuration file to launch the debugger with a single click | ||
(or keyboard shortcut) from the IDE. | ||
Note that not all build system features are provided in the IDE, only the most | ||
common. You can call all build system tools from the command line. | ||
In addition, the `modm:build:cmake` module is supported natively by the | ||
[CMake Tools][] extension and is therefore not wrapped. | ||
|
||
We recommend adding this module from the command line so that you don't | ||
accidentally overwrite your modified files later: `lbuild build -m ::vscode`. | ||
|
||
Note that some configuration options may be specific to your environment (such | ||
as the compiler path) and may not work in other environments. | ||
|
||
|
||
[VSCode]: https://code.visualstudio.com/ | ||
[C/C++ extension]: https://github.com/Microsoft/vscode-cpptools | ||
[CMake Tools]: https://github.com/microsoft/vscode-cmake-tools | ||
[Cortex-Debug]: https://github.com/Marus/cortex-debug#readme | ||
[mcuoneclipse-vscode-debug]: https://mcuoneclipse.com/2021/10/23/visual-studio-code-for-c-c-with-arm-cortex-m-part-10-assembly-stepping/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
{ | ||
// See https://code.visualstudio.com/docs/editor/tasks | ||
// for the documentation about the tasks.json format | ||
"version": "2.0.0", | ||
"tasks": [ | ||
%% for config in configs | ||
{ | ||
"type": "shell", | ||
"label": "Build ({{ config.profile | capitalize }})", | ||
"command": "{{ config.tool }} build profile={{ config.profile }}", | ||
"group": "build", | ||
"presentation": { | ||
"reveal": "silent", | ||
"showReuseMessage": false | ||
}, | ||
"problemMatcher": "$gcc" | ||
}, | ||
%% endfor | ||
%% for config in configs | ||
{ | ||
"type": "shell", | ||
"label": "Upload ({{ config.profile | capitalize }})", | ||
"command": "{{ config.tool }} program profile={{ config.profile }}", | ||
"group": "build", | ||
"presentation": { | ||
"reveal": "silent", | ||
"showReuseMessage": false | ||
} | ||
}, | ||
%% endfor | ||
] | ||
} |