diff --git a/.codespellrc b/.codespellrc index 2290f3c11f..515e8859e4 100644 --- a/.codespellrc +++ b/.codespellrc @@ -1,4 +1,4 @@ [codespell] -skip = build,*.yuv,components/fatfs/src/*,alice.txt,*.rgb,components/wpa_supplicant/*,components/esp_wifi/*,*.pem,components/newlib/COPYING.*,docs/sphinx-known-warnings.txt +skip = build,*.yuv,components/fatfs/src/*,alice.txt,*.rgb,components/wpa_supplicant/*,components/esp_wifi/*,*.pem,*/COPYING*,docs/sphinx-known-warnings.txt ignore-words-list = ser,dout,rsource,fram,inout,shs,ans,aci,unstall,unstalling,hart,wheight,wel,ot,fane,assertIn,registr,oen,parms write-changes = true diff --git a/.gitlab/CODEOWNERS b/.gitlab/CODEOWNERS index 82b29a703e..0f773ebe0a 100644 --- a/.gitlab/CODEOWNERS +++ b/.gitlab/CODEOWNERS @@ -103,6 +103,7 @@ /components/esp_hw_support/lowpower/ @esp-idf-codeowners/power-management /components/esp_hw_support/usb_phy/ @esp-idf-codeowners/peripherals/usb /components/esp_lcd/ @esp-idf-codeowners/peripherals +/components/esp_libc/ @esp-idf-codeowners/system @esp-idf-codeowners/toolchain /components/esp_local_ctrl/ @esp-idf-codeowners/app-utilities /components/esp_mm/ @esp-idf-codeowners/peripherals /components/esp_netif/ @esp-idf-codeowners/network @@ -140,7 +141,6 @@ /components/lwip/ @esp-idf-codeowners/lwip /components/mbedtls/ @esp-idf-codeowners/app-utilities/mbedtls @esp-idf-codeowners/security /components/mqtt/ @esp-idf-codeowners/network -/components/newlib/ @esp-idf-codeowners/system @esp-idf-codeowners/toolchain /components/nvs_flash/ @esp-idf-codeowners/storage /components/nvs_sec_provider/ @esp-idf-codeowners/storage @esp-idf-codeowners/security /components/openthread/ @esp-idf-codeowners/ieee802154 diff --git a/.idf_build_apps.toml b/.idf_build_apps.toml index 470ad263ab..07ea248d34 100644 --- a/.idf_build_apps.toml +++ b/.idf_build_apps.toml @@ -48,7 +48,7 @@ deactivate_dependency_driven_build_by_components = [ 'hal', 'heap', 'log', - 'newlib', + 'esp_libc', 'riscv', 'soc', 'xtensa', diff --git a/components/README.md b/components/README.md index 60d1765e3e..6517fb68d1 100644 --- a/components/README.md +++ b/components/README.md @@ -10,7 +10,7 @@ The core components are organized into two groups. The first group (referred to as `G0`) includes `hal`, `arch` (where `arch` is either `riscv` or `xtensa` depending on the chip), `esp_rom`, `esp_common`, and `soc`. This group contains information about and provides low-level access to the underlying hardware. In the case of `esp_common`, it contains hardware-agnostic code and utilities. These components may have dependencies on each other within the group, but outside dependencies should be minimized. The reason for this approach is that these components are fundamental, and many other components may require them. Ideally, the dependency relationship only goes one way, making it easier for this group to be usable in other projects. -The second group (referred to as `G1`) operates at a higher level than the first group. `G1` includes the components `esp_hw_support`, `esp_system`, `newlib`, `spi_flash`, `freertos`, `log`, and `heap`. Like the first group, circular dependencies within this group are allowed, and these components can have dependencies on the first group. G1 components represent essential software mechanisms for building other components. +The second group (referred to as `G1`) operates at a higher level than the first group. `G1` includes the components `esp_hw_support`, `esp_system`, `esp_libc`, `spi_flash`, `freertos`, `log`, and `heap`. Like the first group, circular dependencies within this group are allowed, and these components can have dependencies on the first group. G1 components represent essential software mechanisms for building other components. ## Descriptions @@ -40,7 +40,7 @@ Example: #### `esp_common` -Contains hardware-agnostic definitions, constants, macros, utilities, 'pure' and/or algorithmic functions that is useable by all other components (that is, barring there being a more appropriate component to put them in). +Contains hardware-agnostic definitions, constants, macros, utilities, 'pure' and/or algorithmic functions that is usable by all other components (that is, barring there being a more appropriate component to put them in). Example: @@ -85,7 +85,7 @@ Logging library. Heap implementation. -#### `newlib` +#### `esp_libc` Some functions n the standard library are implemented here, especially those needing other `G1` components. diff --git a/components/bootloader/subproject/CMakeLists.txt b/components/bootloader/subproject/CMakeLists.txt index 5503db2ddb..e67ad30fb4 100644 --- a/components/bootloader/subproject/CMakeLists.txt +++ b/components/bootloader/subproject/CMakeLists.txt @@ -31,8 +31,7 @@ set(COMPONENTS micro-ecc main efuse - esp_system - newlib + esp_libc esp_tee) # EXTRA_COMPONENT_DIRS can be populated with directories containing one or several components. @@ -61,7 +60,7 @@ endforeach() set(BOOTLOADER_BUILD 1) set(NON_OS_BUILD 1) include("${IDF_PATH}/tools/cmake/project.cmake") -set(common_req log esp_rom esp_common esp_hw_support newlib) +set(common_req log esp_rom esp_common esp_hw_support esp_libc) idf_build_set_property(EXTRA_COMPONENT_EXCLUDE_DIRS "${EXTRA_COMPONENT_EXCLUDE_DIRS}") idf_build_set_property(__COMPONENT_REQUIRES_COMMON "${common_req}") idf_build_set_property(__OUTPUT_SDKCONFIG 0) diff --git a/components/cxx/CMakeLists.txt b/components/cxx/CMakeLists.txt index bce5de3233..371bb2a9f1 100644 --- a/components/cxx/CMakeLists.txt +++ b/components/cxx/CMakeLists.txt @@ -74,15 +74,15 @@ if(NOT esp_tee_build) # Furthermore, force libcxx to appear later than libgcc because some libgcc unwind code is wrapped, if C++ # exceptions are disabled. libcxx (this component) provides the unwind code wrappers. # This is to prevent linking of libgcc's unwind code which considerably increases the binary size. - # Also force libnewlib to appear later than libstdc++ in link line since libstdc++ depends on - # some functions in libnewlib, e.g. getentropy(). + # Also force esp_libc to appear later than libstdc++ in link line since libstdc++ depends on + # some functions in esp_libc, e.g. getentropy(). idf_component_get_property(pthread pthread COMPONENT_LIB) - idf_component_get_property(newlib newlib COMPONENT_LIB) + idf_component_get_property(esp_libc esp_libc COMPONENT_LIB) if(CMAKE_C_COMPILER_ID MATCHES "Clang") - target_link_libraries(stdcpp_deps INTERFACE stdc++ c $ $) + target_link_libraries(stdcpp_deps INTERFACE stdc++ c $ $) else() - target_link_libraries(stdcpp_deps INTERFACE stdc++ $ $) + target_link_libraries(stdcpp_deps INTERFACE stdc++ $ $) endif() endif() diff --git a/components/esp_driver_uart/src/uart_vfs.c b/components/esp_driver_uart/src/uart_vfs.c index 332540ef85..4687ec4428 100644 --- a/components/esp_driver_uart/src/uart_vfs.c +++ b/components/esp_driver_uart/src/uart_vfs.c @@ -229,7 +229,7 @@ static ssize_t uart_write(int fd, const void * data, size_t size) tx_func_t tx_func = s_ctx[fd]->tx_func; esp_line_endings_t tx_mode = s_ctx[fd]->tx_mode; const char *data_c = (const char *)data; - /* Even though newlib does stream locking on each individual stream, we need + /* Even though libc does stream locking on each individual stream, we need * a dedicated UART lock if two streams (stdout and stderr) point to the * same UART. */ diff --git a/components/newlib/CMakeLists.txt b/components/esp_libc/CMakeLists.txt similarity index 96% rename from components/newlib/CMakeLists.txt rename to components/esp_libc/CMakeLists.txt index 7c8a1faa92..3c354f2932 100644 --- a/components/newlib/CMakeLists.txt +++ b/components/esp_libc/CMakeLists.txt @@ -68,7 +68,7 @@ else() endif() set(ldfragments "") -list(APPEND ldfragments "src/newlib.lf" "src/system_libs.lf") +list(APPEND ldfragments "src/esp_libc.lf" "src/system_libs.lf") if(CONFIG_LIBC_NEWLIB) list(APPEND ldfragments src/libc.lf) @@ -84,8 +84,8 @@ idf_component_register(SRCS "${srcs}" LDFRAGMENTS "${ldfragments}") # Toolchain libraries require code defined in this component -idf_component_get_property(newlib newlib COMPONENT_LIB) -target_link_libraries(${COMPONENT_LIB} INTERFACE c m ${CONFIG_COMPILER_RT_LIB_NAME} "$") +idf_component_get_property(esp_libc esp_libc COMPONENT_LIB) +target_link_libraries(${COMPONENT_LIB} INTERFACE c m ${CONFIG_COMPILER_RT_LIB_NAME} "$") set_source_files_properties(heap.c PROPERTIES COMPILE_FLAGS -fno-builtin) diff --git a/components/newlib/COPYING.NEWLIB b/components/esp_libc/COPYING.NEWLIB similarity index 100% rename from components/newlib/COPYING.NEWLIB rename to components/esp_libc/COPYING.NEWLIB diff --git a/components/newlib/COPYING.picolibc b/components/esp_libc/COPYING.picolibc similarity index 100% rename from components/newlib/COPYING.picolibc rename to components/esp_libc/COPYING.picolibc diff --git a/components/newlib/Kconfig b/components/esp_libc/Kconfig similarity index 100% rename from components/newlib/Kconfig rename to components/esp_libc/Kconfig diff --git a/components/newlib/platform_include/assert.h b/components/esp_libc/platform_include/assert.h similarity index 100% rename from components/newlib/platform_include/assert.h rename to components/esp_libc/platform_include/assert.h diff --git a/components/newlib/platform_include/endian.h b/components/esp_libc/platform_include/endian.h similarity index 100% rename from components/newlib/platform_include/endian.h rename to components/esp_libc/platform_include/endian.h diff --git a/components/newlib/platform_include/esp_newlib.h b/components/esp_libc/platform_include/esp_newlib.h similarity index 100% rename from components/newlib/platform_include/esp_newlib.h rename to components/esp_libc/platform_include/esp_newlib.h diff --git a/components/newlib/platform_include/net/if.h b/components/esp_libc/platform_include/net/if.h similarity index 100% rename from components/newlib/platform_include/net/if.h rename to components/esp_libc/platform_include/net/if.h diff --git a/components/newlib/platform_include/pthread.h b/components/esp_libc/platform_include/pthread.h similarity index 100% rename from components/newlib/platform_include/pthread.h rename to components/esp_libc/platform_include/pthread.h diff --git a/components/newlib/platform_include/semaphore.h b/components/esp_libc/platform_include/semaphore.h similarity index 100% rename from components/newlib/platform_include/semaphore.h rename to components/esp_libc/platform_include/semaphore.h diff --git a/components/newlib/platform_include/stdatomic.h b/components/esp_libc/platform_include/stdatomic.h similarity index 100% rename from components/newlib/platform_include/stdatomic.h rename to components/esp_libc/platform_include/stdatomic.h diff --git a/components/newlib/platform_include/stdio.h b/components/esp_libc/platform_include/stdio.h similarity index 100% rename from components/newlib/platform_include/stdio.h rename to components/esp_libc/platform_include/stdio.h diff --git a/components/newlib/platform_include/stdio_ext.h b/components/esp_libc/platform_include/stdio_ext.h similarity index 100% rename from components/newlib/platform_include/stdio_ext.h rename to components/esp_libc/platform_include/stdio_ext.h diff --git a/components/newlib/platform_include/sys/errno.h b/components/esp_libc/platform_include/sys/errno.h similarity index 100% rename from components/newlib/platform_include/sys/errno.h rename to components/esp_libc/platform_include/sys/errno.h diff --git a/components/newlib/platform_include/sys/ioctl.h b/components/esp_libc/platform_include/sys/ioctl.h similarity index 100% rename from components/newlib/platform_include/sys/ioctl.h rename to components/esp_libc/platform_include/sys/ioctl.h diff --git a/components/newlib/platform_include/sys/lock.h b/components/esp_libc/platform_include/sys/lock.h similarity index 100% rename from components/newlib/platform_include/sys/lock.h rename to components/esp_libc/platform_include/sys/lock.h diff --git a/components/newlib/platform_include/sys/poll.h b/components/esp_libc/platform_include/sys/poll.h similarity index 100% rename from components/newlib/platform_include/sys/poll.h rename to components/esp_libc/platform_include/sys/poll.h diff --git a/components/newlib/platform_include/sys/random.h b/components/esp_libc/platform_include/sys/random.h similarity index 100% rename from components/newlib/platform_include/sys/random.h rename to components/esp_libc/platform_include/sys/random.h diff --git a/components/newlib/platform_include/sys/reent.h b/components/esp_libc/platform_include/sys/reent.h similarity index 100% rename from components/newlib/platform_include/sys/reent.h rename to components/esp_libc/platform_include/sys/reent.h diff --git a/components/newlib/platform_include/sys/select.h b/components/esp_libc/platform_include/sys/select.h similarity index 100% rename from components/newlib/platform_include/sys/select.h rename to components/esp_libc/platform_include/sys/select.h diff --git a/components/newlib/platform_include/sys/termios.h b/components/esp_libc/platform_include/sys/termios.h similarity index 100% rename from components/newlib/platform_include/sys/termios.h rename to components/esp_libc/platform_include/sys/termios.h diff --git a/components/newlib/platform_include/sys/time.h b/components/esp_libc/platform_include/sys/time.h similarity index 100% rename from components/newlib/platform_include/sys/time.h rename to components/esp_libc/platform_include/sys/time.h diff --git a/components/newlib/platform_include/sys/uio.h b/components/esp_libc/platform_include/sys/uio.h similarity index 100% rename from components/newlib/platform_include/sys/uio.h rename to components/esp_libc/platform_include/sys/uio.h diff --git a/components/newlib/platform_include/sys/un.h b/components/esp_libc/platform_include/sys/un.h similarity index 100% rename from components/newlib/platform_include/sys/un.h rename to components/esp_libc/platform_include/sys/un.h diff --git a/components/newlib/platform_include/sys/unistd.h b/components/esp_libc/platform_include/sys/unistd.h similarity index 100% rename from components/newlib/platform_include/sys/unistd.h rename to components/esp_libc/platform_include/sys/unistd.h diff --git a/components/newlib/platform_include/sys/utime.h b/components/esp_libc/platform_include/sys/utime.h similarity index 100% rename from components/newlib/platform_include/sys/utime.h rename to components/esp_libc/platform_include/sys/utime.h diff --git a/components/newlib/platform_include/time.h b/components/esp_libc/platform_include/time.h similarity index 100% rename from components/newlib/platform_include/time.h rename to components/esp_libc/platform_include/time.h diff --git a/components/newlib/priv_include/esp_stdatomic.h b/components/esp_libc/priv_include/esp_stdatomic.h similarity index 100% rename from components/newlib/priv_include/esp_stdatomic.h rename to components/esp_libc/priv_include/esp_stdatomic.h diff --git a/components/newlib/priv_include/esp_time_impl.h b/components/esp_libc/priv_include/esp_time_impl.h similarity index 100% rename from components/newlib/priv_include/esp_time_impl.h rename to components/esp_libc/priv_include/esp_time_impl.h diff --git a/components/newlib/priv_include/string/local.h b/components/esp_libc/priv_include/string/local.h similarity index 100% rename from components/newlib/priv_include/string/local.h rename to components/esp_libc/priv_include/string/local.h diff --git a/components/newlib/project_include.cmake b/components/esp_libc/project_include.cmake similarity index 100% rename from components/newlib/project_include.cmake rename to components/esp_libc/project_include.cmake diff --git a/components/newlib/sbom.yml b/components/esp_libc/sbom.yml similarity index 97% rename from components/newlib/sbom.yml rename to components/esp_libc/sbom.yml index 496cb10c30..fec4fa1104 100644 --- a/components/newlib/sbom.yml +++ b/components/esp_libc/sbom.yml @@ -1,5 +1,5 @@ name: 'newlib' -version: '4.3.0' +version: '4.5.0' cpe: cpe:2.3:a:newlib_project:newlib:{}:*:*:*:*:*:*:* supplier: 'Organization: Espressif Systems (Shanghai) CO LTD' originator: 'Organization: Red Hat Incorporated' diff --git a/components/newlib/sdkconfig.rename b/components/esp_libc/sdkconfig.rename similarity index 100% rename from components/newlib/sdkconfig.rename rename to components/esp_libc/sdkconfig.rename diff --git a/components/newlib/sdkconfig.rename.esp32 b/components/esp_libc/sdkconfig.rename.esp32 similarity index 100% rename from components/newlib/sdkconfig.rename.esp32 rename to components/esp_libc/sdkconfig.rename.esp32 diff --git a/components/newlib/sdkconfig.rename.esp32c3 b/components/esp_libc/sdkconfig.rename.esp32c3 similarity index 100% rename from components/newlib/sdkconfig.rename.esp32c3 rename to components/esp_libc/sdkconfig.rename.esp32c3 diff --git a/components/newlib/sdkconfig.rename.esp32s2 b/components/esp_libc/sdkconfig.rename.esp32s2 similarity index 100% rename from components/newlib/sdkconfig.rename.esp32s2 rename to components/esp_libc/sdkconfig.rename.esp32s2 diff --git a/components/newlib/sdkconfig.rename.esp32s3 b/components/esp_libc/sdkconfig.rename.esp32s3 similarity index 100% rename from components/newlib/sdkconfig.rename.esp32s3 rename to components/esp_libc/sdkconfig.rename.esp32s3 diff --git a/components/newlib/src/.gitignore b/components/esp_libc/src/.gitignore similarity index 100% rename from components/newlib/src/.gitignore rename to components/esp_libc/src/.gitignore diff --git a/components/newlib/src/abort.c b/components/esp_libc/src/abort.c similarity index 100% rename from components/newlib/src/abort.c rename to components/esp_libc/src/abort.c diff --git a/components/newlib/src/assert.c b/components/esp_libc/src/assert.c similarity index 100% rename from components/newlib/src/assert.c rename to components/esp_libc/src/assert.c diff --git a/components/newlib/src/newlib.lf b/components/esp_libc/src/esp_libc.lf similarity index 92% rename from components/newlib/src/newlib.lf rename to components/esp_libc/src/esp_libc.lf index e311ff5b17..46509e58e2 100644 --- a/components/newlib/src/newlib.lf +++ b/components/esp_libc/src/esp_libc.lf @@ -1,5 +1,5 @@ -[mapping:newlib] -archive: libnewlib.a +[mapping:esp_libc] +archive: libesp_libc.a entries: if LIBC_OPTIMIZED_MISALIGNED_ACCESS = y: memcpy (noflash) diff --git a/components/newlib/src/flockfile.c b/components/esp_libc/src/flockfile.c similarity index 100% rename from components/newlib/src/flockfile.c rename to components/esp_libc/src/flockfile.c diff --git a/components/newlib/src/getentropy.c b/components/esp_libc/src/getentropy.c similarity index 100% rename from components/newlib/src/getentropy.c rename to components/esp_libc/src/getentropy.c diff --git a/components/newlib/src/heap.c b/components/esp_libc/src/heap.c similarity index 100% rename from components/newlib/src/heap.c rename to components/esp_libc/src/heap.c diff --git a/components/newlib/src/init.c b/components/esp_libc/src/init.c similarity index 100% rename from components/newlib/src/init.c rename to components/esp_libc/src/init.c diff --git a/components/newlib/src/libc.lf b/components/esp_libc/src/libc.lf similarity index 100% rename from components/newlib/src/libc.lf rename to components/esp_libc/src/libc.lf diff --git a/components/newlib/src/libm.lf b/components/esp_libc/src/libm.lf similarity index 100% rename from components/newlib/src/libm.lf rename to components/esp_libc/src/libm.lf diff --git a/components/newlib/src/locks.c b/components/esp_libc/src/locks.c similarity index 100% rename from components/newlib/src/locks.c rename to components/esp_libc/src/locks.c diff --git a/components/newlib/src/newlib_init.c b/components/esp_libc/src/newlib_init.c similarity index 100% rename from components/newlib/src/newlib_init.c rename to components/esp_libc/src/newlib_init.c diff --git a/components/newlib/src/picolibc/libc.lf b/components/esp_libc/src/picolibc/libc.lf similarity index 100% rename from components/newlib/src/picolibc/libc.lf rename to components/esp_libc/src/picolibc/libc.lf diff --git a/components/newlib/src/picolibc/open_memstream.c b/components/esp_libc/src/picolibc/open_memstream.c similarity index 100% rename from components/newlib/src/picolibc/open_memstream.c rename to components/esp_libc/src/picolibc/open_memstream.c diff --git a/components/newlib/src/picolibc/picolibc_init.c b/components/esp_libc/src/picolibc/picolibc_init.c similarity index 100% rename from components/newlib/src/picolibc/picolibc_init.c rename to components/esp_libc/src/picolibc/picolibc_init.c diff --git a/components/newlib/src/picolibc/rand.c b/components/esp_libc/src/picolibc/rand.c similarity index 100% rename from components/newlib/src/picolibc/rand.c rename to components/esp_libc/src/picolibc/rand.c diff --git a/components/newlib/src/poll.c b/components/esp_libc/src/poll.c similarity index 100% rename from components/newlib/src/poll.c rename to components/esp_libc/src/poll.c diff --git a/components/newlib/src/port/CMakeLists.txt b/components/esp_libc/src/port/CMakeLists.txt similarity index 100% rename from components/newlib/src/port/CMakeLists.txt rename to components/esp_libc/src/port/CMakeLists.txt diff --git a/components/newlib/src/port/esp_time_impl.c b/components/esp_libc/src/port/esp_time_impl.c similarity index 100% rename from components/newlib/src/port/esp_time_impl.c rename to components/esp_libc/src/port/esp_time_impl.c diff --git a/components/newlib/src/port/riscv/memcpy.c b/components/esp_libc/src/port/riscv/memcpy.c similarity index 100% rename from components/newlib/src/port/riscv/memcpy.c rename to components/esp_libc/src/port/riscv/memcpy.c diff --git a/components/newlib/src/port/riscv/memmove.c b/components/esp_libc/src/port/riscv/memmove.c similarity index 100% rename from components/newlib/src/port/riscv/memmove.c rename to components/esp_libc/src/port/riscv/memmove.c diff --git a/components/newlib/src/port/riscv/strcmp.S b/components/esp_libc/src/port/riscv/strcmp.S similarity index 100% rename from components/newlib/src/port/riscv/strcmp.S rename to components/esp_libc/src/port/riscv/strcmp.S diff --git a/components/newlib/src/port/riscv/strcpy.c b/components/esp_libc/src/port/riscv/strcpy.c similarity index 100% rename from components/newlib/src/port/riscv/strcpy.c rename to components/esp_libc/src/port/riscv/strcpy.c diff --git a/components/newlib/src/port/xtensa/stdatomic_s32c1i.c b/components/esp_libc/src/port/xtensa/stdatomic_s32c1i.c similarity index 100% rename from components/newlib/src/port/xtensa/stdatomic_s32c1i.c rename to components/esp_libc/src/port/xtensa/stdatomic_s32c1i.c diff --git a/components/newlib/src/pthread.c b/components/esp_libc/src/pthread.c similarity index 100% rename from components/newlib/src/pthread.c rename to components/esp_libc/src/pthread.c diff --git a/components/newlib/src/random.c b/components/esp_libc/src/random.c similarity index 100% rename from components/newlib/src/random.c rename to components/esp_libc/src/random.c diff --git a/components/newlib/src/realpath.c b/components/esp_libc/src/realpath.c similarity index 100% rename from components/newlib/src/realpath.c rename to components/esp_libc/src/realpath.c diff --git a/components/newlib/src/reent_init.c b/components/esp_libc/src/reent_init.c similarity index 100% rename from components/newlib/src/reent_init.c rename to components/esp_libc/src/reent_init.c diff --git a/components/newlib/src/reent_syscalls.c b/components/esp_libc/src/reent_syscalls.c similarity index 100% rename from components/newlib/src/reent_syscalls.c rename to components/esp_libc/src/reent_syscalls.c diff --git a/components/newlib/src/scandir.c b/components/esp_libc/src/scandir.c similarity index 100% rename from components/newlib/src/scandir.c rename to components/esp_libc/src/scandir.c diff --git a/components/newlib/src/stdatomic.c b/components/esp_libc/src/stdatomic.c similarity index 100% rename from components/newlib/src/stdatomic.c rename to components/esp_libc/src/stdatomic.c diff --git a/components/newlib/src/string/memcmp.c b/components/esp_libc/src/string/memcmp.c similarity index 100% rename from components/newlib/src/string/memcmp.c rename to components/esp_libc/src/string/memcmp.c diff --git a/components/newlib/src/string/strncmp.c b/components/esp_libc/src/string/strncmp.c similarity index 100% rename from components/newlib/src/string/strncmp.c rename to components/esp_libc/src/string/strncmp.c diff --git a/components/newlib/src/string/strncpy.c b/components/esp_libc/src/string/strncpy.c similarity index 100% rename from components/newlib/src/string/strncpy.c rename to components/esp_libc/src/string/strncpy.c diff --git a/components/newlib/src/syscalls.c b/components/esp_libc/src/syscalls.c similarity index 100% rename from components/newlib/src/syscalls.c rename to components/esp_libc/src/syscalls.c diff --git a/components/newlib/src/sysconf.c b/components/esp_libc/src/sysconf.c similarity index 100% rename from components/newlib/src/sysconf.c rename to components/esp_libc/src/sysconf.c diff --git a/components/newlib/src/system_libs.lf b/components/esp_libc/src/system_libs.lf similarity index 100% rename from components/newlib/src/system_libs.lf rename to components/esp_libc/src/system_libs.lf diff --git a/components/newlib/src/termios.c b/components/esp_libc/src/termios.c similarity index 100% rename from components/newlib/src/termios.c rename to components/esp_libc/src/termios.c diff --git a/components/newlib/src/time.c b/components/esp_libc/src/time.c similarity index 100% rename from components/newlib/src/time.c rename to components/esp_libc/src/time.c diff --git a/components/newlib/test_apps/.build-test-rules.yml b/components/esp_libc/test_apps/.build-test-rules.yml similarity index 68% rename from components/newlib/test_apps/.build-test-rules.yml rename to components/esp_libc/test_apps/.build-test-rules.yml index 8383b02ebc..2f99fbdfcf 100644 --- a/components/newlib/test_apps/.build-test-rules.yml +++ b/components/esp_libc/test_apps/.build-test-rules.yml @@ -1,3 +1,3 @@ # Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps -components/newlib/test_apps/newlib: +components/esp_libc/test_apps/newlib: diff --git a/components/newlib/test_apps/newlib/CMakeLists.txt b/components/esp_libc/test_apps/newlib/CMakeLists.txt similarity index 100% rename from components/newlib/test_apps/newlib/CMakeLists.txt rename to components/esp_libc/test_apps/newlib/CMakeLists.txt diff --git a/components/newlib/test_apps/newlib/README.md b/components/esp_libc/test_apps/newlib/README.md similarity index 100% rename from components/newlib/test_apps/newlib/README.md rename to components/esp_libc/test_apps/newlib/README.md diff --git a/components/newlib/test_apps/newlib/main/CMakeLists.txt b/components/esp_libc/test_apps/newlib/main/CMakeLists.txt similarity index 100% rename from components/newlib/test_apps/newlib/main/CMakeLists.txt rename to components/esp_libc/test_apps/newlib/main/CMakeLists.txt diff --git a/components/newlib/test_apps/newlib/main/test_app_main.c b/components/esp_libc/test_apps/newlib/main/test_app_main.c similarity index 100% rename from components/newlib/test_apps/newlib/main/test_app_main.c rename to components/esp_libc/test_apps/newlib/main/test_app_main.c diff --git a/components/newlib/test_apps/newlib/main/test_atomic.c b/components/esp_libc/test_apps/newlib/main/test_atomic.c similarity index 100% rename from components/newlib/test_apps/newlib/main/test_atomic.c rename to components/esp_libc/test_apps/newlib/main/test_atomic.c diff --git a/components/newlib/test_apps/newlib/main/test_file.c b/components/esp_libc/test_apps/newlib/main/test_file.c similarity index 100% rename from components/newlib/test_apps/newlib/main/test_file.c rename to components/esp_libc/test_apps/newlib/main/test_file.c diff --git a/components/newlib/test_apps/newlib/main/test_locks.c b/components/esp_libc/test_apps/newlib/main/test_locks.c similarity index 100% rename from components/newlib/test_apps/newlib/main/test_locks.c rename to components/esp_libc/test_apps/newlib/main/test_locks.c diff --git a/components/newlib/test_apps/newlib/main/test_memstream.c b/components/esp_libc/test_apps/newlib/main/test_memstream.c similarity index 100% rename from components/newlib/test_apps/newlib/main/test_memstream.c rename to components/esp_libc/test_apps/newlib/main/test_memstream.c diff --git a/components/newlib/test_apps/newlib/main/test_misaligned_access.c b/components/esp_libc/test_apps/newlib/main/test_misaligned_access.c similarity index 100% rename from components/newlib/test_apps/newlib/main/test_misaligned_access.c rename to components/esp_libc/test_apps/newlib/main/test_misaligned_access.c diff --git a/components/newlib/test_apps/newlib/main/test_misc.c b/components/esp_libc/test_apps/newlib/main/test_misc.c similarity index 100% rename from components/newlib/test_apps/newlib/main/test_misc.c rename to components/esp_libc/test_apps/newlib/main/test_misc.c diff --git a/components/newlib/test_apps/newlib/main/test_newlib.c b/components/esp_libc/test_apps/newlib/main/test_newlib.c similarity index 100% rename from components/newlib/test_apps/newlib/main/test_newlib.c rename to components/esp_libc/test_apps/newlib/main/test_newlib.c diff --git a/components/newlib/test_apps/newlib/main/test_printf.c b/components/esp_libc/test_apps/newlib/main/test_printf.c similarity index 100% rename from components/newlib/test_apps/newlib/main/test_printf.c rename to components/esp_libc/test_apps/newlib/main/test_printf.c diff --git a/components/newlib/test_apps/newlib/main/test_setjmp.c b/components/esp_libc/test_apps/newlib/main/test_setjmp.c similarity index 100% rename from components/newlib/test_apps/newlib/main/test_setjmp.c rename to components/esp_libc/test_apps/newlib/main/test_setjmp.c diff --git a/components/newlib/test_apps/newlib/main/test_stdatomic.c b/components/esp_libc/test_apps/newlib/main/test_stdatomic.c similarity index 100% rename from components/newlib/test_apps/newlib/main/test_stdatomic.c rename to components/esp_libc/test_apps/newlib/main/test_stdatomic.c diff --git a/components/newlib/test_apps/newlib/main/test_time.c b/components/esp_libc/test_apps/newlib/main/test_time.c similarity index 100% rename from components/newlib/test_apps/newlib/main/test_time.c rename to components/esp_libc/test_apps/newlib/main/test_time.c diff --git a/components/newlib/test_apps/newlib/pytest_newlib.py b/components/esp_libc/test_apps/newlib/pytest_newlib.py similarity index 100% rename from components/newlib/test_apps/newlib/pytest_newlib.py rename to components/esp_libc/test_apps/newlib/pytest_newlib.py diff --git a/components/newlib/test_apps/newlib/sdkconfig.ci.default b/components/esp_libc/test_apps/newlib/sdkconfig.ci.default similarity index 100% rename from components/newlib/test_apps/newlib/sdkconfig.ci.default rename to components/esp_libc/test_apps/newlib/sdkconfig.ci.default diff --git a/components/newlib/test_apps/newlib/sdkconfig.ci.misaligned_mem b/components/esp_libc/test_apps/newlib/sdkconfig.ci.misaligned_mem similarity index 100% rename from components/newlib/test_apps/newlib/sdkconfig.ci.misaligned_mem rename to components/esp_libc/test_apps/newlib/sdkconfig.ci.misaligned_mem diff --git a/components/newlib/test_apps/newlib/sdkconfig.ci.nano_psram_esp32 b/components/esp_libc/test_apps/newlib/sdkconfig.ci.nano_psram_esp32 similarity index 100% rename from components/newlib/test_apps/newlib/sdkconfig.ci.nano_psram_esp32 rename to components/esp_libc/test_apps/newlib/sdkconfig.ci.nano_psram_esp32 diff --git a/components/newlib/test_apps/newlib/sdkconfig.ci.options b/components/esp_libc/test_apps/newlib/sdkconfig.ci.options similarity index 100% rename from components/newlib/test_apps/newlib/sdkconfig.ci.options rename to components/esp_libc/test_apps/newlib/sdkconfig.ci.options diff --git a/components/newlib/test_apps/newlib/sdkconfig.ci.picolibc b/components/esp_libc/test_apps/newlib/sdkconfig.ci.picolibc similarity index 100% rename from components/newlib/test_apps/newlib/sdkconfig.ci.picolibc rename to components/esp_libc/test_apps/newlib/sdkconfig.ci.picolibc diff --git a/components/newlib/test_apps/newlib/sdkconfig.ci.psram_esp32 b/components/esp_libc/test_apps/newlib/sdkconfig.ci.psram_esp32 similarity index 100% rename from components/newlib/test_apps/newlib/sdkconfig.ci.psram_esp32 rename to components/esp_libc/test_apps/newlib/sdkconfig.ci.psram_esp32 diff --git a/components/newlib/test_apps/newlib/sdkconfig.ci.release_esp32 b/components/esp_libc/test_apps/newlib/sdkconfig.ci.release_esp32 similarity index 100% rename from components/newlib/test_apps/newlib/sdkconfig.ci.release_esp32 rename to components/esp_libc/test_apps/newlib/sdkconfig.ci.release_esp32 diff --git a/components/newlib/test_apps/newlib/sdkconfig.ci.release_esp32c2 b/components/esp_libc/test_apps/newlib/sdkconfig.ci.release_esp32c2 similarity index 100% rename from components/newlib/test_apps/newlib/sdkconfig.ci.release_esp32c2 rename to components/esp_libc/test_apps/newlib/sdkconfig.ci.release_esp32c2 diff --git a/components/newlib/test_apps/newlib/sdkconfig.ci.single_core_esp32 b/components/esp_libc/test_apps/newlib/sdkconfig.ci.single_core_esp32 similarity index 100% rename from components/newlib/test_apps/newlib/sdkconfig.ci.single_core_esp32 rename to components/esp_libc/test_apps/newlib/sdkconfig.ci.single_core_esp32 diff --git a/components/newlib/test_apps/newlib/sdkconfig.defaults b/components/esp_libc/test_apps/newlib/sdkconfig.defaults similarity index 100% rename from components/newlib/test_apps/newlib/sdkconfig.defaults rename to components/esp_libc/test_apps/newlib/sdkconfig.defaults diff --git a/components/newlib/test_apps/newlib/test_sbom/newlib_version.c b/components/esp_libc/test_apps/newlib/test_sbom/newlib_version.c similarity index 100% rename from components/newlib/test_apps/newlib/test_sbom/newlib_version.c rename to components/esp_libc/test_apps/newlib/test_sbom/newlib_version.c diff --git a/components/esp_phy/CMakeLists.txt b/components/esp_phy/CMakeLists.txt index 21a4b79792..44c9d4d156 100644 --- a/components/esp_phy/CMakeLists.txt +++ b/components/esp_phy/CMakeLists.txt @@ -144,7 +144,7 @@ if(CONFIG_ESP_PHY_ENABLED) if(CONFIG_ESP_PHY_INIT_DATA_IN_PARTITION) idf_component_get_property(esp_common_dir esp_common COMPONENT_DIR) idf_component_get_property(esp_rom_dir esp_rom COMPONENT_DIR) - idf_component_get_property(newlib_dir newlib COMPONENT_DIR) + idf_component_get_property(esp_libc_dir esp_libc COMPONENT_DIR) idf_component_get_property(soc_dir soc COMPONENT_DIR) idf_component_get_property(log_dir log COMPONENT_DIR) partition_table_get_partition_info(phy_partition_offset @@ -165,7 +165,7 @@ if(CONFIG_ESP_PHY_ENABLED) COMMAND ${CMAKE_C_COMPILER} -c ${CMAKE_CURRENT_LIST_DIR}/${idf_target}/phy_init_data.c -I ${esp_common_dir}/include -I ${CMAKE_CURRENT_LIST_DIR}/include -I ${CMAKE_CURRENT_LIST_DIR}/${idf_target}/include -I ${esp_rom_dir}/include - -I ${soc_dir}/${idf_target}/include -I ${newlib_dir}/platform_include + -I ${soc_dir}/${idf_target}/include -I ${esp_libc_dir}/platform_include -I ${log_dir}/include -I ${config_dir} -o phy_init_data.obj COMMAND ${CMAKE_OBJCOPY} -O binary phy_init_data.obj ${phy_init_data_bin} ) diff --git a/components/esp_pm/linker.lf b/components/esp_pm/linker.lf index 635b5aeb32..3611738407 100644 --- a/components/esp_pm/linker.lf +++ b/components/esp_pm/linker.lf @@ -73,8 +73,8 @@ entries: esp_timer_impl_systimer:esp_timer_impl_advance (noflash) esp_timer_impl_systimer:esp_timer_impl_set (noflash) -[mapping:newlib_pm] -archive: libnewlib.a +[mapping:esp_libc_pm] +archive: libesp_libc.a entries: if PM_SLP_IRAM_OPT = y: esp_time_impl:esp_time_impl_set_boot_time (noflash) diff --git a/components/esp_psram/esp32/Kconfig.spiram b/components/esp_psram/esp32/Kconfig.spiram index 04c32ff5fa..739abbca2c 100644 --- a/components/esp_psram/esp32/Kconfig.spiram +++ b/components/esp_psram/esp32/Kconfig.spiram @@ -84,7 +84,7 @@ menu "SPI RAM config" default SPIRAM_CACHE_WORKAROUND_STRATEGY_MEMW help Select the workaround strategy. Note that the strategy for precompiled - libraries (libgcc, newlib, bt, wifi) is not affected by this selection. + libraries (libgcc, libc, bt, wifi) is not affected by this selection. Unless you know you need a different strategy, it's suggested you stay with the default MEMW strategy. Note that DUPLDST can interfere with hardware diff --git a/components/esp_rom/test_apps/rom_tests/main/CMakeLists.txt b/components/esp_rom/test_apps/rom_tests/main/CMakeLists.txt index f7ca0448b7..d4f9281897 100644 --- a/components/esp_rom/test_apps/rom_tests/main/CMakeLists.txt +++ b/components/esp_rom/test_apps/rom_tests/main/CMakeLists.txt @@ -4,7 +4,7 @@ if(CONFIG_IDF_TARGET_ARCH_RISCV AND NOT DEFINED CONFIG_ESP_ROM_HAS_SUBOPTIMAL_NE " 1) Check if ROM functions implementation is optimized on misaligned memory operations.\n" " 2) Define ESP_ROM_HAS_SUBOPTIMAL_NEWLIB_ON_MISALIGNED_MEMORY to esp_rom_caps.h. If it is zero:\n" " 2.1) Move some functions out from *.rom.libc.ld file (see *.rom.libc-suboptimal_for_misaligned_mem.ld).\n" - "Find a related test in the newlib component to use as a reference.") + "Find a related test in the esp_libc component to use as a reference.") endif() set(srcs "test_app_main.c" diff --git a/components/esp_system/README.md b/components/esp_system/README.md index f01e59d828..fd4a917f43 100644 --- a/components/esp_system/README.md +++ b/components/esp_system/README.md @@ -17,12 +17,12 @@ should maintain the definition of having the origin point at `g_startup_time`. This is the time read from an underlying hardware timer, controlled through config. Origin is at the point where the underlying timer starts counting. -3. `newlib` time (`gettimeofday`) +3. `esp_libc` time (`gettimeofday`) Timekeeping function in standard library. Can be set (`settimeofday`) or moved forward/backward (`adjtime`); with the possibility of the changes being made persistent through config. Currently implemented in terms of system time, as the point of origin is fixed. -If persistence is enabled, RTC time is also used in conjuction with system time. +If persistence is enabled, RTC time is also used in conjunction with system time. 4. RTC time (`esp_rtc_get_time_us`) diff --git a/components/esp_system/startup_funcs.c b/components/esp_system/startup_funcs.c index 78caab6a32..23a0527a97 100644 --- a/components/esp_system/startup_funcs.c +++ b/components/esp_system/startup_funcs.c @@ -75,7 +75,7 @@ ESP_SYSTEM_INIT_FN(init_show_cpu_freq, CORE, BIT(0), 10) ESP_SYSTEM_INIT_FN(init_brownout, CORE, BIT(0), 104) { // [refactor-todo] leads to call chain rtc_is_register (driver) -> esp_intr_alloc (esp32/esp32s2) -> - // malloc (newlib) -> heap_caps_malloc (heap), so heap must be at least initialized + // malloc (esp_libc) -> heap_caps_malloc (heap), so heap must be at least initialized esp_err_t ret = ESP_OK; // BOD and VBAT share the same interrupt number. To avoid blocking the system in an intermediate state // where an interrupt occurs and the interrupt number is enabled, but the ISR is not configured, enable diff --git a/components/esp_system/system_init_fn.txt b/components/esp_system/system_init_fn.txt index 2d6238b0c5..8f9808f8f9 100644 --- a/components/esp_system/system_init_fn.txt +++ b/components/esp_system/system_init_fn.txt @@ -34,13 +34,13 @@ CORE: 21: init_efuse_show_app_info in components/efuse/src/esp_efuse_startup.c # fail initializing it properly. CORE: 100: init_heap in components/heap/heap_caps_init.c on BIT(0) -# When apptrace module is enabled, there will be SEGGER_SYSVIEW calls in the newlib init. +# When apptrace module is enabled, there will be SEGGER_SYSVIEW calls in the esp_libc init. # SEGGER_SYSVIEW relies on apptrace module # apptrace module uses esp_timer_get_time to determine timeout conditions. # esp_timer early initialization is required for esp_timer_get_time to work. CORE: 101: esp_timer_init_nonos in components/esp_timer/src/esp_timer_init.c on BIT(0) -CORE: 102: init_libc in components/newlib/src/init.c on BIT(0) +CORE: 102: init_libc in components/esp_libc/src/init.c on BIT(0) # Add the psram to heap, psram vaddr region is reserved when initialising the heap, after # psram is initialised (and necessary reservation for psram usage), the rest of the psram @@ -51,14 +51,14 @@ CORE: 104: init_brownout in components/esp_system/startup_funcs.c on BIT(0) CORE: 105: init_newlib_time in components/esp_system/startup_funcs.c on BIT(0) # Peripheral-specific implementation operators should be filled first -# Then register vfs console, and follow by newlib stdio initialization +# Then register vfs console, and follow by esp_libc stdio initialization CORE: 110: init_vfs_uart in components/esp_driver_uart/src/uart_vfs.c on BIT(0) CORE: 111: init_vfs_usj in components/esp_driver_usb_serial_jtag/src/usb_serial_jtag_vfs.c on BIT(0) CORE: 112: init_vfs_usj_sec in components/esp_driver_usb_serial_jtag/src/usb_serial_jtag_vfs.c on BIT(0) CORE: 113: init_vfs_usb_cdc_rom_console in components/esp_usb_cdc_rom_console/vfs_cdcacm.c on BIT(0) CORE: 118: init_vfs_nullfs in components/vfs/nullfs.c on BIT(0) CORE: 119: init_vfs_console in components/esp_vfs_console/vfs_console.c on BIT(0) -CORE: 120: init_libc_stdio in components/newlib/src/init.c on BIT(0) +CORE: 120: init_libc_stdio in components/esp_libc/src/init.c on BIT(0) CORE: 130: init_flash in components/esp_system/startup_funcs.c on BIT(0) CORE: 140: init_efuse in components/efuse/src/esp_efuse_startup.c on BIT(0) diff --git a/components/esp_tee/subproject/CMakeLists.txt b/components/esp_tee/subproject/CMakeLists.txt index ee31a83577..ce1028c462 100644 --- a/components/esp_tee/subproject/CMakeLists.txt +++ b/components/esp_tee/subproject/CMakeLists.txt @@ -34,7 +34,7 @@ list(APPEND COMPONENTS tee_flash_mgr tee_ota_ops tee_sec_storage tee_attestation include_directories(${CONFIG_DIR}) include("${IDF_PATH}/tools/cmake/project.cmake") -set(common_req esp_common esp_hw_support esp_rom freertos hal log newlib soc spi_flash) +set(common_req esp_common esp_hw_support esp_rom freertos hal log esp_libc soc spi_flash) if(CONFIG_IDF_TARGET_ARCH_RISCV) list(APPEND common_req riscv) diff --git a/components/heap/heap_private.h b/components/heap/heap_private.h index 7a959bde6a..4960be5bb3 100644 --- a/components/heap/heap_private.h +++ b/components/heap/heap_private.h @@ -84,8 +84,8 @@ FORCE_INLINE_ATTR heap_t *find_containing_heap(void *ptr ) /* Because we don't want to add _another_ known allocation method to the stack of functions to trace wrt memory tracing, - these are declared private. The newlib malloc()/realloc() implementation also calls these, so they are declared - separately in newlib/syscalls.c. + these are declared private. The libc malloc()/realloc() implementation also calls these, so they are declared + separately in esp_libc/src/syscalls.c. */ void *heap_caps_realloc_default(void *p, size_t size); void *heap_caps_malloc_default(size_t size); diff --git a/components/lwip/port/esp32xx/no_vfs_syscalls.c b/components/lwip/port/esp32xx/no_vfs_syscalls.c index 69fa1576fb..de27ddae60 100644 --- a/components/lwip/port/esp32xx/no_vfs_syscalls.c +++ b/components/lwip/port/esp32xx/no_vfs_syscalls.c @@ -19,7 +19,7 @@ #error This file should only be built when CONFIG_VFS_SUPPORT_IO=n #endif -/* Default implementations of read/write provided in newlib component, +/* Default implementations of read/write provided in esp_libc component, * used as a fallback for console I/O. */ extern ssize_t _write_r_console(struct _reent *r, int fd, const void * data, size_t size); diff --git a/components/nvs_flash/CMakeLists.txt b/components/nvs_flash/CMakeLists.txt index 8872c5ea19..74745ffa67 100644 --- a/components/nvs_flash/CMakeLists.txt +++ b/components/nvs_flash/CMakeLists.txt @@ -32,7 +32,7 @@ elseif(esp_tee_build) "src/nvs_platform.cpp") set(requires esp_partition mbedtls) - set(priv_requires spi_flash newlib cxx) + set(priv_requires spi_flash esp_libc cxx) idf_component_register(SRCS "${srcs}" REQUIRES "${requires}" @@ -63,7 +63,7 @@ else() if(${target} STREQUAL "linux") set(priv_requires spi_flash) else() - set(priv_requires spi_flash newlib esptool_py) + set(priv_requires spi_flash esp_libc esptool_py) endif() idf_component_register(SRCS "${srcs}" diff --git a/components/rt/idf_changes.md b/components/rt/idf_changes.md index 06bdf14f5d..297b5b6ea2 100644 --- a/components/rt/idf_changes.md +++ b/components/rt/idf_changes.md @@ -8,7 +8,7 @@ This document is used to track all changes made to the FreeRTOS-Plus-POSIX V1.0. ## POSIX errno -Instead of relying on the FreeRTOS `errno` scheme by enabling `configUSE_POSIX_ERRNO`, the `errno` provided by newlib is used. `configUSE_POSIX_ERRNO` should stay disabled. +Instead of relying on the FreeRTOS `errno` scheme by enabling `configUSE_POSIX_ERRNO`, the `errno` provided by libc is used. `configUSE_POSIX_ERRNO` should stay disabled. ## API Changes @@ -22,7 +22,7 @@ The following functions are stubs and always return `ENOSYS`: In the original FreeRTOS-Plus-POSIX project, the POSIX header files are provided in the sub directory `FreeRTOS-Plus-POSIX`. In ESP-IDF, however, the POSIX header files do not need any prefix. This increases compatibility with applications originally written for other platforms. All files originating from the FreeRTOS-Plus-POSIX project have been modified to reflect the different include path. -Wherever possible, ESP-IDF is using header files from newlib instead of the header files from FreeRTOS-Plus-POSIX. +Wherever possible, ESP-IDF is using header files from libc instead of the header files from FreeRTOS-Plus-POSIX. In some cases, additional includes have been added to files from FreeRTOS-Plus-POSIX to simplify building. @@ -39,7 +39,7 @@ NANOSECONDS_PER_SECOND NANOSECONDS_PER_TICK ``` -In FreeRTOS-Plus-POSIX, they are located in the custom `time.h`, but ESP-IDF uses newlib's `time.h`, where these definitions are not present. +In FreeRTOS-Plus-POSIX, they are located in the custom `time.h`, but ESP-IDF uses `components/esp_libc/platform_include/time.h`, where these definitions are not present. ## Code Format diff --git a/components/vfs/CMakeLists.txt b/components/vfs/CMakeLists.txt index fca10cbde8..cd7a785f06 100644 --- a/components/vfs/CMakeLists.txt +++ b/components/vfs/CMakeLists.txt @@ -23,7 +23,7 @@ idf_component_register(SRCS ${sources} PRIV_INCLUDE_DIRS private_include PRIV_REQUIRES ${pr}) -# Some newlib syscalls are implemented in vfs.c, make sure these are always +# Some libc syscalls are implemented in vfs.c, make sure these are always # seen by the linker target_link_libraries(${COMPONENT_LIB} INTERFACE "-u vfs_include_syscalls_impl") diff --git a/components/vfs/include/esp_vfs.h b/components/vfs/include/esp_vfs.h index 48308fa0c4..7ad766c028 100644 --- a/components/vfs/include/esp_vfs.h +++ b/components/vfs/include/esp_vfs.h @@ -370,8 +370,8 @@ esp_err_t esp_vfs_register_fd_with_local_fd(esp_vfs_id_t vfs_id, int local_fd, b esp_err_t esp_vfs_unregister_fd(esp_vfs_id_t vfs_id, int fd); /** - * These functions are to be used in newlib syscall table. They will be called by - * newlib when it needs to use any of the syscalls. + * These functions are to be used in esp_libc syscall table. They will be called by + * esp_libc when it needs to use any of the syscalls. */ /**@{*/ ssize_t esp_vfs_write(struct _reent *r, int fd, const void * data, size_t size); diff --git a/components/vfs/vfs.c b/components/vfs/vfs.c index bcd5efa3d5..020a2312eb 100644 --- a/components/vfs/vfs.c +++ b/components/vfs/vfs.c @@ -1833,7 +1833,7 @@ int tcsendbreak(int fd, int duration) #endif // CONFIG_VFS_SUPPORT_TERMIOS -/* Create aliases for newlib syscalls +/* Create aliases for libc syscalls These functions are also available in ROM as stubs which use the syscall table, but linking them directly here saves an additional function call when a software function is linked to one, and diff --git a/docs/en/COPYRIGHT.rst b/docs/en/COPYRIGHT.rst index bf9ad5fad3..c863d2d56b 100644 --- a/docs/en/COPYRIGHT.rst +++ b/docs/en/COPYRIGHT.rst @@ -19,9 +19,9 @@ Firmware Components These third party libraries can be included into the application (firmware) produced by ESP-IDF. -* :component:`Newlib ` is licensed under the BSD License, with copyright held by the respective parties, as described in :component_file:`COPYING.NEWLIB `. If :ref:`CONFIG_LIBC_PICOLIBC` is enabled, see also :component_file:`COPYING.picolibc `. +* :component:`Newlib ` is licensed under the BSD License, with copyright held by the respective parties, as described in :component_file:`COPYING.NEWLIB `. If :ref:`CONFIG_LIBC_PICOLIBC` is enabled, see also :component_file:`COPYING.picolibc `. -:component:`Picolibc ` is licensed under the BSD License, with copyright held by the respective parties, as described in :component_file:`COPYING.picolibc `. +:component:`Picolibc ` is licensed under the BSD License, with copyright held by the respective parties, as described in :component_file:`COPYING.picolibc `. * :component:`Xtensa header files ` are Copyright (C) 2013 Tensilica Inc and are licensed under the MIT License as reproduced in the individual header files. @@ -87,7 +87,7 @@ ROM Source Code Copyrights Espressif SoCs mask ROM hardware includes binaries compiled from portions of the following third party software: -* :component:`Newlib `, licensed under the BSD License and is Copyright of various parties, as described in :component_file:`COPYING.NEWLIB `. +* :component:`Newlib `, licensed under the BSD License and is Copyright of various parties, as described in :component_file:`COPYING.NEWLIB `. * Xtensa libhal, Copyright (C) Tensilica Inc and licensed under the MIT License (see below). diff --git a/docs/en/api-guides/build-system.rst b/docs/en/api-guides/build-system.rst index fedb5ce058..f1f880fa2c 100644 --- a/docs/en/api-guides/build-system.rst +++ b/docs/en/api-guides/build-system.rst @@ -603,7 +603,7 @@ Common Component Requirements To avoid duplication, every component automatically requires some "common" IDF components even if they are not mentioned explicitly. Headers from these components can always be included. -The list of common components is: cxx, newlib, freertos, esp_hw_support, heap, log, soc, hal, esp_rom, esp_common, esp_system, xtensa/riscv. +The list of common components is: cxx, esp_libc, freertos, esp_hw_support, heap, log, soc, hal, esp_rom, esp_common, esp_system, xtensa/riscv. Including Components in the Build @@ -1247,10 +1247,10 @@ It is possible to do so by using the :ref:`build system APIs provided `_ (default) - `Picolibc `_ (enabled with :ref:`CONFIG_LIBC_PICOLIBC` Kconfig option) -The Newlib version is specified in :component_file:`newlib/sbom.yml`. +The Newlib version is specified in :component_file:`esp_libc/sbom.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. diff --git a/docs/en/api-guides/lwip.rst b/docs/en/api-guides/lwip.rst index 8261eef79c..523a8504b9 100644 --- a/docs/en/api-guides/lwip.rst +++ b/docs/en/api-guides/lwip.rst @@ -173,7 +173,7 @@ Example: Socket Error Reason Code ++++++++++++++++++++++++ -Below is a list of common error codes. For a more detailed list of standard POSIX/C error codes, please see `newlib errno.h `_ and the platform-specific extensions :component_file:`newlib/platform_include/sys/errno.h`. +Below is a list of common error codes. For a more detailed list of standard POSIX/C error codes, please see `newlib errno.h `_ and the platform-specific extensions :component_file:`esp_libc/platform_include/sys/errno.h`. .. list-table:: :header-rows: 1 diff --git a/docs/en/api-guides/startup.rst b/docs/en/api-guides/startup.rst index 47555130a9..edb9313a52 100644 --- a/docs/en/api-guides/startup.rst +++ b/docs/en/api-guides/startup.rst @@ -141,7 +141,7 @@ The primary system initialization stage includes: - Log information about this application (project name, :ref:`app-version`, etc.) if default log level enables this. - Initialize the heap allocator (before this point all allocations must be static or on the stack). - - Initialize newlib component syscalls and time functions. + - Initialize esp_libc component syscalls and time functions. - Configure the brownout detector. - Setup libc stdin, stdout, and stderr according to the :ref:`serial console configuration `. :esp32: - Perform any security-related checks, including burning efuses that should be burned for this configuration (including :ref:`disabling ROM download mode on ESP32 V3 `, :ref:`CONFIG_ESP32_DISABLE_BASIC_ROM_CONSOLE`). diff --git a/docs/en/api-reference/system/pthread.rst b/docs/en/api-reference/system/pthread.rst index 148344181e..e64bf10e95 100644 --- a/docs/en/api-reference/system/pthread.rst +++ b/docs/en/api-reference/system/pthread.rst @@ -29,7 +29,7 @@ Unlike many operating systems using POSIX Threads, ESP-IDF is a real-time operat .. note:: - The POSIX ``errno`` is provided by newlib in ESP-IDF. Thus the configuration ``configUSE_POSIX_ERRNO`` is not used and should stay disabled. + The POSIX ``errno`` is provided by esp_libc in ESP-IDF. Thus the configuration ``configUSE_POSIX_ERRNO`` is not used and should stay disabled. By default, all POSIX Threads have the same RTOS priority, but it is possible to change this by calling a :ref:`custom API `. diff --git a/docs/zh_CN/COPYRIGHT.rst b/docs/zh_CN/COPYRIGHT.rst index c614804a53..6607f98998 100644 --- a/docs/zh_CN/COPYRIGHT.rst +++ b/docs/zh_CN/COPYRIGHT.rst @@ -19,9 +19,9 @@ 以下这些第三方库包含在 ESP-IDF 生成的应用程序(固件)中。 -* 如 :component_file:`COPYING.NEWLIB ` 中所述, :component:`Newlib ` 经 BSD 许可证许可,版权归各方所有。如启用了 :ref:`CONFIG_LIBC_PICOLIBC`,请参阅 :component_file:`COPYING.picolibc `。 +* 如 :component_file:`COPYING.NEWLIB ` 中所述, :component:`Newlib ` 经 BSD 许可证许可,版权归各方所有。如启用了 :ref:`CONFIG_LIBC_PICOLIBC`,请参阅 :component_file:`COPYING.picolibc `。 -* 如 :component_file:`COPYING.picolibc ` 中所述, :component:`Picolibc ` 经 BSD 许可证许可,版权归各方所有。 +* 如 :component_file:`COPYING.picolibc ` 中所述, :component:`Picolibc ` 经 BSD 许可证许可,版权归各方所有。 * :component:`Xtensa 头文件 ` 版权归 2013 Tensilica 公司所有,并根据各头文件中复制的 MIT 许可证进行许可。 @@ -87,7 +87,7 @@ ROM 源代码版权 乐鑫芯片中的 Mask ROM 包含以下部分第三方软件编译的二进制文件: -* :component:`Newlib `,如 :component_file:`COPYING.NEWLIB ` 所述,由 BSD 许可证进行许可,版权归各方所有。 +* :component:`Newlib `,如 :component_file:`COPYING.NEWLIB ` 所述,由 BSD 许可证进行许可,版权归各方所有。 * Xtensa libhal,版权归 Tensilica 公司所有,并根据下述 MIT 许可证进行许可。 diff --git a/docs/zh_CN/api-guides/build-system.rst b/docs/zh_CN/api-guides/build-system.rst index 5c03b8d2a4..b507cf06b4 100644 --- a/docs/zh_CN/api-guides/build-system.rst +++ b/docs/zh_CN/api-guides/build-system.rst @@ -603,7 +603,7 @@ Spark Plug 组件 为避免重复性工作,各组件都用自动依赖一些“通用” IDF 组件,即使它们没有被明确提及。这些组件的头文件会一直包含在构建系统中。 -通用组件包括:cxx、newlib、freertos、esp_hw_support、heap、log、soc、hal、esp_rom、esp_common、esp_system。 +通用组件包括:cxx、esp_libc、freertos、esp_hw_support、heap、log、soc、hal、esp_rom、esp_common、esp_system。 在构建中导入组件 @@ -1248,9 +1248,9 @@ ESP-IDF 提供了一个模板 CMake 项目,可以基于此轻松创建应用 idf_build_process(esp32) # 创建项目可执行文件 - # 使用其别名 idf::newlib 将其链接到 newlib 组件 + # 使用其别名 idf::esp_libc 将其链接到 esp_libc 组件 add_executable(${CMAKE_PROJECT_NAME}.elf main.c) - target_link_libraries(${CMAKE_PROJECT_NAME}.elf idf::newlib) + target_link_libraries(${CMAKE_PROJECT_NAME}.elf idf::esp_libc) # 让构建系统知道项目到可执行文件是什么,从而添加更多的目标以及依赖关系等 idf_build_executable(${CMAKE_PROJECT_NAME}.elf) diff --git a/docs/zh_CN/api-guides/c.rst b/docs/zh_CN/api-guides/c.rst index c7e19514dd..672cf3e8d5 100644 --- a/docs/zh_CN/api-guides/c.rst +++ b/docs/zh_CN/api-guides/c.rst @@ -8,7 +8,7 @@ ESP-IDF 主要使用 C 语言编写,并提供 C API。ESP-IDF 可以使用以 - `Newlib `_ (默认) - `Picolibc `_ (通过 :ref:`CONFIG_LIBC_PICOLIBC` Kconfig 选项启用) -Newlib 的版本号记录在 :component_file:`newlib/sbom.yml` 文件中。 +Newlib 的版本号记录在 :component_file:`esp_libc/sbom.yml` 文件中。 一般来说,除非在 :ref:`unsupported_c_features` 特别说明,当前编译器(目前是 GCC)支持的所有 C 语言功能在 ESP-IDF 中均可使用。 diff --git a/docs/zh_CN/api-guides/lwip.rst b/docs/zh_CN/api-guides/lwip.rst index 80d1a2c146..d9f9997919 100644 --- a/docs/zh_CN/api-guides/lwip.rst +++ b/docs/zh_CN/api-guides/lwip.rst @@ -173,7 +173,7 @@ BSD 套接字的相关参考资料十分丰富,包括但不限于: 套接字错误原因代码 ++++++++++++++++++++++++ -以下是常见错误代码列表。获取标准 POSIX/C 错误代码的详细列表,请参阅 `newlib errno.h `_ 和特定平台扩展 :component_file:`newlib/platform_include/sys/errno.h`。 +以下是常见错误代码列表。获取标准 POSIX/C 错误代码的详细列表,请参阅 `newlib errno.h `_ 和特定平台扩展 :component_file:`esp_libc/platform_include/sys/errno.h`。 .. list-table:: :header-rows: 1 diff --git a/docs/zh_CN/api-guides/startup.rst b/docs/zh_CN/api-guides/startup.rst index 2f7dcc0603..e8d2d25ed3 100644 --- a/docs/zh_CN/api-guides/startup.rst +++ b/docs/zh_CN/api-guides/startup.rst @@ -141,7 +141,7 @@ ESP-IDF 应用程序的入口是 :idf_file:`components/esp_system/port/cpu_start - 如果默认的日志级别允许,则记录该应用程序的相关信息(项目名称、:ref:`app-version` 等)。 - 初始化堆分配器(在这之前,所有分配必须是静态的或在堆栈上)。 - - 初始化 newlib 组件的系统调用和时间函数。 + - 初始化 esp_libc 组件的系统调用和时间函数。 - 配置断电检测器。 - 根据 :ref:`串行控制台配置 ` 设置 libc stdin、stdout、和 stderr。 :esp32: - 执行与安全有关的检查,包括为该配置烧录 efuse(包括 :ref:`禁用 ESP32 V3 的 ROM 下载模式 `、:ref:`CONFIG_ESP32_DISABLE_BASIC_ROM_CONSOLE`)。 diff --git a/docs/zh_CN/api-reference/system/pthread.rst b/docs/zh_CN/api-reference/system/pthread.rst index 71d5fc6afe..66a757db36 100644 --- a/docs/zh_CN/api-reference/system/pthread.rst +++ b/docs/zh_CN/api-reference/system/pthread.rst @@ -29,7 +29,7 @@ RTOS 集成 .. note:: - POSIX 的 ``errno`` 由 ESP-IDF 中的 newlib 提供。因此,配置项 ``configUSE_POSIX_ERRNO`` 并未被使用,应该保持禁用状态。 + POSIX 的 ``errno`` 由 ESP-IDF 中的 esp_libc 提供。因此,配置项 ``configUSE_POSIX_ERRNO`` 并未被使用,应该保持禁用状态。 默认情况下,所有 pthread 具有相同的 RTOS 优先级,但可以通过调用 :ref:`ESP-IDF 提供的扩展 API ` 对此优先级进行更改。 diff --git a/examples/custom_bootloader/bootloader_multiboot/main/CMakeLists.txt b/examples/custom_bootloader/bootloader_multiboot/main/CMakeLists.txt index 38e5bb3702..d1a6f1b2dc 100644 --- a/examples/custom_bootloader/bootloader_multiboot/main/CMakeLists.txt +++ b/examples/custom_bootloader/bootloader_multiboot/main/CMakeLists.txt @@ -1,3 +1,3 @@ idf_component_register(SRCS "bootloader_multiboot_example_main.c" INCLUDE_DIRS "." - PRIV_REQUIRES newlib) + PRIV_REQUIRES esp_libc) diff --git a/examples/peripherals/spi_master/hd_eeprom/components/eeprom/linker.lf b/examples/peripherals/spi_master/hd_eeprom/components/eeprom/linker.lf index 4c11ffc8de..59b886fbc6 100644 --- a/examples/peripherals/spi_master/hd_eeprom/components/eeprom/linker.lf +++ b/examples/peripherals/spi_master/hd_eeprom/components/eeprom/linker.lf @@ -12,8 +12,8 @@ entries: spi_eeprom: spi_eeprom_deinit (default) spi_eeprom: spi_eeprom_init (default) -[mapping:ext_newlib] -archive: libnewlib.a +[mapping:ext_esp_libc] +archive: libesp_libc.a entries: if EXAMPLE_USE_SPI1_PINS = y: time:usleep (noflash) diff --git a/tools/ci/check_copyright_config.yaml b/tools/ci/check_copyright_config.yaml index 9bc679ec10..733cc0fd7b 100644 --- a/tools/ci/check_copyright_config.yaml +++ b/tools/ci/check_copyright_config.yaml @@ -74,12 +74,12 @@ lwip_component: - BSD-3-Clause license_for_new_files: Apache-2.0 -newlib_component: +esp_libc_component: include: - - 'components/newlib/platform_include/**' - - 'components/newlib/port/**' - - 'components/newlib/priv_include/**' - - 'components/newlib/src/**' + - 'components/esp_libc/platform_include/**' + - 'components/esp_libc/port/**' + - 'components/esp_libc/priv_include/**' + - 'components/esp_libc/src/**' allowed_licenses: - Apache-2.0 - BSD-2-Clause-FreeBSD AND Apache-2.0 diff --git a/tools/ci/sg_rules/no_std_assert_in_hal_component.yml b/tools/ci/sg_rules/no_std_assert_in_hal_component.yml index 1e3a854cc1..11b5632b99 100644 --- a/tools/ci/sg_rules/no_std_assert_in_hal_component.yml +++ b/tools/ci/sg_rules/no_std_assert_in_hal_component.yml @@ -2,7 +2,7 @@ id: no-std-assert-call-in-hal-component message: Don't use standard assert function in the hal component severity: error # error, warning, info, hint -note: The standard assert function depends on newlib(G1) component, but hal is a G0 component +note: The standard assert function depends on esp_libc(G1) component, but hal is a G0 component language: C files: - "components/hal/**/*" diff --git a/tools/cmake/build.cmake b/tools/cmake/build.cmake index 582991bf0d..e87ec1f6e0 100644 --- a/tools/cmake/build.cmake +++ b/tools/cmake/build.cmake @@ -322,7 +322,7 @@ function(__build_init idf_path) # Set components required by all other components in the build # # - esp_hw_support is here for backward compatibility - set(requires_common cxx newlib freertos esp_hw_support heap log soc hal esp_rom esp_common esp_system) + set(requires_common cxx esp_libc freertos esp_hw_support heap log soc hal esp_rom esp_common esp_system) idf_build_set_property(__COMPONENT_REQUIRES_COMMON "${requires_common}") endif() diff --git a/tools/cmake/component_deps.dot.in b/tools/cmake/component_deps.dot.in index a28a9d5921..d1711ff079 100644 --- a/tools/cmake/component_deps.dot.in +++ b/tools/cmake/component_deps.dot.in @@ -21,7 +21,7 @@ subgraph cluster_g1 { freertos; log; heap; - newlib; + esp_libc; esp_system; esp_hw_support; } diff --git a/tools/idf_py_actions/hints.yml b/tools/idf_py_actions/hints.yml index 0c4889ecb4..27e1267c8a 100644 --- a/tools/idf_py_actions/hints.yml +++ b/tools/idf_py_actions/hints.yml @@ -206,6 +206,10 @@ re: "Failed to resolve component 'esp_ipc'" hint: "IPC component has been moved to esp_system. Any `REQUIRES esp_ipc` can simply be deleted as esp_system is REQUIRED by default." +- + re: "Failed to resolve component 'newlib'" + hint: "newlib component has been renamed to esp_libc. Any `REQUIRES newlib` can simply be deleted as esp_libc is REQUIRED by default." + - re: "error: invalid use of incomplete typedef 'esp_tls_t'" hint: "The struct 'esp_tls_t' has now been made private - its elements can be only be accessed/modified through respective getter/setter functions. Please refer to the migration guide for more information." @@ -215,7 +219,7 @@ hint: "The event handler, specified in the 'event_handler' element, of the 'esp_http_client_config_t' struct now needs to handle the new 'HTTP_EVENT_REDIRECT' event case." - - re: "Failed to resolve component '(?!esp_ipc)(\\w+)'" + re: "Failed to resolve component '(?!esp_ipc|newlib)(\\w+)'" hint: "The component '{}' could not be found. This could be because: component name was misspelled, the component was not added to the build, the component has been moved to the IDF component manager, the component has been removed and refactored into some other component or the component may not be supported by the selected target.\nPlease look out for component in 'https://components.espressif.com' and add using 'idf.py add-dependency' command.\nRefer to the migration guide for more details about moved components.\nRefer to the build-system guide for more details about how components are found and included in the build." match_to_output: True diff --git a/tools/test_apps/storage/.build-test-rules.yml b/tools/test_apps/storage/.build-test-rules.yml index c98bb01b98..2f9d85c098 100644 --- a/tools/test_apps/storage/.build-test-rules.yml +++ b/tools/test_apps/storage/.build-test-rules.yml @@ -48,5 +48,5 @@ tools/test_apps/storage/std_filesystem: reason: Issue with C++ exceptions on Xtensa, issue with getrandom linking on RISC-V depends_components: - vfs - - newlib + - esp_libc - fatfs diff --git a/tools/test_apps/system/g1_components/CMakeLists.txt b/tools/test_apps/system/g1_components/CMakeLists.txt index 47d05d8485..3fdcd9cd32 100644 --- a/tools/test_apps/system/g1_components/CMakeLists.txt +++ b/tools/test_apps/system/g1_components/CMakeLists.txt @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.22) set(g0_components soc hal esp_common esp_rom) # also , i.e. xtensa or riscv, will be added below -set(g1_components spi_flash freertos log heap newlib esp_system esp_hw_support esp_mm) +set(g1_components spi_flash freertos log heap esp_libc esp_system esp_hw_support esp_mm) set(COMPONENTS ${g0_components} ${g1_components} main) include($ENV{IDF_PATH}/tools/cmake/project.cmake) diff --git a/tools/test_apps/system/g1_components/check_dependencies.py b/tools/test_apps/system/g1_components/check_dependencies.py index f899a021a9..01b2211c78 100644 --- a/tools/test_apps/system/g1_components/check_dependencies.py +++ b/tools/test_apps/system/g1_components/check_dependencies.py @@ -6,7 +6,7 @@ import logging g1_g0_components = [ 'hal', 'cxx', - 'newlib', + 'esp_libc', 'freertos', 'esp_hw_support', 'heap', diff --git a/tools/test_build_system/test_rebuild.py b/tools/test_build_system/test_rebuild.py index c5df4bc378..417fcb6511 100644 --- a/tools/test_build_system/test_rebuild.py +++ b/tools/test_build_system/test_rebuild.py @@ -5,16 +5,14 @@ import logging import os from pathlib import Path -from typing import List -from typing import Union import pytest from test_build_system_helpers import ALL_ARTIFACTS from test_build_system_helpers import APP_BINS from test_build_system_helpers import BOOTLOADER_BINS -from test_build_system_helpers import get_snapshot -from test_build_system_helpers import IdfPyFunc from test_build_system_helpers import PARTITION_BIN +from test_build_system_helpers import IdfPyFunc +from test_build_system_helpers import get_snapshot from test_build_system_helpers import replace_in_file @@ -24,9 +22,14 @@ def test_rebuild_no_changes(idf_py: IdfPyFunc) -> None: idf_py('build') logging.info('get the first snapshot') # excluding the 'log' subdirectory here since it changes after every build - all_build_files = get_snapshot('build/**/*', exclude_patterns=['build/log/*', - 'build/CMakeFiles/bootloader-complete', - 'build/bootloader-prefix/src/bootloader-stamp/bootloader-done']) + all_build_files = get_snapshot( + 'build/**/*', + exclude_patterns=[ + 'build/log/*', + 'build/CMakeFiles/bootloader-complete', + 'build/bootloader-prefix/src/bootloader-stamp/bootloader-done', + ], + ) logging.info('check that all build artifacts were generated') for artifact in ALL_ARTIFACTS: @@ -35,15 +38,20 @@ def test_rebuild_no_changes(idf_py: IdfPyFunc) -> None: logging.info('build again with no changes') idf_py('build') # if there are no changes, nothing gets rebuilt - all_build_files_after_rebuild = get_snapshot('build/**/*', exclude_patterns=['build/log/*', - 'build/CMakeFiles/bootloader-complete', - 'build/bootloader-prefix/src/bootloader-stamp/bootloader-done']) + all_build_files_after_rebuild = get_snapshot( + 'build/**/*', + exclude_patterns=[ + 'build/log/*', + 'build/CMakeFiles/bootloader-complete', + 'build/bootloader-prefix/src/bootloader-stamp/bootloader-done', + ], + ) all_build_files_after_rebuild.assert_same(all_build_files) -def rebuild_and_check(idf_py: IdfPyFunc, - should_be_rebuilt: Union[str, List[str]], - should_not_be_rebuilt: Union[str, List[str]]) -> None: +def rebuild_and_check( + idf_py: IdfPyFunc, should_be_rebuilt: str | list[str], should_not_be_rebuilt: str | list[str] +) -> None: """ Helper function for the test cases below. Asserts that the files matching 'should_be_rebuilt' patterns are rebuilt @@ -71,44 +79,42 @@ def test_rebuild_source_files(idf_py: IdfPyFunc) -> None: logging.info('updating a component source file rebuilds only that component') component_files_patterns = [ 'build/esp-idf/esp_system/libesp_system.a', - 'build/esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/port/cpu_start.c.obj'] + 'build/esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/port/cpu_start.c.obj', + ] other_files_patterns = [ 'build/esp-idf/lwip/liblwip.a', 'build/esp-idf/freertos/libfreertos.a', *BOOTLOADER_BINS, - *PARTITION_BIN] + *PARTITION_BIN, + ] (idf_path / 'components/esp_system/port/cpu_start.c').touch() - rebuild_and_check(idf_py, - component_files_patterns, other_files_patterns) + rebuild_and_check(idf_py, component_files_patterns, other_files_patterns) logging.info('changing a bootloader source file rebuilds the bootloader') (idf_path / 'components/bootloader/subproject/main/bootloader_start.c').touch() - rebuild_and_check(idf_py, - BOOTLOADER_BINS, APP_BINS + PARTITION_BIN) + rebuild_and_check(idf_py, BOOTLOADER_BINS, APP_BINS + PARTITION_BIN) logging.info('changing the partitions CSV file rebuilds only the partition table') (idf_path / 'components/partition_table/partitions_singleapp.csv').touch() - rebuild_and_check(idf_py, - PARTITION_BIN, APP_BINS + BOOTLOADER_BINS) + rebuild_and_check(idf_py, PARTITION_BIN, APP_BINS + BOOTLOADER_BINS) logging.info('sdkconfig update triggers full recompile') # pick on .c, .cpp, .S file which includes sdkconfig.h: obj_files = [ - 'build/esp-idf/newlib/CMakeFiles/__idf_newlib.dir/newlib_init.c.obj', + 'build/esp-idf/esp_libc/CMakeFiles/__idf_esp_libc.dir/newlib_init.c.obj', 'build/esp-idf/nvs_flash/CMakeFiles/__idf_nvs_flash.dir/src/nvs_api.cpp.obj' - 'build/esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/port/arch/xtensa/panic_handler_asm.S.obj' - ] - sdkconfig_files = [ - 'build/config/sdkconfig.h', - 'build/config/sdkconfig.json' + 'build/esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/port/arch/xtensa/panic_handler_asm.S.obj', ] + sdkconfig_files = ['build/config/sdkconfig.h', 'build/config/sdkconfig.json'] replace_in_file('sdkconfig', '# CONFIG_FREERTOS_UNICORE is not set', 'CONFIG_FREERTOS_UNICORE=y') rebuild_and_check(idf_py, APP_BINS + BOOTLOADER_BINS + obj_files + sdkconfig_files, PARTITION_BIN) logging.info('Updating project CMakeLists.txt triggers app recompile') - replace_in_file('CMakeLists.txt', - '# placeholder_after_include_project_cmake', - 'add_compile_options("-DUSELESS_MACRO_DOES_NOTHING=1")') + replace_in_file( + 'CMakeLists.txt', + '# placeholder_after_include_project_cmake', + 'add_compile_options("-DUSELESS_MACRO_DOES_NOTHING=1")', + ) rebuild_and_check(idf_py, APP_BINS + obj_files, PARTITION_BIN + BOOTLOADER_BINS + sdkconfig_files) @@ -120,23 +126,19 @@ def test_rebuild_linker(idf_py: IdfPyFunc) -> None: logging.info('Updating rom ld file should re-link app and bootloader') (idf_path / 'components/esp_rom/esp32/ld/esp32.rom.ld').touch() - rebuild_and_check(idf_py, - APP_BINS + BOOTLOADER_BINS, PARTITION_BIN) + rebuild_and_check(idf_py, APP_BINS + BOOTLOADER_BINS, PARTITION_BIN) logging.info('Updating app-only sections ld file should only re-link the app') (idf_path / 'components/esp_system/ld/esp32/sections.ld.in').touch() - rebuild_and_check(idf_py, - APP_BINS, BOOTLOADER_BINS + PARTITION_BIN) + rebuild_and_check(idf_py, APP_BINS, BOOTLOADER_BINS + PARTITION_BIN) logging.info('Updating app-only memory ld file should only re-link the app') (idf_path / 'components/esp_system/ld/esp32/memory.ld.in').touch() - rebuild_and_check(idf_py, - APP_BINS, BOOTLOADER_BINS + PARTITION_BIN) + rebuild_and_check(idf_py, APP_BINS, BOOTLOADER_BINS + PARTITION_BIN) logging.info('Updating fragment file should only re-link the app') (idf_path / 'components/esp_common/common.lf').touch() - rebuild_and_check(idf_py, - APP_BINS, BOOTLOADER_BINS + PARTITION_BIN) + rebuild_and_check(idf_py, APP_BINS, BOOTLOADER_BINS + PARTITION_BIN) @pytest.mark.usefixtures('idf_copy')