esp32/README: Update toolchain setup.

This commit is contained in:
Ayke van Laethem 2017-12-10 18:25:33 +01:00 committed by Damien George
parent 7a46d9ae73
commit f16c775a07
2 changed files with 28 additions and 24 deletions

View File

@ -21,19 +21,23 @@ FLASH_FREQ ?= 40m
FLASH_SIZE ?= 4MB FLASH_SIZE ?= 4MB
CROSS_COMPILE ?= xtensa-esp32-elf- CROSS_COMPILE ?= xtensa-esp32-elf-
ESPIDF_SUPHASH := 2c95a77cf93781f296883d5dbafcdc18e4389656
# paths to ESP IDF and its components # paths to ESP IDF and its components
ifeq ($(ESPIDF),) ifeq ($(ESPIDF),)
ifneq ($(IDF_PATH),) ifneq ($(IDF_PATH),)
ESPIDF = $(IDF_PATH) ESPIDF = $(IDF_PATH)
else else
$(error Please configure the ESPIDF variable) $(info The ESPIDF variable has not been set, please set it to the root of the esp-idf repository.)
$(info See README.md for installation instructions.)
$(info Supported git hash: $(ESPIDF_SUPHASH))
$(error ESPIDF not set)
endif endif
endif endif
ESPCOMP = $(ESPIDF)/components ESPCOMP = $(ESPIDF)/components
ESPTOOL ?= $(ESPCOMP)/esptool_py/esptool/esptool.py ESPTOOL ?= $(ESPCOMP)/esptool_py/esptool/esptool.py
# verify the ESP IDF version # verify the ESP IDF version
ESPIDF_SUPHASH := 2c95a77cf93781f296883d5dbafcdc18e4389656
ESPIDF_CURHASH := $(shell git -C $(ESPIDF) show -s --pretty=format:'%H') ESPIDF_CURHASH := $(shell git -C $(ESPIDF) show -s --pretty=format:'%H')
ifneq ($(ESPIDF_CURHASH),$(ESPIDF_SUPHASH)) ifneq ($(ESPIDF_CURHASH),$(ESPIDF_SUPHASH))
$(info ** WARNING **) $(info ** WARNING **)

View File

@ -26,34 +26,28 @@ There are two main components that are needed to build the firmware:
different to the compiler used by the ESP8266) different to the compiler used by the ESP8266)
- the Espressif IDF (IoT development framework, aka SDK) - the Espressif IDF (IoT development framework, aka SDK)
Instructions for setting up both of these components are provided by the The ESP-IDF changes quickly and MicroPython only supports a certain version. The
ESP-IDF itself, which is found at https://github.com/espressif/esp-idf . git hash of this version can be found by running `make` without a configured
Follow the guide "Setting Up ESP-IDF", for Windows, Mac or Linux. You `ESPIDF`. Then you can fetch only the given esp-idf using the following command:
only need to perform up to "Step 2" of the guide, by which stage you
should have installed the cross-compile and cloned the ESP-IDF repository. $ git clone https://github.com/espressif/esp-idf.git
$ git checkout <Current supported ESP-IDF commit hash>
$ git submodule update --recursive
The binary toolchain (binutils, gcc, etc.) can be installed using the following
guides:
* [Linux installation](https://esp-idf.readthedocs.io/en/latest/get-started/linux-setup.html)
* [MacOS installation](https://esp-idf.readthedocs.io/en/latest/get-started/macos-setup.html)
* [Windows installation](https://esp-idf.readthedocs.io/en/latest/get-started/windows-setup.html)
If you are on a Windows machine then the If you are on a Windows machine then the
[Windows Subsystem for Linux](https://msdn.microsoft.com/en-au/commandline/wsl/install_guide) [Windows Subsystem for Linux](https://msdn.microsoft.com/en-au/commandline/wsl/install_guide)
is the most efficient way to install the ESP32 toolchain and build the project. is the most efficient way to install the ESP32 toolchain and build the project.
If you use WSL then follow the If you use WSL then follow the
[Linux guidelines](http://esp-idf.readthedocs.io/en/latest/get-started/linux-setup.html) [Linux guidelines](https://esp-idf.readthedocs.io/en/latest/get-started/linux-setup.html)
for the ESP-IDF instead of the Windows ones. for the ESP-IDF instead of the Windows ones.
Be advised that the ESP-IDF is still undergoing changes and only some
versions are supported. To find which build is compatible refer to the line
in the makefile containing the following:
```
ESPIDF_SUPHASH := <Current supported ESP-IDF commit hash>
```
After finishing "Step 2" you can roll back your current build of
the ESP-IDF (and update the submodules accordingly) using:
```
$ git checkout <Current supported ESP-IDF commit hash>
$ git submodule update --recursive
```
Note that you will get a warning when building the code if the ESP-IDF
version is incorrect.
The Espressif ESP-IDF instructions above only install pyserial for Python 2, The Espressif ESP-IDF instructions above only install pyserial for Python 2,
so if you're running Python 3 or a non-system Python you'll also need to so if you're running Python 3 or a non-system Python you'll also need to
install `pyserial` (or `esptool`) so that the Makefile can flash the board install `pyserial` (or `esptool`) so that the Makefile can flash the board
@ -64,7 +58,13 @@ $ pip install pyserial
Once everything is set up you should have a functioning toolchain with Once everything is set up you should have a functioning toolchain with
prefix xtensa-esp32-elf- (or otherwise if you configured it differently) prefix xtensa-esp32-elf- (or otherwise if you configured it differently)
as well as a copy of the ESP-IDF repository. as well as a copy of the ESP-IDF repository. You will need to update your `PATH`
environment variable to include the ESP32 toolchain. For example, you can issue
the following commands on (at least) Linux:
$ export PATH=$PATH:$HOME/esp/crosstool-NG/builds/xtensa-esp32-elf/bin
You cam put this command in your `.profile` or `.bash_login`.
You then need to set the `ESPIDF` environment/makefile variable to point to You then need to set the `ESPIDF` environment/makefile variable to point to
the root of the ESP-IDF repository. You can set the variable in your PATH, the root of the ESP-IDF repository. You can set the variable in your PATH,