166 lines
3.6 KiB
JSON
166 lines
3.6 KiB
JSON
{
|
|
"version": "2.0.0",
|
|
"inputs": [
|
|
{
|
|
"id": "target_ip",
|
|
"type": "command",
|
|
"command": "shellCommand.execute",
|
|
"args": {
|
|
"command": ". ${workspaceFolder}/.env && echo $TARGET_IP",
|
|
"useFirstResult": true
|
|
}
|
|
},
|
|
{
|
|
"id": "target_user",
|
|
"type": "command",
|
|
"command": "shellCommand.execute",
|
|
"args": {
|
|
"command": ". ${workspaceFolder}/.env && echo $TARGET_USER",
|
|
"useFirstResult": true
|
|
}
|
|
},
|
|
{
|
|
"id": "target_dir",
|
|
"type": "command",
|
|
"command": "shellCommand.execute",
|
|
"args": {
|
|
"command": ". ${workspaceFolder}/.env && echo $TARGET_DIR",
|
|
"useFirstResult": true
|
|
}
|
|
},
|
|
{
|
|
"id": "buildroot_path",
|
|
"type": "command",
|
|
"command": "shellCommand.execute",
|
|
"args": {
|
|
"command": ". ${workspaceFolder}/.env && echo $BUILDROOT_PATH",
|
|
"useFirstResult": true
|
|
}
|
|
},
|
|
{
|
|
"id": "project_name",
|
|
"type": "command",
|
|
"command": "shellCommand.execute",
|
|
"args": {
|
|
"command": ". ${workspaceFolder}/.env && echo $PROJECT_NAME",
|
|
"useFirstResult": true
|
|
}
|
|
}
|
|
],
|
|
"tasks": [
|
|
{
|
|
"label": "CMake: Configure",
|
|
"type": "shell",
|
|
"command": "cmake",
|
|
"args": [
|
|
"-S", "${workspaceFolder}",
|
|
"-B", "${workspaceFolder}/build",
|
|
"-DCMAKE_TOOLCHAIN_FILE=${workspaceFolder}/rpi1-toolchain.cmake",
|
|
"-DCMAKE_BUILD_TYPE=Debug",
|
|
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON",
|
|
"-DBUILDROOT_PATH=${input:buildroot_path}",
|
|
"-DPROJECT_NAME=${input:project_name}"
|
|
],
|
|
"problemMatcher": [],
|
|
"detail": "Configure CMake for cross-compilation"
|
|
},
|
|
{
|
|
"label": "CMake: Build",
|
|
"type": "shell",
|
|
"command": "cmake",
|
|
"args": [
|
|
"--build", "${workspaceFolder}/build",
|
|
"--config", "Debug",
|
|
"-j", "4"
|
|
],
|
|
"dependsOn": "CMake: Configure",
|
|
"problemMatcher": [
|
|
"$gcc"
|
|
],
|
|
"group": {
|
|
"kind": "build",
|
|
"isDefault": true
|
|
},
|
|
"detail": "Build the project with CMake"
|
|
},
|
|
{
|
|
"label": "CMake: Clean",
|
|
"type": "shell",
|
|
"command": "cmake",
|
|
"args": [
|
|
"--build", "${workspaceFolder}/build",
|
|
"--target", "clean"
|
|
],
|
|
"problemMatcher": [],
|
|
"detail": "Clean build artifacts"
|
|
},
|
|
{
|
|
"label": "CMake: Rebuild",
|
|
"type": "shell",
|
|
"dependsOn": ["CMake: Clean", "CMake: Build"],
|
|
"dependsOrder": "sequence",
|
|
"problemMatcher": [],
|
|
"detail": "Clean and rebuild the project"
|
|
},
|
|
{
|
|
"label": "Deploy",
|
|
"type": "shell",
|
|
"dependsOn": "CMake: Build",
|
|
"command": "scp",
|
|
"args": [
|
|
"-O",
|
|
"${workspaceFolder}/build/${input:project_name}",
|
|
"${input:target_user}@${input:target_ip}:${input:target_dir}/${input:project_name}"
|
|
],
|
|
"problemMatcher": [],
|
|
"group": {
|
|
"kind": "build"
|
|
}
|
|
},
|
|
{
|
|
"label": "Start GDB Server",
|
|
"type": "shell",
|
|
"command": "ssh",
|
|
"args": [
|
|
"-t",
|
|
"${input:target_user}@${input:target_ip}",
|
|
"gdbserver :2345 ${input:target_dir}/${input:project_name}"
|
|
],
|
|
"isBackground": true,
|
|
"presentation": {
|
|
"reveal": "always",
|
|
"panel": "dedicated",
|
|
"focus": false,
|
|
"clear": true
|
|
},
|
|
"problemMatcher": {
|
|
"pattern": {
|
|
"regexp": "^Listening on port (\\d+)$",
|
|
"line": 1
|
|
},
|
|
"background": {
|
|
"activeOnStart": true,
|
|
"beginsPattern": ".",
|
|
"endsPattern": "^Listening on port \\d+$"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"label": "Deploy and Start GDB Server",
|
|
"dependsOn": ["Deploy", "Start GDB Server"],
|
|
"dependsOrder": "sequence",
|
|
"problemMatcher": []
|
|
},
|
|
{
|
|
"label": "Stop GDB Server",
|
|
"type": "shell",
|
|
"command": "ssh",
|
|
"args": [
|
|
"${input:target_user}@${input:target_ip}",
|
|
"pkill -9 gdbserver"
|
|
],
|
|
"problemMatcher": []
|
|
}
|
|
]
|
|
}
|