espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.76k stars 7.3k forks source link

VSCode works really well. Worth adding setup instructions in to the docs? (IDF-88) #303

Closed grisevg closed 4 years ago

grisevg commented 7 years ago

Hey guys,

I've tried configuring Visual Studio Code for IDF development on Linux and it works really well (for example Eclipse would fail to resolve portTICK_PERIOD_MS for me, while VSCode resolves it nicely).

Here's what I had to do to get basic functionality working:

  1. Install C/C++ extension for VSCode
  2. Create .vscode/c_cpp_properties.json with header search paths:
    {
    "configurations": [
        {
            "name": "Linux",
            "includePath": ["/home/grisevg/esp/esp-idf/components/"],
            "browse" : {
                "limitSymbolsToIncludedHeaders" : true,
                "databaseFilename" : ""
            }
        }
    ]
    }
  3. Create .vscode/tasks.json with a build task and error parser
    {
    "version": "0.1.0",
    "command": "bash",
    "args": ["-c"],
    "isShellCommand": true,
    "showOutput": "always",
    "suppressTaskName": true,
    "options": {
        "cwd": "${workspaceRoot}",
        "env": { 
            "IDF_PATH" : "/home/grisevg/esp/esp-idf", 
            "PATH" : "${env.PATH}:/home/grisevg/esp/xtensa-esp32-elf/bin" 
        }
    },
    "tasks": [
        {
            "taskName": "build app",
            "args": ["make app"],
            "isBuildCommand": true,
            "problemMatcher": {
                "owner": "cpp",
                "fileLocation": "absolute",
                "pattern": {
                    "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
                    "file": 1,
                    "line": 2,
                    "column": 3,
                    "severity": 4,
                    "message": 5
                }
            }
        },
        {
            "taskName": "clean app",
            "args": ["make app-clean"]
        },
        {
            "taskName": "monitor",
            "args": ["make monitor"]
        },
        {
            "taskName": "flash app",
            "args": ["make app-flash"]
        }
    ]
    }

It's not perfect, as you have to manually specify include path, path to IDF and path to the toolchain, but same goes for Eclipse.

Do you guys think it's worth adding to the docs? Of course question of what IDE is better is a personal choice, but considering that VSCode is very popular, cross-platform and works really well, I think it's worth adding to the getting started docs.

KaeLL commented 10 months ago

https://www.reddit.com/r/embedded/comments/11mdgz5/makefile_versus_cmake_build_system/jbkgob3/?context=3