fix(config): actualize newlib Kconfig options

This commit is contained in:
Alexey Lapshin
2025-08-15 12:32:48 +07:00
committed by BOT
parent 42b065bdce
commit 28ced4efad
28 changed files with 41 additions and 44 deletions

View File

@@ -49,7 +49,7 @@ static esp_err_t esp_mbedtls_init_pk_ctx_for_ds(const void *pki);
static const char *TAG = "esp-tls-mbedtls";
static mbedtls_x509_crt *global_cacert = NULL;
#if CONFIG_NEWLIB_NANO_FORMAT
#if CONFIG_LIBC_NEWLIB_NANO_FORMAT
#define NEWLIB_NANO_SSIZE_T_COMPAT_FORMAT "X"
#define NEWLIB_NANO_SIZE_T_COMPAT_FORMAT PRIu32
#define NEWLIB_NANO_SIZE_T_COMPAT_CAST(size_t_var) (uint32_t)size_t_var

View File

@@ -4,7 +4,7 @@
# CONFIG_ESP_TASK_WDT_INIT is not set
CONFIG_FREERTOS_HZ=1000
# Disable nano printf, because we need to print the timer count in %llu format
CONFIG_NEWLIB_NANO_FORMAT=n
CONFIG_LIBC_NEWLIB_NANO_FORMAT=n
# primitives for checking sleep internal state
CONFIG_ESP_SLEEP_DEBUG=y

View File

@@ -81,7 +81,7 @@ TEST_CASE("CRs are removed from the stdin correctly", "[vfs_uart]")
// If there is data available at the moment, read() also returns directly with the currently available size
const char* send_str = "1234567890\n\r123\r\n4\n";
/* with CONFIG_NEWLIB_STDOUT_ADDCR, the following will be sent on the wire.
/* with CONFIG_LIBC_STDOUT_LINE_ENDING_CRLF, the following will be sent on the wire.
* (last character of each part is marked with a hat)
*
* 1234567890\r\n\r123\r\r\n4\r\n

View File

@@ -22,7 +22,7 @@
extern "C" {
#endif
#if CONFIG_NEWLIB_NANO_FORMAT
#if CONFIG_LIBC_NEWLIB_NANO_FORMAT
#define NEWLIB_NANO_COMPAT_FORMAT PRIu32
#define NEWLIB_NANO_COMPAT_CAST(size_t_var) (uint32_t)size_t_var
#else

View File

@@ -27,10 +27,10 @@
#define ESP_TASK_PRIO_MAX (configMAX_PRIORITIES)
#define ESP_TASK_PRIO_MIN (0)
/* Bt contoller Task */
/* Bt controller Task */
/* controller */
#define ESP_TASK_BT_CONTROLLER_PRIO (ESP_TASK_PRIO_MAX - 2)
#ifdef CONFIG_NEWLIB_NANO_FORMAT
#ifdef CONFIG_LIBC_NEWLIB_NANO_FORMAT
#define TASK_EXTRA_STACK_SIZE (0)
#else
#define TASK_EXTRA_STACK_SIZE (512)

View File

@@ -17,9 +17,6 @@
#include "esp_private/cache_utils.h"
#include "spi_flash_mmap.h"
#include "esp_flash_internal.h"
#if CONFIG_NEWLIB_ENABLED
#include "esp_newlib.h"
#endif
#include "esp_newlib.h"
#include "esp_xt_wdt.h"
#include "esp_cpu.h"

View File

@@ -41,7 +41,7 @@
#define ACCESS_ECDH(S, var) S.MBEDTLS_PRIVATE(ctx).MBEDTLS_PRIVATE(mbed_ecdh).MBEDTLS_PRIVATE(var)
#endif
#if CONFIG_NEWLIB_NANO_FORMAT
#if CONFIG_LIBC_NEWLIB_NANO_FORMAT
#define NEWLIB_NANO_COMPAT_FORMAT PRIu32
#define NEWLIB_NANO_COMPAT_CAST(int64_t_var) (uint32_t)int64_t_var
#else

View File

@@ -36,7 +36,7 @@
#define TEST_ASSERT_MBEDTLS_OK(X) TEST_ASSERT_EQUAL_HEX32(0, -(X))
#if CONFIG_NEWLIB_NANO_FORMAT
#if CONFIG_LIBC_NEWLIB_NANO_FORMAT
#define NEWLIB_NANO_COMPAT_FORMAT PRIu32
#define NEWLIB_NANO_COMPAT_CAST(int64_t_var) (uint32_t)int64_t_var
#else

View File

@@ -101,7 +101,7 @@ static struct syscall_stub_table s_stub_table = {
._lock_release = &_lock_release,
._lock_release_recursive = &_lock_release_recursive,
#endif
#ifdef CONFIG_NEWLIB_NANO_FORMAT
#ifdef CONFIG_LIBC_NEWLIB_NANO_FORMAT
._printf_float = &_printf_float,
._scanf_float = &_scanf_float,
#else

View File

@@ -135,23 +135,23 @@ static bool fn_in_rom(void *fn)
/* Older chips have newlib nano in rom as well, but this is not linked in due to us now using 64 bit time_t
and the ROM code was compiled for 32 bit.
*/
#define PRINTF_NANO_IN_ROM (CONFIG_NEWLIB_NANO_FORMAT && ESP_ROM_HAS_NEWLIB_NANO_FORMAT && !ESP_ROM_HAS_NEWLIB_32BIT_TIME && !ESP_ROM_HAS_NEWLIB_NANO_PRINTF_FLOAT_BUG)
#define PRINTF_NANO_IN_ROM (CONFIG_LIBC_NEWLIB_NANO_FORMAT && ESP_ROM_HAS_NEWLIB_NANO_FORMAT && !ESP_ROM_HAS_NEWLIB_32BIT_TIME && !ESP_ROM_HAS_NEWLIB_NANO_PRINTF_FLOAT_BUG)
#define SSCANF_NANO_IN_ROM (CONFIG_NEWLIB_NANO_FORMAT && CONFIG_IDF_TARGET_ESP32C2)
#define SSCANF_NANO_IN_ROM (CONFIG_LIBC_NEWLIB_NANO_FORMAT && CONFIG_IDF_TARGET_ESP32C2)
TEST_CASE("check if ROM or Flash is used for functions", "[newlib]")
{
#if CONFIG_LIBC_NEWLIB && (PRINTF_NANO_IN_ROM || (ESP_ROM_HAS_NEWLIB_NORMAL_FORMAT && !CONFIG_NEWLIB_NANO_FORMAT))
#if CONFIG_LIBC_NEWLIB && (PRINTF_NANO_IN_ROM || (ESP_ROM_HAS_NEWLIB_NORMAL_FORMAT && !CONFIG_LIBC_NEWLIB_NANO_FORMAT))
TEST_ASSERT(fn_in_rom(vfprintf));
#else
TEST_ASSERT_FALSE(fn_in_rom(vfprintf));
#endif // CONFIG_LIBC_NEWLIB && (PRINTF_NANO_IN_ROM || (ESP_ROM_HAS_NEWLIB_NORMAL_FORMAT && !CONFIG_NEWLIB_NANO_FORMAT))
#endif // CONFIG_LIBC_NEWLIB && (PRINTF_NANO_IN_ROM || (ESP_ROM_HAS_NEWLIB_NORMAL_FORMAT && !CONFIG_LIBC_NEWLIB_NANO_FORMAT))
#if CONFIG_LIBC_NEWLIB && (SSCANF_NANO_IN_ROM || (ESP_ROM_HAS_NEWLIB_NORMAL_FORMAT && !CONFIG_NEWLIB_NANO_FORMAT))
#if CONFIG_LIBC_NEWLIB && (SSCANF_NANO_IN_ROM || (ESP_ROM_HAS_NEWLIB_NORMAL_FORMAT && !CONFIG_LIBC_NEWLIB_NANO_FORMAT))
TEST_ASSERT(fn_in_rom(sscanf));
#else
TEST_ASSERT_FALSE(fn_in_rom(sscanf));
#endif // CONFIG_LIBC_NEWLIB && (SSCANF_NANO_IN_ROM || (ESP_ROM_HAS_NEWLIB_NORMAL_FORMAT && !CONFIG_NEWLIB_NANO_FORMAT))
#endif // CONFIG_LIBC_NEWLIB && (SSCANF_NANO_IN_ROM || (ESP_ROM_HAS_NEWLIB_NORMAL_FORMAT && !CONFIG_LIBC_NEWLIB_NANO_FORMAT))
#if CONFIG_LIBC_NEWLIB
#if defined(CONFIG_IDF_TARGET_ESP32)
@@ -179,7 +179,7 @@ TEST_CASE("check if ROM or Flash is used for functions", "[newlib]")
#endif // CONFIG_LIBC_NEWLIB
}
#ifndef CONFIG_NEWLIB_NANO_FORMAT
#ifndef CONFIG_LIBC_NEWLIB_NANO_FORMAT
TEST_CASE("test 64bit int formats", "[newlib]")
{
char* res = NULL;
@@ -196,7 +196,7 @@ TEST_CASE("test 64bit int formats", "[newlib]")
TEST_ASSERT_EQUAL(1, ret);
TEST_ASSERT_EQUAL(val, sval);
}
#else // CONFIG_NEWLIB_NANO_FORMAT
#else // CONFIG_LIBC_NEWLIB_NANO_FORMAT
#if CONFIG_SPIRAM_CACHE_WORKAROUND
static bool fn_in_iram(void *fn)
@@ -318,7 +318,7 @@ TEST_CASE("test 64bit int formats", "[newlib]")
TEST_ASSERT_EQUAL(0, ret);
}
#endif // CONFIG_NEWLIB_NANO_FORMAT
#endif // CONFIG_LIBC_NEWLIB_NANO_FORMAT
TEST_CASE("fmod and fmodf work as expected", "[newlib]")
{

View File

@@ -473,7 +473,7 @@ static struct timeval get_time(const char *desc, char *buffer)
gettimeofday(&timestamp, NULL);
struct tm* tm_info = localtime(&timestamp.tv_sec);
strftime(buffer, 32, "%c", tm_info);
#if !CONFIG_NEWLIB_NANO_FORMAT
#if !CONFIG_LIBC_NEWLIB_NANO_FORMAT
ESP_LOGI("TAG", "%s: %016llX (%s)", desc, timestamp.tv_sec, buffer);
#endif
return timestamp;
@@ -490,7 +490,7 @@ TEST_CASE("test time_t wide 64 bits", "[newlib]")
tzset();
struct tm tm = {4, 14, 3, 19, 0, 138, 0, 0, 0};
struct timeval timestamp = { mktime(&tm), 0 };
#if !CONFIG_NEWLIB_NANO_FORMAT
#if !CONFIG_LIBC_NEWLIB_NANO_FORMAT
ESP_LOGI("TAG", "timestamp: %016llX", timestamp.tv_sec);
#endif
settimeofday(&timestamp, NULL);
@@ -527,7 +527,7 @@ TEST_CASE("test time functions wide 64 bits", "[newlib]")
localtime_r(&now, &timeinfo);
time_t t = mktime(&timeinfo);
#if !CONFIG_NEWLIB_NANO_FORMAT
#if !CONFIG_LIBC_NEWLIB_NANO_FORMAT
ESP_LOGI("TAG", "Test mktime(). Time: %016llX", t);
#endif
TEST_ASSERT_EQUAL(timestamp.tv_sec, t);

View File

@@ -1,2 +1,2 @@
# Test all chips with nano off, nano on is tested in options config
CONFIG_NEWLIB_NANO_FORMAT=n
CONFIG_LIBC_NEWLIB_NANO_FORMAT=n

View File

@@ -1,2 +1,2 @@
# Test with misc newlib config options turned on
CONFIG_NEWLIB_NANO_FORMAT=y
CONFIG_LIBC_NEWLIB_NANO_FORMAT=y

View File

@@ -1,4 +1,4 @@
CONFIG_IDF_TARGET="esp32"
CONFIG_FREERTOS_UNICORE=y
# IDF-6964 test nano format in this configuration (current tests are not passing, so keep disabled for now)
CONFIG_NEWLIB_NANO_FORMAT=n
CONFIG_LIBC_NEWLIB_NANO_FORMAT=n

View File

@@ -4,4 +4,4 @@
CONFIG_IDF_TARGET="esp32c2"
CONFIG_BT_ENABLED=y
CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304
# CONFIG_NEWLIB_NANO_FORMAT is not set
# CONFIG_LIBC_NEWLIB_NANO_FORMAT is not set

View File

@@ -4,4 +4,4 @@
CONFIG_IDF_TARGET="esp32c2"
CONFIG_BT_ENABLED=y
CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304
# CONFIG_NEWLIB_NANO_FORMAT is not set
# CONFIG_LIBC_NEWLIB_NANO_FORMAT is not set

View File

@@ -4,4 +4,4 @@
CONFIG_IDF_TARGET="esp32c2"
CONFIG_BT_ENABLED=y
CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304
# CONFIG_NEWLIB_NANO_FORMAT is not set
# CONFIG_LIBC_NEWLIB_NANO_FORMAT is not set

View File

@@ -4,4 +4,4 @@
CONFIG_IDF_TARGET="esp32c2"
CONFIG_BT_ENABLED=y
CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304
# CONFIG_NEWLIB_NANO_FORMAT is not set
# CONFIG_LIBC_NEWLIB_NANO_FORMAT is not set

View File

@@ -4,4 +4,4 @@
CONFIG_IDF_TARGET="esp32c2"
CONFIG_BT_ENABLED=y
CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304
# CONFIG_NEWLIB_NANO_FORMAT is not set
# CONFIG_LIBC_NEWLIB_NANO_FORMAT is not set

View File

@@ -31,7 +31,7 @@ CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS=y
CONFIG_ESP_ERR_TO_NAME_LOOKUP=n
CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT=y
CONFIG_LOG_DEFAULT_LEVEL_NONE=y
CONFIG_NEWLIB_NANO_FORMAT=y
CONFIG_LIBC_NEWLIB_NANO_FORMAT=y
CONFIG_OPENTHREAD_LOG_LEVEL_DYNAMIC=n
CONFIG_OPENTHREAD_LOG_LEVEL_NONE=y
```

View File

@@ -31,8 +31,8 @@ CONFIG_OPENTHREAD_DNS_CLIENT=n
#
# Deprecated options for backward compatibility
#
CONFIG_LOG_BOOTLOADER_LEVEL_ERROR=y
CONFIG_LOG_BOOTLOADER_LEVEL_INFO=n
CONFIG_BOOTLOADER_LOG_LEVEL_ERROR=y
CONFIG_BOOTLOADER_LOG_LEVEL_INFO=n
# End of deprecated options
#
@@ -45,6 +45,6 @@ CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS=y
CONFIG_ESP_ERR_TO_NAME_LOOKUP=n
CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT=y
CONFIG_LOG_DEFAULT_LEVEL_NONE=y
CONFIG_NEWLIB_NANO_FORMAT=y
CONFIG_LIBC_NEWLIB_NANO_FORMAT=y
CONFIG_OPENTHREAD_LOG_LEVEL_DYNAMIC=n
CONFIG_OPENTHREAD_LOG_LEVEL_NONE=y

View File

@@ -3,4 +3,4 @@
#
# Disable nano printf, because we need to print the timer count in %llu format
CONFIG_NEWLIB_NANO_FORMAT=n
CONFIG_LIBC_NEWLIB_NANO_FORMAT=n

View File

@@ -286,7 +286,7 @@ static void print_device_info(msc_host_device_info_t *info)
printf("\t Sector count: %"PRIu32"\n", info->sector_count);
printf("\t PID: 0x%04X \n", info->idProduct);
printf("\t VID: 0x%04X \n", info->idVendor);
#ifndef CONFIG_NEWLIB_NANO_FORMAT
#ifndef CONFIG_LIBC_NEWLIB_NANO_FORMAT
wprintf(L"\t iProduct: %S \n", info->iProduct);
wprintf(L"\t iManufacturer: %S \n", info->iManufacturer);
wprintf(L"\t iSerialNumber: %S \n", info->iSerialNumber);

View File

@@ -1,6 +1,6 @@
# With this option enabled, esp_timer_dump() prints more data about timers in the output log
CONFIG_ESP_TIMER_PROFILING=y
# NEWLIB_NANO_FORMAT is enabled by default on ESP32-C2
# LIBC_NEWLIB_NANO_FORMAT is enabled by default on ESP32-C2
# This example needs 64-bit integer formatting, this is why this option is disabled
CONFIG_NEWLIB_NANO_FORMAT=n
CONFIG_LIBC_NEWLIB_NANO_FORMAT=n

View File

@@ -50,7 +50,7 @@ static void light_sleep_task(void *args)
} else {
wakeup_reason = "other";
}
#if CONFIG_NEWLIB_NANO_FORMAT
#if CONFIG_LIBC_NEWLIB_NANO_FORMAT
/* printf in newlib-nano does not support %ll format, causing example test fail */
printf("Returned from light sleep, reason: %s, t=%d ms, slept for %d ms\n",
wakeup_reason, (int) (t_after_us / 1000), (int) ((t_after_us - t_before_us) / 1000));

View File

@@ -146,7 +146,7 @@ CONFIG_LIBC_STDOUT_LINE_ENDING_CR=
CONFIG_LIBC_STDIN_LINE_ENDING_CRLF=
CONFIG_LIBC_STDIN_LINE_ENDING_LF=
CONFIG_LIBC_STDIN_LINE_ENDING_CR=y
CONFIG_NEWLIB_NANO_FORMAT=
CONFIG_LIBC_NEWLIB_NANO_FORMAT=
CONFIG_ESP_CONSOLE_UART_DEFAULT=y
CONFIG_ESP_CONSOLE_UART_CUSTOM=
CONFIG_ESP_CONSOLE_UART_NONE=

View File

@@ -1,7 +1,7 @@
CONFIG_LOG_DEFAULT_LEVEL_NONE=y
CONFIG_APP_BUILD_TYPE_RAM=y
CONFIG_VFS_SUPPORT_TERMIOS=n
CONFIG_NEWLIB_NANO_FORMAT=y
CONFIG_LIBC_NEWLIB_NANO_FORMAT=y
CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y
CONFIG_ESP_DEBUG_STUBS_ENABLE=n
CONFIG_ESP_ERR_TO_NAME_LOOKUP=n

View File

@@ -207,7 +207,7 @@ def test_build_loadable_elf(idf_py: IdfPyFunc, test_app_copy: Path) -> None:
[
'CONFIG_APP_BUILD_TYPE_RAM=y',
'CONFIG_VFS_SUPPORT_TERMIOS=n',
'CONFIG_NEWLIB_NANO_FORMAT=y',
'CONFIG_LIBC_NEWLIB_NANO_FORMAT=y',
'CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y',
'CONFIG_ESP_ERR_TO_NAME_LOOKUP=n',
]