Skip to content

Commit

Permalink
Add Clangd and Live-Watch Support (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
irvingywang authored Dec 3, 2024
1 parent 0c5dd48 commit 8cafe6e
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 27 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
!.vscode/c_cpp_properties.json
.vscode/.cortex-debug*
.vscode/settings.json
.cache/

# Byte-compiled / optimized / DLL files
__pycache__/
Expand All @@ -23,4 +24,4 @@ __pycache__/
*.DS_Store

# DBC files, merging these is basically useless
*.dbc
*.dbc
142 changes: 119 additions & 23 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
"${workspaceFolder}/source/main_module"
],
"preLaunchTask": "build",
"runToEntryPoint": "main"
"runToEntryPoint": "main",
"liveWatch": {
"enabled":true,
"samplesPerSecond":5
}
},
{ "name": "PDU",
"cwd": "${workspaceRoot}",
Expand All @@ -37,7 +41,11 @@
"${workspaceFolder}/source/f4_testing"
],
"preLaunchTask": "build",
"runToEntryPoint": "main"
"runToEntryPoint": "main",
"liveWatch": {
"enabled":true,
"samplesPerSecond":5
}
},
{ "name": "Dashboard",
"cwd": "${workspaceRoot}",
Expand All @@ -56,7 +64,11 @@
"${workspaceFolder}/source/dashboard"
],
"preLaunchTask": "build",
"runToEntryPoint": "main"
"runToEntryPoint": "main",
"liveWatch": {
"enabled":true,
"samplesPerSecond":5
}
},
{ "name": "Torque Vectoring",
"cwd": "${workspaceRoot}",
Expand All @@ -75,7 +87,11 @@
"${workspaceFolder}/source/torque_vector"
],
"preLaunchTask": "build",
"runToEntryPoint": "main"
"runToEntryPoint": "main",
"liveWatch": {
"enabled":true,
"samplesPerSecond":5
}
},
{ "name": "daq",
"cwd": "${workspaceRoot}",
Expand All @@ -96,6 +112,10 @@
],
"preLaunchTask": "build",
"runToEntryPoint": "main",
"liveWatch": {
"enabled":true,
"samplesPerSecond":5
}
},
{ "name": "daq_attach",
"cwd": "${workspaceRoot}",
Expand All @@ -115,6 +135,10 @@
"${workspaceFolder}/source/daq"
],
"runToEntryPoint": "main",
"liveWatch": {
"enabled":true,
"samplesPerSecond":5
}
},
{ "name": "l4_testing",
"cwd": "${workspaceRoot}",
Expand All @@ -133,7 +157,11 @@
"${workspaceFolder}/source/l4_testing"
],
"preLaunchTask": "build",
"runToEntryPoint": "main"
"runToEntryPoint": "main",
"liveWatch": {
"enabled":true,
"samplesPerSecond":5
}
},
{ "name": "f4_testing",
"cwd": "${workspaceRoot}",
Expand All @@ -152,7 +180,11 @@
"${workspaceFolder}/source/f4_testing"
],
"preLaunchTask": "build",
"runToEntryPoint": "main"
"runToEntryPoint": "main",
"liveWatch": {
"enabled":true,
"samplesPerSecond":5
}
},
{ "name": "f7_testing",
"cwd": "${workspaceRoot}",
Expand All @@ -171,7 +203,11 @@
"${workspaceFolder}/source/f7_testing"
],
"preLaunchTask": "build",
"runToEntryPoint": "main"
"runToEntryPoint": "main",
"liveWatch": {
"enabled":true,
"samplesPerSecond":5
}
},
{ "name": "A_Box",
"cwd": "${workspaceRoot}",
Expand All @@ -190,7 +226,11 @@
"${workspaceFolder}/source/a_box"
],
"preLaunchTask": "build_bl",
"runToEntryPoint": "main"
"runToEntryPoint": "main",
"liveWatch": {
"enabled":true,
"samplesPerSecond":5
}
},
{ "name": "BL App - Main Module",
"cwd": "${workspaceRoot}",
Expand All @@ -209,7 +249,11 @@
"${workspaceFolder}/source/main_module"
],
"preLaunchTask": "build_bl",
"runToEntryPoint": "main"
"runToEntryPoint": "main",
"liveWatch": {
"enabled":true,
"samplesPerSecond":5
}
},
{ "name": "BL App - Dashboard",
"cwd": "${workspaceRoot}",
Expand All @@ -228,7 +272,11 @@
"${workspaceFolder}/source/dashboard"
],
"preLaunchTask": "build_bl",
"runToEntryPoint": "main"
"runToEntryPoint": "main",
"liveWatch": {
"enabled":true,
"samplesPerSecond":5
}
},
{ "name": "BL App - Torque Vectoring",
"cwd": "${workspaceRoot}",
Expand All @@ -247,7 +295,11 @@
"${workspaceFolder}/source/torque_vector"
],
"preLaunchTask": "build_bl",
"runToEntryPoint": "main"
"runToEntryPoint": "main",
"liveWatch": {
"enabled":true,
"samplesPerSecond":5
}
},
{ "name": "BL App - A_Box",
"cwd": "${workspaceRoot}",
Expand All @@ -266,7 +318,11 @@
"${workspaceFolder}/source/a_box"
],
"preLaunchTask": "build_bl",
"runToEntryPoint": "main"
"runToEntryPoint": "main",
"liveWatch": {
"enabled":true,
"samplesPerSecond":5
}
},
{ "name": "BL App - PDU",
"cwd": "${workspaceRoot}",
Expand All @@ -285,7 +341,11 @@
"${workspaceFolder}/source/pdu"
],
"preLaunchTask": "build_bl",
"runToEntryPoint": "main"
"runToEntryPoint": "main",
"liveWatch": {
"enabled":true,
"samplesPerSecond":5
}
},
{ "name": "BL App - DAQ",
"cwd": "${workspaceRoot}",
Expand All @@ -304,7 +364,11 @@
"${workspaceFolder}/source/daq"
],
"preLaunchTask": "build_bl",
"runToEntryPoint": "main"
"runToEntryPoint": "main",
"liveWatch": {
"enabled":true,
"samplesPerSecond":5
}
},
{ "name": "BL App - l4_testing",
"cwd": "${workspaceRoot}",
Expand All @@ -323,7 +387,11 @@
"${workspaceFolder}/source/l4_testing"
],
"preLaunchTask": "build",
"runToEntryPoint": "main"
"runToEntryPoint": "main",
"liveWatch": {
"enabled":true,
"samplesPerSecond":5
}
},
{ "name": "BL Bootloader - Main Module",
"cwd": "${workspaceRoot}",
Expand All @@ -342,7 +410,11 @@
"${workspaceFolder}/source/bootloader"
],
"preLaunchTask": "build_bl",
"runToEntryPoint": "Reset_Handler"
"runToEntryPoint": "Reset_Handler",
"liveWatch": {
"enabled":true,
"samplesPerSecond":5
}
},
{
"name": "BL Bootloader - Dashboard",
Expand All @@ -362,7 +434,11 @@
"${workspaceFolder}/source/bootloader"
],
"preLaunchTask": "build_bl",
"runToEntryPoint": "Reset_Handler"
"runToEntryPoint": "Reset_Handler",
"liveWatch": {
"enabled":true,
"samplesPerSecond":5
}
},
{ "name": "BL Bootloader - Torque Vectoring",
"cwd": "${workspaceRoot}",
Expand All @@ -381,7 +457,11 @@
"${workspaceFolder}/source/bootloader"
],
"preLaunchTask": "build_bl",
"runToEntryPoint": "Reset_Handler"
"runToEntryPoint": "Reset_Handler",
"liveWatch": {
"enabled":true,
"samplesPerSecond":5
}
},
{
"name": "BL Bootloader - A Box",
Expand All @@ -401,7 +481,11 @@
"${workspaceFolder}/source/bootloader"
],
"preLaunchTask": "build_bl",
"runToEntryPoint": "Reset_Handler"
"runToEntryPoint": "Reset_Handler",
"liveWatch": {
"enabled":true,
"samplesPerSecond":5
}
},
{ "name": "BL Bootloader - PDU",
"cwd": "${workspaceRoot}",
Expand All @@ -420,7 +504,11 @@
"${workspaceFolder}/source/bootloader"
],
"preLaunchTask": "build_bl",
"runToEntryPoint": "Reset_Handler"
"runToEntryPoint": "Reset_Handler",
"liveWatch": {
"enabled":true,
"samplesPerSecond":5
}
},
{ "name": "BL Bootloader - DAQ",
"cwd": "${workspaceRoot}",
Expand All @@ -439,7 +527,11 @@
"${workspaceFolder}/source/bootloader"
],
"preLaunchTask": "build_bl",
"runToEntryPoint": "Reset_Handler"
"runToEntryPoint": "Reset_Handler",
"liveWatch": {
"enabled":true,
"samplesPerSecond":5
}
},
{
"name": "BL Bootloader - L4_Testing",
Expand All @@ -459,7 +551,11 @@
"${workspaceFolder}/source/bootloader"
],
"preLaunchTask": "build_bl",
"runToEntryPoint": "Reset_Handler"
},
"runToEntryPoint": "Reset_Handler",
"liveWatch": {
"enabled":true,
"samplesPerSecond":5
}
}
]
}
4 changes: 1 addition & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
Expand All @@ -24,7 +22,7 @@
"label": "Submodule Update",
"group": "none",
"type": "shell",
"command": "git submodule update --init --recursive",
"command": "git submodule update --init --recursive"
},
{
"label": "can_gen",
Expand Down
5 changes: 5 additions & 0 deletions setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ git clone https://github.com/PurdueElectricRacing/firmware.git

5. Install [Visual Studio Code](https://code.visualstudio.com/): Text editor with extensions for helping build the firmware components using CMake.

Important extensions:
- [Cortex-Debug](https://marketplace.visualstudio.com/items?itemName=marus25.cortex-debug): Provides debugging support for ARM Cortex-M microcontrollers, including live watch capability.
- [clangd](https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd): Provides advanced C/C++ code completion and analysis. (Optional)


6. Initialize the git submodules in this project with the following command to download the source for the various git submodules: `git submodule update --init --recursive`.

- This command needs to be run in the base folder of the cloned repository and may take a few minutes to complete.
Expand Down

0 comments on commit 8cafe6e

Please sign in to comment.