docs: update picolibc as default C library, remove experimental references

Made-with: Cursor
This commit is contained in:
Marius Vikhammer
2026-03-10 14:50:52 +08:00
parent c2768cf849
commit 60320ff0e9
6 changed files with 10 additions and 14 deletions
+3 -3
View File
@@ -5,10 +5,10 @@ C Support
ESP-IDF is primarily written in C and provides C APIs. ESP-IDF can use one of the following C Standard Library implementations:
- `Newlib <https://sourceware.org/newlib/>`_ (default)
- `Picolibc <https://keithp.com/picolibc/>`_ (enabled with :ref:`CONFIG_LIBC_PICOLIBC<CONFIG_LIBC_PICOLIBC>` Kconfig option)
- `Picolibc <https://keithp.com/picolibc/>`_ (default)
- `Newlib <https://sourceware.org/newlib/>`_ (enabled with :ref:`CONFIG_LIBC_NEWLIB<CONFIG_LIBC_NEWLIB>` Kconfig option)
The Newlib version is specified in :component_file:`esp_libc/sbom.yml`.
The Picolibc version is specified in :component_file:`esp_libc/sbom_picolibc.yml` and the Newlib version in :component_file:`esp_libc/sbom_newlibc.yml`.
In general, all C features supported by the compiler (currently GCC) can be used in ESP-IDF, unless otherwise noted in :ref:`unsupported_c_features` below.
+1 -1
View File
@@ -96,7 +96,7 @@ Reducing Stack Sizes
- Avoid stack heavy functions. String formatting functions (like ``printf()``) are particularly heavy users of the stack, so any task which does not ever call these can usually have its stack size reduced.
- Using experimental :ref:`picolibc-instead-of-newlib` reduces the stack usage of ``printf()`` calls significantly.
- Using :ref:`picolibc-instead-of-newlib` reduces the stack usage of ``printf()`` calls significantly.
- Enabling :ref:`newlib-nano-formatting` reduces the stack usage of any task that calls ``printf()`` or other C string formatting functions.
- Avoid allocating large variables on the stack. In C, any large structures or arrays allocated as an automatic variable (i.e., default scope of a C declaration) uses space on the stack. To minimize the sizes of these, allocate them statically and/or see if you can save memory by dynamically allocating them from the heap only when they are needed.
+1 -3
View File
@@ -158,12 +158,10 @@ lwIP IPv4
Picolibc instead of Newlib
@@@@@@@@@@@@@@@@@@@@@@@@@@
By default, ESP-IDF uses the Newlib C library, and it also has experimental support for the Picolibc C library.
By default, ESP-IDF uses the Picolibc C library. Newlib is also supported and can be selected with :ref:`CONFIG_LIBC_NEWLIB<CONFIG_LIBC_NEWLIB>`.
Picolibc C library provides smaller ``printf`` family functions and can reduce the binary size by up to 30 KB, depending on your application.
To switch to linking against the Picolibc C library, please enable the configuration options :ref:`CONFIG_IDF_EXPERIMENTAL_FEATURES` and :ref:`CONFIG_LIBC_PICOLIBC<CONFIG_LIBC_PICOLIBC>`.
.. _newlib-nano-formatting:
Newlib Nano Formatting
+3 -3
View File
@@ -5,10 +5,10 @@ C 支持
ESP-IDF 主要使用 C 语言编写,并提供 C API。ESP-IDF 可以使用以下 C 标准函数库的实现之一:
- `Newlib <https://sourceware.org/newlib/>`_ (默认)
- `Picolibc <https://keithp.com/picolibc/>`_ (通过 :ref:`CONFIG_LIBC_PICOLIBC<CONFIG_LIBC_PICOLIBC>` Kconfig 选项启用)
- `Picolibc <https://keithp.com/picolibc/>`_ (默认)
- `Newlib <https://sourceware.org/newlib/>`_ (通过 :ref:`CONFIG_LIBC_NEWLIB<CONFIG_LIBC_NEWLIB>` Kconfig 选项启用)
Newlib 的版本号记录在 :component_file:`esp_libc/sbom.yml` 文件中。
Picolibc 的版本号记录在 :component_file:`esp_libc/sbom_picolibc.yml` 文件中,Newlib 的版本号记录在 :component_file:`esp_libc/sbom_newlibc.yml` 文件中。
一般来说,除非在 :ref:`unsupported_c_features` 特别说明,当前编译器(目前是 GCC)支持的所有 C 语言功能在 ESP-IDF 中均可使用。
@@ -96,7 +96,7 @@ ESP-IDF 包含一系列堆 API,可以在运行时测量空闲堆内存,请
- 避免占用过多栈内存的函数。字符串格式化函数(如 ``printf()``)会使用大量栈内存,如果任务不调用这类函数,通常可以减小其占用的栈内存。
- 使用实验性的选项 :ref:`picolibc-instead-of-newlib` 可以显著减少 ``printf()`` 调用的堆栈使用量。
- 使用 :ref:`picolibc-instead-of-newlib` 可以显著减少 ``printf()`` 调用的堆栈使用量。
- 启用 :ref:`newlib-nano-formatting`,可以在任务调用 ``printf()`` 或其他 C 语言字符串格式化函数时,减少这类任务的栈内存使用量。
- 避免在栈上分配大型变量。在 C 语言声明的默认作用域中,任何分配为自动变量的大型结构体或数组都会占用栈内存。要优化这些变量占用的栈内存大小,可以使用静态分配,或仅在需要时从堆中动态分配。
+1 -3
View File
@@ -158,12 +158,10 @@ lwIP IPv4
使用 Picolibc 替代 Newlib
@@@@@@@@@@@@@@@@@@@@@@@@@
默认情况下,ESP-IDF 使用 Newlib C 库,同时也对 Picolibc C 库提供实验性支持
默认情况下,ESP-IDF 使用 Picolibc C 库。也支持 Newlib,可通过 :ref:`CONFIG_LIBC_NEWLIB<CONFIG_LIBC_NEWLIB>` 选项选择使用
Picolibc C 库提供了更精简的 ``printf`` 系列函数,并且根据应用程序,可以将二进制文件大小减少最多 30 KB。
如需切换链接到 Picolibc C 库,请启用配置选项 :ref:`CONFIG_IDF_EXPERIMENTAL_FEATURES`:ref:`CONFIG_LIBC_PICOLIBC<CONFIG_LIBC_PICOLIBC>`
.. _newlib-nano-formatting:
Newlib Nano 格式化