feat: support libc for small devices

This commit is contained in:
Haolan
2025-08-28 20:11:13 +08:00
parent 5587fd2885
commit f3ecce86ee
15 changed files with 1536 additions and 746 deletions

185
targets/esp32.app.elf.ld Executable file
View File

@@ -0,0 +1,185 @@
__stack = ORIGIN(dram_seg) + LENGTH(dram_seg);
__MIN_STACK_SIZE = 0x2000;
ENTRY(_start)
SECTIONS
{
. = SEGMENT_START("iram_seg", 0);
.vectors :
{
_vector_table = ABSOLUTE(.);
KEEP(*(.WindowVectors.text));
KEEP(*(.Level2InterruptVector.text));
KEEP(*(.Level3InterruptVector.text));
KEEP(*(.Level4InterruptVector.text));
KEEP(*(.Level5InterruptVector.text));
KEEP(*(.DebugExceptionVector.text));
KEEP(*(.NMIExceptionVector.text));
KEEP(*(.KernelExceptionVector.text));
KEEP(*(.UserExceptionVector.text));
KEEP(*(.DoubleExceptionVector.text));
KEEP(*(.ResetVector.text));
*(.*Vector.literal)
. = ALIGN (16);
} > iram_seg
text :
{
KEEP (*(.init.literal))
KEEP (*(SORT_NONE(.init)))
*(.literal .text .stub .literal.* .text.* .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
KEEP (*(.fini.literal))
KEEP (*(SORT_NONE(.fini)))
} > iram_seg
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
/* Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. */
. = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
.rodata :
{
*(.rodata .rodata.* .gnu.linkonce.r.*)
*(.rodata1)
*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
*(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
}
.preinit_array :
{
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array))
PROVIDE_HIDDEN (__preinit_array_end = .);
}
.init_array :
{
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
PROVIDE_HIDDEN (__init_array_end = .);
}
.fini_array :
{
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
PROVIDE_HIDDEN (__fini_array_end = .);
}
.ctors :
{
/* gcc uses crtbegin.o to find the start of
the constructors, so we make sure it is
first. Because this is a wildcard, it
doesn't matter if the user does not
actually link against crtbegin.o; the
linker won't look for a file to match a
wildcard. The wildcard also means that it
doesn't matter which directory crtbegin.o
is in. */
KEEP (*crtbegin.o(.ctors))
KEEP (*crtbegin?.o(.ctors))
/* We don't want to include the .ctor section from
the crtend.o file until after the sorted ctors.
The .ctor section from the crtend file contains the
end of ctors marker and it must be last */
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
}
.dtors :
{
KEEP (*crtbegin.o(.dtors))
KEEP (*crtbegin?.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
}
_data_start = .;
.data :
{
*(.data .data.* .gnu.linkonce.d.*)
SORT(CONSTRUCTORS)
*(.data1)
}
_edata = .; PROVIDE (edata = .);
. = .;
__bss_start = .;
.bss :
{
*(.dynsbss)
*(.sbss .sbss.* .gnu.linkonce.sb.*)
*(.scommon)
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections.
FIXME: Why do we need it? When there is no .bss section, we do not
pad the .data section. */
. = ALIGN(. != 0 ? 32 / 8 : 1);
}
. = ALIGN(32 / 8);
. = ALIGN(32 / 8);
_end = .; PROVIDE (end = .);
. = DATA_SEGMENT_END (.);
/* Check if data + heap + stack exceeds RAM limit */
ASSERT(. <= __stack - __MIN_STACK_SIZE, "region DRAM overflowed by .data and .bss sections")
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
.gnu.build.attributes : { *(.gnu.build.attributes .gnu.build.attributes.*) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
/* DWARF 3 */
.debug_pubtypes 0 : { *(.debug_pubtypes) }
.debug_ranges 0 : { *(.debug_ranges) }
/* DWARF Extension. */
.debug_macro 0 : { *(.debug_macro) }
.debug_addr 0 : { *(.debug_addr) }
.gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
}
_sbss = __bss_start;
_ebss = _end;

View File

@@ -1,20 +1,25 @@
{
"inherits": ["xtensa"],
"inherits": [
"xtensa"
],
"cpu": "esp32",
"features": "+atomctl,+bool,+clamps,+coprocessor,+debug,+density,+dfpaccel,+div32,+exception,+fp,+highpriinterrupts,+interrupt,+loop,+mac16,+memctl,+minmax,+miscsr,+mul32,+mul32high,+nsa,+prid,+regprotect,+rvector,+s32c1i,+sext,+threadptr,+timerint,+windowed",
"build-tags": ["esp32", "esp"],
"build-tags": [
"esp32",
"esp"
],
"scheduler": "tasks",
"serial": "uart",
"linker": "ld.lld",
"default-stack-size": 2048,
"rtlib": "compiler-rt",
"libc": "picolibc",
"linkerscript": "targets/esp32.ld",
"extra-files": [
"targets/device/esp/esp32.S"
],
"libc": "newlib-esp32",
"linkerscript": "targets/esp32.memory.elf.ld",
"extra-files": [],
"binary-format": "esp32",
"flash-command": "esptool.py --chip=esp32 --port {port} write_flash 0x1000 {bin} -ff 80m -fm dout",
"emulator": "qemu-system-xtensa -machine esp32 -nographic -drive file={img},if=mtd,format=raw",
"gdb": ["xtensa-esp32-elf-gdb"]
"gdb": [
"xtensa-esp32-elf-gdb"
]
}

View File

@@ -1,200 +0,0 @@
/* Linker script for the ESP32 */
MEMORY
{
/* Data RAM. Allows byte access.
* There are various data RAM regions:
* SRAM2: 0x3FFA_E000..0x3FFD_FFFF (72 + 128 = 200K)
* SRAM1: 0x3FFE_0000..0x3FFF_FFFF (128K)
* This gives us 328K of contiguous RAM, which is the largest span possible.
* SRAM1 has other addresses as well but the datasheet seems to indicate
* these are aliases.
*/
DRAM (rw) : ORIGIN = 0x3FFAE000, LENGTH = 200K + 128K /* Internal SRAM 1 + 2 */
/* Instruction RAM. */
IRAM (x) : ORIGIN = 0x40080000, LENGTH = 128K /* Internal SRAM 0 */
}
/* The entry point. It is set in the image flashed to the chip, so must be
* defined.
*/
ENTRY(call_start_cpu0)
SECTIONS
{
/* Constant literals and code. Loaded into IRAM for now. Eventually, most
* code should be executed directly from flash.
* Note that literals must be before code for the l32r instruction to work.
*/
.text : ALIGN(4)
{
*(.literal.call_start_cpu0)
*(.text.call_start_cpu0)
*(.literal .text)
*(.literal.* .text.*)
} >IRAM
/* Put the stack at the bottom of DRAM, so that the application will
* crash on stack overflow instead of silently corrupting memory.
* See: http://blog.japaric.io/stack-overflow-protection/ */
.stack (NOLOAD) :
{
. = ALIGN(16);
. += _stack_size;
_stack_top = .;
} >DRAM
/* Constant global variables.
* They are loaded in DRAM for ease of use. Eventually they should be stored
* in flash and loaded directly from there but they're kept in RAM to make
* sure they can always be accessed (even in interrupts).
*/
.rodata : ALIGN(4)
{
*(.rodata)
*(.rodata.*)
} >DRAM
/* Mutable global variables.
*/
.data : ALIGN(4)
{
_sdata = ABSOLUTE(.);
*(.data)
*(.data.*)
_edata = ABSOLUTE(.);
} >DRAM
/* Check that the boot ROM stack (for the APP CPU) does not overlap with the
* data that is loaded by the boot ROM. There may be ways to avoid this
* issue if it occurs in practice.
* The magic value here is _stack_sentry in the boot ROM ELF file.
*/
ASSERT(_edata < 0x3ffe1320, "the .data section overlaps with the stack used by the boot ROM, possibly causing corruption at startup")
/* Global variables that are mutable and zero-initialized.
* These must be zeroed at startup (unlike data, which is loaded by the
* bootloader).
*/
.bss (NOLOAD) : ALIGN(4)
{
. = ALIGN (4);
_sbss = ABSOLUTE(.);
*(.bss)
*(.bss.*)
. = ALIGN (4);
_ebss = ABSOLUTE(.);
} >DRAM
}
/* For the garbage collector.
*/
_globals_start = _sdata;
_globals_end = _ebss;
_heap_start = _ebss;
_heap_end = ORIGIN(DRAM) + LENGTH(DRAM);
_stack_size = 4K;
/* From ESP-IDF:
* components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
* These are called from LLVM during codegen. The original license is Apache
* 2.0, but I believe that a list of function names and addresses can't really
* be copyrighted.
*/
__absvdi2 = 0x4006387c;
__absvsi2 = 0x40063868;
__adddf3 = 0x40002590;
__addsf3 = 0x400020e8;
__addvdi3 = 0x40002cbc;
__addvsi3 = 0x40002c98;
__ashldi3 = 0x4000c818;
__ashrdi3 = 0x4000c830;
__bswapdi2 = 0x40064b08;
__bswapsi2 = 0x40064ae0;
__clrsbdi2 = 0x40064b7c;
__clrsbsi2 = 0x40064b64;
__clzdi2 = 0x4000ca50;
__clzsi2 = 0x4000c7e8;
__cmpdi2 = 0x40063820;
__ctzdi2 = 0x4000ca64;
__ctzsi2 = 0x4000c7f0;
__divdc3 = 0x400645a4;
__divdf3 = 0x40002954;
__divdi3 = 0x4000ca84;
__divsi3 = 0x4000c7b8;
__eqdf2 = 0x400636a8;
__eqsf2 = 0x40063374;
__extendsfdf2 = 0x40002c34;
__ffsdi2 = 0x4000ca2c;
__ffssi2 = 0x4000c804;
__fixdfdi = 0x40002ac4;
__fixdfsi = 0x40002a78;
__fixsfdi = 0x4000244c;
__fixsfsi = 0x4000240c;
__fixunsdfsi = 0x40002b30;
__fixunssfdi = 0x40002504;
__fixunssfsi = 0x400024ac;
__floatdidf = 0x4000c988;
__floatdisf = 0x4000c8c0;
__floatsidf = 0x4000c944;
__floatsisf = 0x4000c870;
__floatundidf = 0x4000c978;
__floatundisf = 0x4000c8b0;
__floatunsidf = 0x4000c938;
__floatunsisf = 0x4000c864;
__gcc_bcmp = 0x40064a70;
__gedf2 = 0x40063768;
__gesf2 = 0x4006340c;
__gtdf2 = 0x400636dc;
__gtsf2 = 0x400633a0;
__ledf2 = 0x40063704;
__lesf2 = 0x400633c0;
__lshrdi3 = 0x4000c84c;
__ltdf2 = 0x40063790;
__ltsf2 = 0x4006342c;
__moddi3 = 0x4000cd4c;
__modsi3 = 0x4000c7c0;
__muldc3 = 0x40063c90;
__muldf3 = 0x4006358c;
__muldi3 = 0x4000c9fc;
__mulsf3 = 0x400632c8;
__mulsi3 = 0x4000c7b0;
__mulvdi3 = 0x40002d78;
__mulvsi3 = 0x40002d60;
__nedf2 = 0x400636a8;
__negdf2 = 0x400634a0;
__negdi2 = 0x4000ca14;
__negsf2 = 0x400020c0;
__negvdi2 = 0x40002e98;
__negvsi2 = 0x40002e78;
__nesf2 = 0x40063374;
__nsau_data = 0x3ff96544;
__paritysi2 = 0x40002f3c;
__popcount_tab = 0x3ff96544;
__popcountdi2 = 0x40002ef8;
__popcountsi2 = 0x40002ed0;
__powidf2 = 0x400638e4;
__subdf3 = 0x400026e4;
__subsf3 = 0x400021d0;
__subvdi3 = 0x40002d20;
__subvsi3 = 0x40002cf8;
__truncdfsf2 = 0x40002b90;
__ucmpdi2 = 0x40063840;
__udiv_w_sdiv = 0x40064bec;
__udivdi3 = 0x4000cff8;
__udivmoddi4 = 0x40064bf4;
__udivsi3 = 0x4000c7c8;
__umoddi3 = 0x4000d280;
__umodsi3 = 0x4000c7d0;
__umulsidi3 = 0x4000c7d8;
__unorddf2 = 0x400637f4;
__unordsf2 = 0x40063478;
INCLUDE "targets/esp32.rom.newlib-data.ld";
INCLUDE "targets/esp32.rom.newlib-funcs.ld";
INCLUDE "targets/esp32.rom.newlib-locale.ld";
INCLUDE "targets/esp32.rom.newlib-nano.ld";
INCLUDE "targets/esp32.rom.newlib-time.ld";

26
targets/esp32.memory.elf.ld Executable file
View File

@@ -0,0 +1,26 @@
/*
* IROM/DRAM definition in QEMU:
* [ESP32_MEMREGION_IROM] = { 0x40000000, 0x70000 },
* [ESP32_MEMREGION_DRAM] = { 0x3ffae000, 0x52000 },
*
* In theory we could use whole DRAM section, but I had some faults when using
* memory in range 0x3ffae000 - 0x3ffb0000
*
* But used memory range for data such as esp-idf for ESP32 to satisfy user's
* expectation on chip emulation
*
* Pass '--defsym=entire_dram_seg=1' to linker script to use whole DRAM
*
*/
MEMORY
{
iram_seg (X) : org = 0x40078000, len = 0x28000
/* 64k at the end of DRAM, after ROM bootloader stack
* or entire DRAM (for QEMU only)
*/
dram_seg (RW) : org = 0x3FFF0000 ,
len = 0x10000
}
INCLUDE "targets/esp32.app.elf.ld";

View File

@@ -1,23 +0,0 @@
/* 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;
environ = 0x3ffae0b4;
_global_impure_ptr = 0x3ffae0b0;
__mb_cur_max = 0x3ff96530;
__sf_fake_stderr = 0x3ff96458;
__sf_fake_stdin = 0x3ff96498;
__sf_fake_stdout = 0x3ff96478;
__wctomb = 0x3ff96540;
__sfp_lock = 0x3ffae0ac;
__sinit_lock = 0x3ffae0a8;
__env_lock_object = 0x3ffae0b8;
__tz_lock_object = 0x3ffae080;

View File

@@ -1,130 +0,0 @@
/* 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.
Time functions were moved to the esp32.rom.newlib-time.ld file.
*/
abs = 0x40056340;
__ascii_wctomb = 0x40058ef0;
atoi = 0x400566c4;
_atoi_r = 0x400566d4;
atol = 0x400566ec;
_atol_r = 0x400566fc;
bzero = 0x4000c1f4;
_cleanup = 0x40001df8;
_cleanup_r = 0x40001d48;
creat = 0x40000e8c;
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;
_getenv_r = 0x40001fbc;
isalnum = 0x40000f04;
isalpha = 0x40000f18;
isascii = 0x4000c20c;
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;
longjmp = 0x400562cc;
memccpy = 0x4000c220;
memchr = 0x4000c244;
memcmp = 0x4000c260;
memcpy = 0x4000c2c8;
memmove = 0x4000c3c0;
memrchr = 0x4000c400;
memset = 0x4000c44c;
qsort = 0x40056424;
rand = 0x40001058;
rand_r = 0x400010d4;
__sccl = 0x4000c498;
__sclose = 0x400011b8;
__seofread = 0x40001148;
setjmp = 0x40056268;
__sflush_r = 0x400591e0;
__sfmoreglue = 0x40001dc8;
__sfp = 0x40001e90;
__sfp_lock_acquire = 0x40001e08;
__sfp_lock_release = 0x40001e14;
__sinit = 0x40001e38;
__sinit_lock_acquire = 0x40001e20;
__sinit_lock_release = 0x40001e2c;
srand = 0x40001004;
__sread = 0x40001118;
__sseek = 0x40001184;
strcasecmp = 0x400011cc;
strcasestr = 0x40001210;
strcat = 0x4000c518;
strchr = 0x4000c53c;
strcmp = 0x40001274;
strcoll = 0x40001398;
strcpy = 0x400013ac;
strcspn = 0x4000c558;
strdup = 0x4000143c;
_strdup_r = 0x40001450;
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;
toascii = 0x4000c720;
tolower = 0x40001868;
toupper = 0x40001884;
ungetc = 0x400590f4;
_ungetc_r = 0x40058fa0;
__utoa = 0x400561f0;
utoa = 0x40056258;
wcrtomb = 0x40058920;
_wcrtomb_r = 0x400588d8;
_wctomb_r = 0x40058f14;

View File

@@ -1,19 +0,0 @@
/* These are the locale-related newlib functions present in ESP32 ROM.
ESP32 ROM contains newlib version 2.2.0, and these functions should not be
used when compiling with newlib version 3, since locale implementation is
different there.
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.
*/
__locale_charset = 0x40059540;
__locale_cjk_lang = 0x40059558;
localeconv = 0x4005957c;
_localeconv_r = 0x40059560;
__locale_mb_cur_max = 0x40059548;
__locale_msgcharset = 0x40059550;
setlocale = 0x40059568;
_setlocale_r = 0x4005950c;

View File

@@ -1,115 +0,0 @@
/* 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;
*/

View File

@@ -1,38 +0,0 @@
/* These are the newlib functions and the .bss/.data symbols necessary for these functions present in ESP32 ROM.
They should not be used when you need to solve the Y2K38 problem.
Because these functions were compiled with 32-bit width for the time_t structure.
*/
asctime = 0x40059588;
asctime_r = 0x40000ec8;
ctime = 0x400595b0;
ctime_r = 0x400595c4;
__gettzinfo = 0x40001fcc;
__get_current_time_locale = 0x40001834;
gmtime = 0x40059848;
gmtime_r = 0x40059868;
localtime = 0x400595dc;
localtime_r = 0x400595fc;
mktime = 0x4005a5e8;
strftime = 0x40059ab4;
time = 0x40001844;
__time_load_locale = 0x4000183c;
tzset = 0x40001a1c;
_tzset_r = 0x40001a28;
__tzcalc_limits = 0x400018a0;
__tz_lock = 0x40001a04;
__tz_unlock = 0x40001a10;
/* The .bss/.data symbols necessary for these functions */
_timezone = 0x3ffae0a0;
_tzname = 0x3ffae030;
_daylight = 0x3ffae0a4;
__month_lengths = 0x3ff9609c;
/* These functions don't use time_t, but use other structures which include time_t.
* For example, 'struct stat' contains time_t.
*/
_isatty_r = 0x40000ea0;
__sfvwrite_r = 0x4005893c;
__smakebuf_r = 0x40059108;
__srefill_r = 0x400593d4;
__swsetup_r = 0x40058cc8;