Merge branch 'feature/python_future' into 'master'

Add python-future by using python requirements file

See merge request idf/esp-idf!2973
This commit is contained in:
Angus Gratton 2018-08-24 08:04:18 +08:00
commit c7f4fae8d0
18 changed files with 282 additions and 34 deletions

View file

@ -49,7 +49,7 @@ $(BLANK_OTA_DATA_FILE): partition_table_get_info
blank_ota_data: $(BLANK_OTA_DATA_FILE) blank_ota_data: $(BLANK_OTA_DATA_FILE)
erase_ota: partition_table_get_info erase_ota: partition_table_get_info check_python_dependencies
@echo $(if $(OTA_DATA_OFFSET), "Erase ota_data [addr=$(OTA_DATA_OFFSET) size=$(OTA_DATA_SIZE)] ...", $(error "ERROR: Partition table does not have ota_data partition.")) @echo $(if $(OTA_DATA_OFFSET), "Erase ota_data [addr=$(OTA_DATA_OFFSET) size=$(OTA_DATA_SIZE)] ...", $(error "ERROR: Partition table does not have ota_data partition."))
$(ESPTOOLPY_SERIAL) erase_region $(OTA_DATA_OFFSET) $(OTA_DATA_SIZE) $(ESPTOOLPY_SERIAL) erase_region $(OTA_DATA_OFFSET) $(OTA_DATA_SIZE)

View file

@ -49,14 +49,14 @@ ifndef CONFIG_SECURE_BOOT_ENABLED
# If secure boot disabled, bootloader flashing is integrated # If secure boot disabled, bootloader flashing is integrated
# with 'make flash' and no warnings are printed. # with 'make flash' and no warnings are printed.
bootloader: $(BOOTLOADER_BIN) bootloader: $(BOOTLOADER_BIN) | check_python_dependencies
@echo $(SEPARATOR) @echo $(SEPARATOR)
@echo "Bootloader built. Default flash command is:" @echo "Bootloader built. Default flash command is:"
@echo "$(ESPTOOLPY_WRITE_FLASH) $(BOOTLOADER_OFFSET) $^" @echo "$(ESPTOOLPY_WRITE_FLASH) $(BOOTLOADER_OFFSET) $^"
ESPTOOL_ALL_FLASH_ARGS += $(BOOTLOADER_OFFSET) $(BOOTLOADER_BIN) ESPTOOL_ALL_FLASH_ARGS += $(BOOTLOADER_OFFSET) $(BOOTLOADER_BIN)
bootloader-flash: $(BOOTLOADER_BIN) $(call prereq_if_explicit,erase_flash) bootloader-flash: $(BOOTLOADER_BIN) $(call prereq_if_explicit,erase_flash) check_python_dependencies
$(ESPTOOLPY_WRITE_FLASH) 0x1000 $^ $(ESPTOOLPY_WRITE_FLASH) 0x1000 $^
else ifdef CONFIG_SECURE_BOOTLOADER_ONE_TIME_FLASH else ifdef CONFIG_SECURE_BOOTLOADER_ONE_TIME_FLASH
@ -67,7 +67,7 @@ else ifdef CONFIG_SECURE_BOOTLOADER_ONE_TIME_FLASH
# The flashing command is deliberately printed without an auto-reset # The flashing command is deliberately printed without an auto-reset
# step, so the device doesn't immediately reset to flash itself. # step, so the device doesn't immediately reset to flash itself.
bootloader: $(BOOTLOADER_BIN) bootloader: $(BOOTLOADER_BIN) | check_python_dependencies
@echo $(SEPARATOR) @echo $(SEPARATOR)
@echo "Bootloader built. One-time flash command is:" @echo "Bootloader built. One-time flash command is:"
@echo "$(subst hard_reset,no_reset,$(ESPTOOLPY_WRITE_FLASH)) $(BOOTLOADER_OFFSET) $(BOOTLOADER_BIN)" @echo "$(subst hard_reset,no_reset,$(ESPTOOLPY_WRITE_FLASH)) $(BOOTLOADER_OFFSET) $(BOOTLOADER_BIN)"
@ -82,7 +82,7 @@ BOOTLOADER_DIGEST_BIN := $(BOOTLOADER_BUILD_DIR)/bootloader-reflash-digest.bin
SECURE_BOOTLOADER_KEY := $(BOOTLOADER_BUILD_DIR)/secure-bootloader-key.bin SECURE_BOOTLOADER_KEY := $(BOOTLOADER_BUILD_DIR)/secure-bootloader-key.bin
ifdef CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES ifdef CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES
$(SECURE_BOOTLOADER_KEY): $(SECURE_BOOT_SIGNING_KEY) $(SECURE_BOOTLOADER_KEY): $(SECURE_BOOT_SIGNING_KEY) | check_python_dependencies
$(ESPSECUREPY) digest_private_key -k $< $@ $(ESPSECUREPY) digest_private_key -k $< $@
else else
$(SECURE_BOOTLOADER_KEY): $(SECURE_BOOTLOADER_KEY):
@ -105,7 +105,7 @@ bootloader: $(BOOTLOADER_DIGEST_BIN)
@echo "* After first boot, only re-flashes of this kind (with same key) will be accepted." @echo "* After first boot, only re-flashes of this kind (with same key) will be accepted."
@echo "* Not recommended to re-use the same secure boot keyfile on multiple production devices." @echo "* Not recommended to re-use the same secure boot keyfile on multiple production devices."
$(BOOTLOADER_DIGEST_BIN): $(BOOTLOADER_BIN) $(SECURE_BOOTLOADER_KEY) $(BOOTLOADER_DIGEST_BIN): $(BOOTLOADER_BIN) $(SECURE_BOOTLOADER_KEY) | check_python_dependencies
@echo "DIGEST $(notdir $@)" @echo "DIGEST $(notdir $@)"
$(ESPSECUREPY) digest_secure_bootloader -k $(SECURE_BOOTLOADER_KEY) -o $@ $< $(ESPSECUREPY) digest_secure_bootloader -k $(SECURE_BOOTLOADER_KEY) -o $@ $<

View file

@ -55,17 +55,17 @@ endif
# non-secure boot (or bootloader), both these files are the same # non-secure boot (or bootloader), both these files are the same
APP_BIN_UNSIGNED ?= $(APP_BIN) APP_BIN_UNSIGNED ?= $(APP_BIN)
$(APP_BIN_UNSIGNED): $(APP_ELF) $(ESPTOOLPY_SRC) $(APP_BIN_UNSIGNED): $(APP_ELF) $(ESPTOOLPY_SRC) | check_python_dependencies
$(ESPTOOLPY) elf2image $(ESPTOOL_FLASH_OPTIONS) $(ESPTOOL_ELF2IMAGE_OPTIONS) -o $@ $< $(ESPTOOLPY) elf2image $(ESPTOOL_FLASH_OPTIONS) $(ESPTOOL_ELF2IMAGE_OPTIONS) -o $@ $<
flash: all_binaries $(ESPTOOLPY_SRC) $(call prereq_if_explicit,erase_flash) partition_table_get_info flash: all_binaries $(ESPTOOLPY_SRC) $(call prereq_if_explicit,erase_flash) partition_table_get_info check_python_dependencies
@echo "Flashing binaries to serial port $(ESPPORT) (app at offset $(APP_OFFSET))..." @echo "Flashing binaries to serial port $(ESPPORT) (app at offset $(APP_OFFSET))..."
ifdef CONFIG_SECURE_BOOT_ENABLED ifdef CONFIG_SECURE_BOOT_ENABLED
@echo "(Secure boot enabled, so bootloader not flashed automatically. See 'make bootloader' output)" @echo "(Secure boot enabled, so bootloader not flashed automatically. See 'make bootloader' output)"
endif endif
$(ESPTOOLPY_WRITE_FLASH) $(ESPTOOL_ALL_FLASH_ARGS) $(ESPTOOLPY_WRITE_FLASH) $(ESPTOOL_ALL_FLASH_ARGS)
app-flash: $(APP_BIN) $(ESPTOOLPY_SRC) $(call prereq_if_explicit,erase_flash) partition_table_get_info app-flash: $(APP_BIN) $(ESPTOOLPY_SRC) $(call prereq_if_explicit,erase_flash) partition_table_get_info check_python_dependencies
@echo "Flashing app to serial port $(ESPPORT), offset $(APP_OFFSET)..." @echo "Flashing app to serial port $(ESPPORT), offset $(APP_OFFSET)..."
$(ESPTOOLPY_WRITE_FLASH) $(APP_OFFSET) $(APP_BIN) $(ESPTOOLPY_WRITE_FLASH) $(APP_OFFSET) $(APP_BIN)
@ -73,7 +73,7 @@ app-flash: $(APP_BIN) $(ESPTOOLPY_SRC) $(call prereq_if_explicit,erase_flash) pa
# at the project level as long as qualified path # at the project level as long as qualified path
COMPONENT_SUBMODULES += $(COMPONENT_PATH)/esptool COMPONENT_SUBMODULES += $(COMPONENT_PATH)/esptool
erase_flash: erase_flash: check_python_dependencies
@echo "Erasing entire flash..." @echo "Erasing entire flash..."
$(ESPTOOLPY_SERIAL) erase_flash $(ESPTOOLPY_SERIAL) erase_flash
@ -90,14 +90,14 @@ endif
# note: if you want to run miniterm from command line, can simply run # note: if you want to run miniterm from command line, can simply run
# miniterm.py on the console. The '$(PYTHON) -m serial.tools.miniterm' # miniterm.py on the console. The '$(PYTHON) -m serial.tools.miniterm'
# is to allow for the $(PYTHON) variable overriding the python path. # is to allow for the $(PYTHON) variable overriding the python path.
simple_monitor: $(call prereq_if_explicit,%flash) simple_monitor: check_python_dependencies $(call prereq_if_explicit,%flash)
$(MONITOR_PYTHON) -m serial.tools.miniterm --rts 0 --dtr 0 --raw $(ESPPORT) $(MONITORBAUD) $(MONITOR_PYTHON) -m serial.tools.miniterm --rts 0 --dtr 0 --raw $(ESPPORT) $(MONITORBAUD)
PRINT_FILTER ?= PRINT_FILTER ?=
MONITOR_OPTS := --baud $(MONITORBAUD) --port $(ESPPORT) --toolchain-prefix $(CONFIG_TOOLPREFIX) --make "$(MAKE)" --print_filter "$(PRINT_FILTER)" MONITOR_OPTS := --baud $(MONITORBAUD) --port $(ESPPORT) --toolchain-prefix $(CONFIG_TOOLPREFIX) --make "$(MAKE)" --print_filter "$(PRINT_FILTER)"
monitor: $(call prereq_if_explicit,%flash) monitor: check_python_dependencies $(call prereq_if_explicit,%flash)
$(summary) MONITOR $(summary) MONITOR
[ -f $(APP_ELF) ] || echo "*** 'make monitor' target requires an app to be compiled and flashed first." [ -f $(APP_ELF) ] || echo "*** 'make monitor' target requires an app to be compiled and flashed first."
[ -f $(APP_ELF) ] || echo "*** Run 'make flash monitor' to build, flash and monitor" [ -f $(APP_ELF) ] || echo "*** Run 'make flash monitor' to build, flash and monitor"

View file

@ -56,7 +56,7 @@ else
PARTITION_TABLE_BIN_UNSIGNED := $(PARTITION_TABLE_BIN) PARTITION_TABLE_BIN_UNSIGNED := $(PARTITION_TABLE_BIN)
endif endif
$(PARTITION_TABLE_BIN_UNSIGNED): $(PARTITION_TABLE_CSV_PATH) $(SDKCONFIG_MAKEFILE) $(PARTITION_TABLE_BIN_UNSIGNED): $(PARTITION_TABLE_CSV_PATH) $(SDKCONFIG_MAKEFILE) | check_python_dependencies
@echo "Building partitions from $(PARTITION_TABLE_CSV_PATH)..." @echo "Building partitions from $(PARTITION_TABLE_CSV_PATH)..."
$(GEN_ESP32PART) $< $@ $(GEN_ESP32PART) $< $@
@ -76,7 +76,7 @@ export OTA_DATA_SIZE
PARTITION_TABLE_FLASH_CMD = $(ESPTOOLPY_SERIAL) write_flash $(PARTITION_TABLE_OFFSET) $(PARTITION_TABLE_BIN) PARTITION_TABLE_FLASH_CMD = $(ESPTOOLPY_SERIAL) write_flash $(PARTITION_TABLE_OFFSET) $(PARTITION_TABLE_BIN)
ESPTOOL_ALL_FLASH_ARGS += $(PARTITION_TABLE_OFFSET) $(PARTITION_TABLE_BIN) ESPTOOL_ALL_FLASH_ARGS += $(PARTITION_TABLE_OFFSET) $(PARTITION_TABLE_BIN)
partition_table: $(PARTITION_TABLE_BIN) partition_table_get_info partition_table: $(PARTITION_TABLE_BIN) partition_table_get_info check_python_dependencies
@echo "Partition table binary generated. Contents:" @echo "Partition table binary generated. Contents:"
@echo $(SEPARATOR) @echo $(SEPARATOR)
$(GEN_ESP32PART) $< $(GEN_ESP32PART) $<
@ -84,7 +84,7 @@ partition_table: $(PARTITION_TABLE_BIN) partition_table_get_info
@echo "Partition flashing command:" @echo "Partition flashing command:"
@echo "$(PARTITION_TABLE_FLASH_CMD)" @echo "$(PARTITION_TABLE_FLASH_CMD)"
partition_table-flash: $(PARTITION_TABLE_BIN) partition_table-flash: $(PARTITION_TABLE_BIN) check_python_dependencies
@echo "Flashing partition table..." @echo "Flashing partition table..."
$(PARTITION_TABLE_FLASH_CMD) $(PARTITION_TABLE_FLASH_CMD)

View file

@ -136,6 +136,26 @@ Setup Path to ESP-IDF
The toolchain programs access ESP-IDF using ``IDF_PATH`` environment variable. This variable should be set up on your PC, otherwise projects will not build. Setting may be done manually, each time PC is restarted. Another option is to set up it permanently by defining ``IDF_PATH`` in user profile. To do so, follow instructions specific to :ref:`Windows <add-idf_path-to-profile-windows>` , :ref:`Linux and MacOS <add-idf_path-to-profile-linux-macos>` in section :doc:`add-idf_path-to-profile`. The toolchain programs access ESP-IDF using ``IDF_PATH`` environment variable. This variable should be set up on your PC, otherwise projects will not build. Setting may be done manually, each time PC is restarted. Another option is to set up it permanently by defining ``IDF_PATH`` in user profile. To do so, follow instructions specific to :ref:`Windows <add-idf_path-to-profile-windows>` , :ref:`Linux and MacOS <add-idf_path-to-profile-linux-macos>` in section :doc:`add-idf_path-to-profile`.
.. _get-started-get-packages:
Install the Required Python Packages
====================================
Python packages required by ESP-IDF are located in the ``$IDF_PATH/requirements.txt`` file. You can install them by running::
sudo python -m pip install -r $IDF_PATH/requirements.txt
or you can use the following command for installing them into the user install directory on systems where you don't have administrator rights::
python -m pip install --user -r $IDF_PATH/requirements.txt
.. note::
Please invoke that version of the Python interpreter which you will be using with ESP-IDF. The version of the
interpreter can be checked by running command ``python --version`` and depending on the result, you might want to
use ``python2``, ``python2.7`` or similar instead of ``python``, e.g.::
sudo python2.7 -m pip install -r $IDF_PATH/requirements.txt
.. _get-started-start-project: .. _get-started-start-project:

View file

@ -18,6 +18,11 @@ To compile with ESP-IDF you need to get the following packages:
sudo pacman -S --needed gcc git make ncurses flex bison gperf python2-pyserial sudo pacman -S --needed gcc git make ncurses flex bison gperf python2-pyserial
.. note::
Some older (pre-2014) Linux distributions may use ``pyserial`` version 2.x which is not supported by ESP-IDF.
In this case please install a supported version via ``pip`` as it is described in section
:ref:`get-started-get-packages`.
Compile the Toolchain from Source Compile the Toolchain from Source
================================= =================================

View file

@ -21,6 +21,11 @@ To compile with ESP-IDF you need to get the following packages:
sudo pacman -S --needed gcc git make ncurses flex bison gperf python2-pyserial sudo pacman -S --needed gcc git make ncurses flex bison gperf python2-pyserial
.. note::
Some older (pre-2014) Linux distributions may use ``pyserial`` version 2.x which is not supported by ESP-IDF.
In this case please install a supported version via ``pip`` as it is described in section
:ref:`get-started-get-packages`.
Toolchain Setup Toolchain Setup
=============== ===============

View file

@ -9,10 +9,9 @@ Install Prerequisites
sudo easy_install pip sudo easy_install pip
- install pyserial:: .. note::
sudo pip install pyserial
``pip`` will be used later for installing :ref:`the required Python packages <get-started-get-packages>`.
Compile the Toolchain from Source Compile the Toolchain from Source
================================= =================================

View file

@ -10,10 +10,9 @@ Install Prerequisites
sudo easy_install pip sudo easy_install pip
- install pyserial:: .. note::
sudo pip install pyserial
``pip`` will be used later for installing :ref:`the required Python packages <get-started-get-packages>`.
Toolchain Setup Toolchain Setup
=============== ===============

View file

@ -133,6 +133,30 @@ ESP32 是一套 Wi-Fi (2.4 GHz) 和蓝牙 (4.2) 双模解决方案,集成了
工具链程序使用环境变量 ``IDF_PATH`` 来访问 ESP-IDF。这个变量应该设置在你的 PC 中,否则工程将不能编译。你可以在每次 PC 重启时手工设置,也可以通过在用户配置文件中定义 ``IDF_PATH`` 变量来永久性设置。要永久性设置,请参考 :doc:`add-idf_path-to-profile` 文档中 :ref:`Windows <add-idf_path-to-profile-windows>`:ref:`Linux and MacOS <add-idf_path-to-profile-linux-macos>` 相关的指导进行操作。 工具链程序使用环境变量 ``IDF_PATH`` 来访问 ESP-IDF。这个变量应该设置在你的 PC 中,否则工程将不能编译。你可以在每次 PC 重启时手工设置,也可以通过在用户配置文件中定义 ``IDF_PATH`` 变量来永久性设置。要永久性设置,请参考 :doc:`add-idf_path-to-profile` 文档中 :ref:`Windows <add-idf_path-to-profile-windows>`:ref:`Linux and MacOS <add-idf_path-to-profile-linux-macos>` 相关的指导进行操作。
.. _get-started-get-packages:
安装依赖的 Python 软件包
====================================
ESP-IDF 所依赖的 Python 软件包位于 ``$IDF_PATH/requirements.txt`` 文件中,您可以通过运行以下命令来安装它们:
.. code:: bash
sudo python -m pip install -r $IDF_PATH/requirements.txt
如果您没有系统的管理员权限,那么可以使用如下命令来将软件包安装到用户目录中:
.. code:: bash
python -m pip install --user -r $IDF_PATH/requirements.txt
.. note::
Please invoke that version of the Python interpreter which you will be using with ESP-IDF. The version of the
interpreter can be checked by running command ``python --version`` and depending on the result, you might want to
use ``python2``, ``python2.7`` or similar instead of ``python``, e.g.::
sudo python2.7 -m pip install -r $IDF_PATH/requirements.txt
.. _get-started-start-project: .. _get-started-start-project:

View file

@ -1 +1,70 @@
.. include:: ../../en/get-started/linux-setup-scratch.rst **********************************
从零开始设置 Linux 环境下的工具链
**********************************
除了直接从 Espressif 官网下载二进制格式的工具链,下面将再介绍一种可替代的办法。如果想要快速设置二进制工具链而不是手动从源码编译,请做好备份,并前往 :doc:`Linux 环境下的设置 <linux-setup>` 章节。
安装必要的工具
==============
要想使用 ESP-IDF 进行编译,您需要获取以下软件包:
- Ubuntu 和 Debian::
sudo apt-get install git wget make libncurses-dev flex bison gperf python python-serial
- Arch::
sudo pacman -S --needed gcc git make ncurses flex bison gperf python2-pyserial
.. note::
一些旧的2014年之前Linux 发行版中使用的 ``pyserial`` 版本可能是 2.x ESP-IDF并不支持。
在这种情况下,请参考 :ref:`安装依赖的 Python 软件包 <get-started-get-packages>` 章节,通过 ``pip`` 工具来安装支持的版本。
从源代码编译工具链
==================
- 安装依赖:
- CentOS 7::
sudo yum install gawk gperf grep gettext ncurses-devel python python-devel automake bison flex texinfo help2man libtool
- Ubuntu pre-16.04::
sudo apt-get install gawk gperf grep gettext libncurses-dev python python-dev automake bison flex texinfo help2man libtool
- Ubuntu 16.04::
sudo apt-get install gawk gperf grep gettext python python-dev automake bison flex texinfo help2man libtool libtool-bin
- Debian 9::
sudo apt-get install gawk gperf grep gettext libncurses-dev python python-dev automake bison flex texinfo help2man libtool libtool-bin
- Arch::
TODO
下载 ``crosstool-NG`` 然后编译::
cd ~/esp
git clone -b xtensa-1.22.x https://github.com/espressif/crosstool-NG.git
cd crosstool-NG
./bootstrap && ./configure --enable-local && make install
编译工具链::
./ct-ng xtensa-esp32-elf
./ct-ng build
chmod -R u+w builds/xtensa-esp32-elf
编译得到的工具链会被保存到 ``~/esp/crosstool-NG/builds/xtensa-esp32-elf``。根据 :ref:`Linux 下设置环境变量的标准方法 <setup-linux-toolchain-add-it-to-path>` 中的介绍,将工具链添加到 ``PATH`` 中。
下一步
======
继续设置开发环境,请前往 :ref:`获取 ESP-IDF <get-started-get-esp-idf>` 章节。

View file

@ -20,6 +20,11 @@ Linux 平台工具链的标准设置
sudo pacman -S --needed gcc git make ncurses flex bison gperf python2-pyserial sudo pacman -S --needed gcc git make ncurses flex bison gperf python2-pyserial
.. note::
一些旧的2014年之前Linux 发行版中使用的 ``pyserial`` 版本可能是 2.x ESP-IDF并不支持。
在这种情况下,请参考 :ref:`安装依赖的 Python 软件包 <get-started-get-packages>` 章节,通过 ``pip`` 工具来安装支持的版本。
工具链的设置 工具链的设置
=============== ===============

View file

@ -1 +1,66 @@
.. include:: ../../en/get-started/macos-setup-scratch.rst **********************************
从零开始设置 Mac OS 环境下的工具链
**********************************
安装必要的工具
=====================
- 安装 pip::
sudo easy_install pip
.. note::
``pip`` 稍后将用于安装 :ref:`必要的 Python 软件包 <get-started-get-packages>`
从源代码编译工具链
==================
- 安装依赖:
- 安装 MacPorts_ 或者 homebrew_ 包管理器。MacPorts 需要安装完整的 XCode 软件,但是 homebrew 只需要安装 XCode 命令行工具即可。
.. _homebrew: https://brew.sh/
.. _MacPorts: https://www.macports.org/install.php
- 对于 MacPorts::
sudo port install gsed gawk binutils gperf grep gettext wget libtool autoconf automake
- 对于 homebrew::
brew install gnu-sed gawk binutils gperftools gettext wget help2man libtool autoconf automake
创建大小写敏感的文件系统镜像::
hdiutil create ~/esp/crosstool.dmg -volname "ctng" -size 10g -fs "Case-sensitive HFS+"
挂载::
hdiutil mount ~/esp/crosstool.dmg
创建指向你工作目录的符号链接::
cd ~/esp
ln -s /Volumes/ctng crosstool-NG
下载 ``crosstool-NG`` 然后编译::
cd ~/esp
git clone -b xtensa-1.22.x https://github.com/espressif/crosstool-NG.git
cd crosstool-NG
./bootstrap && ./configure --enable-local && make install
编译工具链::
./ct-ng xtensa-esp32-elf
./ct-ng build
chmod -R u+w builds/xtensa-esp32-elf
编译得到的工具链会被保存到 ``~/esp/crosstool-NG/builds/xtensa-esp32-elf``。根据 :ref:`Mac OS 下设置环境变量的标准方法 <setup-macos-toolchain-add-it-to-path>` 中的介绍,将工具链添加到 ``PATH`` 中。
下一步
======
继续设置开发环境,请前往 :ref:`获取 ESP-IDF <get-started-get-esp-idf>` 章节。

View file

@ -10,10 +10,9 @@
sudo easy_install pip sudo easy_install pip
- 安装 pyserial:: .. note::
sudo pip install pyserial
``pip`` 稍后将用于安装 :ref:`必要的 Python 软件包 <get-started-get-packages>`
安装工具链 安装工具链
=============== ===============

View file

@ -13,7 +13,7 @@
.PHONY: build-components menuconfig defconfig all build clean all_binaries check-submodules size size-components size-files size-symbols list-components .PHONY: build-components menuconfig defconfig all build clean all_binaries check-submodules size size-components size-files size-symbols list-components
MAKECMDGOALS ?= all MAKECMDGOALS ?= all
all: all_binaries all: all_binaries check_python_dependencies
# see below for recipe of 'all' target # see below for recipe of 'all' target
# #
# # other components will add dependencies to 'all_binaries'. The # # other components will add dependencies to 'all_binaries'. The
@ -43,12 +43,13 @@ help:
@echo "make app-flash - Flash just the app" @echo "make app-flash - Flash just the app"
@echo "make app-clean - Clean just the app" @echo "make app-clean - Clean just the app"
@echo "make print_flash_cmd - Print the arguments for esptool when flash" @echo "make print_flash_cmd - Print the arguments for esptool when flash"
@echo "make check_python_dependencies - Check that the required python packages are installed"
@echo "" @echo ""
@echo "See also 'make bootloader', 'make bootloader-flash', 'make bootloader-clean', " @echo "See also 'make bootloader', 'make bootloader-flash', 'make bootloader-clean', "
@echo "'make partition_table', etc, etc." @echo "'make partition_table', etc, etc."
# Non-interactive targets. Mostly, those for which you do not need to build a binary # Non-interactive targets. Mostly, those for which you do not need to build a binary
NON_INTERACTIVE_TARGET += defconfig clean% %clean help list-components print_flash_cmd NON_INTERACTIVE_TARGET += defconfig clean% %clean help list-components print_flash_cmd check_python_dependencies
# dependency checks # dependency checks
ifndef MAKE_RESTARTS ifndef MAKE_RESTARTS
@ -421,6 +422,14 @@ else
@echo $(ESPTOOLPY_WRITE_FLASH) $(APP_OFFSET) $(APP_BIN) @echo $(ESPTOOLPY_WRITE_FLASH) $(APP_OFFSET) $(APP_BIN)
endif endif
.PHONY: check_python_dependencies
# Notify users when some of the required python packages are not installed
check_python_dependencies:
ifndef IS_BOOTLOADER_BUILD
$(PYTHON) $(IDF_PATH)/tools/check_python_dependencies.py
endif
all_binaries: $(APP_BIN) all_binaries: $(APP_BIN)
$(BUILD_DIR_BASE): $(BUILD_DIR_BASE):
@ -476,16 +485,16 @@ app-clean: $(addprefix component-,$(addsuffix -clean,$(notdir $(COMPONENT_PATHS)
$(summary) RM $(APP_ELF) $(summary) RM $(APP_ELF)
rm -f $(APP_ELF) $(APP_BIN) $(APP_MAP) rm -f $(APP_ELF) $(APP_BIN) $(APP_MAP)
size: $(APP_ELF) size: check_python_dependencies $(APP_ELF)
$(PYTHON) $(IDF_PATH)/tools/idf_size.py $(APP_MAP) $(PYTHON) $(IDF_PATH)/tools/idf_size.py $(APP_MAP)
size-files: $(APP_ELF) size-files: check_python_dependencies $(APP_ELF)
$(PYTHON) $(IDF_PATH)/tools/idf_size.py --files $(APP_MAP) $(PYTHON) $(IDF_PATH)/tools/idf_size.py --files $(APP_MAP)
size-components: $(APP_ELF) size-components: check_python_dependencies $(APP_ELF)
$(PYTHON) $(IDF_PATH)/tools/idf_size.py --archives $(APP_MAP) $(PYTHON) $(IDF_PATH)/tools/idf_size.py --archives $(APP_MAP)
size-symbols: $(APP_ELF) size-symbols: check_python_dependencies $(APP_ELF)
ifndef COMPONENT ifndef COMPONENT
$(error "ERROR: Please enter the component to look symbols for, e.g. COMPONENT=heap") $(error "ERROR: Please enter the component to look symbols for, e.g. COMPONENT=heap")
else else

5
requirements.txt Normal file
View file

@ -0,0 +1,5 @@
# This is a list of python packages needed for ESP-IDF. This file is used with pip.
# Please see the Get Started section of the ESP-IDF Programming Guide for further information.
#
pyserial>=3.0
future>=0.16.0

View file

@ -0,0 +1,46 @@
#!/usr/bin/env python
#
# Copyright 2018 Espressif Systems (Shanghai) PTE LTD
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import sys
try:
import pkg_resources
except:
print('pkg_resources cannot be imported probably because the pip package is not installed and/or using a '
'legacy Python interpreter. Please refer to the Get Started section of the ESP-IDF Programming Guide for '
'setting up the required packages.')
sys.exit(1)
req_file = '{}/requirements.txt'.format(os.getenv("IDF_PATH"))
if __name__ == "__main__":
not_satisfied = []
with open(req_file) as f:
for line in f:
line = line.strip()
try:
pkg_resources.require(line)
except:
not_satisfied.append(line)
if len(not_satisfied) > 0:
print('The following Python requirements are not satisfied:')
for requirement in not_satisfied:
print(requirement)
print('Please run "{} -m pip install -r {}" for resolving the issue.'.format(sys.executable, req_file))
sys.exit(1)
print('Python requirements are satisfied.')

View file

@ -41,8 +41,6 @@ rm -f /mingw32/bin/envsubst.exe
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install pyserial
# Automatically download precompiled toolchain, unpack at /opt/xtensa-esp32-elf/ # Automatically download precompiled toolchain, unpack at /opt/xtensa-esp32-elf/
TOOLCHAIN_ZIP=xtensa-esp32-elf-win32-1.22.0-80-g6c4433a-5.2.0.zip TOOLCHAIN_ZIP=xtensa-esp32-elf-win32-1.22.0-80-g6c4433a-5.2.0.zip
echo "Downloading precompiled toolchain ${TOOLCHAIN_ZIP}..." echo "Downloading precompiled toolchain ${TOOLCHAIN_ZIP}..."