-
Notifications
You must be signed in to change notification settings - Fork 1.8k
VScode Setup Info Hints
CAVEAT: The following info is not complete! This is useful info that I can remember to help. Please feel free to update as you see missing or incomplete information. Thanks!
-
NOTE: This process is the configuration for vscode cmake plugin. The F' cmake system is written so it is consistent with the way vscode builds through cmake. So this is normal vscode project setup except for the presets which is F' specific and the targets which are specific to any project. This strategy will create a launch.json file that will work for all your unit tests. If you want to launch the debugger for the selected target (see instructions below to select your desired build target), you just have to click on the debug "bug" on the bar at the bottom of the vscode GUI.

-
(For users using LLDB debugger on Mac) Add the following to /Users/<replace-with-your-user-name>/Library/Application Support/Code/user/settings.json file to indicate you are using the LLDB debugger, which is the default debugger for Mac.
"cmake.debugConfig": {
"MIMode": "lldb"
},
-
Click on the CMake icon (triangle with a tool in it) on the leftmost panel) (11th icon down on the image below)
-
-
Next on the panel to the right of the leftmost panel,
- Click on the folded page to the right of "Configure", which will give you a drop-down list of which build types you want to build for:
-
NOTE: you won't see the 3 build types if you already selected it previously, so if you want to see the 3 build types in this case, click on the pencil next to the build type in the line (e.g., "F' Unit Test preset") underneath "Configure" and you will see the build type choices.
-
The build types are the following:
-
F' Release Preset - release (standard flight build) (to run fsw without debug)
-
F' Debug Preset - debug (flight build with debug symbols on) to run FSW with debug, and
-
F' Unit Test Preset - debug UT (builds unit tests along with building the other things.) to run unit tests with debug
-
-
- Click on the folded page to the right of "Configure", which will give you a drop-down list of which build types you want to build for:
-
If you want to build unit test, then go to the "[Targets in Preset]" under "Build" (see blurry image below) and click edit (looks like a pencil) on it, it will allow you to select a target in the top center text box. Type your target, (e.g., if you want to run the unit test for Svc/PrmDB, search for Svc_PrmDb in the entry box and select Svc_PrmDb_ut_exe. If you are trying to test Os, select Os_ut_exe)
-
If you click the Build icon (looks like a box with dots in it with an arrow pointing down) next to "Build", then it will run a "build all"
-
If it complains, it could be because it can't cmake, so make sure cmake is installed and that vscode can find the path to it. If it is in a non-standard location or for some reason vscode can't find it, you can add it to your /Users/<put-your-user-name-here>/Library/Application Support/Code/user/settings.json file and put the path to your cmake installation:
Example: "cmake.cmakePath": "/Users/<replace-with-your-user-name>/<path-to-your-cmake-installation>/fprime/fprime-venv/bin/cmake"
-
-
Next either click 'Build" in one of the two places:
- the bar on the bottom
- the build icon to the right of the "Build", which is after the "Configure", which looks like a box of dots with an arrow pointing down into it
- the bar on the bottom
-
Next hit the bug to the right of "Build" on the orange bar, which will prompt you to enter the Unit test that you want to debug and type in your desired build target (e.g.., Svc_PrmDb_ut_exe) in the selection box

-
The "play" button (looks liike a triangle) will launch the selected build target (e.g., Svc_PrmDb_ut_exe) in the terminal window.
- See @thomas-bc and @LeStarch VSCode settings info
- Make sure the CMAKE Tools extension is installed. https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools
- You also need C/C++ extension pack: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools-extension-pack for IntelliSense and debugging.
- Make sure CMake is installed on your system
- macOS: You do not need the full Xcode IDE (which is several gigabytes). You only need the Xcode Command Line Tools, which provide the clang compiler and lldb debugger. You can install these by running xcode-select --install in your terminal.
- C/C++ Extension: The Microsoft C/C++ extension is required for IntelliSense and the actual debugging engine.
- NOTE: I did not need to make my own launch.json file to do the debugging since the F' CMake system creates one
- IMPORTANT!! For simplicity when you want to debug, you can to click on the ladybug on the bottom bar.
- If you click the 4th icon on the left panel with the ladybug on a triangle, that will ask you for a launch.json and ask you to click the run and debug button and request additional configuration. So to avoid that additional configuration/setup, I avoided the left panel debug and just used the ladybug on the bottom.