diff --git a/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/.vscode/launch.json b/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/.vscode/launch.json new file mode 100644 index 000000000..ca2d87d64 --- /dev/null +++ b/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/.vscode/launch.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/.vscode/tasks.json b/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/.vscode/tasks.json new file mode 100644 index 000000000..9928581d8 --- /dev/null +++ b/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/.vscode/tasks.json @@ -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", + } + } + ] + } + ] +} \ No newline at end of file diff --git a/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/Readme.md b/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/Readme.md new file mode 100644 index 000000000..7ec0f47c4 --- /dev/null +++ b/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/Readme.md @@ -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. diff --git a/FreeRTOS/Demo/Posix_GCC/.vscode/launch.json b/FreeRTOS/Demo/Posix_GCC/.vscode/launch.json new file mode 100644 index 000000000..48a48d530 --- /dev/null +++ b/FreeRTOS/Demo/Posix_GCC/.vscode/launch.json @@ -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}" + } + ] +} diff --git a/FreeRTOS/Demo/Posix_GCC/.vscode/settings.json b/FreeRTOS/Demo/Posix_GCC/.vscode/settings.json new file mode 100644 index 000000000..d131d3d60 --- /dev/null +++ b/FreeRTOS/Demo/Posix_GCC/.vscode/settings.json @@ -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", +} \ No newline at end of file diff --git a/FreeRTOS/Demo/Posix_GCC/.vscode/tasks.json b/FreeRTOS/Demo/Posix_GCC/.vscode/tasks.json new file mode 100644 index 000000000..2b77ce6a9 --- /dev/null +++ b/FreeRTOS/Demo/Posix_GCC/.vscode/tasks.json @@ -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 + } + } + ] +} \ No newline at end of file diff --git a/FreeRTOS/Demo/Posix_GCC/Readme.md b/FreeRTOS/Demo/Posix_GCC/Readme.md index 966697a1d..def1dcda2 100644 --- a/FreeRTOS/Demo/Posix_GCC/Readme.md +++ b/FreeRTOS/Demo/Posix_GCC/Readme.md @@ -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 ## Introduction [(from the official gprof doc)](https://sourceware.org/binutils/docs/gprof/Introduction.html#Introduction)