docs: translated removed-components and build-system

This commit is contained in:
daiziyan 2022-07-04 19:13:17 +08:00 committed by daiziyan
parent 0f08d4050d
commit b995b584bd
8 changed files with 182 additions and 41 deletions

View File

@ -303,7 +303,7 @@ The minimal component ``CMakeLists.txt`` file simply registers the component to
- ``SRCS`` is a list of source files (``*.c``, ``*.cpp``, ``*.cc``, ``*.S``). These source files will be compiled into the component library.
- ``INCLUDE_DIRS`` is a list of directories to add to the global include search path for any component which requires this component, and also the main source files.
- ``REQUIRES`` is not actually required, but it is very often required to declare what other components this component will use. See :ref:`component requirements`.
- ``REQUIRES`` is not actually required, but it is very often required to declare what other components this component will use. See :ref:`component requirements <component-requirements>`.
A library with the name of the component will be built and linked into the final app.
@ -395,7 +395,7 @@ The ESP-IDF build system adds the following C preprocessor definitions on the co
- ``ESP_PLATFORM`` : Can be used to detect that build happens within ESP-IDF.
- ``IDF_VER`` : Defined to a git version string. E.g. ``v2.0`` for a tagged release or ``v1.0-275-g0efaa4f`` for an arbitrary commit.
.. _component requirements:
.. _component-requirements:
Component Requirements
======================

View File

@ -1,20 +1,20 @@
Build System
============
Migrating from GNU Make build system
Migrating from GNU Make Build System
------------------------------------
Please follow the :ref:`build system <migrating_from_make>` guide for migrating make-based projects no longer supported in ESP-IDF v5.0.
ESP-IDF v5.0 no longer supports GNU make-based projects. Please follow the :ref:`build system <migrating_from_make>` guide for migration.
Update fragment file grammar
Update Fragment File Grammar
----------------------------
Please follow the :ref:`migrate linker script fragment files grammar<ldgen-migrate-lf-grammar>` chapter for migrating v3.x grammar to the new one.
Specify component requirements explicitly
Specify Component Requirements Explicitly
-----------------------------------------
In previous versions of ESP-IDF, some components were always added as public requirements (dependencies) to every component in the build, in addition to the :ref:`common requirements<component-common-requirements>`:
In previous versions of ESP-IDF, some components were always added as public requirements (dependencies) to every component in the build, in addition to the :ref:`common component requirements<component-common-requirements>`:
* ``driver``
* ``efuse``
@ -27,20 +27,18 @@ In previous versions of ESP-IDF, some components were always added as public req
* ``esp_eth``
* ``esp_phy``
This means that it was possible to include header files of those components without specifying them as requirements in ``idf_component_register``.
This behavior was caused by transitive dependencies of various common components.
This means that it was possible to include header files of those components without specifying them as requirements in ``idf_component_register``. This behavior was caused by transitive dependencies of various common components.
In ESP-IDF v5.0, this behavior is fixed and these components are no longer added as public requirements by default.
Every component depending on one of the components which isn't part of common requirements has to declare this dependency explicitly. This can be done by adding ``REQUIRES <component_name>`` or ``PRIV_REQUIRES <component_name>`` in ``idf_component_register`` call inside component's ``CMakeLists.txt``. See :ref:`Component Requirements` for more information on specifying requirements.
Every component depending on one of the components which isn't part of common requirements has to declare this dependency explicitly. This can be done by adding ``REQUIRES <component_name>`` or ``PRIV_REQUIRES <component_name>`` in ``idf_component_register`` call inside component's ``CMakeLists.txt``. See :ref:`Component Requirements <component-requirements>` for more information on specifying requirements.
Setting ``COMPONENT_DIRS`` and ``EXTRA_COMPONENT_DIRS`` variables
Setting ``COMPONENT_DIRS`` and ``EXTRA_COMPONENT_DIRS`` Variables
-----------------------------------------------------------------
.. highlight:: cmake
ESP-IDF 5.0 includes a number of improvements to support building projects with space characters in their paths. To make that possible, there are some changes related to setting ``COMPONENT_DIRS`` and ``EXTRA_COMPONENT_DIRS`` variables in project CMakeLists.txt files.
ESP-IDF v5.0 includes a number of improvements to support building projects with space characters in their paths. To make that possible, there are some changes related to setting ``COMPONENT_DIRS`` and ``EXTRA_COMPONENT_DIRS`` variables in project CMakeLists.txt files.
Adding non-existent directories to ``COMPONENT_DIRS`` or ``EXTRA_COMPONENT_DIRS`` is no longer supported and will result in an error.
@ -54,14 +52,14 @@ instead of::
set(EXTRA_COMPONENT_DIRS "path1 path2")
set(EXTRA_COMPONENT_DIRS "${EXTRA_COMPONENT_DIRS} path3")
Defining these variables as CMake lists is compatible with previous IDF versions.
Defining these variables as CMake lists is compatible with previous ESP-IDF versions.
Update usage of target_link_libraries with project_elf
Update Usage of target_link_libraries with project_elf
------------------------------------------------------
ESP-IDF v5.0 fixes issues with CMake variable propagation for components, which caused among others compiler flags and defines applied to one component to be applied to every component in the project.
ESP-IDF v5.0 fixes CMake variable propagation issues for components. This issue caused compiler flags and definitions that were supposed to apply to one component to be applied to every component in the project.
As a side effect of this ESP-IDF user projects from ESP-IDF v5.0 onwards using ``target_link_libraries`` with ``project_elf`` explicitly and custom CMake projects must specify ``PRIVATE``, ``PUBLIC`` or ``INTERFACE`` arguments. This is a breaking change and is not backwards compatible with previous ESP-IDF versions.
As a side effect of this, user projects from ESP-IDF v5.0 onwards must use ``target_link_libraries`` with ``project_elf`` explicitly and custom CMake projects must specify ``PRIVATE``, ``PUBLIC``, or ``INTERFACE`` arguments. This is a breaking change and is not backward compatible with previous ESP-IDF versions.
For example::
@ -71,24 +69,24 @@ instead of::
target_link_libraries(${project_elf} "-Wl,--wrap=esp_panic_handler")
Update CMake version
--------------------
Update CMake Version
-----------------------
In ESP-IDF v5.0 minimal cmake version was increased to 3.16 and versions lower than 3.16 are not supported anymore. Run "tools/idf_tools.py install cmake" to install a suitable version if your OS versions doesn't have one.
In ESP-IDF v5.0 minimal CMake version was increased to 3.16 and versions lower than 3.16 are not supported anymore. Run ``tools/idf_tools.py install cmake`` to install a suitable version if your OS version doesn't have one.
This affects ESP-IDF users who use system-provided CMake and custom CMake project users.
This affects ESP-IDF users who use system-provided CMake and custom CMake.
Target-specific sdkconfig files no longer always override all other files in SDKCONFIG_DEFAULTS
Reorder the Applying of the Target-Specific Config Files
-----------------------------------------------------------------------------------------------
.. highlight:: none
ESP-IDF v5.0 reorders the applying order of target-specific config files and other files listed in SDKCONFIG_DEFAULTS. Now, target-specific file will be applied right after the file bringing it in, before all latter files in ``SDKCONFIG_DEFAULTS``.
ESP-IDF v5.0 reorders the applying order of target-specific config files and other files listed in SDKCONFIG_DEFAULTS. Now, target-specific files will be applied right after the file brings it in, before all latter files in ``SDKCONFIG_DEFAULTS``.
For example::
If ``SDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig_devkit1"``, and there is a file ``sdkconfig.defaults.esp32`` in the same folder, then the files will be applied in the following order: (1) sdkconfig.defaults (2) sdkconfig.defaults.esp32 (3) sdkconfig_devkit1.
If you have a key with different values in the target-specific file of former item (e.g. ``sdkconfig.defaults.esp32`` above) and the latter item (e.g. ``sdkconfig_devket1`` above), please note the latter one will override the target-specific file of the former one.
If you have a key with different values in the target-specific files of the former item (e.g., ``sdkconfig.defaults.esp32`` above) and the latter item (e.g., ``sdkconfig_devkit1`` above), please note the latter will override the target-specific file of the former.
If you do want to have some target-specific config values, please put it into the target-specific file of the latter item (e.g. ``sdkconfig_devkit1.esp32``).
If you do want to have some target-specific config values, please put it into the target-specific file of the latter item (e.g., ``sdkconfig_devkit1.esp32``).

View File

@ -56,6 +56,7 @@ PHY Address Auto-detect
-----------------------
Ethernet PHY address auto-detect function ``esp_eth_detect_phy_addr`` was renamed to :cpp:func:`esp_eth_phy_802_3_detect_phy_addr` and its header declaration was moved to :component_file:`esp_eth/include/esp_eth_phy_802_3.h`.
.. _tcpip-adapter:
TCP/IP Adapter
*****************

View File

@ -1,8 +1,8 @@
Removed or deprecated components
Removed or Deprecated Components
================================
Components moved to IDF Component Registry
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Components Moved to IDF Component Registry
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Following components are removed from ESP-IDF and moved to `IDF Component Registry <https://components.espressif.com/>`_:
@ -15,29 +15,30 @@ Following components are removed from ESP-IDF and moved to `IDF Component Regist
* `esp_websocket_client <https://components.espressif.com/component/espressif/esp_websocket_client>`_
* `asio <https://components.espressif.com/component/espressif/asio>`_
* `freemodbus <https://components.espressif.com/component/espressif/esp-modbus>`_
.. note:: Please note that http parser functionality which was previously part of ``nghttp`` component is now part of :component:`http_parser <http_parser>` component.
* `sh2lib <https://components.espressif.com/component/espressif/sh2lib>`_
* `expat <https://components.espressif.com/component/espressif/expat>`_
* `coap <https://components.espressif.com/component/espressif/coap>`_
.. note::
Please note that http parser functionality which was previously part of ``nghttp`` component is now part of :component:`http_parser <http_parser>` component.
These components can be installed using ``idf.py add-dependency`` command.
For example, to install libsodium component with exact version X.Y, run: ``idf.py add-dependency libsodium==X.Y``.
For example, to install libsodium component with the exact version X.Y, run ``idf.py add-dependency libsodium==X.Y``.
To install libsodium component with the latest version compatible to X.Y according to `semver <https://semver.org/>`_ rules, run: ``idf.py add-dependency libsodium~X.Y``.
To install libsodium component with the latest version compatible to X.Y according to `semver <https://semver.org/>`_ rules, run ``idf.py add-dependency libsodium~X.Y``.
To find out which versions of each component are available, open https://components.espressif.com, search for the component by its name and check the versions listed on the component page.
Deprecated Components
^^^^^^^^^^^^^^^^^^^^^
Following components are removed since they were deprecated in IDF v4.x
The following components are removed since they were deprecated in IDF v4.x:
* ``tcpip_adapter`` Please use the :doc:`ESP-NETIF </api-reference/network/esp_netif>` component instead; you can follow the `Migration guide to ESP-NETIF<tcpip-adapter>`
* ``tcpip_adapter``. Please use the :doc:`ESP-NETIF </api-reference/network/esp_netif>` component instead; you can follow the :ref:`tcpip-adapter`.
.. note:: OpenSSL-API component is no longer supported. It is not available in the IDF Component Registry, either. Please use :doc:`ESP-TLS </api-reference/protocols/esp_tls>` or :component:`mbedtls` API directly.
.. note::
OpenSSL-API component is no longer supported. It is not available in the IDF Component Registry, either. Please use :doc:`ESP-TLS </api-reference/protocols/esp_tls>` or :component:`mbedtls` API directly.
The targets components are no longer necessary after refactoring and have been removed:
@ -46,4 +47,4 @@ The targets components are no longer necessary after refactoring and have been r
* ``esp32s3``
* ``esp32c2``
* ``esp32c3``
* ``esp32h2``
* ``esp32h2``

View File

@ -303,7 +303,7 @@ ESP-IDF 在搜索所有待构建的组件时,会按照 ``COMPONENT_DIRS`` 指
- ``SRCS`` 是源文件列表(``*.c````*.cpp````*.cc````*.S``),里面所有的源文件都将会编译进组件库中。
- ``INCLUDE_DIRS`` 是目录列表,里面的路径会被添加到所有需要该组件的组件(包括 main 组件)全局 include 搜索路径中。
- ``REQUIRES`` 实际上并不是必需的,但通常需要它来声明该组件需要使用哪些其它组件,请参考 :ref:`component requirements`。
- ``REQUIRES`` 实际上并不是必需的,但通常需要它来声明该组件需要使用哪些其它组件,请参考 :ref:`组件依赖 <component-requirements>`。
上述命令会构建生成与组件同名的库,并最终被链接到应用程序中。
@ -395,7 +395,7 @@ ESP-IDF 构建系统会在命令行中添加以下 C 预处理器定义:
- ``ESP_PLATFORM``:可以用来检测在 ESP-IDF 内发生了构建行为。
- ``IDF_VER``:定义 git 版本字符串,例如:``v2.0`` 用于标记已发布的版本,``v1.0-275-g0efaa4f`` 则用于标记任意某次的提交记录。
.. _component requirements:
.. _component-requirements:
组件依赖
========

View File

@ -1 +1,92 @@
.. include:: ../../../en/migration-guides/release-5.x/build-system.rst
迁移构建系统至 ESP-IDF v5.0
===================================
从 GNU Make 构建系统迁移至 ESP-IDF v5.0
-----------------------------------------------
ESP-IDF v5.0 已不再支持基于 Make 的工程,请参考 :ref:`从 ESP-IDF GNU Make 构建系统迁移到 CMake 构建系统 <migrating_from_make>` 进行迁移。
更新片段文件语法
----------------------------
请参考 :ref:`将链接器脚本片段文件语法迁移至 ESP-IDF v5.0 适应版本 <ldgen-migrate-lf-grammar>` 对 v3.x 的语法进行更新。
明确指定组件依赖
-----------------------------------------
在之前的 ESP-IDF 版本中,除了 :ref:`通用组件依赖项 <component-common-requirements>`,还有一些组件总是作为公共依赖项在构建中被添加至每个组件中,如:
* ``driver``
* ``efuse``
* ``esp_timer``
* ``lwip``
* ``vfs``
* ``esp_wifi``
* ``esp_event``
* ``esp_netif``
* ``esp_eth``
* ``esp_phy``
这意味着可以直接包含这些组件的头文件,而无需在 ``idf_component_register`` 中将它们指定为依赖。此行为是由各种常见组件的传递依赖关系引起的。
在 ESP-IDF v5.0 中,此行为已修复,这些组件不再默认作为公共依赖项添加。
如果组件所依赖的某个组件不属于通用组件依赖项,则必须显式地声明此依赖关系。可以通过在组件的 ``CMakeLists.txt`` 中的 ``idf_component_register`` 调用中添加 ``REQUIRES <component_name>````PRIV_REQUIRES <component_name>`` 来完成。有关指定组件依赖的更多信息,请参阅 :ref:`组件依赖 <component-requirements>`
设置 ``COMPONENT_DIRS````EXTRA_COMPONENT_DIRS`` 变量
-----------------------------------------------------------------
.. highlight:: cmake
为了实现构建项目时的路径能够包含空格ESP-IDF v5.0 做了一系列改进,其中包括改进了 CMakeLists.txt 文件中的 ``COMPONENT_DIRS````EXTRA_COMPONENT_DIRS`` 变量。
ESP-IDF v5.0 版本中,不再支持添加不存在的目录到变量 ``COMPONENT_DIRS````EXTRA_COMPONENT_DIRS`` 中,否则会出现报错。
同时ESP-IDF v5.0 中也不再支持使用字符串拼接的方式定义 ``COMPONENT_DIRS````EXTRA_COMPONENT_DIRS`` 变量。这些变量应该定义为 CMake 列表。 例如::
set(EXTRA_COMPONENT_DIRS path1 path2)
list(APPEND EXTRA_COMPONENT_DIRS path3)
不支持::
set(EXTRA_COMPONENT_DIRS "path1 path2")
set(EXTRA_COMPONENT_DIRS "${EXTRA_COMPONENT_DIRS} path3")
将这些变量定义为 CMake 列表的方式兼容之前的 ESP-IDF 版本。
更新 target_link_libraries 用法
---------------------------------------------------
ESP-IDF v5.0 修复了组件的 CMake 变量传播问题。此问题导致本应该只应用于某一组件的编译器标志和定义应用到了项目中的每个组件。
该修复也带来一定的副作用,从 ESP-IDF v5.0 开始,用户项目在使用 ``target_link_libraries`` 时必须明确指定 ``project_elf``,同时自定义 CMake 项目必须指定 ``PRIVATE````PUBLIC````INTERFACE`` 参数。这是一项重大变更,不兼容以前的 ESP-IDF 版本。
例如::
target_link_libraries(${project_elf} PRIVATE "-Wl,--wrap=esp_panic_handler")
不支持::
target_link_libraries(${project_elf} "-Wl,--wrap=esp_panic_handler")
更新 CMake 版本
-----------------------
在 ESP-IDF v5.0 中,最低 CMake 版本已更新到 3.16,并且不再支持低于 3.16 的版本。如果您的操作系统没有安装 CMake请运行 ``tools/idf_tools.py install cmake`` 来安装合适的版本。
该变更会影响到使用系统提供的 CMake 以及自定义 CMake 的 ESP-IDF 用户。
重新定义特定目标配置文件的应用顺序
-------------------------------------------------------------------------------------------
.. highlight:: none
ESP-IDF v5.0 重新安排了特定目标配置文件和 SDKCONFIG_DEFAULTS 中所有其他文件的应用顺序。现在,特定目标的配置文件将在引入它的文件之后、在 SDKCONFIG_DEFAULTS 中后续的其他文件之前应用。
例如::
如果 ``SDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig_devkit1"``,且同一文件夹内有 ``sdkconfig.defaults.esp32`` 文件,那么文件的应用顺序为:(1) sdkconfig.defaults (2) sdkconfig.defaults.esp32 (3) sdkconfig_devkit1
如果某个键在不同的特定目标配置文件中有不同的值,那么后者的值会覆盖前者。例如在以上案例中,如果某个键在 ``sdkconfig.defaults.esp32````sdkconfig_devkit1`` 中的值不同,则在 ``sdkconfig_devkit1`` 中的值会覆盖在 ``sdkconfig.defaults.esp32`` 中的值。
如果确实需要设置特定目标的配置值,请将其放到后应用的特定目标文件中,如 ``sdkconfig_devkit1.esp32``

View File

@ -56,6 +56,7 @@ PHY Address Auto-detect
-----------------------
Ethernet PHY address auto-detect function ``esp_eth_detect_phy_addr`` was renamed to :cpp:func:`esp_eth_phy_802_3_detect_phy_addr` and its header declaration was moved to :component_file:`esp_eth/include/esp_eth_phy_802_3.h`.
.. _tcpip-adapter:
TCP/IP 适配器
*************

View File

@ -1 +1,50 @@
.. include:: ../../../en/migration-guides/release-5.x/removed-components.rst
从 ESP-IDF 中移出或弃用的组件
================================
移至 IDF Component Registry 的组件
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
以下组件已经从 ESP-IDF 中迁出至 `IDF Component Registry <https://components.espressif.com/>`_
* `libsodium <https://components.espressif.com/component/espressif/libsodium>`_
* `cbor <https://components.espressif.com/component/espressif/cbor>`_
* `jsmn <https://components.espressif.com/component/espressif/jsmn>`_
* `esp_modem <https://components.espressif.com/component/espressif/esp_modem>`_
* `nghttp <https://components.espressif.com/component/espressif/nghttp>`_
* `mdns <https://components.espressif.com/component/espressif/mdns>`_
* `esp_websocket_client <https://components.espressif.com/component/espressif/esp_websocket_client>`_
* `asio <https://components.espressif.com/component/espressif/asio>`_
* `freemodbus <https://components.espressif.com/component/espressif/esp-modbus>`_
* `sh2lib <https://components.espressif.com/component/espressif/sh2lib>`_
* `expat <https://components.espressif.com/component/espressif/expat>`_
* `coap <https://components.espressif.com/component/espressif/coap>`_
.. note::
请注意http 解析功能以前属于 ``nghttp`` 组件一部分,但现在属于 :component:`http_parser <http_parser>` 组件。
可使用 ``idf.py add-dependency`` 命令安装以上组件。
例如,要安装 X.Y 版本的 libsodium 组件,请运行:``idf.py add-dependency libsodium==X.Y``
根据 `semver <https://semver.org/>`_ 规则安装与 X.Y 兼容的最新版本 libsodium 组件,请运行 ``idf.py add-dependency libsodium~X.Y``
可前往 https://components.espressif.com 查询每个组件有哪些版本,按名称搜索该组件,组件页面上会列出所有版本。
弃用的组件
^^^^^^^^^^^^^^^^^^^^^
IDF v4.x 版本中已不再使用以下组件,这些组件已弃用:
* ``tcpip_adapter``。可使用 :doc:`ESP-NETIF </api-reference/network/esp_netif>` 组件代替,具体可参考 :ref:`tcpip-adapter`
.. note::
不再支持 OpenSSL-API 组件。IDF Component Registry 中也没有该组件。请直接使用 :doc:`ESP-TLS </api-reference/protocols/esp_tls>`:component:`mbedtls` API。
版本更新后无需目标组件,因此以下目标组件也已经从 ESP-IDF 中删除:
* ``esp32``
* ``esp32s2``
* ``esp32s3``
* ``esp32c2``
* ``esp32c3``
* ``esp32h2``