-
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.
[vscode] Support tasks and intelliSense
- Loading branch information
Showing
5 changed files
with
161 additions
and
33 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.defines | 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,25 @@ | ||
{ | ||
"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 %} | ||
}, | ||
%% 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,26 @@ | ||
# 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. | ||
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 generates a `.vscode/` folder with the following files: | ||
|
||
- `launch.json`: configuration file to launch the debugger with a single click | ||
(or keyboard shortcut) from the IDE. | ||
## Building | ||
|
||
This module provides a `.vscode/tasks.json` file that wraps your selected build | ||
system | ||
|
||
|
||
## Debugging | ||
|
||
This module generates a configuration file to use with the [Cortex-Debug][] | ||
extension for Cortex-M targets: | ||
|
||
- `.vscode/launch.json`: launches the debugger with a single click from the IDE. | ||
|
||
[VSCode]: https://code.visualstudio.com/ | ||
[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/ | ||
|
||
[VSCode]: https://code.visualstudio.com/ | ||
[mcuoneclipse-vscode-debug]: https://mcuoneclipse.com/2021/05/01/visual-studio-code-for-c-c-with-arm-cortex-m-part-1/ |
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,36 @@ | ||
|
||
{ | ||
// 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": { | ||
"base": "$gcc", | ||
"fileLocation": ["relative", "${workspaceFolder}"] | ||
} | ||
}, | ||
%% 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 | ||
] | ||
} |