Follow the steps at the [Espressif Getting Started guide](https://docs.espressif.com/projects/esp-idf/en/v4.0/get-started/index.html#step-3-set-up-the-tools).
This will guide you through using the `install.sh` (or `install.bat`) script
to download the toolchain and add it to your `PATH`. The steps are summarised
below:
After you've cloned and checked out the IDF to the correct version (see
above), run the `install.sh` script:
```bash
$ cd$ESPIDF
$ ./install.sh # (or install.bat on Windows)
```
(You don't need a full recursive clone; see the `ci_esp32_setup` function in
`tools/ci.sh` in this repository for more detailed set-up commands.)
Then in the `ports/esp32` directory, source the `export.sh` script to set the
`PATH`.
After you've cloned and checked out the IDF to the correct version, run the
`install.sh` script:
```bash
$ cd micropython/ports/esp32
$ source$ESPIDF/export.sh # (or path\to\esp-idf\export.bat on Windows)
$ # Run make etc, see below.
$ cd esp-idf
$ ./install.sh # (or install.bat on Windows)
$ source export.sh # (or export.bat on Windows)
```
The `install.sh` step only needs to be done once. You will need to source
`export.sh` for every new session.
Note: If you get an error about `--no-site-packages`, then modify
`$ESPIDF/tools/idf_tools.py` and make the same change as [this