mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-12-09 21:25:15 -05:00
VSCode launch configurations (#820)
* CORTEX_MPS2_QEMU_IAR_GCC now has VSCode tasks and launch configurations to build, run, and debug in one button. This should work on all platforms (Linux, MacOS, Windows).
* Posix_GCC Demo now has VSCode task and launch configs to build, run, debug in one button for Linux/MacOS ("lldb Launch").
It also has configuration for Windows through Ubuntu ("gdb launch"), and this will also work for Linux if the user wants to use gdb instead of lldb.
* Integrated terminal settings for Ubuntu and MSYS2 ways to run Posix Demo on Windows.
This allows Posix port demo to be built on either WSL/Ubuntu or MSYS2 on Windows.
These are absolute paths so if the user has installed Ubuntu or MSYS2 elsewhere they will need to change them.
* Improved pattern matching in Run QEMU task. Replaced usage of deprecated ${workspaceRoot} with ${workspaceFolder}.
* Split MSYS2 and Ubuntu WSL configurations
MSYS2 works better with external console, and Ubuntu WSL works with internal console. This is reflected by having two different configurations.
* Delete RTOSDemo.map
Cleanup. (This is file is built but never deleted when make-ing)
* Delete null.d
* Cleanup extranneous vscode workspace
* Documentation for VSCode launch configs
Documentation for how to run this demo on VSCode using launch configs.
* Added documentation for VSCode launch configs
Added documentation for running demo through VSCode using launch configurations.
* Removed unneeded .log files and c_cpp_properties.json in CORTEX_MPS2_QEMU_IAR_GCC/.vscode/
* Deleted unnecessary .log files from POSIX_GCC/.vscode
* Set build task problem matcher to "gcc", deault problem matcher from VSCode.
* Removed unneeded "sh -c -l" command from the default build task in CORTEX_MPS2_QEMU_IAR_GCC.
* "Build QEMU" task problem matcher finds the correct paths to problem files.
* Moved steps to "Prerequisites" section.
* Update Readme.md
Fixed markdown typo.
* Moved items to prerequisites for Posix_GCC demo.
Co-authored-by: Fan <gilbefan@f84d899204e1.ant.amazon.com>
This commit is contained in:
parent
f62d4ecd69
commit
3a5a8e14fc
7 changed files with 188 additions and 0 deletions
19
FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/.vscode/launch.json
vendored
Normal file
19
FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/.vscode/launch.json
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Launch QEMU RTOSDemo",
|
||||||
|
"type": "cppdbg",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/build/gcc/output/RTOSDemo.out",
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"miDebuggerPath": "/Applications/ARM/bin/arm-none-eabi-gdb-py",
|
||||||
|
"miDebuggerServerAddress": "localhost:1234",
|
||||||
|
"stopAtEntry": true,
|
||||||
|
"preLaunchTask": "Run QEMU"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
44
FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/.vscode/tasks.json
vendored
Normal file
44
FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/.vscode/tasks.json
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
{
|
||||||
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
|
// for the documentation about the tasks.json format
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "Build QEMU",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "make --directory=${workspaceFolder}/build/gcc",
|
||||||
|
"problemMatcher": {
|
||||||
|
"base": "$gcc",
|
||||||
|
"fileLocation": ["relative", "${workspaceFolder}/build/gcc"]
|
||||||
|
},
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Run QEMU",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "echo 'QEMU RTOSdemo started'; qemu-system-arm -machine mps2-an385 -cpu cortex-m3 -kernel ${workspaceFolder}/build/gcc/output/RTOSDemo.out -monitor none -nographic -serial stdio -s -S",
|
||||||
|
"dependsOn": ["Build QEMU"],
|
||||||
|
"isBackground": true,
|
||||||
|
"problemMatcher": [
|
||||||
|
{
|
||||||
|
"pattern": [
|
||||||
|
{
|
||||||
|
"regexp": ".",
|
||||||
|
"file": 1,
|
||||||
|
"location": 2,
|
||||||
|
"message": 3
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"background": {
|
||||||
|
"activeOnStart": true,
|
||||||
|
"beginsPattern": ".",
|
||||||
|
"endsPattern": "QEMU RTOSdemo started",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
13
FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/Readme.md
Normal file
13
FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/Readme.md
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Running with VSCode Launch Configurations
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
* Install [C/C++ extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) in VSCode.
|
||||||
|
* Install [arm-none-eabi-gcc](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads).
|
||||||
|
* Install GNU make utility.
|
||||||
|
* Ensure the required binaries are in PATH with ```arm-none-eabi-gcc --version```, ```arm-none-eabi-gdb --version```, and ```make --version```.
|
||||||
|
|
||||||
|
## Building and Running
|
||||||
|
1. Open VSCode to the folder ```FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC```.
|
||||||
|
2. Open ```.vscode/launch.json```, and ensure the ```miDebuggerPath``` variable is set to the path where arm-none-eabi-gdb is on your machine.
|
||||||
|
3. Open ```main.c```, and set ```mainCREATE_SIMPLE_BLINKY_DEMO_ONLY``` to ```1``` to generate just the [simply blinky demo](https://www.freertos.org/a00102.html#simple_blinky_demo).
|
||||||
|
4. On the VSCode left side panel, select the “Run and Debug” button. Then select “Launch QEMU RTOSDemo” from the dropdown on the top right and press the play button. This will build, run, and attach a debugger to the demo program.
|
||||||
47
FreeRTOS/Demo/Posix_GCC/.vscode/launch.json
vendored
Normal file
47
FreeRTOS/Demo/Posix_GCC/.vscode/launch.json
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Launch lldb",
|
||||||
|
"type": "cppdbg",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/build/posix_demo",
|
||||||
|
"args": [],
|
||||||
|
"stopAtEntry": true,
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"environment": [],
|
||||||
|
"externalConsole": false,
|
||||||
|
"MIMode": "lldb",
|
||||||
|
"preLaunchTask": "${defaultBuildTask}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Launch GDB Ubuntu WSL",
|
||||||
|
"type": "cppdbg",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/build/posix_demo",
|
||||||
|
"args": [],
|
||||||
|
"stopAtEntry": true,
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"environment": [],
|
||||||
|
"externalConsole": false,
|
||||||
|
"MIMode": "gdb",
|
||||||
|
"preLaunchTask": "${defaultBuildTask}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Launch GDB MSYS2",
|
||||||
|
"type": "cppdbg",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/build/posix_demo",
|
||||||
|
"args": [],
|
||||||
|
"stopAtEntry": true,
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"environment": [],
|
||||||
|
"externalConsole": true,
|
||||||
|
"MIMode": "gdb",
|
||||||
|
"preLaunchTask": "${defaultBuildTask}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
16
FreeRTOS/Demo/Posix_GCC/.vscode/settings.json
vendored
Normal file
16
FreeRTOS/Demo/Posix_GCC/.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"terminal.integrated.profiles.windows": {
|
||||||
|
"Ubuntu (WSL)": {
|
||||||
|
"path": "C:\\Windows\\Sysnative\\bash.exe",
|
||||||
|
},
|
||||||
|
"MSYS2": {
|
||||||
|
"path": "C:\\msys64\\usr\\bin\\bash.exe",
|
||||||
|
"args": ["--login", "-i"],
|
||||||
|
"env": {
|
||||||
|
"MSYSTEM": "MSYS",
|
||||||
|
"CHERE_INVOKING": "1",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"terminal.integrated.defaultProfile.windows": "MSYS2",
|
||||||
|
}
|
||||||
17
FreeRTOS/Demo/Posix_GCC/.vscode/tasks.json
vendored
Normal file
17
FreeRTOS/Demo/Posix_GCC/.vscode/tasks.json
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
|
// for the documentation about the tasks.json format
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "Build Posix Demo",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "make",
|
||||||
|
"problemMatcher": "$gcc",
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -1,3 +1,35 @@
|
||||||
|
# Running with VSCode
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
* Install [C/C++ extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) in VSCode.
|
||||||
|
* For MacOS or Linux:
|
||||||
|
* Install gcc.
|
||||||
|
* Install GNU make utility.
|
||||||
|
* Install lldb.
|
||||||
|
* For Windows with Ubuntu WSL:
|
||||||
|
* Install [WSL](https://docs.microsoft.com/en-us/windows/wsl/install).
|
||||||
|
* Install [Remote Development Extension Pack](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack).
|
||||||
|
* For Windows with MSYS2:
|
||||||
|
* Install [MSYS2](https://www.msys2.org/).
|
||||||
|
* Install gcc with ```pacman -S gcc```.
|
||||||
|
* For all platforms, ensure the required binaries are in PATH with ```gcc --version```, ```make --version```, and either ```lldb --version``` or ```gdb --version```.
|
||||||
|
|
||||||
|
## On MacOS or Linux
|
||||||
|
1. Open VSCode to the folder FreeRTOS/Demo/Posix_GCC.
|
||||||
|
2. On the VSCode left side panel, select “Run and Debug”. Then select the “Launch lldb” and press the play button to begin debugging.
|
||||||
|
|
||||||
|
## On Windows using Ubuntu WSL
|
||||||
|
1. Navigate to ```FreeRTOS/Demo/Posix_GCC``` in Ubuntu WSL and use ```code .``` to open the folder in VSCode.
|
||||||
|
1. If ```code``` is not a recognized command, open VSCode and press ```CTRL+SHIFT+P```. Search for "Shell Command: Install ‘code’ command in Path".
|
||||||
|
2. On the VSCode left side panel, select the “Run and Debug” button. Then select the “Launch GDB Ubuntu WSL” and press the play button. This will build, run, and attach a debugger to the demo program.
|
||||||
|
1. If the demo was previously built by MSYS2, make sure to ```make clean``` before building on Ubuntu WSL.
|
||||||
|
|
||||||
|
## On Windows using MSYS2
|
||||||
|
2. Open VSCode to the folder ```FreeRTOS/Demo/Posix_GCC```.
|
||||||
|
3. In ```.vscode/settings.json```, ensure the ```path``` variable under ```MSYS2``` is set to the ```bash.exe``` under your msys64 installation directory. The path should resemble ```${path to msys2 installation}\\msys64\\usr\\bin\\bash.exe```.
|
||||||
|
4. On the VSCode left side panel, select the “Run and Debug” button. Then select the “Launch GDB MSYS2” and press the play button to begin debugging.
|
||||||
|
1. If the demo was previously built by Ubuntu WSL, make sure to ```make clean``` before building on MSYS2.
|
||||||
|
|
||||||
# Profiling your application
|
# Profiling your application
|
||||||
|
|
||||||
## Introduction [(from the official gprof doc)](https://sourceware.org/binutils/docs/gprof/Introduction.html#Introduction)
|
## Introduction [(from the official gprof doc)](https://sourceware.org/binutils/docs/gprof/Introduction.html#Introduction)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue