Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify onboarding (VSC-426) #159

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
ee5405c
initial auto window
brianignacio5 Aug 10, 2020
eacf16d
initial setup window
brianignacio5 Aug 14, 2020
2aaa643
add tools setup methods
brianignacio5 Aug 17, 2020
07c21d6
complete one click install
brianignacio5 Aug 18, 2020
9527603
open py esp-idf folders
brianignacio5 Aug 19, 2020
553ec0e
add prerequisites validation
brianignacio5 Aug 20, 2020
2cd8ffd
add codicons and custom page
brianignacio5 Aug 24, 2020
aa1c791
add initial custom setup page
brianignacio5 Aug 25, 2020
0403fb6
idf download setup
brianignacio5 Aug 27, 2020
65eab41
add esp-idf cancel logic
brianignacio5 Aug 28, 2020
3ab7eeb
improve custom ui alignment
brianignacio5 Aug 31, 2020
f8625fd
idfToolManager simplify check tools cancel dload
brianignacio5 Sep 1, 2020
d6087df
progress tools cancel py env install
brianignacio5 Sep 2, 2020
47eafd0
cancel pkg extract save custom settings
brianignacio5 Sep 3, 2020
e634b2a
fix manual path issues
brianignacio5 Sep 3, 2020
72832ef
test on win 1
brianignacio5 Sep 4, 2020
01564a8
rm duplicate python manual path
brianignacio5 Sep 8, 2020
9f606ce
1 click install status window
brianignacio5 Sep 9, 2020
9d4e9b9
update status page
brianignacio5 Sep 10, 2020
687cb59
check esp-idf container and path on install page
brianignacio5 Sep 11, 2020
ea1985e
finished status rm custom
brianignacio5 Sep 14, 2020
7c298a4
status ui update
brianignacio5 Sep 15, 2020
275de0c
fix esp-idf url links
brianignacio5 Sep 15, 2020
86995ba
check default values env vars
brianignacio5 Sep 16, 2020
6ba66d4
install py reqs command
brianignacio5 Sep 16, 2020
2eefff9
install py req cmd in schema
brianignacio5 Sep 16, 2020
9761065
fix error message on esp-idf python
brianignacio5 Sep 22, 2020
e533463
enhance download progress ui
brianignacio5 Sep 23, 2020
c991489
Add status step background
brianignacio5 Sep 23, 2020
e0ce0d0
improve start ui and errors
brianignacio5 Sep 24, 2020
85b992f
improve tools ui status page
brianignacio5 Sep 25, 2020
ff9fe68
add custom setup ui
brianignacio5 Sep 25, 2020
089010b
check settings on extension activate
brianignacio5 Oct 9, 2020
aa4b780
rm old onboarding
brianignacio5 Oct 9, 2020
b7a2cbe
show setup when missing pre requisites
brianignacio5 Oct 9, 2020
1258c0e
rm test lines
brianignacio5 Oct 14, 2020
5474a53
rm testing on checkExistingSetttings
brianignacio5 Oct 14, 2020
fd4da10
improve setup css align and colors
brianignacio5 Oct 15, 2020
08ca4db
Merge branch 'master' into feature/simple-onboarding
brianignacio5 Oct 19, 2020
6928bfc
fix select erroMsg css rm home btn statusPage
brianignacio5 Oct 21, 2020
89ee873
Merge branch 'master' into feature/simple-onboarding
brianignacio5 Oct 26, 2020
f8c3a64
reject execChildProcess only on Error
brianignacio5 Oct 26, 2020
5089f97
fix childProcess cancelToken
brianignacio5 Oct 27, 2020
44e77dc
fix icons on vsix
brianignacio5 Oct 27, 2020
76ca0e6
add resolve url loader fix font codicon
brianignacio5 Oct 28, 2020
5beadff
Merge branch 'master' into feature/simple-onboarding
brianignacio5 Oct 29, 2020
88d8b1f
update yarn lock
brianignacio5 Oct 29, 2020
ec3153c
resolve url loader
brianignacio5 Oct 29, 2020
a8f8222
fix python list linux
brianignacio5 Oct 30, 2020
78b8be0
add font face to setup webview
brianignacio5 Nov 9, 2020
805daeb
Merge branch 'master' into feature/simple-onboarding
brianignacio5 Nov 9, 2020
4051b53
Merge branch 'master' into feature/simple-onboarding
brianignacio5 Nov 23, 2020
6315fcb
update codicon icons ensure idfContainer dir
brianignacio5 Nov 24, 2020
b6a3caa
fix path sep add def idfPath
brianignacio5 Nov 26, 2020
8dc2039
empty default manual idf path
brianignacio5 Nov 26, 2020
b9c6d5e
Merge branch 'master' into feature/simple-onboarding
brianignacio5 Dec 1, 2020
5999f34
log download error
brianignacio5 Dec 1, 2020
b60bbeb
initialize versions currentSetupValid
brianignacio5 Dec 2, 2020
33150dd
set percentage on idf and tools installed status
brianignacio5 Dec 3, 2020
c6e5a98
update setup docs
brianignacio5 Dec 4, 2020
df84c02
refactor setup panel highlight tools folder
brianignacio5 Dec 4, 2020
c0004fd
update doc paths
brianignacio5 Dec 4, 2020
94efca9
rm timeout test setup spaces
brianignacio5 Dec 8, 2020
c2ea4c1
fix python path with spaces
brianignacio5 Dec 8, 2020
756fdda
Merge branch 'feature/simple-onboarding' of github.com:brianignacio5/…
brianignacio5 Dec 8, 2020
ee7739d
Merge branch 'master' into feature/simple-onboarding
brianignacio5 Dec 8, 2020
eb579df
add fallback on env idf_path idf_tools_path
brianignacio5 Dec 11, 2020
ff7cb7b
Merge branch 'master' into feature/simple-onboarding
brianignacio5 Dec 30, 2020
48e507e
Merge branch 'master' into feature/simple-onboarding
brianignacio5 Jan 4, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add fallback on env idf_path idf_tools_path
  • Loading branch information
brianignacio5 committed Dec 11, 2020
commit eb579df11b307f2dd444e9e3f5094a0a1961d1a7
45 changes: 26 additions & 19 deletions docs/SETUP.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ESPRESSIF IDF extension for Visual Studio Code

When you start ESP-IDF extension, it will try to self-configure by looking for existing ESP-IDF directory in `~/esp/esp-idf` on MacOS/Linux and `%USERPROFILE%\esp\esp-idf` or `%USERPROFILE%\Desktop\esp-idf` in Windows. It will look for ESP-IDF Tools and ESP-IDF Python virtual environment in `~\.espressif` on MacOS/Linux and `%USERPROFILE%\.espressif` on Windows.
When you start ESP-IDF extension, it will try to self-configure by looking for existing ESP-IDF directory in `IDF_PATH` environment variable, `$HOME/esp/esp-idf` on MacOS/Linux and `%USERPROFILE%\esp\esp-idf` or `%USERPROFILE%\Desktop\esp-idf` in Windows. It will look for ESP-IDF Tools and ESP-IDF Python virtual environment in `IDF_TOOLS_PATH` environment variable, `$HOME\.espressif` on MacOS/Linux and `%USERPROFILE%\.espressif` on Windows.

If ESP-IDF and required ESP-IDF tools are found, these paths will be saved as Visual Studio Code Configuration settings, which are located in `press F1 -> type Preferences: Open Settings (UI)` and `press F1 -> type Preferences: Open Settings (JSON)`. These settings, as described in [README ESP-IDF Specific Settings](../README.md), are `idf.espIdfPath` for IDF_PATH, `idf.customExtraPaths` for ESP-IDF Tools paths to be appended to environment variable PATH, `idf.pythonBinPath` for absolute virtual environment python path and `idf.customExtraVars` for additional environment variables from ESP-IDF tools such as OPENOCD_SCRIPTS.

Expand All @@ -12,9 +12,9 @@ In Visual Studio Code press **F1** and type **ESP-IDF: Configure ESP-IDF extensi

Setup wizard provides 3 choices:

- Express install: Fastest option. Choose to either download selected ESP-IDF version or find ESP-IDF in your system, install ESP-IDF Tools and create python virtual environment with required packages on the path specified in `idf.toolsPath` on MacOS/Linux or `idf.toolsPathWin` in Windows, which has a default path value of in `~\.espressif` on MacOS/Linux and `%USERPROFILE%\.espressif` on Windows, respectively.
- Express install: Fastest option. Choose to either download selected ESP-IDF version or find ESP-IDF in your system, install ESP-IDF Tools and create python virtual environment with required packages on the path specified in `idf.toolsPath` on MacOS/Linux or `idf.toolsPathWin` in Windows, which has a default path value of in `$HOME\.espressif` on MacOS/Linux and `%USERPROFILE%\.espressif` on Windows, respectively.
- Advanced install: Configurable option. Choose to either download selected ESP-IDF version or find ESP-IDF in your system, install ESP-IDF Tools and create python virtual environment with required packages in the chosen location or manually specify each required ESP-IDF tool path.
- Use existing setup: If ESP-IDF is found in `idf.espIdfPath` (or `~/esp/esp-idf` on MacOS/Linux and `%USERPROFILE%\esp\esp-idf` or `%USERPROFILE%\Desktop\esp-idf` in Windows) and ESP-IDF tools in `idf.toolsPath` (or `~\.espressif` on MacOS/Linux and `%USERPROFILE%\.espressif` in Windows) then this option is shown to use an existing setup, install extension and extension debug adapter python requirements.
- Use existing setup: If ESP-IDF is found in `idf.espIdfPath` (or `$HOME/esp/esp-idf` on MacOS/Linux and `%USERPROFILE%\esp\esp-idf` or `%USERPROFILE%\Desktop\esp-idf` in Windows) and ESP-IDF tools in `idf.toolsPath` (or `$HOME\.espressif` on MacOS/Linux and `%USERPROFILE%\.espressif` in Windows) then this option is shown to use an existing setup, install extension and extension debug adapter python requirements.

After choosing any of the previous options, a status page is displayed showing ESP-IDF, tools and python environment install status. When the setup is finished, a message is shown that "All settings have been configured. You can close this window."

Expand All @@ -29,51 +29,58 @@ After choosing any of the previous options, a status page is displayed showing E
"idf.espIdfPath": "path/to/esp-idf",
"idf.customExtraPaths": "UPDATED_PATH",
"idf.customExtraVars": "{\"OPENOCD_SCRIPTS\":\"OPENOCD_FOLDER/share/openocd/scripts\"}",
"idf.pythonBinPath": "PYTHON_INTERPRETER"
"idf.pythonBinPath": "PYTHON_INTERPRETER",
"idf.openOcdConfigs": [
"interface/ftdi/esp32_devkitj_v1.cfg",
"board/esp32-wrover.cfg"
],
"idf.port": "DEVICE_PORT"
}
```

where **UPDATED_PATH** is the "Updated PATH variable" generated by `$IDF_PATH/export.sh`, **PYTHON_INTERPRETER** is the "Using Python interpreter in" value generated by `$IDF_PATH/export.sh`, the device port is your device serial port (COM1, /dev/cu.usbserial-1433401, etc) and idf.openOcdConfigs are the config files used for OpenOCD for your device (they are relative to OPENOCD_SCRIPTS directory).
where **UPDATED_PATH** is the "Updated PATH variable" generated by `$IDF_PATH/export.sh`, **PYTHON_INTERPRETER** is the "Using Python interpreter in" value generated by `$IDF_PATH/export.sh`, the DEVICE_PORT is your device serial port (COM1, /dev/cu.usbserial-1433401 or /dev/ttyUSB1 etc) and idf.openOcdConfigs are the config files used for OpenOCD for your device (they are relative to OPENOCD_SCRIPTS directory).

**DO NOT USE ~, $HOME OR %USERPROFILE%, ENVIRONMENT VARIABLES ARE NOT RESOLVED IN THIS CONFIGURATION SETTINGS. You could use ${env:HOME} to refer to \$HOME (Linux/MacOS) or %HOME% (Windows).**
**DO NOT USE ~, $HOME OR %USERPROFILE%, ENVIRONMENT VARIABLES ARE NOT RESOLVED IN THIS CONFIGURATION SETTINGS. You must use ${env:HOME} instead of \$HOME (Linux/MacOS) or %HOME% (Windows).**

Make sure to install the extension and extension debug adapter Python requirements by running the following commands in your terminal:

`PYTHON_INTERPRETER -m pip install -r EXTENSION_PATH/requirements.txt`
`PYTHON_INTERPRETER -m pip install -r EXTENSION_PATH/esp_debug_adapter/requirements.txt`
```
PYTHON_INTERPRETER -m pip install -r EXTENSION_PATH/requirements.txt
```

```
PYTHON_INTERPRETER -m pip install -r EXTENSION_PATH/esp_debug_adapter/requirements.txt
```

where EXTENSION_PATH is `%USERPROFILE%\.vscode\extensions\espressif.esp-idf-extension-VERSION` on Windows and `$HOME/.vscode/extensions/espressif.esp-idf-extension-VERSION` on Linux/MacOS.

### Example configuration setting values

An example python path for `idf.pythonBinPath` is `/home/myUser/.espressif/python_env/idf4.0_py3.5_env/bin/python` for MacOS/Linux users or `C:\Users\myUser\.espressif\python_env\idf4.0_py3.5_env\Scripts\python.exe` for Windows users.

For example if required ESP-IDF Tools are:

- OpenOCD executable path is _/home/myUser/.espressif/tools/openocd/version/openocd-esp32/bin/openocd_ or _C:\Users\myUser\.espressif\tools\openocd\version\openocd-esp32\bin\openocd_ (Windows)
- XtensaEsp32 executable path is _/home/myUser/.espressif/tools/xtensa-esp32/version/xtensa-esp32/bin/xtensa-esp32-gcc_ or _C:\Users\myUser\.espressif\tools\xtensa\version\xtensa-esp32\bin/xtensa-esp32-gcc_ (Windows)
- OpenOCD executable path is `/home/myUser/.espressif/tools/openocd-esp32/version/openocd-esp32/bin/openocd` or `C:\Users\myUser\.espressif\tools\openocd-esp32\version\openocd-esp32\bin\openocd` (Windows)
- XtensaEsp32 executable path is `/home/myUser/.espressif/tools/xtensa-esp32/version/xtensa-esp32/bin/xtensa-esp32-gcc` or `C:\Users\myUser\.espressif\tools\xtensa\version\xtensa-esp32\bin\xtensa-esp32-gcc` (Windows)

you need to set in `idf.customExtraPaths`:

- Linux/MacOS users

```
/home/myUser/\.espressif\tools\openocd\version\openocd-esp32\bin:/home/myUser/.espressif/tools/xtensa-esp32/version/xtensa-esp32/bin
/home/myUser/.espressif/tools/openocd/version/openocd-esp32/bin:/home/myUser/.espressif/tools/xtensa-esp32/version/xtensa-esp32/bin
```

- Windows users

```
C:\Users\myUser\.espressif\tools\openocd\version\openocd-esp32\bin;C:\Users\myUser\.espressif\tools\xtensa-esp32\version\xtensa-esp32\bin
C:\Users\myUser\.espressif\tools\openocd-esp32\version\openocd-esp32\bin;C:\Users\myUser\.espressif\tools\xtensa-esp32\version\xtensa-esp32\bin
```

`idf.customExtraVars` is an object saved in Visual Studio Code's settings.json that looks like this (**Make sure to replace \${TOOL_PATH} with the tool path**):
`idf.customExtraVars` is an JSON object saved in Visual Studio Code's settings.json (**Make sure to replace \${TOOL_PATH} with the tool path**):

```
{
...,
OPENOCD_SCRIPTS: "...",
OTHER_ENV_VAR: "...",
...
}
"idf.customExtraVars": "{\"OPENOCD_SCRIPTS\":\"/home/myUser/.espressif/tools/openocd-esp32/version/openocd-esp32/share/openocd/scripts\"}"
```

The list of required `idf.customExtraVars` can be found in `$IDF_PATH/tools/tools.json` (replace **\${TOOL_PATH}** with tool location) and they should be filled for the extension to work properly.
Expand Down
10 changes: 8 additions & 2 deletions src/setup/setupInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,14 @@ export async function checkPreviousInstall(pythonVersions: string[]) {

const confEspIdfPath = idfConf.readParameter("idf.espIdfPath") as string;
const confToolsPath = idfConf.readParameter("idf.toolsPath") as string;
const toolsPath = confToolsPath || path.join(containerPath, ".espressif");
let espIdfPath = confEspIdfPath || path.join(containerPath, "esp", "esp-idf");
const toolsPath =
confToolsPath ||
process.env.IDF_TOOLS_PATH ||
path.join(containerPath, ".espressif");
let espIdfPath =
confEspIdfPath ||
process.env.IDF_PATH ||
path.join(containerPath, "esp", "esp-idf");
let idfPathVersion = await utils.getEspIdfVersion(espIdfPath);
if (idfPathVersion === "x.x" && process.platform === "win32") {
espIdfPath = path.join(process.env.USERPROFILE, "Desktop", "esp-idf");
Expand Down