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

@@ -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