├── README.md ├── c_cpp_properties.json ├── settings.json └── tasks.json /README.md: -------------------------------------------------------------------------------- 1 | Visual Studio Code Configuration for ESP-IDF Projects 2 | ===================================================== 3 | 4 | This is a simple but nicely working .vscode configuration for your ESP-IDF projects. 5 | 6 | In the meantime, this configuration was not working for me anymore but this was probably due to an update of the [vscode-cpptools](https://github.com/Microsoft/vscode-cpptools)?! 7 | 8 | Setup 9 | ----- 10 | 11 | All you have to do is to add this repository as a Git submodule to your project: 12 | 13 | ``` 14 | git submodule add https://github.com/pathob/.vscode-esp32.git .vscode 15 | ``` 16 | 17 | Make sure that you have configured the `IDF_PATH` environment variable as described here: 18 | [Add IDF_PATH to User Profile](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/add-idf_path-to-profile.html) 19 | 20 | Furthermore, create another environment variable `XTENSA_ESP32_ELF_PATH` that points to your `xtensa-esp32-elf` directory. 21 | 22 | On Linux, this could look like this: 23 | 24 | ``` 25 | export ESP_PATH=/path/to/esp/tools 26 | 27 | export IDF_PATH=${ESP_PATH}/esp-idf 28 | export PATH="$PATH:${IDF_PATH}/tools" 29 | 30 | export XTENSA_ESP32_ELF_PATH=${ESP_PATH}/xtensa-esp32-elf 31 | export PATH=${PATH}:${XTENSA_ESP32_ELF_PATH}/bin 32 | ``` 33 | 34 | Issues / Future Work 35 | -------------------- 36 | 37 | It should be possible to improve the includes by providing a `compile_commands.json` file as described here: 38 | [How to specify the include paths?](https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/Getting%20started%20with%20IntelliSense%20configuration.md#how-to-specify-the-include-paths) 39 | But this probably requires CMake as the build tool (which will be mandatory in the future anyway). 40 | 41 | Feel free to contribute via pull request if you made any generic improvements. 42 | 43 | -------------------------------------------------------------------------------- /c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "ESP32", 5 | "includePath": [ 6 | "${workspaceRoot}/**", 7 | "${IDF_PATH}/components/**", 8 | "${XTENSA_ESP32_ELF_PATH}/xtensa-esp32-elf/**" 9 | ], 10 | "browse": { 11 | "limitSymbolsToIncludedHeaders": true, 12 | "databaseFilename": "", 13 | "path": [ 14 | "${workspaceRoot}", 15 | "${IDF_PATH}/components", 16 | "${XTENSA_ESP32_ELF_PATH}/xtensa-esp32-elf" 17 | ] 18 | }, 19 | "defines": [ 20 | "ESP32", 21 | "FREERTOS" 22 | ], 23 | "compilerPath": "${XTENSA_ESP32_ELF_PATH}/bin/xtensa-esp32-elf-gcc", 24 | "cStandard": "c11", 25 | "cppStandard": "c++17" 26 | } 27 | ], 28 | "version": 4 29 | } -------------------------------------------------------------------------------- /settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "C_Cpp.intelliSenseEngine": "Default", 3 | "C_Cpp.intelliSenseEngineFallback": "Disabled", 4 | "files.associations": { 5 | "*.h": "c", 6 | "*.hpp": "c" 7 | } 8 | } -------------------------------------------------------------------------------- /tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "command": "make", 6 | "type": "shell", 7 | "options": { 8 | "cwd": "${workspaceRoot}" 9 | }, 10 | "presentation": { 11 | "echo": true, 12 | "reveal": "always", 13 | "focus": false, 14 | "panel": "shared" 15 | }, 16 | "tasks": [ 17 | { 18 | "label": "all", 19 | "problemMatcher": "$gcc", 20 | "group": { 21 | "kind": "build", 22 | "isDefault": true 23 | } 24 | }, 25 | { 26 | "label": "flash", 27 | "problemMatcher": "$gcc" 28 | }, 29 | { 30 | "label": "clean", 31 | "problemMatcher": "$gcc" 32 | }, 33 | { 34 | "label": "monitor", 35 | "problemMatcher": "$gcc", 36 | "presentation": { 37 | "focus": true 38 | } 39 | }, 40 | { 41 | "label": "menuconfig", 42 | "problemMatcher": "$gcc", 43 | "presentation": { 44 | "focus": true 45 | } 46 | }, 47 | { 48 | "label": "defconfig", 49 | "problemMatcher": "$gcc" 50 | } 51 | ] 52 | } --------------------------------------------------------------------------------