mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-04 13:14:32 +02:00
Merge branch 'docs/update_trans_for_migration_guides' into 'master'
docs: Provide translation for toolchain Closes DOC-11604 See merge request espressif/esp-idf!40219
This commit is contained in:
@@ -11,7 +11,7 @@ Introduction
|
|||||||
|
|
||||||
{IDF_TARGET_PSRAM_VADDR_SIZE:default="Value not updated", esp32="4 MB", esp32s2="10.5 MB", esp32s3="32 MB", esp32p4="64 MB"}
|
{IDF_TARGET_PSRAM_VADDR_SIZE:default="Value not updated", esp32="4 MB", esp32s2="10.5 MB", esp32s3="32 MB", esp32p4="64 MB"}
|
||||||
|
|
||||||
{IDF_TARGET_NAME} has a few hundred kilobytes of internal RAM, residing on the same die as the rest of the chip components. It can be insufficient for some purposes, so {IDF_TARGET_NAME} has the ability to use up to {IDF_TARGET_PSRAM_VADDR_SIZE} of virtual addresses for external PSRAM (Psuedostatic RAM) memory. The external memory is incorporated in the memory map and, with certain restrictions, is usable in the same way as internal data RAM.
|
{IDF_TARGET_NAME} has a few hundred kilobytes of internal RAM, residing on the same die as the rest of the chip components. It can be insufficient for some purposes, so {IDF_TARGET_NAME} has the ability to use up to {IDF_TARGET_PSRAM_VADDR_SIZE} of virtual addresses for external PSRAM (pseudo-static RAM) memory. The external memory is incorporated in the memory map and, with certain restrictions, is usable in the same way as internal data RAM.
|
||||||
|
|
||||||
.. only:: esp32s3
|
.. only:: esp32s3
|
||||||
|
|
||||||
|
@@ -1,22 +1,22 @@
|
|||||||
Toolchain
|
Toolchain
|
||||||
*********
|
==========
|
||||||
|
|
||||||
:link_to_translation:`zh_CN:[中文]`
|
:link_to_translation:`zh_CN:[中文]`
|
||||||
|
|
||||||
GCC Version
|
GCC Version
|
||||||
===========
|
-----------
|
||||||
|
|
||||||
The previous GCC version 14.2.0 has been upgraded to 15.1.0 across all chip targets. Upgrading to ESP-IDF v6.0 requires porting code to GCC 15.1.0. Refer to the official `GCC 15 porting guide <https://gcc.gnu.org/gcc-15/porting_to.html>`_
|
The previous GCC version 14.2.0 has been upgraded to 15.1.0 across all chip targets. Upgrading to ESP-IDF v6.0 requires porting code to GCC 15.1.0. Refer to the official guide `Porting to GCC 15 <https://gcc.gnu.org/gcc-15/porting_to.html>`_.
|
||||||
|
|
||||||
Warnings
|
Warnings
|
||||||
========
|
--------
|
||||||
|
|
||||||
The upgrade to GCC 15.1.0 has resulted in the addition of new warnings, or enhancements to existing warnings. The full details of all GCC warnings can be found in `GCC Warning Options <https://gcc.gnu.org/onlinedocs/gcc-15.1.0/gcc/Warning-Options.html>`_. Users are advised to double-check their code, then fix the warnings if possible. Unfortunately, depending on the warning and the complexity of the user's code, some warnings will be false positives that require non-trivial fixes. In such cases, users can choose to suppress the warning in multiple ways. This section outlines some common warnings that users are likely to encounter and ways to fix them.
|
The upgrade to GCC 15.1.0 has resulted in the addition of new warnings, or enhancements to existing warnings. The full details of all GCC warnings can be found in `GCC Warning Options <https://gcc.gnu.org/onlinedocs/gcc-15.1.0/gcc/Warning-Options.html>`_. Users are advised to double-check their code, then fix the warnings if possible. Unfortunately, depending on the warning and the complexity of the user's code, some warnings will be false positives that require non-trivial fixes. In such cases, users can choose to suppress the warning in multiple ways. This section outlines some common warnings that users are likely to encounter and ways to fix them.
|
||||||
|
|
||||||
To suprress all new warnings enable :ref:`CONFIG_COMPILER_DISABLE_GCC15_WARNINGS` config option.
|
To suprress all new warnings, enable :ref:`CONFIG_COMPILER_DISABLE_GCC15_WARNINGS` config option.
|
||||||
|
|
||||||
``-Wno-unterminated-string-initialization``
|
``-Wno-unterminated-string-initialization``
|
||||||
-------------------------------------------
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Warn about character arrays initialized as unterminated character sequences with a string literal, unless the declaration being initialized has the nonstring attribute.
|
Warn about character arrays initialized as unterminated character sequences with a string literal, unless the declaration being initialized has the nonstring attribute.
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ Warn about character arrays initialized as unterminated character sequences with
|
|||||||
NONSTRING_ATTR char arr2[3] = "bar"; /* No warning. */
|
NONSTRING_ATTR char arr2[3] = "bar"; /* No warning. */
|
||||||
|
|
||||||
``-Wno-header-guard``
|
``-Wno-header-guard``
|
||||||
---------------------
|
^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Warn if a header file has a typo in its include guard. When #ifndef and #define use different names.
|
Warn if a header file has a typo in its include guard. When #ifndef and #define use different names.
|
||||||
|
|
||||||
@@ -40,9 +40,9 @@ Warn if a header file has a typo in its include guard. When #ifndef and #define
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
``-Wno-self-move (C++ only)``
|
``-Wno-self-move (C++ only)``
|
||||||
-----------------------------
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Warns when a value is moved to itself with std::move. Such a std::move typically has no effect.
|
Warns when a value is moved to itself with `std::move`. Such a `std::move` typically has no effect.
|
||||||
|
|
||||||
.. code-block:: cpp
|
.. code-block:: cpp
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ Warns when a value is moved to itself with std::move. Such a std::move typically
|
|||||||
|
|
||||||
|
|
||||||
``-Wno-template-body (C++ only)``
|
``-Wno-template-body (C++ only)``
|
||||||
---------------------------------
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Disable diagnosing errors when parsing a template, and instead issue an error only upon instantiation of the template.
|
Disable diagnosing errors when parsing a template, and instead issue an error only upon instantiation of the template.
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ Disable diagnosing errors when parsing a template, and instead issue an error on
|
|||||||
}
|
}
|
||||||
|
|
||||||
``-Wno-dangling-reference (C++ only)``
|
``-Wno-dangling-reference (C++ only)``
|
||||||
--------------------------------------
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Warn when a reference is bound to a temporary whose lifetime has ended.
|
Warn when a reference is bound to a temporary whose lifetime has ended.
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ Warn when a reference is bound to a temporary whose lifetime has ended.
|
|||||||
const int& r = std::max(n - 1, n + 1); /* r is dangling. */
|
const int& r = std::max(n - 1, n + 1); /* r is dangling. */
|
||||||
|
|
||||||
``-Wno-defaulted-function-deleted (C++ only)``
|
``-Wno-defaulted-function-deleted (C++ only)``
|
||||||
----------------------------------------------
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Warn when an explicitly defaulted function is deleted by the compiler. That can occur when the function’s declared type does not match the type of the function that would have been implicitly declared.
|
Warn when an explicitly defaulted function is deleted by the compiler. That can occur when the function’s declared type does not match the type of the function that would have been implicitly declared.
|
||||||
|
|
||||||
@@ -94,15 +94,14 @@ Warn when an explicitly defaulted function is deleted by the compiler. That can
|
|||||||
};
|
};
|
||||||
|
|
||||||
Picolibc
|
Picolibc
|
||||||
========
|
--------
|
||||||
|
|
||||||
When building with :ref:`CONFIG_LIBC_PICOLIBC<CONFIG_LIBC_PICOLIBC>` enabled, the following adaptation is required.
|
When building with :ref:`CONFIG_LIBC_PICOLIBC<CONFIG_LIBC_PICOLIBC>` enabled, the following adaptation is required.
|
||||||
|
|
||||||
``sys/signal.h header removed``
|
``sys/signal.h header removed``
|
||||||
-------------------------------
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
The header ``<sys/signal.h>`` is no longer available in Picolibc.
|
The header ``<sys/signal.h>`` is no longer available in Picolibc. To ensure compatibility and improve portability across libc implementations, replace it with the standard C header ``<signal.h>``.
|
||||||
To ensure compatibility and improve portability across libc implementations, replace it with the standard C header ``<signal.h>``.
|
|
||||||
|
|
||||||
.. code-block:: c
|
.. code-block:: c
|
||||||
|
|
||||||
|
@@ -1 +1,109 @@
|
|||||||
.. include:: ../../../../en/migration-guides/release-6.x/6.0/toolchain.rst
|
工具链
|
||||||
|
==========
|
||||||
|
|
||||||
|
:link_to_translation:`en:[English]`
|
||||||
|
|
||||||
|
GCC 版本更新说明
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
原先使用的 GCC 版本 14.2.0 现已统一升级为 15.1.0,适用于所有芯片系列。升级至 ESP-IDF v6.0 时,需将代码适配至 GCC 15.1.0。请参阅 `Porting to GCC 15 <https://gcc.gnu.org/gcc-15/porting_to.html>`_。
|
||||||
|
|
||||||
|
警告信息
|
||||||
|
---------
|
||||||
|
|
||||||
|
升级到 GCC 15.1.0 后,引入了新的编译警告,同时也增强了已有警告的检测能力。警告详情可参考 `GCC Warning Options <https://gcc.gnu.org/onlinedocs/gcc-15.1.0/gcc/Warning-Options.html>`_。建议认真检查代码并尽可能修复警告。根据具体警告的类型及用户代码的复杂程度不同,某些警告可能属于误报,消除这些误报也需进行较为复杂的代码修改。此时,可通过多种方式屏蔽警告。下文列出了常见的警告及其对应的解决方案。
|
||||||
|
|
||||||
|
如需全局屏蔽所有新增警告,请启用配置项 :ref:`CONFIG_COMPILER_DISABLE_GCC15_WARNINGS`。
|
||||||
|
|
||||||
|
``-Wno-unterminated-string-initialization``
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
当使用字符串字面量来初始化字符数组时,如果该数组的大小不足以容纳字符串末尾的空字符,编译器就会发出这个警告。声明 nonstring 属性时除外。
|
||||||
|
|
||||||
|
.. code-block:: c
|
||||||
|
|
||||||
|
#include "esp_attr.h"
|
||||||
|
|
||||||
|
char arr[3] = "foo"; /* 触发警告 */
|
||||||
|
NONSTRING_ATTR char arr2[3] = "bar"; /* 无警告 */
|
||||||
|
|
||||||
|
``-Wno-header-guard``
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
头文件中的宏定义和引用防护 (include guard) 不一致时触发警告(即 #ifndef 与 #define 使用的宏名称不一致时)。
|
||||||
|
|
||||||
|
.. code-block:: c
|
||||||
|
|
||||||
|
#ifndef WHEADER_GUARD_2
|
||||||
|
#define WHEADERGUARD2 /* 触发警告。此处需改为 WHEADER_GUARD_2 */
|
||||||
|
/* ... */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
``-Wno-self-move(仅限 C++)``
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
当一个值通过 `std::move` 转移到它自身时触发警告(此 `std::move` 操作通常没有意义)。
|
||||||
|
|
||||||
|
.. code-block:: cpp
|
||||||
|
|
||||||
|
struct T {
|
||||||
|
/* ... */
|
||||||
|
};
|
||||||
|
void fn()
|
||||||
|
{
|
||||||
|
T t;
|
||||||
|
/* ... */
|
||||||
|
t = std::move (t); /* 触发警告。可删除该行代码 */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
``-Wno-template-body(仅限 C++)``
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
在模板解析阶段禁用错误诊断,仅在模板实例化时报告错误。
|
||||||
|
|
||||||
|
.. code-block:: cpp
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void f() {
|
||||||
|
const int n = 42;
|
||||||
|
++n; /* 只读变量 'n' */
|
||||||
|
}
|
||||||
|
|
||||||
|
``-Wno-dangling-reference(仅限 C++)``
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
当引用绑定到生命周期已结束的临时对象时触发警告,防止悬垂引用。
|
||||||
|
|
||||||
|
.. code-block:: cpp
|
||||||
|
|
||||||
|
int n = 1;
|
||||||
|
const int& r = std::max(n - 1, n + 1); /* r 成为悬垂引用 */
|
||||||
|
|
||||||
|
``-Wno-defaulted-function-deleted(仅限 C++)``
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
当显式默认函数被编译器隐式删除时触发警告(通常因函数声明类型与隐式声明不匹配导致)。
|
||||||
|
|
||||||
|
.. code-block:: cpp
|
||||||
|
|
||||||
|
template<typename>
|
||||||
|
struct C {
|
||||||
|
C();
|
||||||
|
C(const C&&) = default; /* 被隐式删除 */
|
||||||
|
};
|
||||||
|
|
||||||
|
Picolibc
|
||||||
|
--------
|
||||||
|
|
||||||
|
启用 :ref:`CONFIG_LIBC_PICOLIBC<CONFIG_LIBC_PICOLIBC>` 配置后需注意以下变更:
|
||||||
|
|
||||||
|
``移除 sys/signal.h 头文件``
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Picolibc 已移除 ``<sys/signal.h>`` 头文件。为确保跨 libc 实现的兼容性,请改用标准 C 头文件 ``<signal.h>``。
|
||||||
|
|
||||||
|
.. code-block:: c
|
||||||
|
|
||||||
|
#include <sys/signal.h> /* 严重错误:sys/signal.h:没有此文件或目录 */
|
||||||
|
#include <signal.h> /* 正确:标准且可移植的写法 */
|
||||||
|
Reference in New Issue
Block a user