From 8cafe6e036ea5f3dc3caa8e9cc1ba267718216eb Mon Sep 17 00:00:00 2001 From: irving Date: Tue, 3 Dec 2024 12:40:02 -0500 Subject: [PATCH] Add Clangd and Live-Watch Support (#144) --- .gitignore | 3 +- .vscode/launch.json | 142 +++++++++++++++++++++++++++++++++++++------- .vscode/tasks.json | 4 +- setup.md | 5 ++ 4 files changed, 127 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index caacac6a..798e3eae 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ !.vscode/c_cpp_properties.json .vscode/.cortex-debug* .vscode/settings.json +.cache/ # Byte-compiled / optimized / DLL files __pycache__/ @@ -23,4 +24,4 @@ __pycache__/ *.DS_Store # DBC files, merging these is basically useless -*.dbc \ No newline at end of file +*.dbc diff --git a/.vscode/launch.json b/.vscode/launch.json index 2751597d..1be1105c 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -18,7 +18,11 @@ "${workspaceFolder}/source/main_module" ], "preLaunchTask": "build", - "runToEntryPoint": "main" + "runToEntryPoint": "main", + "liveWatch": { + "enabled":true, + "samplesPerSecond":5 + } }, { "name": "PDU", "cwd": "${workspaceRoot}", @@ -37,7 +41,11 @@ "${workspaceFolder}/source/f4_testing" ], "preLaunchTask": "build", - "runToEntryPoint": "main" + "runToEntryPoint": "main", + "liveWatch": { + "enabled":true, + "samplesPerSecond":5 + } }, { "name": "Dashboard", "cwd": "${workspaceRoot}", @@ -56,7 +64,11 @@ "${workspaceFolder}/source/dashboard" ], "preLaunchTask": "build", - "runToEntryPoint": "main" + "runToEntryPoint": "main", + "liveWatch": { + "enabled":true, + "samplesPerSecond":5 + } }, { "name": "Torque Vectoring", "cwd": "${workspaceRoot}", @@ -75,7 +87,11 @@ "${workspaceFolder}/source/torque_vector" ], "preLaunchTask": "build", - "runToEntryPoint": "main" + "runToEntryPoint": "main", + "liveWatch": { + "enabled":true, + "samplesPerSecond":5 + } }, { "name": "daq", "cwd": "${workspaceRoot}", @@ -96,6 +112,10 @@ ], "preLaunchTask": "build", "runToEntryPoint": "main", + "liveWatch": { + "enabled":true, + "samplesPerSecond":5 + } }, { "name": "daq_attach", "cwd": "${workspaceRoot}", @@ -115,6 +135,10 @@ "${workspaceFolder}/source/daq" ], "runToEntryPoint": "main", + "liveWatch": { + "enabled":true, + "samplesPerSecond":5 + } }, { "name": "l4_testing", "cwd": "${workspaceRoot}", @@ -133,7 +157,11 @@ "${workspaceFolder}/source/l4_testing" ], "preLaunchTask": "build", - "runToEntryPoint": "main" + "runToEntryPoint": "main", + "liveWatch": { + "enabled":true, + "samplesPerSecond":5 + } }, { "name": "f4_testing", "cwd": "${workspaceRoot}", @@ -152,7 +180,11 @@ "${workspaceFolder}/source/f4_testing" ], "preLaunchTask": "build", - "runToEntryPoint": "main" + "runToEntryPoint": "main", + "liveWatch": { + "enabled":true, + "samplesPerSecond":5 + } }, { "name": "f7_testing", "cwd": "${workspaceRoot}", @@ -171,7 +203,11 @@ "${workspaceFolder}/source/f7_testing" ], "preLaunchTask": "build", - "runToEntryPoint": "main" + "runToEntryPoint": "main", + "liveWatch": { + "enabled":true, + "samplesPerSecond":5 + } }, { "name": "A_Box", "cwd": "${workspaceRoot}", @@ -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}", @@ -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}", @@ -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}", @@ -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}", @@ -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}", @@ -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}", @@ -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}", @@ -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}", @@ -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", @@ -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}", @@ -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", @@ -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}", @@ -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}", @@ -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", @@ -459,7 +551,11 @@ "${workspaceFolder}/source/bootloader" ], "preLaunchTask": "build_bl", - "runToEntryPoint": "Reset_Handler" - }, + "runToEntryPoint": "Reset_Handler", + "liveWatch": { + "enabled":true, + "samplesPerSecond":5 + } + } ] } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 6c70d3ea..f35b0700 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -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": [ { @@ -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", diff --git a/setup.md b/setup.md index f0defec6..5d799286 100644 --- a/setup.md +++ b/setup.md @@ -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.