添加 VSCode 的配置脚本

This commit is contained in:
LokLiang
2024-04-30 15:07:13 +08:00
parent d6b6ec39bd
commit 4e259f666c
3 changed files with 308 additions and 0 deletions

46
.vscode/c_cpp_properties.json vendored Executable file
View File

@@ -0,0 +1,46 @@
{
"configurations": [
{
"name": "linux-gcc-x64",
"includePath": [
"${workspaceRoot}/**",
"${workspaceRoot}/esp-idf/components/newlib/platform_include",
"${workspaceRoot}/esp-idf/components/esp_common/include",
"${workspaceRoot}/esp-idf/components/nvs_flash/include",
"${workspaceRoot}/esp-idf/components/esp_partition/include",
"${workspaceRoot}/esp-idf/components/esp_rom/include",
"${workspaceRoot}/esp-idf/components/esp_system/include",
"${workspaceRoot}/esp-idf/components/esp_timer/include",
"${workspaceRoot}/esp-idf/components/driver/uart/include",
"${workspaceRoot}/esp-idf/components/esp_hw_support/include",
"${workspaceRoot}/esp-idf/components/esp_netif/linux/stubs/include",
"${workspaceRoot}/esp-idf/components/freertos/FreeRTOS-Kernel/include",
"${workspaceRoot}/esp-idf/components/freertos/esp_additions/include",
"${workspaceRoot}/esp-idf/components/freertos/esp_additions/include/freertos",
"${workspaceRoot}/esp-idf/components/freertos/esp_additions/arch/riscv/include",
"${workspaceRoot}/esp-idf/components/freertos/FreeRTOS-Kernel/portable/riscv/include/freertos",
"${workspaceRoot}/esp-idf/components/soc/esp32/include",
"${workspaceRoot}/esp-idf/components/soc/esp32s3/include",
"${workspaceRoot}/project/components/system/include",
],
"forcedInclude": [
"${workspaceRoot}/project/build/config/sdkconfig.h"
],
"defines": [
"DEBUG_BUILD=1",
"__XTENSA__",
"CONFIG_EXAMPLE_CONNECT_WIFI"
],
"compilerPath": "${default}",
"cStandard": "${default}",
"cppStandard": "${default}",
"intelliSenseMode": "${default}",
"compilerArgs": [
"-Wall",
"-Wextra",
"-Wpedantic"
]
}
],
"version": 4
}

106
.vscode/launch.json vendored Executable file
View File

@@ -0,0 +1,106 @@
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{ // 使用 JLinkGDBServer 的服务调试
"name": "(gdb) JLinkGDBServer",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/debug/project.elf",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
// "miDebuggerPath": "gdb-multiarch",
"miDebuggerPath": "arm-none-eabi-gdb",
"miDebuggerServerAddress": "localhost:2331",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "JLinkGDBServer",
"postDebugTask": "killallJLinkGDBServer",
},
{ // 直接仿真本机程序
"name": "gdb",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/debug/project.elf",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
},
{ // 使用 qemu 远程调试
"name": "(gdb) qemu-cm3",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/debug/project.elf",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"miDebuggerPath": "gdb-multiarch",
"miDebuggerServerAddress": "localhost:1234",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "qemu",
// "postDebugTask": "killallqemu",
},
{ // TODO: 使用 openocd 的服务调试,打印命令 openocd -f interface/jlink.cfg -f target/stm32f4x.cfg -c 'init' -c 'targets' -c 'reset halt'
"name": "ARM Debug",
"type": "cppdbg",
"request": "launch",
"miDebuggerPath": "gdb-multiarch",
"targetArchitecture": "arm",
"program": "${workspaceFolder}/debug/project.elf",
"setupCommands": [
{
"text": "file '${workspaceFolder}/debug/project.elf'"
},
{
"text": "target remote localhost:3333"
},
{
"text": "monitor reset"
},
{
"text": "monitor halt"
},
{
"text": "load"
}
],
//"preLaunchTask": "build",
//"launchCompleteCommand": "None",
//"externalConsole": true,
"cwd": "${workspaceRoot}"
},
]
}

156
.vscode/tasks.json vendored Executable file
View File

@@ -0,0 +1,156 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build-extras",
"type": "shell",
"command": "./build.sh",
"args": ["debug_build"],
"problemMatcher": {
"owner": "cpp",
"fileLocation": ["relative", "/"],
"pattern": [
{
"regexp": ".",
"file": 1,
"location": 2,
"message": 3
}
]
},
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "dedicated",
"showReuseMessage": true,
"clear": true,
}
},
{
"label": "qemu",
// "dependsOn": "build-extras",
"type":"shell",
"isBackground":true,
"runOptions": {
"instanceLimit": 1
},
"command": [
"qemu-system-arm",
"-kernel ./debug/project.elf",
"-machine mps2-an385",
"-d cpu_reset",
"-nographic",
"-monitor null",
"-semihosting",
"--semihosting-config enable=on,target=native",
"-serial stdio",
"-s",
"-S",
],
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "dedicated",
"showReuseMessage": true,
"clear": true,
},
"problemMatcher":
{
"owner": "external",
"pattern": [
{
"regexp": ".",
"file": 1,
"location": 2,
"message": 3
}
],
"background": {
"activeOnStart": true,
"beginsPattern": ".",
"endsPattern": "."
}
}
},
{
"label": "killallqemu",
"type":"shell",
"isBackground": true,
"command": "killall",
"args": ["qemu-system-arm"],
"presentation": {
"echo": false,
"reveal": "never",
"focus": false,
"showReuseMessage": false,
"clear": true,
},
},
{
"label": "JLinkGDBServer",
"type": "shell",
"isBackground": true,
"command": "./build.sh",
"args": [
// "flash",
"debug_cmd",
],
// This task is run before some debug tasks.
// Problem is, it's a watch script, and since it never exits, VSCode
// complains. All this is needed so VSCode just lets it run.
"problemMatcher": {
"owner": "external",
"pattern": [
{
"regexp": ".",
"file": 1,
"location": 2,
"message": 3
}
],
"background": {
"activeOnStart": true,
"beginsPattern": ".",
"endsPattern": "."
}
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "dedicated",
"showReuseMessage": true,
"clear": true,
},
},
{
"label": "killallJLinkGDBServer",
"type":"shell",
"isBackground": true,
"command": "killall",
"args": ["JLinkGDBServer"],
"presentation": {
"echo": false,
"reveal": "never",
"focus": false,
"showReuseMessage": false,
"clear": true,
},
},
]
}