فهرست منبع

esp_rom: export newlib functions as strong symbols

Ivan Grokhotkov 6 سال پیش
والد
کامیت
e84b26f531

+ 2 - 1
components/bootloader/subproject/CMakeLists.txt

@@ -26,9 +26,10 @@ target_linker_script(bootloader.elf
 
 # as cmake won't attach linker args to a header-only library, attach
 # linker args directly to the bootloader.elf
+# esp32.rom.newlib-funcs.ld is included to use memset/memcpy.
 set(BOOTLOADER_LINKER_SCRIPTS
     "${IDF_PATH}/components/esp_rom/${IDF_TARGET}/ld/${IDF_TARGET}.rom.ld"
-    "${IDF_PATH}/components/esp_rom/${IDF_TARGET}/ld/${IDF_TARGET}.rom.spiram_incompatible_fns.ld"
+    "${IDF_PATH}/components/esp_rom/${IDF_TARGET}/ld/${IDF_TARGET}.rom.newlib-funcs.ld"
     "${IDF_PATH}/components/${IDF_TARGET}/ld/${IDF_TARGET}.peripherals.ld")
 
 target_linker_script(bootloader.elf ${BOOTLOADER_LINKER_SCRIPTS})

+ 1 - 1
components/bootloader/subproject/main/component.mk

@@ -9,7 +9,7 @@ LINKER_SCRIPTS := \
     $(IDF_TARGET).bootloader.ld \
     $(IDF_TARGET).bootloader.rom.ld \
     $(IDF_PATH)/components/esp_rom/$(IDF_TARGET)/ld/$(IDF_TARGET).rom.ld \
-    $(IDF_PATH)/components/esp_rom/$(IDF_TARGET)/ld/$(IDF_TARGET).rom.spiram_incompatible_fns.ld \
+    $(IDF_PATH)/components/esp_rom/$(IDF_TARGET)/ld/$(IDF_TARGET).rom.newlib-funcs.ld \
     $(IDF_PATH)/components/$(IDF_TARGET)/ld/$(IDF_TARGET).peripherals.ld
 
 ifndef CONFIG_SPI_FLASH_ROM_DRIVER_PATCH

+ 5 - 3
components/esp_rom/CMakeLists.txt

@@ -13,16 +13,18 @@ else()
 
     target_linker_script(${COMPONENT_TARGET}
                         "esp32/ld/esp32.rom.ld"
-                        "esp32/ld/esp32.rom.libgcc.ld")
+                        "esp32/ld/esp32.rom.libgcc.ld"
+                        "esp32/ld/esp32.rom.syscalls.ld"
+                        "esp32/ld/esp32.rom.newlib-data.ld")
 
     if(CONFIG_SPIRAM_CACHE_WORKAROUND)
         target_compile_options(${COMPONENT_TARGET} PUBLIC -mfix-esp32-psram-cache-issue)
     else()
-        target_linker_script(${COMPONENT_TARGET} "esp32/ld/esp32.rom.spiram_incompatible_fns.ld")
+        target_linker_script(${COMPONENT_TARGET} "esp32/ld/esp32.rom.newlib-funcs.ld")
     endif()
 
     if(CONFIG_NEWLIB_NANO_FORMAT)
-        target_linker_script(${COMPONENT_TARGET} "esp32/ld/esp32.rom.nanofmt.ld")
+        target_linker_script(${COMPONENT_TARGET} "esp32/ld/esp32.rom.newlib-nano.ld")
     endif()
 
     if(NOT CONFIG_SPI_FLASH_ROM_DRIVER_PATCH)

+ 6 - 3
components/esp_rom/component.mk

@@ -1,16 +1,19 @@
 #Linker scripts used to link the final application.
 #Warning: These linker scripts are only used when the normal app is compiled; the bootloader
 #specifies its own scripts.
-LINKER_SCRIPTS += esp32.rom.ld esp32.rom.libgcc.ld
+LINKER_SCRIPTS += esp32.rom.ld \
+                  esp32.rom.libgcc.ld \
+                  esp32.rom.syscalls.ld \
+                  esp32.rom.newlib-data.ld
 
 #SPI-RAM incompatible functions can be used in when the SPI RAM
 #workaround is not enabled.
 ifndef CONFIG_SPIRAM_CACHE_WORKAROUND
-LINKER_SCRIPTS += esp32.rom.spiram_incompatible_fns.ld
+LINKER_SCRIPTS += esp32.rom.newlib-funcs.ld
 endif
 
 ifdef CONFIG_NEWLIB_NANO_FORMAT
-LINKER_SCRIPTS += esp32.rom.nanofmt.ld
+LINKER_SCRIPTS += esp32.rom.newlib-nano.ld
 endif
 
 ifndef CONFIG_SPI_FLASH_ROM_DRIVER_PATCH

+ 0 - 28
components/esp_rom/esp32/ld/esp32.rom.ld

@@ -33,9 +33,7 @@ PROVIDE ( Cache_Read_Init_rom = 0x40009950 );
 PROVIDE ( cache_sram_mmu_set_rom = 0x400097f4 );
 /* This is static function, but can be used, not generated by script*/
 PROVIDE ( calc_rtc_memory_crc = 0x40008170 );
-PROVIDE ( calloc = 0x4000bee4 );
 PROVIDE ( __clear_cache = 0x40063860 );
-PROVIDE ( _close_r = 0x4000bd3c );
 PROVIDE ( co_default_bdaddr = 0x3ffae704 );
 PROVIDE ( co_null_bdaddr = 0x3ffb80e0 );
 PROVIDE ( co_sca2ppm = 0x3ff971e8 );
@@ -45,8 +43,6 @@ PROVIDE ( crc32_be = 0x4005d024 );
 PROVIDE ( crc32_le = 0x4005cfec );
 PROVIDE ( crc8_be = 0x4005d114 );
 PROVIDE ( crc8_le = 0x4005d0e0 );
-PROVIDE ( _ctype_ = 0x3ff96354 );
-PROVIDE ( __ctype_ptr__ = 0x3ff96350 );
 PROVIDE ( _data_end_rom = 0x4000d5c8 );
 PROVIDE ( _data_end_btdm_rom = 0x4000d4f8 );
 PROVIDE ( _data_start_rom = 0x4000d4f8 );
@@ -55,7 +51,6 @@ PROVIDE ( _data_start_btdm = 0x3ffae6e0);
 PROVIDE ( _data_end_btdm = 0x3ffaff10);
 PROVIDE ( _bss_start_btdm = 0x3ffb8000);
 PROVIDE ( _bss_end_btdm = 0x3ffbff70);
-PROVIDE ( _daylight = 0x3ffae0a4 );
 PROVIDE ( dbg_default_handler = 0x3ff97218 );
 PROVIDE ( dbg_default_state = 0x3ff97220 );
 PROVIDE ( dbg_state = 0x3ffb8d5d );
@@ -84,7 +79,6 @@ PROVIDE ( g_rom_spiflash_dummy_len_plus = 0x3ffae290 );
 PROVIDE ( ecc_env = 0x3ffb8d60 );
 PROVIDE ( ecc_Jacobian_InfinityPoint256 = 0x3ff972e8 );
 PROVIDE ( em_buf_env = 0x3ffb8d74 );
-PROVIDE ( environ = 0x3ffae0b4 );
 PROVIDE ( esp_crc8 = 0x4005d144 );
 PROVIDE ( _etext = 0x4000d66c );
 PROVIDE ( ets_readySet_ = 0x3ffe01f0 );
@@ -92,14 +86,9 @@ PROVIDE ( ets_startup_callback = 0x3ffe0404 );
 PROVIDE ( rwip_coex_cfg = 0x3ff9914c );
 PROVIDE ( rwip_priority = 0x3ff99159 );
 PROVIDE ( exc_cause_table = 0x3ff991d0 );
-PROVIDE ( _exit_r = 0x4000bd28 );
-PROVIDE ( free = 0x4000beb8 );
-PROVIDE ( _fstat_r = 0x4000bccc );
-PROVIDE ( __gcc_bcmp = 0x40064a70 );
 PROVIDE ( GF_Jacobian_Point_Addition256 = 0x400163a4 );
 PROVIDE ( GF_Jacobian_Point_Double256 = 0x40016260 );
 PROVIDE ( GF_Point_Jacobian_To_Affine256 = 0x40016b0c );
-PROVIDE ( _global_impure_ptr = 0x3ffae0b0 );
 PROVIDE ( g_phyFuns_instance = 0x3ffae0c4 );
 PROVIDE ( g_rom_flashchip = 0x3ffae270 );
 PROVIDE ( gTxMsg = 0x3ffe0050 );
@@ -140,7 +129,6 @@ PROVIDE ( ld_env = 0x3ffb9510 );
 PROVIDE ( ld_pcm_settings_dft = 0x3ff98a0c );
 PROVIDE ( ld_sched_params = 0x3ffb96c0 );
 PROVIDE ( ld_sync_train_channels = 0x3ff98a3c );
-PROVIDE ( _link_r = 0x4000bc9c );
 PROVIDE ( llc_default_handler = 0x3ff98b3c );
 PROVIDE ( llc_default_state_tab_p_get = 0x40046058 );
 PROVIDE ( llc_env = 0x3ffb96d0 );
@@ -184,12 +172,8 @@ PROVIDE ( lm_n_page_tab = 0x3ff990e8 );
 PROVIDE ( lmp_desc_tab = 0x3ff96e6c );
 PROVIDE ( lmp_ext_desc_tab = 0x3ff96d9c );
 PROVIDE ( lm_state = 0x3ffb9a1c );
-PROVIDE ( _lseek_r = 0x4000bd8c );
-PROVIDE ( malloc = 0x4000bea0 );
 PROVIDE ( maxSecretKey_256 = 0x3ff97448 );
-PROVIDE ( __mb_cur_max = 0x3ff96530 );
 PROVIDE ( mmu_init = 0x400095a4 );
-PROVIDE ( __month_lengths = 0x3ff9609c );
 PROVIDE ( MultiplyBigHexByUint32_256 = 0x40016214 );
 PROVIDE ( MultiplyBigHexModP256 = 0x400160b8 );
 PROVIDE ( MultiplyByU32ModP256 = 0x40015fdc );
@@ -199,7 +183,6 @@ PROVIDE ( mz_crc32 = 0x4005ee88 );
 PROVIDE ( mz_free = 0x4005eed4 );
 PROVIDE ( notEqual256 = 0x40015b04 );
 PROVIDE ( one_bits = 0x3ff971f8 );
-PROVIDE ( _open_r = 0x4000bd54 );
 PROVIDE ( phy_get_romfuncs = 0x40004100 );
 PROVIDE ( _Pri_4_HandlerAddress = 0x3ffe0648 );
 PROVIDE ( _Pri_5_HandlerAddress = 0x3ffe064c );
@@ -248,7 +231,6 @@ PROVIDE ( lm_n192_mod_add = 0x40011e9c );
 PROVIDE ( lm_n192_mod_sub = 0x40011eec );
 PROVIDE ( r_ea_alarm_clear = 0x40015ab4 );
 PROVIDE ( r_ea_alarm_set = 0x40015a10 );
-PROVIDE ( _read_r = 0x4000bda8 );
 PROVIDE ( r_ea_elt_cancel = 0x400150d0 );
 PROVIDE ( r_ea_elt_create = 0x40015264 );
 PROVIDE ( r_ea_elt_insert = 0x400152a8 );
@@ -262,7 +244,6 @@ PROVIDE ( r_ea_interval_insert = 0x4001557c );
 PROVIDE ( r_ea_interval_remove = 0x40015590 );
 PROVIDE ( ea_conflict_check = 0x40014e9c );
 PROVIDE ( ea_prog_timer = 0x40014f88 );
-PROVIDE ( realloc = 0x4000becc );
 PROVIDE ( r_ea_offset_req = 0x40015748 );
 PROVIDE ( r_ea_sleep_check = 0x40015928 );
 PROVIDE ( r_ea_sw_isr = 0x40015724 );
@@ -281,7 +262,6 @@ PROVIDE ( r_em_buf_rx_buff_addr_get = 0x400173e8 );
 PROVIDE ( r_em_buf_rx_free = 0x400173c4 );
 PROVIDE ( r_em_buf_tx_buff_addr_get = 0x40017404 );
 PROVIDE ( r_em_buf_tx_free = 0x4001741c );
-PROVIDE ( _rename_r = 0x4000bc28 );
 PROVIDE ( r_F1_256 = 0x400133e4 );
 PROVIDE ( r_F2_256 = 0x40013568 );
 PROVIDE ( r_F3_256 = 0x40013664 );
@@ -1290,9 +1270,6 @@ PROVIDE ( rwip_priority = 0x3ff99159 );
 PROVIDE ( rwip_rf = 0x3ffbdb28 );
 PROVIDE ( rwip_rf_p_get = 0x400558f4 );
 PROVIDE ( r_XorKey = 0x400112c0 );
-PROVIDE ( __sf_fake_stderr = 0x3ff96458 );
-PROVIDE ( __sf_fake_stdin = 0x3ff96498 );
-PROVIDE ( __sf_fake_stdout = 0x3ff96478 );
 PROVIDE ( sha_blk_bits = 0x3ff99290 );
 PROVIDE ( sha_blk_bits_bytes = 0x3ff99288 );
 PROVIDE ( sha_blk_hash_bytes = 0x3ff9928c );
@@ -1348,17 +1325,12 @@ PROVIDE ( tdefl_get_prev_return_status = 0x400608d0 );
 PROVIDE ( tdefl_init = 0x40060810 );
 PROVIDE ( tdefl_write_image_to_png_file_in_memory = 0x4006091c );
 PROVIDE ( tdefl_write_image_to_png_file_in_memory_ex = 0x40060910 );
-PROVIDE ( _timezone = 0x3ffae0a0 );
 PROVIDE ( tinfl_decompress = 0x4005ef30 );
 PROVIDE ( tinfl_decompress_mem_to_callback = 0x40060090 );
 PROVIDE ( tinfl_decompress_mem_to_mem = 0x40060050 );
-PROVIDE ( _tzname = 0x3ffae030 );
 PROVIDE ( UartDev = 0x3ffe019c );
-PROVIDE ( _unlink_r = 0x4000bc84 );
 PROVIDE ( user_code_start = 0x3ffe0400 );
 PROVIDE ( veryBigHexP256 = 0x3ff9736c );
-PROVIDE ( __wctomb = 0x3ff96540 );
-PROVIDE ( _write_r = 0x4000bd70 );
 PROVIDE ( xthal_bcopy = 0x4000c098 );
 PROVIDE ( xthal_copy123 = 0x4000c124 );
 PROVIDE ( xthal_get_ccompare = 0x4000c078 );

+ 7 - 0
components/esp_rom/esp32/ld/esp32.rom.libgcc.ld

@@ -1,3 +1,9 @@
+/* Unlike other ROM functions which are exported using PROVIDE, which declares
+   weak symbols, these libgcc functions are exported using assignment,
+   which declares strong symbols. This is done so that ROM functions are always
+   used instead of the ones provided by libgcc.a.
+*/
+
 __absvdi2 = 0x4006387c;
 __absvsi2 = 0x40063868;
 __adddf3 = 0x40002590;
@@ -41,6 +47,7 @@ __floatundidf = 0x4000c978;
 __floatundisf = 0x4000c8b0;
 __floatunsidf = 0x4000c938;
 __floatunsisf = 0x4000c864;
+__gcc_bcmp = 0x40064a70;
 __gedf2 = 0x40063768;
 __gesf2 = 0x4006340c;
 __gtdf2 = 0x400636dc;

+ 0 - 100
components/esp_rom/esp32/ld/esp32.rom.nanofmt.ld

@@ -1,100 +0,0 @@
-/*
-	Address table for printf/scanf family of functions in ESP32 ROM.
-	These functions are compiled with newlib "nano" format option.
-	As such, they don's support 64-bit integer formats.
-	Floating point formats are supported by setting _printf_float and
-	_scanf_float entries in syscall table. This is done automatically
-	by startup code.
-
-	Generated for ROM with MD5sum:
-	ab8282ae908fe9e7a63fb2a4ac2df013  eagle.pro.rom.out
-*/
-
-PROVIDE ( asiprintf = 0x40056d9c );
-PROVIDE ( _asiprintf_r = 0x40056d4c );
-PROVIDE ( asniprintf = 0x40056cd8 );
-PROVIDE ( _asniprintf_r = 0x40056c64 );
-PROVIDE ( asnprintf = 0x40056cd8 );
-PROVIDE ( _asnprintf_r = 0x40056c64 );
-PROVIDE ( asprintf = 0x40056d9c );
-PROVIDE ( _asprintf_r = 0x40056d4c );
-PROVIDE ( fiprintf = 0x40056efc );
-PROVIDE ( _fiprintf_r = 0x40056ed8 );
-PROVIDE ( fiscanf = 0x40058884 );
-PROVIDE ( _fiscanf_r = 0x400588b4 );
-PROVIDE ( fprintf = 0x40056efc );
-PROVIDE ( _fprintf_r = 0x40056ed8 );
-PROVIDE ( iprintf = 0x40056978 );
-PROVIDE ( _iprintf_r = 0x40056944 );
-PROVIDE ( printf = 0x40056978 );
-PROVIDE ( _printf_common = 0x40057338 );
-PROVIDE ( _printf_float = 0x4000befc );
-PROVIDE ( _printf_i = 0x40057404 );
-PROVIDE ( _printf_r = 0x40056944 );
-PROVIDE ( siprintf = 0x40056c08 );
-PROVIDE ( _siprintf_r = 0x40056bbc );
-PROVIDE ( sniprintf = 0x40056b4c );
-PROVIDE ( _sniprintf_r = 0x40056ae4 );
-PROVIDE ( snprintf = 0x40056b4c );
-PROVIDE ( _snprintf_r = 0x40056ae4 );
-PROVIDE ( sprintf = 0x40056c08 );
-PROVIDE ( _sprintf_r = 0x40056bbc );
-PROVIDE ( __sprint_r = 0x400577e4 );
-PROVIDE ( _svfiprintf_r = 0x40057100 );
-PROVIDE ( __svfiscanf_r = 0x40057b08 );
-PROVIDE ( _svfprintf_r = 0x40057100 );
-PROVIDE ( __svfscanf = 0x40057f04 );
-PROVIDE ( __svfscanf_r = 0x40057b08 );
-PROVIDE ( vasiprintf = 0x40056eb8 );
-PROVIDE ( _vasiprintf_r = 0x40056e80 );
-PROVIDE ( vasniprintf = 0x40056e58 );
-PROVIDE ( _vasniprintf_r = 0x40056df8 );
-PROVIDE ( vasnprintf = 0x40056e58 );
-PROVIDE ( _vasnprintf_r = 0x40056df8 );
-PROVIDE ( vasprintf = 0x40056eb8 );
-PROVIDE ( _vasprintf_r = 0x40056e80 );
-PROVIDE ( vfiprintf = 0x40057ae8 );
-PROVIDE ( _vfiprintf_r = 0x40057850 );
-PROVIDE ( vfiscanf = 0x40057eb8 );
-PROVIDE ( _vfiscanf_r = 0x40057f24 );
-PROVIDE ( vfprintf = 0x40057ae8 );
-PROVIDE ( _vfprintf_r = 0x40057850 );
-PROVIDE ( vfscanf = 0x40057eb8 );
-PROVIDE ( _vfscanf_r = 0x40057f24 );
-PROVIDE ( viprintf = 0x400569b4 );
-PROVIDE ( _viprintf_r = 0x400569e4 );
-PROVIDE ( viscanf = 0x40058698 );
-PROVIDE ( _viscanf_r = 0x400586c8 );
-PROVIDE ( vprintf = 0x400569b4 );
-PROVIDE ( _vprintf_r = 0x400569e4 );
-PROVIDE ( vscanf = 0x40058698 );
-PROVIDE ( _vscanf_r = 0x400586c8 );
-PROVIDE ( vsiprintf = 0x40056ac4 );
-PROVIDE ( _vsiprintf_r = 0x40056a90 );
-PROVIDE ( vsiscanf = 0x40058740 );
-PROVIDE ( _vsiscanf_r = 0x400586f8 );
-PROVIDE ( vsniprintf = 0x40056a68 );
-PROVIDE ( _vsniprintf_r = 0x40056a14 );
-PROVIDE ( vsnprintf = 0x40056a68 );
-PROVIDE ( _vsnprintf_r = 0x40056a14 );
-PROVIDE ( vsprintf = 0x40056ac4 );
-PROVIDE ( _vsprintf_r = 0x40056a90 );
-PROVIDE ( vsscanf = 0x40058740 );
-PROVIDE ( _vsscanf_r = 0x400586f8 );
-PROVIDE ( fscanf = 0x40058884 );
-PROVIDE ( _fscanf_r = 0x400588b4 );
-PROVIDE ( iscanf = 0x40058760 );
-PROVIDE ( _iscanf_r = 0x4005879c );
-PROVIDE ( scanf = 0x40058760 );
-PROVIDE ( _scanf_chars = 0x40058384 );
-PROVIDE ( _scanf_float = 0x4000bf18 );
-PROVIDE ( _scanf_i = 0x4005845c );
-PROVIDE ( _scanf_r = 0x4005879c );
-PROVIDE ( siscanf = 0x400587d0 );
-PROVIDE ( _siscanf_r = 0x40058830 );
-PROVIDE ( sscanf = 0x400587d0 );
-PROVIDE ( _sscanf_r = 0x40058830 );
-PROVIDE ( __ssvfiscanf_r = 0x4005802c );
-PROVIDE ( __ssvfscanf_r = 0x4005802c );
-
-

+ 23 - 0
components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld

@@ -0,0 +1,23 @@
+/* These are the .bss/.data symbols used by newlib functions present in ESP32 ROM.
+   See also esp32.rom.newlib-funcs.ld for the list of general newlib functions,
+   and esp32.rom.newlib-nano.ld for "nano" versions of printf/scanf family of functions.
+
+   Unlike other ROM functions and data which are exported using PROVIDE, which declares
+   weak symbols, newlib related functions are exported using assignment,
+   which declares strong symbols. This is done so that ROM functions are always
+   used instead of the ones provided by libc.a.
+ */
+
+_ctype_ = 0x3ff96354;
+__ctype_ptr__ = 0x3ff96350;
+_daylight = 0x3ffae0a4;
+environ = 0x3ffae0b4;
+_global_impure_ptr = 0x3ffae0b0;
+__mb_cur_max = 0x3ff96530;
+__month_lengths = 0x3ff9609c;
+__sf_fake_stderr = 0x3ff96458;
+__sf_fake_stdin = 0x3ff96498;
+__sf_fake_stdout = 0x3ff96478;
+_timezone = 0x3ffae0a0;
+_tzname = 0x3ffae030;
+__wctomb = 0x3ff96540;

+ 160 - 0
components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld

@@ -0,0 +1,160 @@
+/* These are the newlib functions present in ESP32 ROM.
+   They should not be used when compiling with PSRAM cache workaround enabled.
+   See also esp32.rom.newlib-data.ld for the list of .data/.bss symbols
+   used by these functions, and esp32.rom.newlib-nano.ld for "nano" versions
+   of printf/scanf family of functions.
+
+   Unlike other ROM functions which are exported using PROVIDE, which declares
+   weak symbols, newlib related functions are exported using assignment,
+   which declares strong symbols. This is done so that ROM functions are always
+   used instead of the ones provided by libc.a.
+ */
+
+abs = 0x40056340;
+__ascii_wctomb = 0x40058ef0;
+asctime = 0x40059588;
+asctime_r = 0x40000ec8;
+atoi = 0x400566c4;
+_atoi_r = 0x400566d4;
+atol = 0x400566ec;
+_atol_r = 0x400566fc;
+bzero = 0x4000c1f4;
+_cleanup = 0x40001df8;
+_cleanup_r = 0x40001d48;
+creat = 0x40000e8c;
+ctime = 0x400595b0;
+ctime_r = 0x400595c4;
+div = 0x40056348;
+__dummy_lock = 0x4000c728;
+__dummy_lock_try = 0x4000c730;
+__env_lock = 0x40001fd4;
+__env_unlock = 0x40001fe0;
+fclose = 0x400020ac;
+_fclose_r = 0x40001fec;
+fflush = 0x40059394;
+_fflush_r = 0x40059320;
+_findenv_r = 0x40001f44;
+__fp_lock_all = 0x40001f1c;
+__fp_unlock_all = 0x40001f30;
+__fputwc = 0x40058da0;
+fputwc = 0x40058ea8;
+_fputwc_r = 0x40058e4c;
+_fwalk = 0x4000c738;
+_fwalk_reent = 0x4000c770;
+__get_current_time_locale = 0x40001834;
+_getenv_r = 0x40001fbc;
+__gettzinfo = 0x40001fcc;
+gmtime = 0x40059848;
+gmtime_r = 0x40059868;
+isalnum = 0x40000f04;
+isalpha = 0x40000f18;
+isascii = 0x4000c20c;
+_isatty_r = 0x40000ea0;
+isblank = 0x40000f2c;
+iscntrl = 0x40000f50;
+isdigit = 0x40000f64;
+isgraph = 0x40000f94;
+islower = 0x40000f78;
+isprint = 0x40000fa8;
+ispunct = 0x40000fc0;
+isspace = 0x40000fd4;
+isupper = 0x40000fe8;
+__itoa = 0x40056678;
+itoa = 0x400566b4;
+labs = 0x40056370;
+ldiv = 0x40056378;
+__locale_charset = 0x40059540;
+__locale_cjk_lang = 0x40059558;
+localeconv = 0x4005957c;
+_localeconv_r = 0x40059560;
+__locale_mb_cur_max = 0x40059548;
+__locale_msgcharset = 0x40059550;
+localtime = 0x400595dc;
+localtime_r = 0x400595fc;
+longjmp = 0x400562cc;
+memccpy = 0x4000c220;
+memchr = 0x4000c244;
+memcmp = 0x4000c260;
+memcpy = 0x4000c2c8;
+memmove = 0x4000c3c0;
+memrchr = 0x4000c400;
+memset = 0x4000c44c;
+mktime = 0x4005a5e8;
+qsort = 0x40056424;
+rand = 0x40001058;
+rand_r = 0x400010d4;
+__sccl = 0x4000c498;
+__sclose = 0x400011b8;
+__seofread = 0x40001148;
+setjmp = 0x40056268;
+setlocale = 0x40059568;
+_setlocale_r = 0x4005950c;
+__sflush_r = 0x400591e0;
+__sfmoreglue = 0x40001dc8;
+__sfp = 0x40001e90;
+__sfp_lock_acquire = 0x40001e08;
+__sfp_lock_release = 0x40001e14;
+__sfvwrite_r = 0x4005893c;
+__sinit = 0x40001e38;
+__sinit_lock_acquire = 0x40001e20;
+__sinit_lock_release = 0x40001e2c;
+__smakebuf_r = 0x40059108;
+srand = 0x40001004;
+__sread = 0x40001118;
+__srefill_r = 0x400593d4;
+__sseek = 0x40001184;
+strcasecmp = 0x400011cc;
+strcasestr = 0x40001210;
+strcat = 0x4000c518;
+strchr = 0x4000c53c;
+strcmp = 0x40001274;
+strcoll = 0x40001398;
+strcpy = 0x400013ac;
+strcspn = 0x4000c558;
+strdup = 0x4000143c;
+_strdup_r = 0x40001450;
+strftime = 0x40059ab4;
+strlcat = 0x40001470;
+strlcpy = 0x4000c584;
+strlen = 0x400014c0;
+strlwr = 0x40001524;
+strncasecmp = 0x40001550;
+strncat = 0x4000c5c4;
+strncmp = 0x4000c5f4;
+strncpy = 0x400015d4;
+strndup = 0x400016b0;
+_strndup_r = 0x400016c4;
+strnlen = 0x4000c628;
+strrchr = 0x40001708;
+strsep = 0x40001734;
+strspn = 0x4000c648;
+strstr = 0x4000c674;
+__strtok_r = 0x4000c6a8;
+strtok_r = 0x4000c70c;
+strtol = 0x4005681c;
+_strtol_r = 0x40056714;
+strtoul = 0x4005692c;
+_strtoul_r = 0x40056834;
+strupr = 0x4000174c;
+__submore = 0x40058f3c;
+__swbuf = 0x40058cb4;
+__swbuf_r = 0x40058bec;
+__swrite = 0x40001150;
+__swsetup_r = 0x40058cc8;
+time = 0x40001844;
+__time_load_locale = 0x4000183c;
+toascii = 0x4000c720;
+tolower = 0x40001868;
+toupper = 0x40001884;
+__tzcalc_limits = 0x400018a0;
+__tz_lock = 0x40001a04;
+tzset = 0x40001a1c;
+_tzset_r = 0x40001a28;
+__tz_unlock = 0x40001a10;
+ungetc = 0x400590f4;
+_ungetc_r = 0x40058fa0;
+__utoa = 0x400561f0;
+utoa = 0x40056258;
+wcrtomb = 0x40058920;
+_wcrtomb_r = 0x400588d8;
+_wctomb_r = 0x40058f14;

+ 115 - 0
components/esp_rom/esp32/ld/esp32.rom.newlib-nano.ld

@@ -0,0 +1,115 @@
+/* These are the printf/scanf related newlib functions present in ESP32 ROM.
+   These functions are compiled with newlib "nano" format option.
+   As such, they don's support 64-bit integer formats.
+   Floating point formats are supported by setting _printf_float and
+   _scanf_float entries in syscall table. This is done automatically
+   by startup code.
+   These functions should not be used when compiling with PSRAM cache workaround enabled.
+   See also esp32.rom.newlib-data.ld for the list of .data/.bss symbols
+   used by newlib functions, and esp32.rom.newlib-funcs.ld for the list
+   of general newlib functions.
+
+   Unlike other ROM functions which are exported using PROVIDE, which declares
+   weak symbols, newlib related functions are exported using assignment,
+   which declares strong symbols. This is done so that ROM functions are always
+   used instead of the ones provided by libc.a.
+ */
+
+asiprintf = 0x40056d9c;
+_asiprintf_r = 0x40056d4c;
+asniprintf = 0x40056cd8;
+_asniprintf_r = 0x40056c64;
+asnprintf = 0x40056cd8;
+_asnprintf_r = 0x40056c64;
+asprintf = 0x40056d9c;
+_asprintf_r = 0x40056d4c;
+fiprintf = 0x40056efc;
+_fiprintf_r = 0x40056ed8;
+fiscanf = 0x40058884;
+_fiscanf_r = 0x400588b4;
+fprintf = 0x40056efc;
+_fprintf_r = 0x40056ed8;
+fscanf = 0x40058884;
+_fscanf_r = 0x400588b4;
+iprintf = 0x40056978;
+_iprintf_r = 0x40056944;
+iscanf = 0x40058760;
+_iscanf_r = 0x4005879c;
+printf = 0x40056978;
+_printf_common = 0x40057338;
+_printf_i = 0x40057404;
+_printf_r = 0x40056944;
+scanf = 0x40058760;
+_scanf_chars = 0x40058384;
+_scanf_i = 0x4005845c;
+_scanf_r = 0x4005879c;
+__sfputs_r = 0x40057790;
+siprintf = 0x40056c08;
+_siprintf_r = 0x40056bbc;
+siscanf = 0x400587d0;
+_siscanf_r = 0x40058830;
+sniprintf = 0x40056b4c;
+_sniprintf_r = 0x40056ae4;
+snprintf = 0x40056b4c;
+_snprintf_r = 0x40056ae4;
+sprintf = 0x40056c08;
+_sprintf_r = 0x40056bbc;
+__sprint_r = 0x400577e4;
+sscanf = 0x400587d0;
+_sscanf_r = 0x40058830;
+__ssprint_r = 0x40056ff8;
+__ssputs_r = 0x40056f2c;
+__ssrefill_r = 0x40057fec;
+__ssvfiscanf_r = 0x4005802c;
+__ssvfscanf_r = 0x4005802c;
+_sungetc_r = 0x40057f6c;
+_svfiprintf_r = 0x40057100;
+__svfiscanf_r = 0x40057b08;
+_svfprintf_r = 0x40057100;
+__svfscanf = 0x40057f04;
+__svfscanf_r = 0x40057b08;
+vasiprintf = 0x40056eb8;
+_vasiprintf_r = 0x40056e80;
+vasniprintf = 0x40056e58;
+_vasniprintf_r = 0x40056df8;
+vasnprintf = 0x40056e58;
+_vasnprintf_r = 0x40056df8;
+vasprintf = 0x40056eb8;
+_vasprintf_r = 0x40056e80;
+vfiprintf = 0x40057ae8;
+_vfiprintf_r = 0x40057850;
+vfiscanf = 0x40057eb8;
+_vfiscanf_r = 0x40057f24;
+vfprintf = 0x40057ae8;
+_vfprintf_r = 0x40057850;
+vfscanf = 0x40057eb8;
+_vfscanf_r = 0x40057f24;
+viprintf = 0x400569b4;
+_viprintf_r = 0x400569e4;
+viscanf = 0x40058698;
+_viscanf_r = 0x400586c8;
+vprintf = 0x400569b4;
+_vprintf_r = 0x400569e4;
+vscanf = 0x40058698;
+_vscanf_r = 0x400586c8;
+vsiprintf = 0x40056ac4;
+_vsiprintf_r = 0x40056a90;
+vsiscanf = 0x40058740;
+_vsiscanf_r = 0x400586f8;
+vsniprintf = 0x40056a68;
+_vsniprintf_r = 0x40056a14;
+vsnprintf = 0x40056a68;
+_vsnprintf_r = 0x40056a14;
+vsprintf = 0x40056ac4;
+_vsprintf_r = 0x40056a90;
+vsscanf = 0x40058740;
+_vsscanf_r = 0x400586f8;
+
+/* _print_float and _scanf_float functions in ROM are stubs which call
+   real implementations in IDF through the syscall table.
+   As such, don't include these ROM symbols.
+
+_printf_float = 0x4000befc;
+_scanf_float = 0x4000bf18;
+
+*/

+ 1 - 22
components/esp_rom/esp32/ld/esp32.rom.redefined.ld

@@ -3,7 +3,7 @@
    and different definitions for functions with the same names are provided.
    This file is not used when linking ESP-IDF and is intended for reference only
 */
-  
+
 PROVIDE ( abort = 0x4000bba4 );
 PROVIDE ( aes_128_cbc_decrypt = 0x4005cc7c );
 PROVIDE ( aes_128_cbc_encrypt = 0x4005cc18 );
@@ -19,42 +19,21 @@ PROVIDE ( ets_timer_done = 0x40008428 );
 PROVIDE ( ets_timer_init = 0x400084e8 );
 PROVIDE ( ets_timer_handler_isr = 0x40008454 );
 PROVIDE ( ets_timer_setfn = 0x40008350 );
-PROVIDE ( _free_r = 0x4000bbcc );
-PROVIDE ( _getpid_r = 0x4000bcfc );
-PROVIDE ( __getreent = 0x4000be8c );
-PROVIDE ( _gettimeofday_r = 0x4000bc58 );
 PROVIDE ( hmac_md5 = 0x4005d264 );
 PROVIDE ( hmac_md5_vector = 0x4005d17c );
 PROVIDE ( hmac_sha1 = 0x40060acc );
 PROVIDE ( hmac_sha1_vector = 0x400609e4 );
 PROVIDE ( hmac_sha256 = 0x40060d58 );
 PROVIDE ( hmac_sha256_vector = 0x40060c84 );
-PROVIDE ( _kill_r = 0x4000bd10 );
-PROVIDE ( _lock_acquire = 0x4000be14 );
-PROVIDE ( _lock_acquire_recursive = 0x4000be28 );
-PROVIDE ( _lock_close = 0x4000bdec );
-PROVIDE ( _lock_close_recursive = 0x4000be00 );
-PROVIDE ( _lock_init = 0x4000bdc4 );
-PROVIDE ( _lock_init_recursive = 0x4000bdd8 );
-PROVIDE ( _lock_release = 0x4000be64 );
-PROVIDE ( _lock_release_recursive = 0x4000be78 );
-PROVIDE ( _lock_try_acquire = 0x4000be3c );
-PROVIDE ( _lock_try_acquire_recursive = 0x4000be50 );
-PROVIDE ( _malloc_r = 0x4000bbb4 );
 PROVIDE ( MD5Final = 0x4005db1c );
 PROVIDE ( MD5Init = 0x4005da7c );
 PROVIDE ( MD5Update = 0x4005da9c );
 PROVIDE ( md5_vector = 0x4005db80 );
 PROVIDE ( pbkdf2_sha1 = 0x40060ba4 );
 PROVIDE ( rc4_skip = 0x40060928 );
-PROVIDE ( _raise_r = 0x4000bc70 );
-PROVIDE ( _realloc_r = 0x4000bbe0 );
-PROVIDE ( _sbrk_r = 0x4000bce4 );
 PROVIDE ( sha1_prf = 0x40060ae8 );
 PROVIDE ( sha1_vector = 0x40060b64 );
 PROVIDE ( sha256_prf = 0x40060d70 );
 PROVIDE ( sha256_vector = 0x40060e08 );
-PROVIDE ( _system_r = 0x4000bc10 );
-PROVIDE ( _times_r = 0x4000bc40 );
 PROVIDE ( uart_tx_wait_idle = 0x40009278 );
 

+ 0 - 163
components/esp_rom/esp32/ld/esp32.rom.spiram_incompatible_fns.ld

@@ -1,163 +0,0 @@
-/*
- If the spiram compiler workaround is active, these functions from ROM cannot be used. If the workaround is not
- active (e.g. because the system does not use SPI RAM) then these functions are okay to use.
-*/
-PROVIDE ( abs = 0x40056340 );
-PROVIDE ( __ascii_wctomb = 0x40058ef0 );
-PROVIDE ( asctime = 0x40059588 );
-PROVIDE ( asctime_r = 0x40000ec8 );
-PROVIDE ( atoi = 0x400566c4 );
-PROVIDE ( _atoi_r = 0x400566d4 );
-PROVIDE ( atol = 0x400566ec );
-PROVIDE ( _atol_r = 0x400566fc );
-PROVIDE ( bzero = 0x4000c1f4 );
-PROVIDE ( _cleanup = 0x40001df8 );
-PROVIDE ( _cleanup_r = 0x40001d48 );
-PROVIDE ( close = 0x40001778 );
-PROVIDE ( creat = 0x40000e8c );
-PROVIDE ( ctime = 0x400595b0 );
-PROVIDE ( ctime_r = 0x400595c4 );
-PROVIDE ( div = 0x40056348 );
-PROVIDE ( __dummy_lock = 0x4000c728 );
-PROVIDE ( __dummy_lock_try = 0x4000c730 );
-PROVIDE ( __env_lock = 0x40001fd4 );
-PROVIDE ( __env_unlock = 0x40001fe0 );
-PROVIDE ( fclose = 0x400020ac );
-PROVIDE ( _fclose_r = 0x40001fec );
-PROVIDE ( fflush = 0x40059394 );
-PROVIDE ( _fflush_r = 0x40059320 );
-PROVIDE ( _findenv_r = 0x40001f44 );
-PROVIDE ( __fp_lock_all = 0x40001f1c );
-PROVIDE ( __fp_unlock_all = 0x40001f30 );
-PROVIDE ( fputwc = 0x40058ea8 );
-PROVIDE ( __fputwc = 0x40058da0 );
-PROVIDE ( _fputwc_r = 0x40058e4c );
-PROVIDE ( _fwalk = 0x4000c738 );
-PROVIDE ( _fwalk_reent = 0x4000c770 );
-PROVIDE ( __get_current_time_locale = 0x40001834 );
-PROVIDE ( _getenv_r = 0x40001fbc );
-PROVIDE ( __gettzinfo = 0x40001fcc );
-PROVIDE ( gmtime = 0x40059848 );
-PROVIDE ( gmtime_r = 0x40059868 );
-PROVIDE ( isalnum = 0x40000f04 );
-PROVIDE ( isalpha = 0x40000f18 );
-PROVIDE ( isascii = 0x4000c20c );
-PROVIDE ( _isatty_r = 0x40000ea0 );
-PROVIDE ( isblank = 0x40000f2c );
-PROVIDE ( iscntrl = 0x40000f50 );
-PROVIDE ( isdigit = 0x40000f64 );
-PROVIDE ( isgraph = 0x40000f94 );
-PROVIDE ( islower = 0x40000f78 );
-PROVIDE ( isprint = 0x40000fa8 );
-PROVIDE ( ispunct = 0x40000fc0 );
-PROVIDE ( isspace = 0x40000fd4 );
-PROVIDE ( isupper = 0x40000fe8 );
-PROVIDE ( itoa = 0x400566b4 );
-PROVIDE ( __itoa = 0x40056678 );
-PROVIDE ( labs = 0x40056370 );
-PROVIDE ( ldiv = 0x40056378 );
-PROVIDE ( __locale_charset = 0x40059540 );
-PROVIDE ( __locale_cjk_lang = 0x40059558 );
-PROVIDE ( localeconv = 0x4005957c );
-PROVIDE ( _localeconv_r = 0x40059560 );
-PROVIDE ( __locale_mb_cur_max = 0x40059548 );
-PROVIDE ( __locale_msgcharset = 0x40059550 );
-PROVIDE ( localtime = 0x400595dc );
-PROVIDE ( localtime_r = 0x400595fc );
-PROVIDE ( longjmp = 0x400562cc );
-PROVIDE ( memccpy = 0x4000c220 );
-PROVIDE ( memchr = 0x4000c244 );
-PROVIDE ( memcmp = 0x4000c260 );
-PROVIDE ( memcpy = 0x4000c2c8 );
-PROVIDE ( memmove = 0x4000c3c0 );
-PROVIDE ( memrchr = 0x4000c400 );
-PROVIDE ( memset = 0x4000c44c );
-PROVIDE ( mktime = 0x4005a5e8 );
-PROVIDE ( open = 0x4000178c );
-PROVIDE ( qsort = 0x40056424 );
-PROVIDE ( rand = 0x40001058 );
-PROVIDE ( rand_r = 0x400010d4 );
-PROVIDE ( read = 0x400017dc );
-PROVIDE ( sbrk = 0x400017f4 );
-PROVIDE ( __sccl = 0x4000c498 );
-PROVIDE ( __sclose = 0x400011b8 );
-PROVIDE ( __seofread = 0x40001148 );
-PROVIDE ( setjmp = 0x40056268 );
-PROVIDE ( setlocale = 0x40059568 );
-PROVIDE ( _setlocale_r = 0x4005950c );
-PROVIDE ( __sflush_r = 0x400591e0 );
-PROVIDE ( __sfmoreglue = 0x40001dc8 );
-PROVIDE ( __sfp = 0x40001e90 );
-PROVIDE ( __sfp_lock_acquire = 0x40001e08 );
-PROVIDE ( __sfp_lock_release = 0x40001e14 );
-PROVIDE ( __sfputs_r = 0x40057790 );
-PROVIDE ( __sfvwrite_r = 0x4005893c );
-PROVIDE ( __sinit = 0x40001e38 );
-PROVIDE ( __sinit_lock_acquire = 0x40001e20 );
-PROVIDE ( __sinit_lock_release = 0x40001e2c );
-PROVIDE ( __smakebuf_r = 0x40059108 );
-PROVIDE ( srand = 0x40001004 );
-PROVIDE ( __sread = 0x40001118 );
-PROVIDE ( __srefill_r = 0x400593d4 );
-PROVIDE ( __sseek = 0x40001184 );
-PROVIDE ( __ssprint_r = 0x40056ff8 );
-PROVIDE ( __ssputs_r = 0x40056f2c );
-PROVIDE ( __ssrefill_r = 0x40057fec );
-PROVIDE ( strcasecmp = 0x400011cc );
-PROVIDE ( strcasestr = 0x40001210 );
-PROVIDE ( strcat = 0x4000c518 );
-PROVIDE ( strchr = 0x4000c53c );
-PROVIDE ( strcmp = 0x40001274 );
-PROVIDE ( strcoll = 0x40001398 );
-PROVIDE ( strcpy = 0x400013ac );
-PROVIDE ( strcspn = 0x4000c558 );
-PROVIDE ( strdup = 0x4000143c );
-PROVIDE ( _strdup_r = 0x40001450 );
-PROVIDE ( strftime = 0x40059ab4 );
-PROVIDE ( strlcat = 0x40001470 );
-PROVIDE ( strlcpy = 0x4000c584 );
-PROVIDE ( strlen = 0x400014c0 );
-PROVIDE ( strlwr = 0x40001524 );
-PROVIDE ( strncasecmp = 0x40001550 );
-PROVIDE ( strncat = 0x4000c5c4 );
-PROVIDE ( strncmp = 0x4000c5f4 );
-PROVIDE ( strncpy = 0x400015d4 );
-PROVIDE ( strndup = 0x400016b0 );
-PROVIDE ( _strndup_r = 0x400016c4 );
-PROVIDE ( strnlen = 0x4000c628 );
-PROVIDE ( strrchr = 0x40001708 );
-PROVIDE ( strsep = 0x40001734 );
-PROVIDE ( strspn = 0x4000c648 );
-PROVIDE ( strstr = 0x4000c674 );
-PROVIDE ( __strtok_r = 0x4000c6a8 );
-PROVIDE ( strtok_r = 0x4000c70c );
-PROVIDE ( strtol = 0x4005681c );
-PROVIDE ( _strtol_r = 0x40056714 );
-PROVIDE ( strtoul = 0x4005692c );
-PROVIDE ( _strtoul_r = 0x40056834 );
-PROVIDE ( strupr = 0x4000174c );
-PROVIDE ( __submore = 0x40058f3c );
-PROVIDE ( _sungetc_r = 0x40057f6c );
-PROVIDE ( __swbuf = 0x40058cb4 );
-PROVIDE ( __swbuf_r = 0x40058bec );
-PROVIDE ( __swrite = 0x40001150 );
-PROVIDE ( __swsetup_r = 0x40058cc8 );
-PROVIDE ( time = 0x40001844 );
-PROVIDE ( __time_load_locale = 0x4000183c );
-PROVIDE ( times = 0x40001808 );
-PROVIDE ( toascii = 0x4000c720 );
-PROVIDE ( tolower = 0x40001868 );
-PROVIDE ( toupper = 0x40001884 );
-PROVIDE ( __tzcalc_limits = 0x400018a0 );
-PROVIDE ( __tz_lock = 0x40001a04 );
-PROVIDE ( tzset = 0x40001a1c );
-PROVIDE ( _tzset_r = 0x40001a28 );
-PROVIDE ( __tz_unlock = 0x40001a10 );
-PROVIDE ( ungetc = 0x400590f4 );
-PROVIDE ( _ungetc_r = 0x40058fa0 );
-PROVIDE ( utoa = 0x40056258 );
-PROVIDE ( __utoa = 0x400561f0 );
-PROVIDE ( wcrtomb = 0x40058920 );
-PROVIDE ( _wcrtomb_r = 0x400588d8 );
-PROVIDE ( _wctomb_r = 0x40058f14 );
-PROVIDE ( write = 0x4000181c );

+ 79 - 0
components/esp_rom/esp32/ld/esp32.rom.syscalls.ld

@@ -0,0 +1,79 @@
+/* These ROM functions call respective entries in syscall table.
+   IDF implementations of these function carry different names
+   (usually esp_vfs_*) so we still export these functions,
+   in case some newlib function needs to call them.
+
+   I.e.:
+
+   open (in ROM) -> _open_r (in ROM) -> syscall table entry _open_r -> esp_vfs_open (in IDF)
+
+ */
+
+PROVIDE ( _close_r = 0x4000bd3c );
+PROVIDE ( _exit_r = 0x4000bd28 );
+PROVIDE ( _fstat_r = 0x4000bccc );
+PROVIDE ( _link_r = 0x4000bc9c );
+PROVIDE ( _lseek_r = 0x4000bd8c );
+PROVIDE ( _open_r = 0x4000bd54 );
+PROVIDE ( _read_r = 0x4000bda8 );
+PROVIDE ( _rename_r = 0x4000bc28 );
+PROVIDE ( _unlink_r = 0x4000bc84 );
+PROVIDE ( _write_r = 0x4000bd70 );
+
+
+/* These ROM functions call respective entries in the syscall table.
+   They are called by other ROM functions (mostly from newlib).
+   We don't link to them directly, since in IDF there are actual
+   implementations of these functions, with same names.
+
+   I.e.:
+
+   free (in ROM) -> _free_r (in ROM) -> syscall table entry _free_r -> _free_r (in IDF)
+
+   Hence the following entries are provided only for reference
+   and commented out.
+ */  
+
+/*   <--- the following lines are commented out
+
+PROVIDE ( _free_r = 0x4000bbcc );
+PROVIDE ( _getpid_r = 0x4000bcfc );
+PROVIDE ( __getreent = 0x4000be8c );
+PROVIDE ( _gettimeofday_r = 0x4000bc58 );
+PROVIDE ( _kill_r = 0x4000bd10 );
+PROVIDE ( _lock_acquire = 0x4000be14 );
+PROVIDE ( _lock_acquire_recursive = 0x4000be28 );
+PROVIDE ( _lock_close = 0x4000bdec );
+PROVIDE ( _lock_close_recursive = 0x4000be00 );
+PROVIDE ( _lock_init = 0x4000bdc4 );
+PROVIDE ( _lock_init_recursive = 0x4000bdd8 );
+PROVIDE ( _lock_release = 0x4000be64 );
+PROVIDE ( _lock_release_recursive = 0x4000be78 );
+PROVIDE ( _lock_try_acquire = 0x4000be3c );
+PROVIDE ( _lock_try_acquire_recursive = 0x4000be50 );
+PROVIDE ( _malloc_r = 0x4000bbb4 );
+PROVIDE ( _raise_r = 0x4000bc70 );
+PROVIDE ( _realloc_r = 0x4000bbe0 );
+PROVIDE ( _sbrk_r = 0x4000bce4 );
+PROVIDE ( _system_r = 0x4000bc10 );
+PROVIDE ( _times_r = 0x4000bc40 );
+
+    ---> end commented out block
+*/
+
+
+/* These are the non-reentrant versions of syscalls present in the ROM.
+   They call the reentrant versions, passing the pointer returned by __getreent
+   as the first argument.
+ */
+
+calloc = 0x4000bee4;
+close = 0x40001778;
+free = 0x4000beb8;
+malloc = 0x4000bea0;
+open = 0x4000178c;
+read = 0x400017dc;
+realloc = 0x4000becc;
+sbrk = 0x400017f4;
+times = 0x40001808;
+write = 0x4000181c;