diff --git a/CMakeLists.txt b/CMakeLists.txt index c87bc17b38c..2758a1ff599 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,6 +104,28 @@ if(CMAKE_C_COMPILER_ID MATCHES "GNU") list(APPEND c_compile_options "-Wno-old-style-declaration") endif() +# TODO IDF-15784: remove in IDF v7.0 ? +check_c_compiler_flag("-Wunused-but-set-variable=1" compiler_supports_wunused_but_set_variable_eq_1) +if(compiler_supports_wunused_but_set_variable_eq_1) + list(APPEND compile_options "-Wunused-but-set-variable=1") +endif() + +if(CONFIG_COMPILER_CXX_TRIVIAL_AUTO_VAR_INIT_UNINITIALIZED) + set(compiler_cxx_trivial_auto_var_init "uninitialized") +elseif(CONFIG_COMPILER_CXX_TRIVIAL_AUTO_VAR_INIT_PATTERN) + set(compiler_cxx_trivial_auto_var_init "pattern") +elseif(CONFIG_COMPILER_CXX_TRIVIAL_AUTO_VAR_INIT_ZERO) + set(compiler_cxx_trivial_auto_var_init "zero") +endif() +if(compiler_cxx_trivial_auto_var_init) + idf_toolchain_remove_flags(CXX_COMPILE_OPTIONS "-ftrivial-auto-var-init") + check_cxx_compiler_flag("-ftrivial-auto-var-init=${compiler_cxx_trivial_auto_var_init}" + compiler_supports_ftrivial_auto_var_init) + if(compiler_supports_ftrivial_auto_var_init) + idf_toolchain_add_flags(CXX_COMPILE_OPTIONS "-ftrivial-auto-var-init=${compiler_cxx_trivial_auto_var_init}") + endif() +endif() + # Clang finds some warnings in IDF code which GCC doesn't. # All these warnings should be fixed before Clang is presented # as a toolchain choice for users. diff --git a/Kconfig b/Kconfig index 0ccdeb5cc6e..eceb0e90268 100644 --- a/Kconfig +++ b/Kconfig @@ -585,6 +585,41 @@ mainmenu "Espressif IoT Development Framework Configuration" This increases binary size (typically by tens of kB) but allows using dynamic_cast conversion and typeid operator. + choice COMPILER_CXX_TRIVIAL_AUTO_VAR_INIT + prompt "C++ trivial automatic variable initialization" + default COMPILER_CXX_TRIVIAL_AUTO_VAR_INIT_UNINITIALIZED + depends on !IDF_TARGET_LINUX + help + Controls initialization of trivial automatic variables in C++ code + (-ftrivial-auto-var-init). The 'uninitialized' setting reduces overall + binary size compared to 'zero' or 'pattern'. + + config COMPILER_CXX_TRIVIAL_AUTO_VAR_INIT_UNINITIALIZED + bool "Uninitialized" + help + Does not initialize automatic variables. This matches the traditional C and + C++ behavior and yields the smallest code of the three modes. + + When compiling as C++26, compilers may zero-initialize automatic variables + and temporaries unless -ftrivial-auto-var-init is set explicitly. This + option passes -ftrivial-auto-var-init=uninitialized to preserve the + traditional behavior. Padding bits in objects are not initialized. + + config COMPILER_CXX_TRIVIAL_AUTO_VAR_INIT_PATTERN + bool "Pattern" + help + Initialize automatic variables with values which will likely transform logic + bugs into crashes down the line, are easily recognized in a crash dump and + without being values that programmers can rely on for useful program semantics. + The current value is byte-repeatable pattern with byte "0xFE". The values used + for pattern initialization might be changed in the future. + + config COMPILER_CXX_TRIVIAL_AUTO_VAR_INIT_ZERO + bool "Zero" + help + Initialize automatic variables with zeroes. + endchoice + choice COMPILER_STACK_CHECK_MODE prompt "Stack smashing protection mode" default COMPILER_STACK_CHECK_MODE_NONE diff --git a/components/bootloader_support/src/bootloader_panic.c b/components/bootloader_support/src/bootloader_panic.c index aac9e726386..47f48b2d461 100644 --- a/components/bootloader_support/src/bootloader_panic.c +++ b/components/bootloader_support/src/bootloader_panic.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -17,8 +17,7 @@ void __assert_func(const char *file, int line, const char *func, const char *exp esp_rom_printf("Assert failed in %s, %s:%d (%s)\r\n", func, file, line, expr); #endif - while (1) { - } + ESP_INFINITE_LOOP(); } void abort(void) @@ -31,6 +30,5 @@ void abort(void) esp_cpu_dbgr_break(); } #endif - while (1) { - } + ESP_INFINITE_LOOP(); } diff --git a/components/bootloader_support/src/bootloader_utility.c b/components/bootloader_support/src/bootloader_utility.c index 0916ae9a3d5..fbfd8d86c85 100644 --- a/components/bootloader_support/src/bootloader_utility.c +++ b/components/bootloader_support/src/bootloader_utility.c @@ -9,6 +9,7 @@ #include #include "esp_attr.h" +#include "esp_macros.h" #include "esp_log.h" #include "esp_rom_sys.h" @@ -1162,7 +1163,7 @@ void bootloader_reset(void) bootloader_atexit(); esp_rom_delay_us(1000); /* Allow last byte to leave FIFO */ esp_rom_software_reset_system(); - while (1) { } /* This line will never be reached, used to keep gcc happy */ + ESP_INFINITE_LOOP(); /* This line will never be reached, used to keep gcc happy */ #else abort(); /* This function should really not be called from application code */ #endif diff --git a/components/esp_common/include/esp_macros.h b/components/esp_common/include/esp_macros.h index 0893878e7eb..5400bf4fc4a 100644 --- a/components/esp_common/include/esp_macros.h +++ b/components/esp_common/include/esp_macros.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -10,6 +10,7 @@ This header contains various general purpose helper macros used across ESP-IDF */ #include +#include "esp_attr.h" #include "esp_assert.h" #include "esp_compiler.h" @@ -80,12 +81,15 @@ extern "C" { #define ESP_UNUSED(x) ((void)(x)) #endif -#define ESP_INFINITE_LOOP() \ - do { \ - ESP_COMPILER_DIAGNOSTIC_PUSH_IGNORE("-Wanalyzer-infinite-loop") \ - while(1); \ - ESP_COMPILER_DIAGNOSTIC_POP("-Wanalyzer-infinite-loop") \ - } while(1) +IRAM_ATTR +static inline __attribute__((always_inline, __noreturn__)) void esp_infinite_loop(void) +{ + ESP_COMPILER_DIAGNOSTIC_PUSH_IGNORE("-Wanalyzer-infinite-loop") + while (1) { + } + ESP_COMPILER_DIAGNOSTIC_POP("-Wanalyzer-infinite-loop") +} +#define ESP_INFINITE_LOOP() esp_infinite_loop() #ifdef __cplusplus } diff --git a/components/esp_driver_dac/dac_continuous.c b/components/esp_driver_dac/dac_continuous.c index b3f8f9c25e0..f7d995b8c28 100644 --- a/components/esp_driver_dac/dac_continuous.c +++ b/components/esp_driver_dac/dac_continuous.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -418,7 +418,9 @@ esp_err_t dac_continuous_start_async_writing(dac_continuous_handle_t handle) } } /* Wait for the previous DMA stop */ + ESP_COMPILER_DIAGNOSTIC_PUSH_IGNORE("-Wanalyzer-infinite-loop") while (atomic_load(&handle->is_running)) {} + ESP_COMPILER_DIAGNOSTIC_POP("-Wanalyzer-infinite-loop") /* Link all descriptors as a ring */ for (int i = 0; i < handle->cfg.desc_num; i++) { @@ -441,7 +443,10 @@ esp_err_t dac_continuous_stop_async_writing(dac_continuous_handle_t handle) STAILQ_NEXT(handle->desc[i], qe) = NULL; } /* Wait for the previous DMA stop */ + ESP_COMPILER_DIAGNOSTIC_PUSH_IGNORE("-Wanalyzer-infinite-loop") while (atomic_load(&handle->is_running)) {} + ESP_COMPILER_DIAGNOSTIC_POP("-Wanalyzer-infinite-loop") + atomic_store(&handle->is_async, false); return ESP_OK; @@ -515,7 +520,10 @@ esp_err_t dac_continuous_write_cyclically(dac_continuous_handle_t handle, uint8_ } } /* Wait for the previous DMA stop */ + ESP_COMPILER_DIAGNOSTIC_PUSH_IGNORE("-Wanalyzer-infinite-loop") while (atomic_load(&handle->is_running)) {} + ESP_COMPILER_DIAGNOSTIC_POP("-Wanalyzer-infinite-loop") + atomic_store(&handle->is_cyclic, true); size_t src_buf_size = buf_size; @@ -604,7 +612,10 @@ esp_err_t dac_continuous_write(dac_continuous_handle_t handle, uint8_t *buf, siz /* When there is no descriptor in the chain, DMA has stopped, load data and start the DMA link */ if (STAILQ_FIRST(&handle->head) == NULL) { /* Wait for the previous DMA stop */ + ESP_COMPILER_DIAGNOSTIC_PUSH_IGNORE("-Wanalyzer-infinite-loop") while (atomic_load(&handle->is_running)) {} + ESP_COMPILER_DIAGNOSTIC_POP("-Wanalyzer-infinite-loop") + for (int i = 0; i < handle->cfg.desc_num && buf_size > 0; i++, buf += w_size, buf_size -= w_size) { diff --git a/components/esp_driver_i2c/CMakeLists.txt b/components/esp_driver_i2c/CMakeLists.txt index 55df31758ee..6addeee859d 100644 --- a/components/esp_driver_i2c/CMakeLists.txt +++ b/components/esp_driver_i2c/CMakeLists.txt @@ -28,3 +28,5 @@ idf_component_register(SRCS ${srcs} PRIV_REQUIRES "${priv_requires}" LDFRAGMENTS "linker.lf" ) +set_source_files_properties("i2c_master.c" + PROPERTIES COMPILE_FLAGS "-Wno-unused-but-set-variable") diff --git a/components/esp_driver_touch_sens/CMakeLists.txt b/components/esp_driver_touch_sens/CMakeLists.txt index 502baa5af0f..4308bae0a9e 100644 --- a/components/esp_driver_touch_sens/CMakeLists.txt +++ b/components/esp_driver_touch_sens/CMakeLists.txt @@ -25,3 +25,9 @@ idf_component_register(SRCS ${srcs} REQUIRES esp_hal_touch_sens # public require because hal/touch_sens_type.h needs to be public INCLUDE_DIRS ${public_inc} ) + +# GCC -fanalyzer false positives on version-specific register writes (-Werror=analyzer-out-of-bounds). +if(CONFIG_SOC_TOUCH_SENSOR_SUPPORTED AND CONFIG_COMPILER_STATIC_ANALYZER AND CONFIG_IDF_TOOLCHAIN_GCC) + set_source_files_properties("${version_folder}/touch_version_specific.c" + PROPERTIES COMPILE_FLAGS "-Wno-analyzer-out-of-bounds") +endif() diff --git a/components/esp_hw_support/CMakeLists.txt b/components/esp_hw_support/CMakeLists.txt index b8fcd6c4e89..b9b80043082 100644 --- a/components/esp_hw_support/CMakeLists.txt +++ b/components/esp_hw_support/CMakeLists.txt @@ -232,3 +232,11 @@ endif() # Required in `adc_share_hw_ctrl.h` idf_component_optional_requires(PUBLIC esp_hal_ana_conv) + +if(CONFIG_COMPILER_STATIC_ANALYZER AND CONFIG_IDF_TOOLCHAIN_GCC) + set_source_files_properties( + sleep_retention.c + PROPERTIES COMPILE_FLAGS + -Wno-analyzer-null-dereference + ) +endif() diff --git a/components/esp_hw_support/lowpower/port/esp32h4/sleep_cpu.c b/components/esp_hw_support/lowpower/port/esp32h4/sleep_cpu.c index b78bc5d1c26..546101cfae1 100644 --- a/components/esp_hw_support/lowpower/port/esp32h4/sleep_cpu.c +++ b/components/esp_hw_support/lowpower/port/esp32h4/sleep_cpu.c @@ -489,9 +489,9 @@ static IRAM_ATTR void smp_core_do_retention(void) } // Wait another core start to do retention + ESP_COMPILER_DIAGNOSTIC_PUSH_IGNORE("-Wanalyzer-infinite-loop") bool smp_skip_retention = false; smp_retention_state_t another_core_state; - ESP_COMPILER_DIAGNOSTIC_PUSH_IGNORE("-Wanalyzer-infinite-loop") while (1) { another_core_state = atomic_load(&s_smp_retention_state[!core_id]); if (another_core_state == SMP_SKIP_RETENTION) { diff --git a/components/esp_hw_support/lowpower/port/esp32p4/sleep_cpu.c b/components/esp_hw_support/lowpower/port/esp32p4/sleep_cpu.c index b278b24f629..0104d6e55bd 100644 --- a/components/esp_hw_support/lowpower/port/esp32p4/sleep_cpu.c +++ b/components/esp_hw_support/lowpower/port/esp32p4/sleep_cpu.c @@ -407,9 +407,9 @@ static SPM_IRAM_ATTR void smp_core_do_retention(void) } // Wait another core start to do retention + ESP_COMPILER_DIAGNOSTIC_PUSH_IGNORE("-Wanalyzer-infinite-loop") bool smp_skip_retention = false; smp_retention_state_t another_core_state; - ESP_COMPILER_DIAGNOSTIC_PUSH_IGNORE("-Wanalyzer-infinite-loop") while (1) { another_core_state = atomic_load(&s_smp_retention_state[!core_id]); if (another_core_state == SMP_SKIP_RETENTION) { diff --git a/components/esp_hw_support/lowpower/port/esp32s31/sleep_cpu.c b/components/esp_hw_support/lowpower/port/esp32s31/sleep_cpu.c index 424239db2a2..138f6066a1f 100644 --- a/components/esp_hw_support/lowpower/port/esp32s31/sleep_cpu.c +++ b/components/esp_hw_support/lowpower/port/esp32s31/sleep_cpu.c @@ -430,9 +430,9 @@ static IRAM_ATTR void smp_core_do_retention(void) } // Wait another core start to do retention + ESP_COMPILER_DIAGNOSTIC_PUSH_IGNORE("-Wanalyzer-infinite-loop") bool smp_skip_retention = false; smp_retention_state_t another_core_state; - ESP_COMPILER_DIAGNOSTIC_PUSH_IGNORE("-Wanalyzer-infinite-loop") while (1) { another_core_state = atomic_load(&s_smp_retention_state[!core_id]); if (another_core_state == SMP_SKIP_RETENTION) { diff --git a/components/esp_lcd/CMakeLists.txt b/components/esp_lcd/CMakeLists.txt index f5044ee4a5e..ccd234c1163 100644 --- a/components/esp_lcd/CMakeLists.txt +++ b/components/esp_lcd/CMakeLists.txt @@ -49,3 +49,14 @@ idf_component_register(SRCS ${srcs} PRIV_REQUIRES ${priv_requires} REQUIRES ${public_requires} LDFRAGMENTS linker.lf) + +if(CMAKE_C_COMPILER_ID STREQUAL "GNU") + # GCC -fanalyzer false positives on early-return cleanup paths (see build logs with -Werror=analyzer-malloc-leak). + set_source_files_properties("src/esp_lcd_panel_ssd1306.c" + "src/esp_lcd_panel_st7789.c" + PROPERTIES COMPILE_FLAGS "-Wno-analyzer-malloc-leak") + if(CONFIG_SOC_I2C_SUPPORTED) + set_source_files_properties("i2c/esp_lcd_panel_io_i2c.c" + PROPERTIES COMPILE_FLAGS "-Wno-analyzer-malloc-leak") + endif() +endif() diff --git a/components/esp_libc/CMakeLists.txt b/components/esp_libc/CMakeLists.txt index 5f3beec8a04..479347b6f71 100644 --- a/components/esp_libc/CMakeLists.txt +++ b/components/esp_libc/CMakeLists.txt @@ -34,18 +34,6 @@ set(srcs "src/reent_syscalls.c" "src/port/esp_time_impl.c") -# TODO IDF-15041: remove this block and sources -if(CONFIG_LIBC_PICOLIBC AND CONFIG_SPIRAM_CACHE_WORKAROUND) - list(APPEND srcs "src/picolibc/esp32_psram/memcpy.S") - list(APPEND srcs "src/picolibc/esp32_psram/memset.S") - list(APPEND srcs "src/picolibc/esp32_psram/strcpy.S") - list(APPEND srcs "src/picolibc/esp32_psram/strncpy.S") - list(APPEND EXTRA_LINK_FLAGS "-u esp_libc_include_memcpy_impl") - list(APPEND EXTRA_LINK_FLAGS "-u esp_libc_include_memset_impl") - list(APPEND EXTRA_LINK_FLAGS "-u esp_libc_include_strcpy_impl") - list(APPEND EXTRA_LINK_FLAGS "-u esp_libc_include_strncpy_impl") -endif() - if(CONFIG_STDATOMIC_S32C1I_SPIRAM_WORKAROUND) list(APPEND srcs "src/port/xtensa/stdatomic_s32c1i.c") endif() @@ -77,13 +65,9 @@ else() list(APPEND srcs "src/picolibc/picolibc_init.c" "src/picolibc/rand.c" - "src/picolibc/open_memstream.c" - "src/picolibc/errno.c" - "src/picolibc/bufio_setvbuf.c") # TODO IDF-15494: remove this and the following lines - list(APPEND EXTRA_LINK_FLAGS "-Wl,--wrap=__bufio_setvbuf") + "src/picolibc/errno.c") if(CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY) list(APPEND srcs "src/picolibc/getreent.c") - list(APPEND srcs "src/picolibc/fopencookie.c") endif() endif() @@ -117,15 +101,6 @@ target_link_libraries(${COMPONENT_LIB} INTERFACE c m ${CONFIG_COMPILER_RT_LIB_NA set_source_files_properties(heap.c PROPERTIES COMPILE_FLAGS -fno-builtin) -# TODO IDF-15041: remove this block and sources -if(CONFIG_LIBC_PICOLIBC AND CONFIG_SPIRAM_CACHE_WORKAROUND) - set_source_files_properties("src/picolibc/esp32_psram/memcpy.S" - "src/picolibc/esp32_psram/memset.S" - "src/picolibc/esp32_psram/strcpy.S" - "src/picolibc/esp32_psram/strncpy.S" - PROPERTIES COMPILE_FLAGS "-DXTENSA_ESP32_PSRAM_CACHE_FIX=1") -endif() - if(CONFIG_STDATOMIC_S32C1I_SPIRAM_WORKAROUND) set_source_files_properties("src/port/xtensa/stdatomic_s32c1i.c" PROPERTIES COMPILE_FLAGS "-mno-disable-hardware-atomics") diff --git a/components/esp_libc/platform_include/signal.h b/components/esp_libc/platform_include/signal.h deleted file mode 100644 index c5364551f0c..00000000000 --- a/components/esp_libc/platform_include/signal.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -#pragma once -#include "sdkconfig.h" - -#include_next - -#ifdef __cplusplus -extern "C" { -#endif - -/* TODO GCC-441: remove this file */ -#if CONFIG_LIBC_PICOLIBC -#if __POSIX_VISIBLE >= 199506 -int pthread_sigmask(int, const sigset_t *, sigset_t *); -#endif -#endif - -#ifdef __cplusplus -} -#endif diff --git a/components/esp_libc/platform_include/stdio.h b/components/esp_libc/platform_include/stdio.h index 60773130153..46ac1bae275 100644 --- a/components/esp_libc/platform_include/stdio.h +++ b/components/esp_libc/platform_include/stdio.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -40,20 +40,6 @@ FILE *funopen(const void *cookie, void flockfile(FILE *); void funlockfile(FILE *); FILE *open_memstream(char **, size_t *); - -typedef ssize_t cookie_read_function_t(void *cookie, char *buf, size_t n); -typedef ssize_t cookie_write_function_t(void *cookie, const char *buf, size_t n); -typedef int cookie_seek_function_t(void *cookie, __off_t *off, int whence); -typedef int cookie_close_function_t(void *cookie); -typedef struct { - /* These four struct member names are dictated by Linux; hopefully, - they don't conflict with any macros. */ - cookie_read_function_t *read; - cookie_write_function_t *write; - cookie_seek_function_t *seek; - cookie_close_function_t *close; -} cookie_io_functions_t; -FILE *fopencookie(void *cookie, const char *mode, cookie_io_functions_t functions); #endif #ifdef __cplusplus diff --git a/components/esp_libc/platform_include/sys/cdefs.h b/components/esp_libc/platform_include/sys/cdefs.h index 316a4645ccc..d87dbd85aa0 100644 --- a/components/esp_libc/platform_include/sys/cdefs.h +++ b/components/esp_libc/platform_include/sys/cdefs.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -10,14 +10,3 @@ #include #include #endif - -#if CONFIG_LIBC_PICOLIBC // TODO IDF-15569 -#undef __noreturn -#if __has_attribute(__noreturn__) -#define __noreturn __attribute__((__noreturn__)) -#else -#define __noreturn -#endif -#else -#define __noreturn -#endif diff --git a/components/esp_libc/project_include.cmake b/components/esp_libc/project_include.cmake index 28c70ee0cf9..a3cb2042663 100644 --- a/components/esp_libc/project_include.cmake +++ b/components/esp_libc/project_include.cmake @@ -1,56 +1,3 @@ -function(_get_modified_specs_path out_var specs_filename modification) - set(modified_specs_path "${CMAKE_CURRENT_BINARY_DIR}/specs/${specs_filename}") - set(${out_var} "${modified_specs_path}" PARENT_SCOPE) - - # Return if modified specs file already exists to avoid regeneration - if(EXISTS "${modified_specs_path}") - return() - endif() - - # Find the original specs file in the toolchain directory - execute_process( - COMMAND ${CMAKE_C_COMPILER} --print-file-name=${specs_filename} - OUTPUT_VARIABLE specs_path - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_QUIET - ) - - if(specs_path AND EXISTS "${specs_path}") - file(READ "${specs_path}" specs_content) - - if(modification STREQUAL "remove_gc_sections") - string(REGEX REPLACE "--gc-sections" "" specs_content "${specs_content}") - elseif(modification STREQUAL "add_nosys_to_lib") - set(original_lib_specs [=[ -%{!shared:%{g*:-lg_nano} %{!p:%{!pg:-lc_nano}}%{p:-lc_p}%{pg:-lc_p}} -]=]) - set(modified_lib_specs [=[ -%{!shared:%{g*:-lg_nano} %{!p:%{!pg:-lc_nano -lnosys -lc_nano}}%{p:-lc_p}%{pg:-lc_p}} -]=]) - string(REPLACE "${original_lib_specs}" "${modified_lib_specs}" specs_content "${specs_content}") - endif() - - file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/specs") - file(WRITE "${modified_specs_path}" "${specs_content}") - else() - # Fallback: use original specs if not found - message(WARNING "${specs_filename} not found in toolchain, using default") - set(${out_var} "${specs_filename}" PARENT_SCOPE) - endif() -endfunction() - -# Get picolibc specs option with --gc-sections flag removed -function(get_picolibc_specs_path out_var) - _get_modified_specs_path(specs_path picolibc.specs remove_gc_sections) - set(${out_var} "${specs_path}" PARENT_SCOPE) -endfunction() - -# Get nano specs option with nosys included between libc nano references -function(get_newlib_nano_specs_path out_var) - _get_modified_specs_path(specs_path nano.specs add_nosys_to_lib) - set(${out_var} "${specs_path}" PARENT_SCOPE) -endfunction() - if(CONFIG_IDF_TOOLCHAIN_GCC) if(CONFIG_STDATOMIC_S32C1I_SPIRAM_WORKAROUND) idf_toolchain_add_flags(COMPILE_OPTIONS "-mdisable-hardware-atomics") @@ -59,28 +6,18 @@ if(CONFIG_IDF_TOOLCHAIN_GCC) endif() if(CONFIG_LIBC_PICOLIBC) - # TODO GCC-464: - # The original picolibc.specs file cannot be used directly in the build - # system because it contains the --gc-sections linker flag. This flag - # causes CMake's compiler detection checks to incorrectly drop required - # data during configuration. - # - # Workaround: Copy picolibc.specs to the working directory with removed - # --gc-sections option. - get_picolibc_specs_path(picolibc_specs_path) - idf_toolchain_add_flags(COMPILE_OPTIONS "\"-specs=${picolibc_specs_path}\"") + idf_toolchain_add_flags(COMPILE_OPTIONS "-specs=picolibc.specs") if(LIBC_PICOLIBC_NEWLIB_COMPATIBILITY) idf_toolchain_add_flags(COMPILE_OPTIONS "-D__STDC_WANT_LIB_EXT1__=0") endif() else() - idf_toolchain_remove_flags(COMPILE_OPTIONS "-specs=.*picolibc.*") + idf_toolchain_remove_flags(COMPILE_OPTIONS "-specs=picolibc.specs") endif() if(CONFIG_LIBC_NEWLIB_NANO_FORMAT) - get_newlib_nano_specs_path(nano_specs_path) - idf_toolchain_add_flags(LINK_OPTIONS "\"--specs=${nano_specs_path}\"") + idf_toolchain_add_flags(LINK_OPTIONS "--specs=nano.specs") else() - idf_toolchain_remove_flags(LINK_OPTIONS "--specs=.*nano.*") + idf_toolchain_remove_flags(LINK_OPTIONS "--specs=nano.specs") endif() idf_toolchain_rerun_abi_detection() diff --git a/components/esp_libc/src/esp_libc.lf b/components/esp_libc/src/esp_libc.lf index 401418ee7a0..46509e58e2d 100644 --- a/components/esp_libc/src/esp_libc.lf +++ b/components/esp_libc/src/esp_libc.lf @@ -9,14 +9,6 @@ entries: strncpy (noflash) strcmp (noflash) strncmp (noflash) - # TODO IDF-15041: remove this block - if LIBC_PICOLIBC = y: - if SPIRAM_CACHE_WORKAROUND = y: - memcpy (noflash) - memset (noflash) - if SPIRAM_CACHE_LIBSTR_IN_IRAM = y: - strcpy (noflash) - strncpy (noflash) if LIBC_MISC_IN_IRAM = y: if HEAP_PLACE_FUNCTION_INTO_FLASH = n: heap (noflash) diff --git a/components/esp_libc/src/picolibc/bufio_setvbuf.c b/components/esp_libc/src/picolibc/bufio_setvbuf.c deleted file mode 100644 index 5a925631338..00000000000 --- a/components/esp_libc/src/picolibc/bufio_setvbuf.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include -#include -#include - -int __real___bufio_setvbuf(FILE *f, char *buf, int mode, size_t size); -int __wrap___bufio_setvbuf(FILE *f, char *buf, int mode, size_t size) -{ - // File lock is already acquired by the caller - int ret = -1; - bool workaround = false; - if (mode == _IONBF) { - workaround = true; - mode = _IOFBF; - size = 1; - buf = malloc(size); - if (buf == NULL) { - goto exit; - } - } - ret = __real___bufio_setvbuf(f, buf, mode, size); - if (workaround) { - struct __file_bufio *bf = (struct __file_bufio *)f; - - // Free buf if not applied - if (ret != 0 || bf->buf != buf) { - free(buf); - goto exit; - } - bf->bflags |= __BALL; - } - -exit: - return ret; -} diff --git a/components/esp_libc/src/picolibc/esp32_psram/memcpy.S b/components/esp_libc/src/picolibc/esp32_psram/memcpy.S deleted file mode 100644 index 2a15428e69a..00000000000 --- a/components/esp_libc/src/picolibc/esp32_psram/memcpy.S +++ /dev/null @@ -1,358 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2002-2008 Tensilica Inc. - * - * SPDX-License-Identifier: MIT - * - * SPDX-FileContributor: 2025 Espressif Systems (Shanghai) CO LTD - */ -/* ANSI C standard library function memcpy. - - Copyright (c) 2002-2008 Tensilica Inc. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#include - -#include "xtensa-asm.h" - -/* If the Xtensa Unaligned Load Exception option is not used, this - code can run a few cycles faster by relying on the low address bits - being ignored. However, if the code is then run with an Xtensa ISS - client that checks for unaligned accesses, it will produce a lot of - warning messages. Set this flag to disable the use of unaligned - accesses and keep the ISS happy. */ - -/* #define UNALIGNED_ADDRESSES_CHECKED XCHAL_UNALIGNED_LOAD_EXCEPTION */ -#define UNALIGNED_ADDRESSES_CHECKED 1 - - -/* void *memcpy (void *dst, const void *src, size_t len) - - The algorithm is as follows: - - If the destination is unaligned, align it by conditionally - copying 1- and/or 2-byte pieces. - - If the source is aligned, copy 16 bytes with a loop, and then finish up - with 8, 4, 2, and 1-byte copies conditional on the length. - - Else (if source is unaligned), do the same, but use SRC to align the - source data. - - This code tries to use fall-through branches for the common - case of aligned source and destination and multiple of 4 (or 8) length. */ - - -/* Byte by byte copy. */ - - .text - .begin schedule - .align XCHAL_INST_FETCH_WIDTH - .literal_position -__memcpy_aux: - - /* Skip bytes to get proper alignment for three-byte loop */ -.skip XCHAL_INST_FETCH_WIDTH - 3 - -.Lbytecopy: -#if XCHAL_HAVE_LOOPS - loopnez a4, 2f -#else - beqz a4, 2f - add a7, a3, a4 // a7 = end address for source -#endif -1: l8ui a6, a3, 0 - addi a3, a3, 1 -#if XTENSA_ESP32_PSRAM_CACHE_FIX - nop - nop - nop -#endif - s8i a6, a5, 0 - addi a5, a5, 1 -#if XTENSA_ESP32_PSRAM_CACHE_FIX - memw -#endif -#if !XCHAL_HAVE_LOOPS - bltu a3, a7, 1b -#endif -2: leaf_return - - -/* Destination is unaligned. */ - - .align 4 -.Ldst1mod2: // dst is only byte aligned - - /* Do short copies byte-by-byte. */ - bltui a4, 7, .Lbytecopy - - /* Copy 1 byte. */ - l8ui a6, a3, 0 - addi a3, a3, 1 - addi a4, a4, -1 - s8i a6, a5, 0 -#if XTENSA_ESP32_PSRAM_CACHE_FIX - memw -#endif - addi a5, a5, 1 - - /* Return to main algorithm if dst is now aligned. */ - bbci.l a5, 1, .Ldstaligned - -.Ldst2mod4: // dst has 16-bit alignment - - /* Do short copies byte-by-byte. */ - bltui a4, 6, .Lbytecopy - - /* Copy 2 bytes. */ - l8ui a6, a3, 0 - l8ui a7, a3, 1 - addi a3, a3, 2 - addi a4, a4, -2 - s8i a6, a5, 0 - s8i a7, a5, 1 -#if XTENSA_ESP32_PSRAM_CACHE_FIX - memw -#endif - addi a5, a5, 2 - - /* dst is now aligned; return to main algorithm. */ - j .Ldstaligned - - - .align 4 - .global memcpy - .type memcpy, @function -memcpy: - leaf_entry sp, 16 - /* a2 = dst, a3 = src, a4 = len */ - - mov a5, a2 // copy dst so that a2 is return value - bbsi.l a2, 0, .Ldst1mod2 - bbsi.l a2, 1, .Ldst2mod4 -.Ldstaligned: - - /* Get number of loop iterations with 16B per iteration. */ - srli a7, a4, 4 - - /* Check if source is aligned. */ - slli a8, a3, 30 - bnez a8, .Lsrcunaligned - - /* Destination and source are word-aligned, use word copy. */ -#if XCHAL_HAVE_LOOPS - loopnez a7, 2f -#else - beqz a7, 2f - slli a8, a7, 4 - add a8, a8, a3 // a8 = end of last 16B source chunk -#endif - -#if XTENSA_ESP32_PSRAM_CACHE_FIX - -1: l32i a6, a3, 0 - l32i a7, a3, 4 - s32i a6, a5, 0 - s32i a7, a5, 4 - memw - l32i a6, a3, 8 - l32i a7, a3, 12 - s32i a6, a5, 8 - s32i a7, a5, 12 - memw - - addi a3, a3, 16 - addi a5, a5, 16 - -#else - -1: l32i a6, a3, 0 - l32i a7, a3, 4 - s32i a6, a5, 0 - l32i a6, a3, 8 - s32i a7, a5, 4 - l32i a7, a3, 12 - s32i a6, a5, 8 - addi a3, a3, 16 - s32i a7, a5, 12 - addi a5, a5, 16 - -#endif - - -#if !XCHAL_HAVE_LOOPS - bltu a3, a8, 1b -#endif - - /* Copy any leftover pieces smaller than 16B. */ -2: bbci.l a4, 3, 3f - - /* Copy 8 bytes. */ - l32i a6, a3, 0 - l32i a7, a3, 4 - addi a3, a3, 8 - s32i a6, a5, 0 - s32i a7, a5, 4 - addi a5, a5, 8 - -3: bbsi.l a4, 2, 4f - bbsi.l a4, 1, 5f - bbsi.l a4, 0, 6f -#if XTENSA_ESP32_PSRAM_CACHE_FIX - memw -#endif - leaf_return - - .align 4 - /* Copy 4 bytes. */ -4: l32i a6, a3, 0 - addi a3, a3, 4 - s32i a6, a5, 0 - addi a5, a5, 4 - bbsi.l a4, 1, 5f - bbsi.l a4, 0, 6f -#if XTENSA_ESP32_PSRAM_CACHE_FIX - memw -#endif - leaf_return - - /* Copy 2 bytes. */ -5: l16ui a6, a3, 0 - addi a3, a3, 2 - s16i a6, a5, 0 - addi a5, a5, 2 - bbsi.l a4, 0, 6f -#if XTENSA_ESP32_PSRAM_CACHE_FIX - memw -#endif - leaf_return - - /* Copy 1 byte. */ -6: l8ui a6, a3, 0 - s8i a6, a5, 0 - -.Ldone: -#if XTENSA_ESP32_PSRAM_CACHE_FIX - memw -#endif - leaf_return - - -/* Destination is aligned; source is unaligned. */ - - .align 4 -.Lsrcunaligned: - /* Avoid loading anything for zero-length copies. */ - beqz a4, .Ldone - - /* Copy 16 bytes per iteration for word-aligned dst and - unaligned src. */ - ssa8 a3 // set shift amount from byte offset -#if UNALIGNED_ADDRESSES_CHECKED - srli a11, a8, 30 // save unalignment offset for below - sub a3, a3, a11 // align a3 -#endif - l32i a6, a3, 0 // load first word -#if XCHAL_HAVE_LOOPS - loopnez a7, 2f -#else - beqz a7, 2f - slli a10, a7, 4 - add a10, a10, a3 // a10 = end of last 16B source chunk -#endif -1: l32i a7, a3, 4 - l32i a8, a3, 8 - src_b a6, a6, a7 - s32i a6, a5, 0 - l32i a9, a3, 12 - src_b a7, a7, a8 - s32i a7, a5, 4 - l32i a6, a3, 16 - src_b a8, a8, a9 - s32i a8, a5, 8 - addi a3, a3, 16 - src_b a9, a9, a6 - s32i a9, a5, 12 - addi a5, a5, 16 -#if !XCHAL_HAVE_LOOPS - bltu a3, a10, 1b -#endif - -2: bbci.l a4, 3, 3f - - /* Copy 8 bytes. */ - l32i a7, a3, 4 - l32i a8, a3, 8 - src_b a6, a6, a7 - s32i a6, a5, 0 - addi a3, a3, 8 - src_b a7, a7, a8 - s32i a7, a5, 4 - addi a5, a5, 8 - mov a6, a8 - -3: bbci.l a4, 2, 4f - - /* Copy 4 bytes. */ - l32i a7, a3, 4 - addi a3, a3, 4 - src_b a6, a6, a7 - s32i a6, a5, 0 - addi a5, a5, 4 - mov a6, a7 -4: -#if UNALIGNED_ADDRESSES_CHECKED - add a3, a3, a11 // readjust a3 with correct misalignment -#endif - bbsi.l a4, 1, 5f - bbsi.l a4, 0, 6f - leaf_return - - /* Copy 2 bytes. */ -5: l8ui a6, a3, 0 - l8ui a7, a3, 1 - addi a3, a3, 2 - s8i a6, a5, 0 - s8i a7, a5, 1 - addi a5, a5, 2 - bbsi.l a4, 0, 6f -#if XTENSA_ESP32_PSRAM_CACHE_FIX - memw -#endif - leaf_return - - /* Copy 1 byte. */ -6: l8ui a6, a3, 0 - s8i a6, a5, 0 -#if XTENSA_ESP32_PSRAM_CACHE_FIX - memw -#endif - leaf_return - - .end schedule - - .size memcpy, . - memcpy - - - .global esp_libc_include_memcpy_impl - .type esp_libc_include_memcpy_impl, @function -esp_libc_include_memcpy_impl: - .size esp_libc_include_memcpy_impl, . - esp_libc_include_memcpy_impl diff --git a/components/esp_libc/src/picolibc/esp32_psram/memset.S b/components/esp_libc/src/picolibc/esp32_psram/memset.S deleted file mode 100644 index 78d68600529..00000000000 --- a/components/esp_libc/src/picolibc/esp32_psram/memset.S +++ /dev/null @@ -1,208 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2001-2008 Tensilica Inc. - * - * SPDX-License-Identifier: MIT - * - * SPDX-FileContributor: 2025 Espressif Systems (Shanghai) CO LTD - */ -/* ANSI C standard library function memset. - - Copyright (c) 2001-2008 Tensilica Inc. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#include - -#include "xtensa-asm.h" - -/* void *memset (void *dst, int c, size_t length) - - The algorithm is as follows: - - Create a word with c in all byte positions. - - If the destination is aligned, set 16B chunks with a loop, and then - finish up with 8B, 4B, 2B, and 1B stores conditional on the length. - - If the destination is unaligned, align it by conditionally - setting 1B and/or 2B and then go to aligned case. - - This code tries to use fall-through branches for the common - case of an aligned destination (except for the branches to - the alignment labels). */ - - -/* Byte-by-byte set. */ - - .text - .begin schedule - .align XCHAL_INST_FETCH_WIDTH - .literal_position -__memset_aux: - - /* Skip bytes to get proper alignment for three-byte loop */ -.skip XCHAL_INST_FETCH_WIDTH - 3 - -.Lbyteset: -#if XCHAL_HAVE_LOOPS - loopnez a4, 2f -#else - beqz a4, 2f - add a6, a5, a4 // a6 = ending address -#endif -1: s8i a3, a5, 0 -#if XTENSA_ESP32_PSRAM_CACHE_FIX - memw -#endif - addi a5, a5, 1 -#if !XCHAL_HAVE_LOOPS - bltu a5, a6, 1b -#endif -2: leaf_return - - -/* Destination is unaligned. */ - - .align 4 - -.Ldst1mod2: // dst is only byte aligned - - /* Do short sizes byte-by-byte. */ - bltui a4, 8, .Lbyteset - - /* Set 1 byte. */ - s8i a3, a5, 0 - addi a5, a5, 1 - addi a4, a4, -1 -#if XTENSA_ESP32_PSRAM_CACHE_FIX - memw -#endif - - /* Now retest if dst is aligned. */ - _bbci.l a5, 1, .Ldstaligned - -.Ldst2mod4: // dst has 16-bit alignment - - /* Do short sizes byte-by-byte. */ - bltui a4, 8, .Lbyteset - - /* Set 2 bytes. */ - s16i a3, a5, 0 - addi a5, a5, 2 - addi a4, a4, -2 -#if XTENSA_ESP32_PSRAM_CACHE_FIX - memw -#endif - - /* dst is now aligned; return to main algorithm */ - j .Ldstaligned - - - .align 4 - .global memset - .type memset, @function -memset: - leaf_entry sp, 16 - /* a2 = dst, a3 = c, a4 = length */ - - /* Duplicate character into all bytes of word. */ - extui a3, a3, 0, 8 - slli a7, a3, 8 - or a3, a3, a7 - slli a7, a3, 16 - or a3, a3, a7 - - mov a5, a2 // copy dst so that a2 is return value - - /* Check if dst is unaligned. */ - _bbsi.l a2, 0, .Ldst1mod2 - _bbsi.l a2, 1, .Ldst2mod4 -.Ldstaligned: - - /* Get number of loop iterations with 16B per iteration. */ - srli a7, a4, 4 - -#if XTENSA_ESP32_PSRAM_CACHE_FIX - //do not do this if we have less than one iteration to do - beqz a7, 2f - //this seems to work to prefetch the cache line - s32i a3, a5, 0 - nop -#endif - - /* Destination is word-aligned. */ -#if XCHAL_HAVE_LOOPS - loopnez a7, 2f -#else - beqz a7, 2f - slli a6, a7, 4 - add a6, a6, a5 // a6 = end of last 16B chunk -#endif - /* Set 16 bytes per iteration. */ -1: s32i a3, a5, 0 - s32i a3, a5, 4 - s32i a3, a5, 8 - s32i a3, a5, 12 - addi a5, a5, 16 -#if !XCHAL_HAVE_LOOPS - bltu a5, a6, 1b -#endif - - /* Set any leftover pieces smaller than 16B. */ -2: bbci.l a4, 3, 3f - - /* Set 8 bytes. */ - s32i a3, a5, 0 - s32i a3, a5, 4 - addi a5, a5, 8 - -3: bbci.l a4, 2, 4f - - /* Set 4 bytes. */ - s32i a3, a5, 0 - addi a5, a5, 4 - -4: bbci.l a4, 1, 5f - - /* Set 2 bytes. */ - s16i a3, a5, 0 - addi a5, a5, 2 -#if XTENSA_ESP32_PSRAM_CACHE_FIX - memw -#endif - -5: bbci.l a4, 0, 6f - - /* Set 1 byte. */ - s8i a3, a5, 0 -#if XTENSA_ESP32_PSRAM_CACHE_FIX - memw -#endif -6: leaf_return - - .end schedule - - .size memset, . - memset - - - .global esp_libc_include_memset_impl - .type esp_libc_include_memset_impl, @function -esp_libc_include_memset_impl: - .size esp_libc_include_memset_impl, . - esp_libc_include_memset_impl diff --git a/components/esp_libc/src/picolibc/esp32_psram/strcpy.S b/components/esp_libc/src/picolibc/esp32_psram/strcpy.S deleted file mode 100644 index 397d29f7732..00000000000 --- a/components/esp_libc/src/picolibc/esp32_psram/strcpy.S +++ /dev/null @@ -1,289 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2001-2008 Tensilica Inc. - * - * SPDX-License-Identifier: MIT - * - * SPDX-FileContributor: 2025 Espressif Systems (Shanghai) CO LTD - */ -/* ANSI C standard library function strcpy. - - Copyright (c) 2001-2008 Tensilica Inc. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#include - -#include "xtensa-asm.h" - - .text - .begin schedule - .align 4 - .literal_position - .global strcpy - .type strcpy, @function -strcpy: - leaf_entry sp, 16 - /* a2 = dst, a3 = src */ - - mov a10, a2 // leave dst in return value register - movi a4, MASK0 - movi a5, MASK1 - movi a6, MASK2 - movi a7, MASK3 - bbsi.l a3, 0, .Lsrc1mod2 - bbsi.l a3, 1, .Lsrc2mod4 -.Lsrcaligned: - - /* Check if the destination is aligned. */ - movi a8, 3 - bnone a10, a8, .Laligned - - j .Ldstunaligned - -.Lsrc1mod2: // src address is odd - l8ui a8, a3, 0 // get byte 0 - addi a3, a3, 1 // advance src pointer - s8i a8, a10, 0 // store byte 0 -#if XTENSA_ESP32_PSRAM_CACHE_FIX - memw -#endif - beqz a8, 1f // if byte 0 is zero - addi a10, a10, 1 // advance dst pointer - bbci.l a3, 1, .Lsrcaligned // if src is now word-aligned - -.Lsrc2mod4: // src address is 2 mod 4 - l8ui a8, a3, 0 // get byte 0 - /* 1-cycle interlock */ - s8i a8, a10, 0 // store byte 0 -#if XTENSA_ESP32_PSRAM_CACHE_FIX - memw -#endif - beqz a8, 1f // if byte 0 is zero - l8ui a8, a3, 1 // get byte 0 - addi a3, a3, 2 // advance src pointer - s8i a8, a10, 1 // store byte 0 - addi a10, a10, 2 // advance dst pointer -#if XTENSA_ESP32_PSRAM_CACHE_FIX - memw -#endif - bnez a8, .Lsrcaligned -1: leaf_return - - -/* dst is word-aligned; src is word-aligned. */ - - .align 4 -#if XCHAL_HAVE_LOOPS -#if XCHAL_HAVE_DENSITY - /* (2 mod 4) alignment for loop instruction */ -#else - /* (1 mod 4) alignment for loop instruction */ - .byte 0 - .byte 0 -#endif -.Laligned: -#if XCHAL_HAVE_DENSITY - _movi.n a8, 0 // set up for the maximum loop count -#else - _movi a8, 0 // set up for the maximum loop count -#endif - loop a8, .Lz3 // loop forever (almost anyway) - l32i a8, a3, 0 // get word from src - addi a3, a3, 4 // advance src pointer - bnone a8, a4, .Lz0 // if byte 0 is zero - bnone a8, a5, .Lz1 // if byte 1 is zero - bnone a8, a6, .Lz2 // if byte 2 is zero - s32i a8, a10, 0 // store word to dst -#if XTENSA_ESP32_PSRAM_CACHE_FIX - l32i a8, a10, 0 - s32i a8, a10, 0 -#endif - bnone a8, a7, .Lz3 // if byte 3 is zero - addi a10, a10, 4 // advance dst pointer - -#else /* !XCHAL_HAVE_LOOPS */ - -1: addi a10, a10, 4 // advance dst pointer -.Laligned: - l32i a8, a3, 0 // get word from src - addi a3, a3, 4 // advance src pointer - bnone a8, a4, .Lz0 // if byte 0 is zero - bnone a8, a5, .Lz1 // if byte 1 is zero - bnone a8, a6, .Lz2 // if byte 2 is zero - s32i a8, a10, 0 // store word to dst -#if XTENSA_ESP32_PSRAM_CACHE_FIX - l32i a8, a10, 0 - s32i a8, a10, 0 -#endif - - bany a8, a7, 1b // if byte 3 is zero -#endif /* !XCHAL_HAVE_LOOPS */ - -.Lz3: /* Byte 3 is zero. */ - leaf_return - -.Lz0: /* Byte 0 is zero. */ -#ifdef __XTENSA_EB__ - movi a8, 0 -#endif - s8i a8, a10, 0 -#if XTENSA_ESP32_PSRAM_CACHE_FIX - memw -#endif - leaf_return - -.Lz1: /* Byte 1 is zero. */ -#ifdef __XTENSA_EB__ - extui a8, a8, 16, 16 -#endif - s16i a8, a10, 0 -#if XTENSA_ESP32_PSRAM_CACHE_FIX - memw -#endif - leaf_return - -.Lz2: /* Byte 2 is zero. */ -#ifdef __XTENSA_EB__ - extui a8, a8, 16, 16 -#endif - s16i a8, a10, 0 - movi a8, 0 - s8i a8, a10, 2 -#if XTENSA_ESP32_PSRAM_CACHE_FIX - memw -#endif - leaf_return - -#if 1 -/* For now just use byte copy loop for the unaligned destination case. */ - - .align 4 -#if XCHAL_HAVE_LOOPS -#if XCHAL_HAVE_DENSITY - /* (2 mod 4) alignment for loop instruction */ -#else - /* (1 mod 4) alignment for loop instruction */ - .byte 0 - .byte 0 -#endif -#endif -.Ldstunaligned: - -#if XCHAL_HAVE_LOOPS -#if XCHAL_HAVE_DENSITY - _movi.n a8, 0 // set up for the maximum loop count -#else - _movi a8, 0 // set up for the maximum loop count -#endif - loop a8, 2f // loop forever (almost anyway) -#endif -1: l8ui a8, a3, 0 - addi a3, a3, 1 - s8i a8, a10, 0 - addi a10, a10, 1 -#if XTENSA_ESP32_PSRAM_CACHE_FIX - memw -#endif -#if XCHAL_HAVE_LOOPS - beqz a8, 2f -#else - bnez a8, 1b -#endif -2: leaf_return - -#else /* 0 */ - -/* This code is not functional yet. */ - -.Ldstunaligned: - l32i a9, a2, 0 // load word from dst -#ifdef __XTENSA_EB__ - ssa8b a9 // rotate by dst alignment so that - src a9, a9, a9 // shift in loop will put back in place - ssa8l a9 // shift left by byte*8 -#else - ssa8l a9 // rotate by dst alignment so that - src a9, a9, a9 // shift in loop will put back in place - ssa8b a9 // shift left by 32-byte*8 -#endif - -/* dst is word-aligned; src is unaligned. */ - -.Ldstunalignedloop: - l32i a8, a3, 0 // get word from src - /* 1-cycle interlock */ - bnone a8, a4, .Lu0 // if byte 0 is zero - bnone a8, a5, .Lu1 // if byte 1 is zero - bnone a8, a6, .Lu2 // if byte 2 is zero - src a9, a8, a9 // combine last word and this word - s32i a9, a10, 0 // store word to dst - bnone a8, a7, .Lu3 // if byte 3 is nonzero, iterate - l32i a9, a3, 4 // get word from src - addi a3, a3, 8 // advance src pointer - bnone a9, a4, .Lu4 // if byte 0 is zero - bnone a9, a5, .Lu5 // if byte 1 is zero - bnone a9, a6, .Lu6 // if byte 2 is zero - src a8, a9, a8 // combine last word and this word - s32i a8, a10, 4 // store word to dst - addi a10, a10, 8 // advance dst pointer - bany a8, a7, .Ldstunalignedloop // if byte 3 is nonzero, iterate - - /* Byte 7 is zero. */ -.Lu7: leaf_return - -.Lu0: /* Byte 0 is zero. */ -#ifdef __XTENSA_EB__ - movi a8, 0 -#endif - s8i a8, a10, 0 -#if XTENSA_ESP32_PSRAM_CACHE_FIX - memw -#endif - leaf_return - -.Lu1: /* Byte 1 is zero. */ -#ifdef __XTENSA_EB__ - extui a8, a8, 16, 16 -#endif - s16i a8, a10, 0 -#if XTENSA_ESP32_PSRAM_CACHE_FIX - memw -#endif - leaf_return - -.Lu2: /* Byte 2 is zero. */ - s16i a8, a10, 0 - movi a8, 0 - s8i a8, a10, 2 -#if XTENSA_ESP32_PSRAM_CACHE_FIX - memw -#endif - leaf_return - -#endif /* 0 */ - .end schedule - - .size strcpy, . - strcpy - - - .global esp_libc_include_strcpy_impl - .type esp_libc_include_strcpy_impl, @function -esp_libc_include_strcpy_impl: - .size esp_libc_include_strcpy_impl, . - esp_libc_include_strcpy_impl diff --git a/components/esp_libc/src/picolibc/esp32_psram/strncpy.S b/components/esp_libc/src/picolibc/esp32_psram/strncpy.S deleted file mode 100644 index 09c7727aff3..00000000000 --- a/components/esp_libc/src/picolibc/esp32_psram/strncpy.S +++ /dev/null @@ -1,288 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2001-2008 Tensilica Inc. - * - * SPDX-License-Identifier: MIT - * - * SPDX-FileContributor: 2025 Espressif Systems (Shanghai) CO LTD - */ -/* ANSI C standard library function strncpy. - - Copyright (c) 2001-2008 Tensilica Inc. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#include - -#include "xtensa-asm.h" - - .text -.begin schedule - .align 4 - .literal_position -__strncpy_aux: - -.Lsrc1mod2: // src address is odd - l8ui a8, a3, 0 // get byte 0 - addi a3, a3, 1 // advance src pointer - s8i a8, a10, 0 // store byte 0 - addi a4, a4, -1 // decrement n - beqz a4, .Lret // if n is zero - addi a10, a10, 1 // advance dst pointer - beqz a8, .Lfill // if byte 0 is zero - bbci.l a3, 1, .Lsrcaligned // if src is now word-aligned - -.Lsrc2mod4: // src address is 2 mod 4 - l8ui a8, a3, 0 // get byte 0 - addi a4, a4, -1 // decrement n - s8i a8, a10, 0 // store byte 0 - beqz a4, .Lret // if n is zero - addi a10, a10, 1 // advance dst pointer - beqz a8, .Lfill // if byte 0 is zero - l8ui a8, a3, 1 // get byte 0 - addi a3, a3, 2 // advance src pointer - s8i a8, a10, 0 // store byte 0 - addi a4, a4, -1 // decrement n - beqz a4, .Lret // if n is zero - addi a10, a10, 1 // advance dst pointer - bnez a8, .Lsrcaligned - j .Lfill - -.Lret: -#if XTENSA_ESP32_PSRAM_CACHE_FIX - memw -#endif - leaf_return - - - .align 4 - .global strncpy - .type strncpy, @function -strncpy: - leaf_entry sp, 16 - /* a2 = dst, a3 = src */ - - mov a10, a2 // leave dst in return value register - beqz a4, .Lret // if n is zero - - movi a11, MASK0 - movi a5, MASK1 - movi a6, MASK2 - movi a7, MASK3 - bbsi.l a3, 0, .Lsrc1mod2 - bbsi.l a3, 1, .Lsrc2mod4 -.Lsrcaligned: - - /* Check if the destination is aligned. */ - movi a8, 3 - bnone a10, a8, .Laligned - - j .Ldstunaligned - - -/* Fill the dst with zeros -- n is at least 1. */ - -.Lfill: - movi a9, 0 - bbsi.l a10, 0, .Lfill1mod2 - bbsi.l a10, 1, .Lfill2mod4 -.Lfillaligned: - blti a4, 4, .Lfillcleanup - - /* Loop filling complete words with zero. */ -#if XCHAL_HAVE_LOOPS - - srai a8, a4, 2 - loop a8, 1f - s32i a9, a10, 0 - addi a10, a10, 4 - -1: slli a8, a8, 2 - sub a4, a4, a8 - -#else /* !XCHAL_HAVE_LOOPS */ - -1: s32i a9, a10, 0 - addi a10, a10, 4 - addi a4, a4, -4 - bgei a4, 4, 1b - -#endif /* !XCHAL_HAVE_LOOPS */ - - beqz a4, 2f - -.Lfillcleanup: - /* Fill leftover (1 to 3) bytes with zero. */ - s8i a9, a10, 0 // store byte 0 - addi a4, a4, -1 // decrement n - addi a10, a10, 1 - bnez a4, .Lfillcleanup - -2: -#if XTENSA_ESP32_PSRAM_CACHE_FIX - memw -#endif - leaf_return - -.Lfill1mod2: // dst address is odd - s8i a9, a10, 0 // store byte 0 - addi a4, a4, -1 // decrement n - beqz a4, 2b // if n is zero - addi a10, a10, 1 // advance dst pointer - bbci.l a10, 1, .Lfillaligned // if dst is now word-aligned - -.Lfill2mod4: // dst address is 2 mod 4 - s8i a9, a10, 0 // store byte 0 - addi a4, a4, -1 // decrement n - beqz a4, 2b // if n is zero - s8i a9, a10, 1 // store byte 1 - addi a4, a4, -1 // decrement n - beqz a4, 2b // if n is zero - addi a10, a10, 2 // advance dst pointer - j .Lfillaligned - - -/* dst is word-aligned; src is word-aligned; n is at least 1. */ - - .align 4 -#if XCHAL_HAVE_LOOPS -#if XCHAL_HAVE_DENSITY - /* (2 mod 4) alignment for loop instruction */ -#else - /* (1 mod 4) alignment for loop instruction */ - .byte 0 - .byte 0 -#endif -#endif -.Laligned: -#if XCHAL_HAVE_LOOPS -#if XCHAL_HAVE_DENSITY - _movi.n a8, 0 // set up for the maximum loop count -#else - _movi a8, 0 // set up for the maximum loop count -#endif - loop a8, 1f // loop forever (almost anyway) - blti a4, 5, .Ldstunaligned // n is near limit; do one at a time - l32i a8, a3, 0 // get word from src - addi a3, a3, 4 // advance src pointer - bnone a8, a11, .Lz0 // if byte 0 is zero - bnone a8, a5, .Lz1 // if byte 1 is zero - bnone a8, a6, .Lz2 // if byte 2 is zero - s32i a8, a10, 0 // store word to dst - addi a4, a4, -4 // decrement n - addi a10, a10, 4 // advance dst pointer - bnone a8, a7, .Lfill // if byte 3 is zero -1: - -#else /* !XCHAL_HAVE_LOOPS */ - -1: blti a4, 5, .Ldstunaligned // n is near limit; do one at a time - l32i a8, a3, 0 // get word from src - addi a3, a3, 4 // advance src pointer - bnone a8, a11, .Lz0 // if byte 0 is zero - bnone a8, a5, .Lz1 // if byte 1 is zero - bnone a8, a6, .Lz2 // if byte 2 is zero - s32i a8, a10, 0 // store word to dst - addi a4, a4, -4 // decrement n - addi a10, a10, 4 // advance dst pointer - bany a8, a7, 1b // no zeroes -#endif /* !XCHAL_HAVE_LOOPS */ - - j .Lfill - -.Lz0: /* Byte 0 is zero. */ -#ifdef __XTENSA_EB__ - movi a8, 0 -#endif - s8i a8, a10, 0 - addi a4, a4, -1 // decrement n - addi a10, a10, 1 // advance dst pointer - j .Lfill - -.Lz1: /* Byte 1 is zero. */ -#ifdef __XTENSA_EB__ - extui a8, a8, 16, 16 -#endif - s16i a8, a10, 0 - addi a4, a4, -2 // decrement n - addi a10, a10, 2 // advance dst pointer - j .Lfill - -.Lz2: /* Byte 2 is zero. */ -#ifdef __XTENSA_EB__ - extui a8, a8, 16, 16 -#endif - s16i a8, a10, 0 - movi a8, 0 - s8i a8, a10, 2 - addi a4, a4, -3 // decrement n - addi a10, a10, 3 // advance dst pointer - j .Lfill - - .align 4 -#if XCHAL_HAVE_LOOPS -#if XCHAL_HAVE_DENSITY - /* (2 mod 4) alignment for loop instruction */ -#else - /* (1 mod 4) alignment for loop instruction */ - .byte 0 - .byte 0 -#endif -#endif -.Ldstunaligned: - -#if XCHAL_HAVE_LOOPS -#if XCHAL_HAVE_DENSITY - _movi.n a8, 0 // set up for the maximum loop count -#else - _movi a8, 0 // set up for the maximum loop count -#endif - loop a8, 2f // loop forever (almost anyway) -#endif -1: l8ui a8, a3, 0 - addi a3, a3, 1 -#if XTENSA_ESP32_PSRAM_CACHE_FIX - nop - nop - nop -#endif - s8i a8, a10, 0 - addi a4, a4, -1 - beqz a4, 3f - addi a10, a10, 1 -#if XCHAL_HAVE_LOOPS - beqz a8, 2f -#else - bnez a8, 1b -#endif -2: j .Lfill - -3: -#if XTENSA_ESP32_PSRAM_CACHE_FIX - memw -#endif - leaf_return -.end schedule - - .size strncpy, . - strncpy - - .global esp_libc_include_strncpy_impl - .type esp_libc_include_strncpy_impl, @function -esp_libc_include_strncpy_impl: - .size esp_libc_include_strncpy_impl, . - esp_libc_include_strncpy_impl diff --git a/components/esp_libc/src/picolibc/esp32_psram/xtensa-asm.h b/components/esp_libc/src/picolibc/esp32_psram/xtensa-asm.h deleted file mode 100644 index 61efcf7cc15..00000000000 --- a/components/esp_libc/src/picolibc/esp32_psram/xtensa-asm.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2006 Tensilica Inc. - * - * SPDX-License-Identifier: MIT - * - * SPDX-FileContributor: 2025 Espressif Systems (Shanghai) CO LTD - */ -/* Copyright (c) 2006 Tensilica Inc. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -/* Define macros for leaf function entry and return, supporting either the - * standard register windowed ABI or the non-windowed call0 ABI. These - * macros do not allocate any extra stack space, so they only work for - * leaf functions that do not need to spill anything to the stack. */ - -#include - -.macro leaf_entry reg, size -#if XCHAL_HAVE_WINDOWED && !__XTENSA_CALL0_ABI__ -entry \reg, \size -#else -/* do nothing */ -#endif -.endm - -.macro leaf_return -#if XCHAL_HAVE_WINDOWED && !__XTENSA_CALL0_ABI__ -retw -#else -ret -#endif -.endm - -.macro src_b r, w0, w1 -#ifdef __XTENSA_EB__ -src \r, \w0, \w1 -#else -src \r, \w1, \w0 -#endif -.endm - -.macro ssa8 r -#ifdef __XTENSA_EB__ -ssa8b \r -#else -ssa8l \r -#endif -.endm - -#if XCHAL_HAVE_BE -#define MASK0 0xff000000 -#define MASK1 0x00ff0000 -#define MASK2 0x0000ff00 -#define MASK3 0x000000ff -#else -#define MASK0 0x000000ff -#define MASK1 0x0000ff00 -#define MASK2 0x00ff0000 -#define MASK3 0xff000000 -#endif diff --git a/components/esp_libc/src/picolibc/fopencookie.c b/components/esp_libc/src/picolibc/fopencookie.c deleted file mode 100644 index 5aca079b23a..00000000000 --- a/components/esp_libc/src/picolibc/fopencookie.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include -#include -#include "esp_compiler.h" - -struct cookie_wrap { - void *cookie; - cookie_io_functions_t fn; -}; - -static int fun_read(void *c, char *buf, int size) -{ - struct cookie_wrap *w = c; - return (int)w->fn.read(w->cookie, buf, (size_t)size); -} - -static int fun_write(void *c, const char *buf, int size) -{ - struct cookie_wrap *w = c; - return (int)w->fn.write(w->cookie, buf, (size_t)size); -} - -static off_t fun_seek(void *c, off_t off, int whence) -{ - struct cookie_wrap *w = c; - return w->fn.seek(w->cookie, &off, whence); -} - -static int fun_close(void *c) -{ - struct cookie_wrap *w = c; - int r = w->fn.close ? w->fn.close(w->cookie) : 0; - free(w); - return r; -} - -FILE *fopencookie(void *cookie, __attribute__((unused)) const char *mode, - cookie_io_functions_t fn) -{ - ESP_COMPILER_DIAGNOSTIC_PUSH_IGNORE("-Wanalyzer-malloc-leak") - struct cookie_wrap *w = malloc(sizeof * w); - if (!w) { - return NULL; - } - - w->cookie = cookie; - w->fn = fn; - - FILE *fp = funopen(w, - fn.read ? fun_read : NULL, - fn.write ? fun_write : NULL, - fn.seek ? fun_seek : NULL, - fun_close); - - if (!fp) { - free(w); - } - return fp; - ESP_COMPILER_DIAGNOSTIC_POP("-Wanalyzer-malloc-leak") -} diff --git a/components/esp_libc/src/picolibc/libc.lf b/components/esp_libc/src/picolibc/libc.lf index f2a97b4cc9b..2c740898b02 100644 --- a/components/esp_libc/src/picolibc/libc.lf +++ b/components/esp_libc/src/picolibc/libc.lf @@ -13,15 +13,14 @@ entries: # Thus, they shall always be placed in IRAM. libc_stdlib_itoa (noflash) libc_string_memcmp (noflash) - libc_machine_xtensa_memcpy (noflash) - libc_machine_xtensa_memset (noflash) + memcpy (noflash) + memset (noflash) libc_string_strcat (noflash) - libc_machine_xtensa_strcmp (noflash) - libc_machine_xtensa_strlen (noflash) + strcmp (noflash) + strlen (noflash) if SPIRAM_CACHE_LIBJMP_IN_IRAM = y: - libc_machine_xtensa_longjmp (noflash) - libc_machine_xtensa_setjmp (noflash) + setjmp (noflash) if SPIRAM_CACHE_LIBMATH_IN_IRAM = y: libc_stdlib_abs (noflash) diff --git a/components/esp_libc/src/picolibc/open_memstream.c b/components/esp_libc/src/picolibc/open_memstream.c deleted file mode 100644 index 051a07b0d34..00000000000 --- a/components/esp_libc/src/picolibc/open_memstream.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include -#include -#include -#include -#include - -#define GET_BUF(mf) (*(mf->pbuf)) -#define GET_SIZE(mf) (*(mf->psize)) - -struct __file_mem { - struct __file_ext xfile; - char **pbuf; - size_t *psize; // == strlen(*pbuf); - size_t len; // Total allocated size - size_t pos; -}; - -static int __fmem_put(char c, FILE *f) -{ - struct __file_mem *mf = (struct __file_mem *) f; - if (mf->len == mf->pos) { - size_t newsize = mf->len * 3 / 2; - char *tmp = realloc(GET_BUF(mf), newsize); - if (!tmp) { - return _FDEV_ERR; - } - GET_BUF(mf) = tmp; - mf->len = newsize; - } - GET_BUF(mf)[mf->pos++] = c; - if (mf->pos > GET_SIZE(mf)) { - GET_SIZE(mf) = mf->pos; - } - return (unsigned char) c; -} - -static int __fmem_get(FILE *f) -{ - struct __file_mem *mf = (struct __file_mem *) f; - int c; - if (mf->pos < GET_SIZE(mf)) { - c = (unsigned char) GET_BUF(mf)[mf->pos++]; - if (c == '\0') { - c = _FDEV_EOF; - } - } else { - c = _FDEV_ERR; - } - return c; -} - -static int __fmem_flush(FILE *f) -{ - struct __file_mem *mf = (struct __file_mem *) f; - GET_BUF(mf)[mf->pos] = '\0'; - GET_SIZE(mf) = mf->pos; - return 0; -} - -static off_t __fmem_seek(FILE *f, off_t pos, int whence) -{ - struct __file_mem *mf = (struct __file_mem *) f; - - switch (whence) { - case SEEK_SET: - break; - case SEEK_CUR: - pos += mf->pos; - break; - case SEEK_END: - pos += GET_SIZE(mf); - break; - } - if (pos < 0 || GET_SIZE(mf) < (size_t) pos) { - return EOF; - } - mf->pos = pos; - return pos; -} - -static int __fmem_close(FILE *f) -{ - __fmem_flush(f); - free(f); - return 0; -} - -FILE * -open_memstream(char **buf, size_t *size) -{ - struct __file_mem *mf; - - if (!buf || !size) { - errno = EINVAL; - return NULL; - } - /* Allocate file structure and necessary buffers */ - mf = calloc(1, sizeof(struct __file_mem)); - - if (mf == NULL) { - errno = ENOMEM; - return NULL; - } - - *buf = malloc(BUFSIZ); - if (*buf == NULL) { - errno = ENOMEM; - free(mf); - return NULL; - } - - *mf = (struct __file_mem) { - .xfile = FDEV_SETUP_EXT(__fmem_put, __fmem_get, __fmem_flush, __fmem_close, - __fmem_seek, NULL, __SWR), - .pbuf = buf, - .psize = size, - .len = BUFSIZ, - .pos = 0, - }; - *size = 0; - *buf[0] = '\0'; - return (FILE *) mf; -} diff --git a/components/esp_libc/test_apps/newlib/main/CMakeLists.txt b/components/esp_libc/test_apps/newlib/main/CMakeLists.txt index 09ead453fc0..845cd944aeb 100644 --- a/components/esp_libc/test_apps/newlib/main/CMakeLists.txt +++ b/components/esp_libc/test_apps/newlib/main/CMakeLists.txt @@ -3,7 +3,6 @@ set(srcs "test_atomic.c" "test_locks.c" "test_misc.c" - "test_memstream.c" "test_newlib.c" "test_printf.c" "test_setjmp.c" diff --git a/components/esp_libc/test_apps/newlib/main/test_memstream.c b/components/esp_libc/test_apps/newlib/main/test_memstream.c deleted file mode 100644 index 06d6e70b1ad..00000000000 --- a/components/esp_libc/test_apps/newlib/main/test_memstream.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Unlicense OR CC0-1.0 - */ -#include -#include -#include -#include -#include -#include -#include -#include "test_utils.h" - -TEST_CASE("memstream_fseek", "[newlib]") -{ - FILE *stream; - char *buf; - size_t len; - off_t eob; - - stream = open_memstream(&buf, &len); - fprintf(stream, "Hello Espressif!"); - fflush(stream); - TEST_ASSERT_EQUAL_STRING("Hello Espressif!", buf); - TEST_ASSERT_EQUAL_UINT32(strlen("Hello Espressif!"), len); - eob = ftell(stream); - fseek(stream, 0, SEEK_SET); - fprintf(stream, "HELLO"); - fseek(stream, eob, SEEK_SET); - fclose(stream); - TEST_ASSERT_EQUAL_STRING("HELLO Espressif!", buf); - TEST_ASSERT_EQUAL_UINT32(strlen("HELLO Espressif!"), len); - free(buf); -} - -TEST_CASE("memstream_overwrite", "[newlib]") -{ - FILE *stream; - char *buf; - size_t len; - - stream = open_memstream(&buf, &len); - fprintf(stream, "Hello Espressif!"); - fflush(stream); - TEST_ASSERT_EQUAL_STRING("Hello Espressif!", buf); - TEST_ASSERT_EQUAL_UINT32(strlen("Hello Espressif!"), len); - fseek(stream, 0, SEEK_SET); - fprintf(stream, "HELLO"); - fclose(stream); - TEST_ASSERT_EQUAL_STRING("HELLO", buf); - TEST_ASSERT_EQUAL_UINT32(strlen("HELLO"), len); - free(buf); -} - -TEST_CASE("memstream_realloc", "[newlib]") -{ - FILE *stream; - char *buf; - size_t len; - - stream = open_memstream(&buf, &len); - // Initial buf size is BUFSIZ. Try to go out of bounds. - for (int i = 0; i < BUFSIZ * 2; i++) { - fputc('A' + (i % ('Z' - 'A')), stream); - } - fclose(stream); - for (int i = 0; i < BUFSIZ * 2; i++) { - TEST_ASSERT_EQUAL_UINT32('A' + (i % ('Z' - 'A')), buf[i]); - } - free(buf); -} diff --git a/components/esp_system/task_wdt/task_wdt.c b/components/esp_system/task_wdt/task_wdt.c index 04d0d020649..f41eb0b1d44 100644 --- a/components/esp_system/task_wdt/task_wdt.c +++ b/components/esp_system/task_wdt/task_wdt.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -14,6 +14,7 @@ #include "freertos/task.h" #include "freertos/freertos_debug.h" #include "esp_err.h" +#include "esp_macros.h" #include "esp_attr.h" #include "esp_check.h" #include "esp_log.h" @@ -420,11 +421,11 @@ static void task_wdt_timeout_handling(int cores_fail, bool panic) esp_crosscore_int_send_twdt_abort(other_core); /* We are going to abort, on the other core, we have nothing to * do anymore here, just wait until we crash */ - while (1) {} + ESP_INFINITE_LOOP(); } else if (cores_fail & BIT(other_core)) { /* If only the other core is failing, we can tell it to abort. */ esp_crosscore_int_send_twdt_abort(other_core); - while (1) {} + ESP_INFINITE_LOOP(); } #endif // !CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE /* Current core is failing, abort right now */ diff --git a/components/hal/platform_port/include/hal/assert.h b/components/hal/platform_port/include/hal/assert.h index 1eed2c74494..c8db9b4c872 100644 --- a/components/hal/platform_port/include/hal/assert.h +++ b/components/hal/platform_port/include/hal/assert.h @@ -12,11 +12,9 @@ extern "C" { #endif #if CONFIG_LIBC_PICOLIBC -// TODO IDF-15569 -// #if defined(__cplusplus) && __cplusplus >= 201103L -// #define __noreturn [[noreturn]] -// #elif __has_attribute(__noreturn__) -#if __has_attribute(__noreturn__) +#if defined(__cplusplus) && __cplusplus >= 201103L +#define __noreturn [[noreturn]] +#elif __has_attribute(__noreturn__) #define __noreturn __attribute__((__noreturn__)) #else #define __noreturn diff --git a/components/lwip/CMakeLists.txt b/components/lwip/CMakeLists.txt index b929bdb5e2b..310c1e5c45a 100644 --- a/components/lwip/CMakeLists.txt +++ b/components/lwip/CMakeLists.txt @@ -208,6 +208,14 @@ if(CONFIG_LWIP_ENABLE) -Wno-array-parameter ) + if(CONFIG_COMPILER_STATIC_ANALYZER AND CONFIG_IDF_TOOLCHAIN_GCC) + set_source_files_properties( + lwip/src/core/ipv4/ip4_addr.c + PROPERTIES COMPILE_FLAGS + -Wno-analyzer-use-of-uninitialized-value + ) + endif() + if(CONFIG_OPENTHREAD_ENABLED) idf_component_optional_requires(PRIVATE openthread) endif() diff --git a/components/mbedtls/test_apps/mbedtls_ut/include/crypto_performance.h b/components/mbedtls/test_apps/mbedtls_ut/include/crypto_performance.h index 1eb7a87dd8b..2465efeeaca 100644 --- a/components/mbedtls/test_apps/mbedtls_ut/include/crypto_performance.h +++ b/components/mbedtls/test_apps/mbedtls_ut/include/crypto_performance.h @@ -22,7 +22,14 @@ #define IDF_PERFORMANCE_MAX_TIME_SHA1_32KB 5000 #define IDF_PERFORMANCE_MAX_TIME_SHA512_32KB 4500 -#define IDF_PERFORMANCE_MAX_RSA_2048KEY_PUBLIC_OP 45000 +/* + * GCC 16 has a more robust implementation of the -mfix-esp32-psram-cache-issue + * option, which may place memw instructions more often in the generated code. + * As a result, RSA private operations are slightly slower on ESP32. + * Example: + * Encryption took 46627 us, Decryption took 709813 us. + */ +#define IDF_PERFORMANCE_MAX_RSA_2048KEY_PUBLIC_OP 47500 #define IDF_PERFORMANCE_MAX_RSA_2048KEY_PRIVATE_OP 750000 #define IDF_PERFORMANCE_MAX_RSA_3072KEY_PUBLIC_OP 33000 #define IDF_PERFORMANCE_MAX_RSA_3072KEY_PRIVATE_OP 950000 diff --git a/components/pthread/pthread.c b/components/pthread/pthread.c index 69f0c440f0d..b7e57ee4d83 100644 --- a/components/pthread/pthread.c +++ b/components/pthread/pthread.c @@ -140,6 +140,7 @@ static void pthread_delete(esp_pthread_t *pthread) } /* Call this function to configure pthread stacks in Pthreads */ +ESP_COMPILER_DIAGNOSTIC_PUSH_IGNORE("-Wanalyzer-malloc-leak") // ignore leak of 'p' esp_err_t esp_pthread_set_cfg(const esp_pthread_cfg_t *cfg) { if (cfg == NULL) { @@ -167,7 +168,6 @@ esp_err_t esp_pthread_set_cfg(const esp_pthread_cfg_t *cfg) /* If a value is already set, update that value */ esp_pthread_cfg_t *p = pthread_getspecific(s_pthread_cfg_key); - ESP_COMPILER_DIAGNOSTIC_PUSH_IGNORE("-Wanalyzer-malloc-leak") // ignore leak of 'p' if (!p) { p = malloc(sizeof(esp_pthread_cfg_t)); if (!p) { @@ -179,8 +179,8 @@ esp_err_t esp_pthread_set_cfg(const esp_pthread_cfg_t *cfg) pthread_setspecific(s_pthread_cfg_key, p); return ESP_OK; - ESP_COMPILER_DIAGNOSTIC_POP("-Wanalyzer-malloc-leak") } +ESP_COMPILER_DIAGNOSTIC_POP("-Wanalyzer-malloc-leak") esp_err_t esp_pthread_get_cfg(esp_pthread_cfg_t *p) { diff --git a/components/soc/project_include.cmake b/components/soc/project_include.cmake index 145e8e8e156..466a7b1e2fd 100644 --- a/components/soc/project_include.cmake +++ b/components/soc/project_include.cmake @@ -7,21 +7,23 @@ if(CONFIG_IDF_TOOLCHAIN_GCC) idf_toolchain_add_flags(COMPILE_OPTIONS "-Wno-frame-address") elseif(CONFIG_IDF_TARGET_ESP32C2 OR CONFIG_IDF_TARGET_ESP32C3) - set(_march "rv32imc_zicsr_zifencei") + set(_march "rv32imc") elseif(CONFIG_IDF_TARGET_ESP32C5 OR CONFIG_IDF_TARGET_ESP32C6 OR CONFIG_IDF_TARGET_ESP32C61 OR CONFIG_IDF_TARGET_ESP32H2 OR CONFIG_IDF_TARGET_ESP32H21) - set(_march "rv32imac_zicsr_zifencei_zaamo_zalrsc") + set(_march "rv32imac") elseif(CONFIG_IDF_TARGET_ESP32H4) - set(_march "rv32imafcb_zicsr_zifencei_zaamo_zalrsc") + set(_march "rv32imafcb") elseif(CONFIG_IDF_TARGET_ESP32P4 OR CONFIG_IDF_TARGET_ESP32S31) - set(_march "rv32imafc_zicsr_zifencei_zaamo_zalrsc") + set(_march "rv32imafc") elseif(NOT(CONFIG_IDF_TARGET_ESP32S2 OR CONFIG_IDF_TARGET_ESP32S3)) message(FATAL_ERROR "Unknown Espressif target: ${CONFIG_IDF_TARGET}") endif() + set(_march "${_march}_zicsr_zifencei") + # Architecture-specific flags if(CONFIG_IDF_TARGET_ARCH_XTENSA) idf_toolchain_add_flags(COMPILE_OPTIONS "-mlongcalls" @@ -35,6 +37,7 @@ if(CONFIG_IDF_TOOLCHAIN_GCC) # Clean compile options that were added by previous configurations and may be outdated idf_toolchain_remove_flags(COMPILE_OPTIONS "-march=" + "-mtune=" "-mno-cm-push-reverse" "-mno-cm-popret") @@ -78,7 +81,12 @@ if(CONFIG_IDF_TOOLCHAIN_GCC) idf_toolchain_add_flags(COMPILE_OPTIONS "-march=${_march}") if(NOT CONFIG_SOC_CPU_MISALIGNED_ACCESS_ON_PMP_MISMATCH_ISSUE) - idf_toolchain_add_flags(COMPILE_OPTIONS "-mtune=esp-base") + check_c_compiler_flag("-mtune=${CONFIG_IDF_TARGET}" COMPILER_SUPPORTS_MTUNE_${CONFIG_IDF_TARGET}) + if(COMPILER_SUPPORTS_MTUNE_${CONFIG_IDF_TARGET}) + idf_toolchain_add_flags(COMPILE_OPTIONS "-mtune=${CONFIG_IDF_TARGET}") + else() + idf_toolchain_add_flags(COMPILE_OPTIONS "-mtune=esp-base") + endif() endif() idf_toolchain_rerun_abi_detection() else() diff --git a/components/wpa_supplicant/CMakeLists.txt b/components/wpa_supplicant/CMakeLists.txt index e89cf707098..6c100325f50 100644 --- a/components/wpa_supplicant/CMakeLists.txt +++ b/components/wpa_supplicant/CMakeLists.txt @@ -390,3 +390,24 @@ if(CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_SOFTAP) target_compile_definitions(${COMPONENT_LIB} PRIVATE CONFIG_OWE_SOFTAP) endif() set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY LINK_INTERFACE_MULTIPLICITY 3) + +if(CONFIG_COMPILER_STATIC_ANALYZER AND CONFIG_IDF_TOOLCHAIN_GCC) + set(eloop_analyzer_flags + -Wno-analyzer-out-of-bounds + -Wno-analyzer-null-dereference + -Wno-analyzer-use-of-uninitialized-value + -Wno-analyzer-free-of-non-heap + ) + list(JOIN eloop_analyzer_flags " " eloop_analyzer_flags) + + set_source_files_properties( + src/rsn_supp/wpa.c + PROPERTIES COMPILE_FLAGS + -Wno-analyzer-use-of-uninitialized-value + ) + set_source_files_properties( + port/eloop.c + PROPERTIES COMPILE_FLAGS + "${eloop_analyzer_flags}" + ) +endif() diff --git a/tools/ci/check_copyright_config.yaml b/tools/ci/check_copyright_config.yaml index 3b7a5f2e6aa..0bd50f64e50 100644 --- a/tools/ci/check_copyright_config.yaml +++ b/tools/ci/check_copyright_config.yaml @@ -181,14 +181,6 @@ xtensa: - Apache-2.0 #Files added to the xtensa component by us - MIT #Cadence sources -# TODO IDF-15041 - remove this block -esp_libc: - include: - - 'components/esp_libc/**' - allowed_licenses: - - Apache-2.0 #Files added to the esp_libc component by us - - MIT #Cadence sources - tinyusb: include: - 'examples/peripherals/usb/device/tusb_midi/' diff --git a/tools/ci/configure_ci_environment.sh b/tools/ci/configure_ci_environment.sh index 54f2e03159f..38f093cbe03 100644 --- a/tools/ci/configure_ci_environment.sh +++ b/tools/ci/configure_ci_environment.sh @@ -17,8 +17,17 @@ DEBUG_SHELL=${DEBUG_SHELL:-"0"} # (Depends on default options '-Wno-error=XXX' used in the IDF build system) if [ "$IDF_TOOLCHAIN" != "clang" ]; then - PEDANTIC_FLAGS="-Werror -Werror=deprecated-declarations -Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function" + PEDANTIC_FLAGS="-Werror -Werror=deprecated-declarations -Werror=unused-variable -Werror=unused-function" export PEDANTIC_CFLAGS="${PEDANTIC_FLAGS} -Wstrict-prototypes" + # TODO IDF-15784 + case "$CI_JOB_NAME" in + test_pytest_linux|test_sockets_on_host|test_transport_on_host|test_pytest_macos) + export PEDANTIC_CFLAGS="${PEDANTIC_CFLAGS} -Werror=unused-but-set-variable" + ;; + *) + export PEDANTIC_CFLAGS="${PEDANTIC_CFLAGS} -Werror=unused-but-set-variable=1" + ;; + esac else export PEDANTIC_CFLAGS="-Werror" fi diff --git a/tools/cmakev2/project.cmake b/tools/cmakev2/project.cmake index 03e3fbcb351..b5e58327aef 100644 --- a/tools/cmakev2/project.cmake +++ b/tools/cmakev2/project.cmake @@ -236,6 +236,28 @@ function(__init_project_configuration) list(APPEND c_compile_options "-Wno-old-style-declaration") endif() + # TODO IDF-15784: remove in IDF v7.0 ? + check_c_compiler_flag("-Wunused-but-set-variable=1" compiler_supports_wunused_but_set_variable_eq_1) + if(compiler_supports_wunused_but_set_variable_eq_1) + list(APPEND compile_options "-Wunused-but-set-variable=1") + endif() + + if(CONFIG_COMPILER_CXX_TRIVIAL_AUTO_VAR_INIT_UNINITIALIZED) + set(compiler_cxx_trivial_auto_var_init "uninitialized") + elseif(CONFIG_COMPILER_CXX_TRIVIAL_AUTO_VAR_INIT_PATTERN) + set(compiler_cxx_trivial_auto_var_init "pattern") + elseif(CONFIG_COMPILER_CXX_TRIVIAL_AUTO_VAR_INIT_ZERO) + set(compiler_cxx_trivial_auto_var_init "zero") + endif() + if(compiler_cxx_trivial_auto_var_init) + idf_toolchain_remove_flags(CXX_COMPILE_OPTIONS "-ftrivial-auto-var-init") + check_cxx_compiler_flag("-ftrivial-auto-var-init=${compiler_cxx_trivial_auto_var_init}" + compiler_supports_ftrivial_auto_var_init) + if(compiler_supports_ftrivial_auto_var_init) + idf_toolchain_add_flags(CXX_COMPILE_OPTIONS "-ftrivial-auto-var-init=${compiler_cxx_trivial_auto_var_init}") + endif() + endif() + # Clang finds some warnings in IDF code which GCC doesn't. # All these warnings should be fixed before Clang is presented # as a toolchain choice for users. diff --git a/tools/idf_tools.py b/tools/idf_tools.py index b2b03e03a50..802bddad9b0 100755 --- a/tools/idf_tools.py +++ b/tools/idf_tools.py @@ -3008,6 +3008,10 @@ def action_add_version(args: Any) -> None: ) updated_tools = [] for file_size, file_sha256, file_name in checksum_info: + skip_files = ['debug-sections', 'esp8266-multilib'] + if any(skip_file in file_name for skip_file in skip_files): + continue + xz_file = file_name.replace('.tar.gz', '.tar.xz') if xz_file in updated_tools: # .tar.xz archives are preferable, but .tar.gz is needed, for example, when using PlatformIO diff --git a/tools/tools.json b/tools/tools.json index 85ab012a065..8858eb286a7 100644 --- a/tools/tools.json +++ b/tools/tools.json @@ -193,51 +193,56 @@ "versions": [ { "linux-amd64": { - "sha256": "3d50f5cd5f173acfd524e07c1cd69bc99585731a415ca2e5bce879997fe602b8", - "size": 180530004, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-15.2.0_20251204/xtensa-esp-elf-15.2.0_20251204-x86_64-linux-gnu.tar.xz" + "sha256": "f708752ebb35cab21f184b2574114ed1187619db0edb8a4ba913c06ca2fa675e", + "size": 89005792, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-16.1.0_20260609/xtensa-esp-elf-16.1.0_20260609-x86_64-linux-gnu.tar.xz" }, "linux-arm64": { - "sha256": "c8a8255009803036ba3def98a97a7134ee5a8ac5db048425e126fcf07f27ce1c", - "size": 171323572, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-15.2.0_20251204/xtensa-esp-elf-15.2.0_20251204-aarch64-linux-gnu.tar.xz" + "sha256": "785ee242bfbdb3ac4e764e85d2f87109c7c5f3da57d742da9a7c58c0d0906149", + "size": 87039416, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-16.1.0_20260609/xtensa-esp-elf-16.1.0_20260609-aarch64-linux-gnu.tar.xz" }, "linux-armel": { - "sha256": "0ae215a8adb2823b370e31d20891747af42b86ce5042331df50829942d8cbbfe", - "size": 171249364, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-15.2.0_20251204/xtensa-esp-elf-15.2.0_20251204-arm-linux-gnueabi.tar.xz" + "sha256": "ba59c4e5af16ffad5d3f23e91cbf5b16489a65bfcd5ff84a39549ba605da1e18", + "size": 80794900, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-16.1.0_20260609/xtensa-esp-elf-16.1.0_20260609-arm-linux-gnueabi.tar.xz" }, "linux-armhf": { - "sha256": "99c1b5d45e9d661457d7a98494e5ebb2ed2e01b4b4dd4861de750acaec15a7bc", - "size": 178819728, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-15.2.0_20251204/xtensa-esp-elf-15.2.0_20251204-arm-linux-gnueabihf.tar.xz" + "sha256": "63ede3768b29da2d6588cfd4d872f6a3a44b05b8e966d6d788722ade03cc3085", + "size": 80560804, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-16.1.0_20260609/xtensa-esp-elf-16.1.0_20260609-arm-linux-gnueabihf.tar.xz" }, "linux-i686": { - "sha256": "6d3c510ddf5f084734c1dd5671d87a7b13973d713f641596ec1351dcce8d3ff3", - "size": 183293668, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-15.2.0_20251204/xtensa-esp-elf-15.2.0_20251204-i586-linux-gnu.tar.xz" + "sha256": "e5a4a17e7d90a1b3f26bf218178678db18293f6aa2b547ad0ccdcfa254e2a404", + "size": 99667616, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-16.1.0_20260609/xtensa-esp-elf-16.1.0_20260609-i586-linux-gnu.tar.xz" }, "macos": { - "sha256": "96da1fcf01e2ac89819d1e336ca9e27762c35ea120627b89de8fd482f42c54f8", - "size": 177161964, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-15.2.0_20251204/xtensa-esp-elf-15.2.0_20251204-x86_64-apple-darwin.tar.xz" + "sha256": "c79d365223cec0e876fe0b25970a155ba9cddc2ee4130173944efe0ce1370d89", + "size": 84517708, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-16.1.0_20260609/xtensa-esp-elf-16.1.0_20260609-x86_64-apple-darwin.tar.xz" }, "macos-arm64": { - "sha256": "68d3fb1e75c6bb1b88c6a2c74977abd51efd09b560a99149bafdcf403cb21941", - "size": 171304492, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-15.2.0_20251204/xtensa-esp-elf-15.2.0_20251204-aarch64-apple-darwin.tar.xz" + "sha256": "be4eb81c12c9bbf6ead79c758bfa81b8e6ec9a695372f946ac924c70c32f273d", + "size": 77656644, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-16.1.0_20260609/xtensa-esp-elf-16.1.0_20260609-aarch64-apple-darwin.tar.xz" }, - "name": "esp-15.2.0_20251204", + "name": "esp-16.1.0_20260609", "status": "recommended", + "win-arm64": { + "sha256": "8d64c4f1b92d128af87c74f1d761fea1c3722ecbbcd184e18155e619e5a82edd", + "size": 203837546, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-16.1.0_20260609/xtensa-esp-elf-16.1.0_20260609-aarch64-w64-mingw32.zip" + }, "win32": { - "sha256": "72403f48827f75495f7c0b1c2be9f643c8dac25af7722545fc3ba1f21e834389", - "size": 406468543, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-15.2.0_20251204/xtensa-esp-elf-15.2.0_20251204-i686-w64-mingw32.zip" + "sha256": "38eea7d181a1d77a4131f94d4fc0545a0a0bd37ce4031c6dccc7bfa52990fad4", + "size": 253465274, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-16.1.0_20260609/xtensa-esp-elf-16.1.0_20260609-i686-w64-mingw32.zip" }, "win64": { - "sha256": "efa1e337b5f64239674bf755b767969cbba7f4e66fe7c6ab8d19b650f56012a9", - "size": 408348988, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-15.2.0_20251204/xtensa-esp-elf-15.2.0_20251204-x86_64-w64-mingw32.zip" + "sha256": "cb59cbfe7f8ce35700dc407e4ce17af95576cc11285e024caea8a2bd6e590da9", + "size": 247075663, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-16.1.0_20260609/xtensa-esp-elf-16.1.0_20260609-x86_64-w64-mingw32.zip" } } ] @@ -411,51 +416,56 @@ "versions": [ { "linux-amd64": { - "sha256": "ace5aae6afe98f754947be043d40173e2e22ace57754b11a394b7238eefa01cf", - "size": 393927372, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-15.2.0_20251204/riscv32-esp-elf-15.2.0_20251204-x86_64-linux-gnu.tar.xz" + "sha256": "0b029ab31ebc7f74e2c4779077251b21a22cd620669dc4c82e7adc478d403a8d", + "size": 148659348, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-16.1.0_20260609/riscv32-esp-elf-16.1.0_20260609-x86_64-linux-gnu.tar.xz" }, "linux-arm64": { - "sha256": "90cccb3ef035f016836dd7c292528b27333a716d42b9361a68005d178c0f70bf", - "size": 382287852, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-15.2.0_20251204/riscv32-esp-elf-15.2.0_20251204-aarch64-linux-gnu.tar.xz" + "sha256": "d669ad2d452caf0f7887262cd1b2ce44921e2ffd8ee3e94062b50ac655dfb382", + "size": 140733560, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-16.1.0_20260609/riscv32-esp-elf-16.1.0_20260609-aarch64-linux-gnu.tar.xz" }, "linux-armel": { - "sha256": "5603d18a0534ab5c2faca672ac890ad5b57727e55c6734adf6584aa73844f112", - "size": 373116772, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-15.2.0_20251204/riscv32-esp-elf-15.2.0_20251204-arm-linux-gnueabi.tar.xz" + "sha256": "e8c3066b851cdb87fed17bf5e48f688fab16979a1dbaca34506d7931825ea163", + "size": 138188564, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-16.1.0_20260609/riscv32-esp-elf-16.1.0_20260609-arm-linux-gnueabi.tar.xz" }, "linux-armhf": { - "sha256": "61b2feebfe14c5f2a7966ccec0c1c7ed2e2840d260671730f376aa92323b1338", - "size": 375893944, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-15.2.0_20251204/riscv32-esp-elf-15.2.0_20251204-arm-linux-gnueabihf.tar.xz" + "sha256": "f2af4035d8aa8d302e083f3e487d397797f07022396ca706e9f3b2daeb51877f", + "size": 135571220, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-16.1.0_20260609/riscv32-esp-elf-16.1.0_20260609-arm-linux-gnueabihf.tar.xz" }, "linux-i686": { - "sha256": "8dc31a97c008bf80d0c0b20b5960c522d9552f77a79ffd60e3ae6b1329cd68ef", - "size": 397880364, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-15.2.0_20251204/riscv32-esp-elf-15.2.0_20251204-i586-linux-gnu.tar.xz" + "sha256": "7f0d18a415d0931ec87affda00e103b67cb41e80c6ad0220569d6f5af4b1bd2c", + "size": 150194404, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-16.1.0_20260609/riscv32-esp-elf-16.1.0_20260609-i586-linux-gnu.tar.xz" }, "macos": { - "sha256": "6d4709eadf4c66aecb51c0ff9c7b068eefa6ecec37aa7817f172c9f735318e73", - "size": 397611788, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-15.2.0_20251204/riscv32-esp-elf-15.2.0_20251204-x86_64-apple-darwin.tar.xz" + "sha256": "0bd723258440e9fd398f610abc848471f3d362c102a3bbb7f9a1691df64e9abc", + "size": 139607216, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-16.1.0_20260609/riscv32-esp-elf-16.1.0_20260609-x86_64-apple-darwin.tar.xz" }, "macos-arm64": { - "sha256": "0869d1083532c631808543dd802885f02dbe1bb3bd640be0dee827e82ded768d", - "size": 389672664, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-15.2.0_20251204/riscv32-esp-elf-15.2.0_20251204-aarch64-apple-darwin.tar.xz" + "sha256": "5f11c929ecc8a978d9492e4e05cf6f607a4563efdb67e972fea28bef2a07b3bf", + "size": 129177360, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-16.1.0_20260609/riscv32-esp-elf-16.1.0_20260609-aarch64-apple-darwin.tar.xz" }, - "name": "esp-15.2.0_20251204", + "name": "esp-16.1.0_20260609", "status": "recommended", + "win-arm64": { + "sha256": "9beb272c0afebbd166ebd41623fe05360ce5a12185db4e98b6a6670e1068a974", + "size": 340852396, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-16.1.0_20260609/riscv32-esp-elf-16.1.0_20260609-aarch64-w64-mingw32.zip" + }, "win32": { - "sha256": "a52d9c855f1771527d2a6b6a6012ddff3f17bb5c937830b163aa8418177c86da", - "size": 956756021, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-15.2.0_20251204/riscv32-esp-elf-15.2.0_20251204-i686-w64-mingw32.zip" + "sha256": "be813caca615e5c75c1fb7f0d0399782fb5c58349b735f3b82094a7c1a7a45bc", + "size": 416516109, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-16.1.0_20260609/riscv32-esp-elf-16.1.0_20260609-i686-w64-mingw32.zip" }, "win64": { - "sha256": "c61488aa15f49146aae918267110f775a52c3cef3844cbf261f475ef97523c3d", - "size": 963974138, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-15.2.0_20251204/riscv32-esp-elf-15.2.0_20251204-x86_64-w64-mingw32.zip" + "sha256": "70acfe653e6245b4afc3f2d22863445d2a999f0987f3e79b1814b26118284770", + "size": 421575985, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-16.1.0_20260609/riscv32-esp-elf-16.1.0_20260609-x86_64-w64-mingw32.zip" } } ]