From 4731d4322e7b28c15845a87287672515f9ec4ad5 Mon Sep 17 00:00:00 2001 From: jiangguangming Date: Sun, 29 Jan 2023 10:09:02 +0800 Subject: [PATCH] esp_rom: remove newlib-time.ld from ROM built with 64-bit time_t --- components/esp_rom/CMakeLists.txt | 40 +++++-------------- .../esp32c2/ld/esp32c2.rom.newlib-time.ld | 16 -------- .../esp_rom/esp32c2/ld/esp32c2.rom.newlib.ld | 6 +++ .../esp32c6/ld/esp32c6.rom.newlib-time.ld | 15 ------- .../esp32h2/ld/esp32h2.rom.newlib-time.ld | 15 ------- 5 files changed, 15 insertions(+), 77 deletions(-) delete mode 100644 components/esp_rom/esp32c2/ld/esp32c2.rom.newlib-time.ld delete mode 100644 components/esp_rom/esp32c6/ld/esp32c6.rom.newlib-time.ld delete mode 100644 components/esp_rom/esp32h2/ld/esp32h2.rom.newlib-time.ld diff --git a/components/esp_rom/CMakeLists.txt b/components/esp_rom/CMakeLists.txt index 1e40d3cbf4..5671b43ce9 100644 --- a/components/esp_rom/CMakeLists.txt +++ b/components/esp_rom/CMakeLists.txt @@ -224,16 +224,9 @@ else() # Regular app build rom_linker_script("version") rom_linker_script("mbedtls") - if(time_t_size EQUAL 8) - # The ROM functions listed in this linker script depend on sizeof(time_t). - # Since ROM for ESP32-C2 was compiled for 64-bit time_t, only link these functions - # if the toolchain is also using 64-bit time_t. - rom_linker_script("newlib-time") - - if(CONFIG_NEWLIB_NANO_FORMAT) - # nano formatting functions in ROM are also built for 64-bit time_t. - rom_linker_script("newlib-nano") - endif() + if(CONFIG_NEWLIB_NANO_FORMAT) + # nano formatting functions in ROM are also built for 64-bit time_t. + rom_linker_script("newlib-nano") endif() elseif(target STREQUAL "esp32c6") @@ -254,17 +247,9 @@ else() # Regular app build rom_linker_script("wdt") endif() - - if(time_t_size EQUAL 8) - # The ROM functions listed in this linker script depend on sizeof(time_t). - # ESP32-C6 ROM was compiled for 64-bit time_t, only link these functions - # if the toolchain is also using 64-bit time_t. - rom_linker_script("newlib-time") - - if(NOT CONFIG_NEWLIB_NANO_FORMAT) - # Normal(Non-nano) formatting functions in ROM are also built for 64-bit time_t. - rom_linker_script("newlib-normal") - endif() + if(NOT CONFIG_NEWLIB_NANO_FORMAT) + # Normal(Non-nano) formatting functions in ROM are also built for 64-bit time_t. + rom_linker_script("newlib-normal") endif() elseif(target STREQUAL "esp32h2") @@ -279,16 +264,9 @@ else() # Regular app build rom_linker_script("spiflash") endif() - if(time_t_size EQUAL 8) - # The ROM functions listed in this linker script depend on sizeof(time_t). - # Since ROM for ESP32-H2 was compiled for 64-bit time_t, only link these functions - # if the toolchain is also using 64-bit time_t. - rom_linker_script("newlib-time") - - if(CONFIG_NEWLIB_NANO_FORMAT) - # nano formatting functions in ROM are also built for 64-bit time_t. - rom_linker_script("newlib-nano") - endif() + if(CONFIG_NEWLIB_NANO_FORMAT) + # nano formatting functions in ROM are also built for 64-bit time_t. + rom_linker_script("newlib-nano") endif() endif() diff --git a/components/esp_rom/esp32c2/ld/esp32c2.rom.newlib-time.ld b/components/esp_rom/esp32c2/ld/esp32c2.rom.newlib-time.ld deleted file mode 100644 index 1b945aae58..0000000000 --- a/components/esp_rom/esp32c2/ld/esp32c2.rom.newlib-time.ld +++ /dev/null @@ -1,16 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -/* These are the newlib functions and the .bss/.data symbols which are related to 'time_t' - or other structures which include 'time_t' (like 'struct stat'). - These ROM functions were compiled with sizeof(time_t) == 8. - When compiling with sizeof(time_t) == 4, these functions should be excluded from the build. - */ -asctime = 0x40000638; -asctime_r = 0x4000063c; -_isatty_r = 0x400004b4; -PROVIDE( __smakebuf_r = 0x400005a0 ); -PROVIDE( __swhatbuf_r = 0x400005a4 ); -PROVIDE( __swsetup_r = 0x400005b0 ); diff --git a/components/esp_rom/esp32c2/ld/esp32c2.rom.newlib.ld b/components/esp_rom/esp32c2/ld/esp32c2.rom.newlib.ld index 5a74bfacb6..e30c91d07d 100644 --- a/components/esp_rom/esp32c2/ld/esp32c2.rom.newlib.ld +++ b/components/esp_rom/esp32c2/ld/esp32c2.rom.newlib.ld @@ -30,6 +30,7 @@ strncmp = 0x400004a4; strlen = 0x400004a8; strstr = 0x400004ac; bzero = 0x400004b0; +_isatty_r = 0x400004b4; sbrk = 0x400004b8; isalnum = 0x400004bc; isalpha = 0x400004c0; @@ -88,8 +89,11 @@ fflush = 0x40000590; _fflush_r = 0x40000594; _fwalk = 0x40000598; _fwalk_reent = 0x4000059c; +__smakebuf_r = 0x400005a0; +__swhatbuf_r = 0x400005a4; __swbuf_r = 0x400005a8; __swbuf = 0x400005ac; +__swsetup_r = 0x400005b0; _strtod_l = 0x400005b4; _strtod_r = 0x400005b8; strtod_l = 0x400005bc; @@ -123,6 +127,8 @@ __ratio = 0x40000628; _mprec_log10 = 0x4000062c; __copybits = 0x40000630; __any_on = 0x40000634; +asctime = 0x40000638; +asctime_r = 0x4000063c; atof = 0x40000640; atoff = 0x40000644; _dtoa_r = 0x40000648; diff --git a/components/esp_rom/esp32c6/ld/esp32c6.rom.newlib-time.ld b/components/esp_rom/esp32c6/ld/esp32c6.rom.newlib-time.ld deleted file mode 100644 index 27734ced89..0000000000 --- a/components/esp_rom/esp32c6/ld/esp32c6.rom.newlib-time.ld +++ /dev/null @@ -1,15 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -/* These are the newlib functions and the .bss/.data symbols which are related to 'time_t' - or other structures which include 'time_t' (like 'struct stat'). - These ROM functions were compiled with sizeof(time_t) == 4. - When compiling with sizeof(time_t) == 8, these functions should be excluded from the build. - */ - -_isatty_r = 0x40000380; -PROVIDE( __smakebuf_r = 0x4000046c ); -PROVIDE( __swhatbuf_r = 0x40000470 ); -PROVIDE( __swsetup_r = 0x4000047c ); diff --git a/components/esp_rom/esp32h2/ld/esp32h2.rom.newlib-time.ld b/components/esp_rom/esp32h2/ld/esp32h2.rom.newlib-time.ld deleted file mode 100644 index 27734ced89..0000000000 --- a/components/esp_rom/esp32h2/ld/esp32h2.rom.newlib-time.ld +++ /dev/null @@ -1,15 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -/* These are the newlib functions and the .bss/.data symbols which are related to 'time_t' - or other structures which include 'time_t' (like 'struct stat'). - These ROM functions were compiled with sizeof(time_t) == 4. - When compiling with sizeof(time_t) == 8, these functions should be excluded from the build. - */ - -_isatty_r = 0x40000380; -PROVIDE( __smakebuf_r = 0x4000046c ); -PROVIDE( __swhatbuf_r = 0x40000470 ); -PROVIDE( __swsetup_r = 0x4000047c );