diff --git a/.gitignore b/.gitignore index 88f5f86..b1e9698 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ # 忽略构建输出目录 Build/ -.vscode/ # 忽略 Toolchain 目录下所有内容,但保留目录本身 Toolchain/* diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..862a84a --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + "version": "0.2.0", + "recommendations": [ + "marus25.cortex-debug", + "ms-vscode.cmake-tools", + "twxs.cmake", + "ms-vscode.cpptools" + ] +} diff --git a/.vscode/flash.jlink b/.vscode/flash.jlink new file mode 100644 index 0000000..f9c6ac2 --- /dev/null +++ b/.vscode/flash.jlink @@ -0,0 +1,7 @@ +device GD32E230F8 +si SWD +speed 4000 +loadfile Application.hex +r +go +exit diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..a8f4c0d --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,27 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "cwd": "${workspaceFolder}", + "executable": "${workspaceFolder}/Build/Debug/Application/Application.elf", + "name": "Debug with J-Link", + "request": "launch", + "type": "cortex-debug", + "runToEntryPoint": "main", + "showDevDebugOutput": "none", + "servertype": "jlink", + "device": "GD32E230F8", + "interface": "swd", + "svdFile": "${workspaceFolder}/GD32E230.svd", + "liveWatch": { + "enabled": true, + "samplesPerSecond": 1 + }, + "preLaunchTask": "Build", + "preRestartCommands": [ + "load", + "continue" + ] + } + ] +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..62f707e --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,111 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Build", + "type": "cmake", + "command": "build", + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": [ + { + "base": "$gcc", + "fileLocation": [ + "relative", + "${command:cmake.buildDirectory}" + ] + } + ], + "options": { + "environment": { + "CLICOLOR_FORCE": "1" + } + }, + "presentation": { + "clear": true + }, + "icon": { + "id": "code", + "tooltip": "Build" + } + }, + { + "label": "Build and Flash (Jlink)", + "group": { + "kind": "build", + "isDefault": true + }, + "dependsOn": [ + "Build", + "Flash MCU (Jlink)" + ], + "dependsOrder": "sequence", + "icon": { + "id": "insert", + "tooltip": "Build and Flash (Jlink)" + } + }, + { + "label": "Flash MCU (Jlink)", + "type": "shell", + "command": "JLink.exe -device GD32E230F8 -if SWD -speed 4000 -autoconnect 1 -CommanderScript '${workspaceFolder}/.vscode/flash.jlink'", + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": [], + "options": { + "cwd": "${command:cmake.buildDirectory}/Application" + }, + "presentation": { + "clear": true + }, + "icon": { + "id": "gather", + "tooltip": "Flash MCU (Jlink)" + } + }, + { + "label": "Reset MCU (Jlink)", + "type": "shell", + "command": "JLink.exe -device GD32E230F8 -if SWD -speed 4000 -autoconnect 1 -c \"r;exit\"", + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": [], + "options": { + "cwd": "${workspaceFolder}" + }, + "presentation": { + "clear": true + }, + "icon": { + "id": "discard", + "tooltip": "Reset MCU (Jlink)" + } + }, + { + "label": "Mass Erase MCU (Jlink)", + "type": "shell", + "command": "JLink.exe -device GD32E230F8 -if SWD -speed 4000 -autoconnect 1 -c \"erase;exit\"", + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": [], + "options": { + "cwd": "${workspaceFolder}" + }, + "presentation": { + "clear": true + }, + "icon": { + "id": "clear-all", + "tooltip": "Erase MCU (Jlink)" + } + } + ] +}