diff --git a/example/stub_main.c b/example/stub_main.c index 64f61e7..1a86199 100644 --- a/example/stub_main.c +++ b/example/stub_main.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -48,7 +49,9 @@ static __attribute__((unused)) int handle_test2(va_list ap) { (void)ap; - STUB_LOG("test2\n"); + char buf[10]; + strcpy(buf, "test2\n"); + STUB_LOG(buf); return 0; } diff --git a/src/esp32/CMakeLists.txt b/src/esp32/CMakeLists.txt index 7e912d2..1806428 100644 --- a/src/esp32/CMakeLists.txt +++ b/src/esp32/CMakeLists.txt @@ -11,3 +11,4 @@ target_include_directories(${ESP_TARGET_LIB} ) target_link_options(${ESP_TARGET_LIB} PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32.rom.ld) +target_link_options(${ESP_TARGET_LIB} PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32.rom.libc-funcs.ld) diff --git a/src/esp32/ld/esp32.rom.libc-funcs.ld b/src/esp32/ld/esp32.rom.libc-funcs.ld new file mode 100644 index 0000000..890eead --- /dev/null +++ b/src/esp32/ld/esp32.rom.libc-funcs.ld @@ -0,0 +1,74 @@ +/* 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; +bzero = 0x4000c1f4; +div = 0x40056348; +__dummy_lock = 0x4000c728; +__dummy_lock_try = 0x4000c730; +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; +__sccl = 0x4000c498; +setjmp = 0x40056268; +strcasecmp = 0x400011cc; +strcasestr = 0x40001210; +strcat = 0x4000c518; +strchr = 0x4000c53c; +strcmp = 0x40001274; +strcoll = 0x40001398; +strcpy = 0x400013ac; +strcspn = 0x4000c558; +strlcat = 0x40001470; +strlcpy = 0x4000c584; +strlen = 0x400014c0; +strlwr = 0x40001524; +strncasecmp = 0x40001550; +strncat = 0x4000c5c4; +strncmp = 0x4000c5f4; +strncpy = 0x400015d4; +strnlen = 0x4000c628; +strrchr = 0x40001708; +strsep = 0x40001734; +strspn = 0x4000c648; +strstr = 0x4000c674; +strupr = 0x4000174c; +__submore = 0x40058f3c; +toascii = 0x4000c720; +tolower = 0x40001868; +toupper = 0x40001884; +__utoa = 0x400561f0; +utoa = 0x40056258; diff --git a/src/esp32c2/CMakeLists.txt b/src/esp32c2/CMakeLists.txt index 326c32b..a65170d 100644 --- a/src/esp32c2/CMakeLists.txt +++ b/src/esp32c2/CMakeLists.txt @@ -11,3 +11,4 @@ target_include_directories(${ESP_TARGET_LIB} ) target_link_options(${ESP_TARGET_LIB} PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32c2.rom.ld) +target_link_options(${ESP_TARGET_LIB} PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32c2.rom.libc.ld) diff --git a/src/esp32c2/ld/esp32c2.rom.ld b/src/esp32c2/ld/esp32c2.rom.ld index 08c1d4a..2f67444 100644 --- a/src/esp32c2/ld/esp32c2.rom.ld +++ b/src/esp32c2/ld/esp32c2.rom.ld @@ -1,9 +1,3 @@ -/* - * SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - /* ROM function interface esp32c2.rom.ld for esp32c2 * * diff --git a/src/esp32c2/ld/esp32c2.rom.libc.ld b/src/esp32c2/ld/esp32c2.rom.libc.ld new file mode 100644 index 0000000..c65e9aa --- /dev/null +++ b/src/esp32c2/ld/esp32c2.rom.libc.ld @@ -0,0 +1,85 @@ +esp_rom_newlib_init_common_mutexes = 0x40000484; +memset = 0x40000488; +memcpy = 0x4000048c; +memmove = 0x40000490; +memcmp = 0x40000494; +strcpy = 0x40000498; +strncpy = 0x4000049c; +strcmp = 0x400004a0; +strncmp = 0x400004a4; +strlen = 0x400004a8; +strstr = 0x400004ac; +bzero = 0x400004b0; +sbrk = 0x400004b8; +isalnum = 0x400004bc; +isalpha = 0x400004c0; +isascii = 0x400004c4; +isblank = 0x400004c8; +iscntrl = 0x400004cc; +isdigit = 0x400004d0; +islower = 0x400004d4; +isgraph = 0x400004d8; +isprint = 0x400004dc; +ispunct = 0x400004e0; +isspace = 0x400004e4; +isupper = 0x400004e8; +toupper = 0x400004ec; +tolower = 0x400004f0; +toascii = 0x400004f4; +memccpy = 0x400004f8; +memchr = 0x400004fc; +memrchr = 0x40000500; +strcasecmp = 0x40000504; +strcasestr = 0x40000508; +strcat = 0x4000050c; +strchr = 0x40000514; +strcspn = 0x40000518; +strcoll = 0x4000051c; +strlcat = 0x40000520; +strlcpy = 0x40000524; +strlwr = 0x40000528; +strncasecmp = 0x4000052c; +strncat = 0x40000530; +strnlen = 0x40000538; +strrchr = 0x4000053c; +strsep = 0x40000540; +strspn = 0x40000544; +strtok_r = 0x40000548; +strupr = 0x4000054c; +longjmp = 0x40000550; +setjmp = 0x40000554; +abs = 0x40000558; +div = 0x4000055c; +labs = 0x40000560; +ldiv = 0x40000564; +qsort = 0x40000568; +utoa = 0x40000578; +itoa = 0x4000057c; +__match = 0x400005dc; +__hexnan = 0x400005e0; +__hexdig_fun = 0x400005e4; +__gethex = 0x400005e8; +_Balloc = 0x400005ec; +_Bfree = 0x400005f0; +__multadd = 0x400005f4; +__s2b = 0x400005f8; +__hi0bits = 0x400005fc; +__lo0bits = 0x40000600; +__i2b = 0x40000604; +__multiply = 0x40000608; +__pow5mult = 0x4000060c; +__lshift = 0x40000610; +__mcmp = 0x40000614; +__mdiff = 0x40000618; +__ulp = 0x4000061c; +__b2d = 0x40000620; +__d2b = 0x40000624; +__ratio = 0x40000628; +_mprec_log10 = 0x4000062c; +__copybits = 0x40000630; +__any_on = 0x40000634; +nan = 0x40000668; +nanf = 0x4000066c; +/* Data (.data, .bss, .rodata) */ +syscall_table_ptr = 0x3fcdffd8; +_global_impure_ptr = 0x3fcdffd4; diff --git a/src/esp32c3/CMakeLists.txt b/src/esp32c3/CMakeLists.txt index e46547b..833d9e7 100644 --- a/src/esp32c3/CMakeLists.txt +++ b/src/esp32c3/CMakeLists.txt @@ -11,3 +11,4 @@ target_include_directories(${ESP_TARGET_LIB} ) target_link_options(${ESP_TARGET_LIB} PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32c3.rom.ld) +target_link_options(${ESP_TARGET_LIB} PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32c3.rom.libc.ld) diff --git a/src/esp32c3/ld/esp32c3.rom.libc.ld b/src/esp32c3/ld/esp32c3.rom.libc.ld new file mode 100644 index 0000000..84e2c75 --- /dev/null +++ b/src/esp32c3/ld/esp32c3.rom.libc.ld @@ -0,0 +1,60 @@ +esp_rom_newlib_init_common_mutexes = 0x40000350; +memset = 0x40000354; +memcpy = 0x40000358; +memmove = 0x4000035c; +memcmp = 0x40000360; +strcpy = 0x40000364; +strncpy = 0x40000368; +strcmp = 0x4000036c; +strncmp = 0x40000370; +strlen = 0x40000374; +strstr = 0x40000378; +bzero = 0x4000037c; +sbrk = 0x40000384; +isalnum = 0x40000388; +isalpha = 0x4000038c; +isascii = 0x40000390; +isblank = 0x40000394; +iscntrl = 0x40000398; +isdigit = 0x4000039c; +islower = 0x400003a0; +isgraph = 0x400003a4; +isprint = 0x400003a8; +ispunct = 0x400003ac; +isspace = 0x400003b0; +isupper = 0x400003b4; +toupper = 0x400003b8; +tolower = 0x400003bc; +toascii = 0x400003c0; +memccpy = 0x400003c4; +memchr = 0x400003c8; +memrchr = 0x400003cc; +strcasecmp = 0x400003d0; +strcasestr = 0x400003d4; +strcat = 0x400003d8; +strchr = 0x400003e0; +strcspn = 0x400003e4; +strcoll = 0x400003e8; +strlcat = 0x400003ec; +strlcpy = 0x400003f0; +strlwr = 0x400003f4; +strncasecmp = 0x400003f8; +strncat = 0x400003fc; +strnlen = 0x40000404; +strrchr = 0x40000408; +strsep = 0x4000040c; +strspn = 0x40000410; +strtok_r = 0x40000414; +strupr = 0x40000418; +longjmp = 0x4000041c; +setjmp = 0x40000420; +abs = 0x40000424; +div = 0x40000428; +labs = 0x4000042c; +ldiv = 0x40000430; +qsort = 0x40000434; +utoa = 0x40000444; +itoa = 0x40000448; +/* Data (.data, .bss, .rodata) */ +syscall_table_ptr = 0x3fcdffe0; +_global_impure_ptr = 0x3fcdffdc; diff --git a/src/esp32c5/CMakeLists.txt b/src/esp32c5/CMakeLists.txt index d5bbe92..06e6f0e 100644 --- a/src/esp32c5/CMakeLists.txt +++ b/src/esp32c5/CMakeLists.txt @@ -11,3 +11,4 @@ target_include_directories(${ESP_TARGET_LIB} ) target_link_options(${ESP_TARGET_LIB} PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32c5.rom.ld) +target_link_options(${ESP_TARGET_LIB} PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32c5.rom.libc.ld) diff --git a/src/esp32c5/ld/esp32c5.rom.libc.ld b/src/esp32c5/ld/esp32c5.rom.libc.ld new file mode 100644 index 0000000..9c6e808 --- /dev/null +++ b/src/esp32c5/ld/esp32c5.rom.libc.ld @@ -0,0 +1,60 @@ +esp_rom_newlib_init_common_mutexes = 0x400004b4; +memset = 0x400004b8; +memcpy = 0x400004bc; +memmove = 0x400004c0; +memcmp = 0x400004c4; +strcpy = 0x400004c8; +strncpy = 0x400004cc; +strcmp = 0x400004d0; +strncmp = 0x400004d4; +strlen = 0x400004d8; +strstr = 0x400004dc; +bzero = 0x400004e0; +sbrk = 0x400004e8; +isalnum = 0x400004ec; +isalpha = 0x400004f0; +isascii = 0x400004f4; +isblank = 0x400004f8; +iscntrl = 0x400004fc; +isdigit = 0x40000500; +islower = 0x40000504; +isgraph = 0x40000508; +isprint = 0x4000050c; +ispunct = 0x40000510; +isspace = 0x40000514; +isupper = 0x40000518; +toupper = 0x4000051c; +tolower = 0x40000520; +toascii = 0x40000524; +memccpy = 0x40000528; +memchr = 0x4000052c; +memrchr = 0x40000530; +strcasecmp = 0x40000534; +strcasestr = 0x40000538; +strcat = 0x4000053c; +strchr = 0x40000544; +strcspn = 0x40000548; +strcoll = 0x4000054c; +strlcat = 0x40000550; +strlcpy = 0x40000554; +strlwr = 0x40000558; +strncasecmp = 0x4000055c; +strncat = 0x40000560; +strnlen = 0x40000568; +strrchr = 0x4000056c; +strsep = 0x40000570; +strspn = 0x40000574; +strtok_r = 0x40000578; +strupr = 0x4000057c; +longjmp = 0x40000580; +setjmp = 0x40000584; +abs = 0x40000588; +div = 0x4000058c; +labs = 0x40000590; +ldiv = 0x40000594; +qsort = 0x40000598; +utoa = 0x400005a8; +itoa = 0x400005ac; +/* Data (.data, .bss, .rodata) */ +syscall_table_ptr = 0x4085ffd4; +_global_impure_ptr = 0x4085ffd0; diff --git a/src/esp32c6/CMakeLists.txt b/src/esp32c6/CMakeLists.txt index 7c86c7a..aabf11c 100644 --- a/src/esp32c6/CMakeLists.txt +++ b/src/esp32c6/CMakeLists.txt @@ -11,3 +11,4 @@ target_include_directories(${ESP_TARGET_LIB} ) target_link_options(${ESP_TARGET_LIB} PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32c6.rom.ld) +target_link_options(${ESP_TARGET_LIB} PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32c6.rom.libc.ld) diff --git a/src/esp32c6/ld/esp32c6.rom.libc.ld b/src/esp32c6/ld/esp32c6.rom.libc.ld new file mode 100644 index 0000000..c50c046 --- /dev/null +++ b/src/esp32c6/ld/esp32c6.rom.libc.ld @@ -0,0 +1,60 @@ +esp_rom_newlib_init_common_mutexes = 0x400004a4; +memset = 0x400004a8; +memcpy = 0x400004ac; +memmove = 0x400004b0; +memcmp = 0x400004b4; +strcpy = 0x400004b8; +strncpy = 0x400004bc; +strcmp = 0x400004c0; +strncmp = 0x400004c4; +strlen = 0x400004c8; +strstr = 0x400004cc; +bzero = 0x400004d0; +sbrk = 0x400004d8; +isalnum = 0x400004dc; +isalpha = 0x400004e0; +isascii = 0x400004e4; +isblank = 0x400004e8; +iscntrl = 0x400004ec; +isdigit = 0x400004f0; +islower = 0x400004f4; +isgraph = 0x400004f8; +isprint = 0x400004fc; +ispunct = 0x40000500; +isspace = 0x40000504; +isupper = 0x40000508; +toupper = 0x4000050c; +tolower = 0x40000510; +toascii = 0x40000514; +memccpy = 0x40000518; +memchr = 0x4000051c; +memrchr = 0x40000520; +strcasecmp = 0x40000524; +strcasestr = 0x40000528; +strcat = 0x4000052c; +strchr = 0x40000534; +strcspn = 0x40000538; +strcoll = 0x4000053c; +strlcat = 0x40000540; +strlcpy = 0x40000544; +strlwr = 0x40000548; +strncasecmp = 0x4000054c; +strncat = 0x40000550; +strnlen = 0x40000558; +strrchr = 0x4000055c; +strsep = 0x40000560; +strspn = 0x40000564; +strtok_r = 0x40000568; +strupr = 0x4000056c; +longjmp = 0x40000570; +setjmp = 0x40000574; +abs = 0x40000578; +div = 0x4000057c; +labs = 0x40000580; +ldiv = 0x40000584; +qsort = 0x40000588; +utoa = 0x40000598; +itoa = 0x4000059c; +/* Data (.data, .bss, .rodata) */ +syscall_table_ptr = 0x4087ffd4; +_global_impure_ptr = 0x4087ffd0; diff --git a/src/esp32c61/CMakeLists.txt b/src/esp32c61/CMakeLists.txt index 57af5df..70bba40 100644 --- a/src/esp32c61/CMakeLists.txt +++ b/src/esp32c61/CMakeLists.txt @@ -11,3 +11,4 @@ target_include_directories(${ESP_TARGET_LIB} ) target_link_options(${ESP_TARGET_LIB} PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32c61.rom.ld) +target_link_options(${ESP_TARGET_LIB} PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32c61.rom.libc.ld) diff --git a/src/esp32c61/ld/esp32c61.rom.libc.ld b/src/esp32c61/ld/esp32c61.rom.libc.ld new file mode 100644 index 0000000..8fbf5ec --- /dev/null +++ b/src/esp32c61/ld/esp32c61.rom.libc.ld @@ -0,0 +1,60 @@ +esp_rom_newlib_init_common_mutexes = 0x400004b4; +memset = 0x400004b8; +memcpy = 0x400004bc; +memmove = 0x400004c0; +memcmp = 0x400004c4; +strcpy = 0x400004c8; +strncpy = 0x400004cc; +strcmp = 0x400004d0; +strncmp = 0x400004d4; +strlen = 0x400004d8; +strstr = 0x400004dc; +bzero = 0x400004e0; +sbrk = 0x400004e8; +isalnum = 0x400004ec; +isalpha = 0x400004f0; +isascii = 0x400004f4; +isblank = 0x400004f8; +iscntrl = 0x400004fc; +isdigit = 0x40000500; +islower = 0x40000504; +isgraph = 0x40000508; +isprint = 0x4000050c; +ispunct = 0x40000510; +isspace = 0x40000514; +isupper = 0x40000518; +toupper = 0x4000051c; +tolower = 0x40000520; +toascii = 0x40000524; +memccpy = 0x40000528; +memchr = 0x4000052c; +memrchr = 0x40000530; +strcasecmp = 0x40000534; +strcasestr = 0x40000538; +strcat = 0x4000053c; +strchr = 0x40000544; +strcspn = 0x40000548; +strcoll = 0x4000054c; +strlcat = 0x40000550; +strlcpy = 0x40000554; +strlwr = 0x40000558; +strncasecmp = 0x4000055c; +strncat = 0x40000560; +strnlen = 0x40000568; +strrchr = 0x4000056c; +strsep = 0x40000570; +strspn = 0x40000574; +strtok_r = 0x40000578; +strupr = 0x4000057c; +longjmp = 0x40000580; +setjmp = 0x40000584; +abs = 0x40000588; +div = 0x4000058c; +labs = 0x40000590; +ldiv = 0x40000594; +qsort = 0x40000598; +utoa = 0x400005a8; +itoa = 0x400005ac; +/* Data (.data, .bss, .rodata) */ +syscall_table_ptr = 0x4084ffd4; +_global_impure_ptr = 0x4084ffd0; diff --git a/src/esp32h2/CMakeLists.txt b/src/esp32h2/CMakeLists.txt index a74ccc4..26310ad 100644 --- a/src/esp32h2/CMakeLists.txt +++ b/src/esp32h2/CMakeLists.txt @@ -11,3 +11,4 @@ target_include_directories(${ESP_TARGET_LIB} ) target_link_options(${ESP_TARGET_LIB} PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32h2.rom.ld) +target_link_options(${ESP_TARGET_LIB} PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32h2.rom.libc.ld) diff --git a/src/esp32h2/ld/esp32h2.rom.libc.ld b/src/esp32h2/ld/esp32h2.rom.libc.ld new file mode 100644 index 0000000..7843820 --- /dev/null +++ b/src/esp32h2/ld/esp32h2.rom.libc.ld @@ -0,0 +1,60 @@ +esp_rom_newlib_init_common_mutexes = 0x4000049c; +memset = 0x400004a0; +memcpy = 0x400004a4; +memmove = 0x400004a8; +memcmp = 0x400004ac; +strcpy = 0x400004b0; +strncpy = 0x400004b4; +strcmp = 0x400004b8; +strncmp = 0x400004bc; +strlen = 0x400004c0; +strstr = 0x400004c4; +bzero = 0x400004c8; +sbrk = 0x400004d0; +isalnum = 0x400004d4; +isalpha = 0x400004d8; +isascii = 0x400004dc; +isblank = 0x400004e0; +iscntrl = 0x400004e4; +isdigit = 0x400004e8; +islower = 0x400004ec; +isgraph = 0x400004f0; +isprint = 0x400004f4; +ispunct = 0x400004f8; +isspace = 0x400004fc; +isupper = 0x40000500; +toupper = 0x40000504; +tolower = 0x40000508; +toascii = 0x4000050c; +memccpy = 0x40000510; +memchr = 0x40000514; +memrchr = 0x40000518; +strcasecmp = 0x4000051c; +strcasestr = 0x40000520; +strcat = 0x40000524; +strchr = 0x4000052c; +strcspn = 0x40000530; +strcoll = 0x40000534; +strlcat = 0x40000538; +strlcpy = 0x4000053c; +strlwr = 0x40000540; +strncasecmp = 0x40000544; +strncat = 0x40000548; +strnlen = 0x40000550; +strrchr = 0x40000554; +strsep = 0x40000558; +strspn = 0x4000055c; +strtok_r = 0x40000560; +strupr = 0x40000564; +longjmp = 0x40000568; +setjmp = 0x4000056c; +abs = 0x40000570; +div = 0x40000574; +labs = 0x40000578; +ldiv = 0x4000057c; +qsort = 0x40000580; +utoa = 0x40000590; +itoa = 0x40000594; +/* Data (.data, .bss, .rodata) */ +syscall_table_ptr = 0x4084ffd4; +_global_impure_ptr = 0x4084ffd0; diff --git a/src/esp32p4/CMakeLists.txt b/src/esp32p4/CMakeLists.txt index 07ae0e7..c2b61ed 100644 --- a/src/esp32p4/CMakeLists.txt +++ b/src/esp32p4/CMakeLists.txt @@ -11,3 +11,4 @@ target_include_directories(${ESP_TARGET_LIB} ) target_link_options(${ESP_TARGET_LIB} PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32p4.rom.ld) +target_link_options(${ESP_TARGET_LIB} PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32p4.rom.libc.ld) diff --git a/src/esp32p4/ld/esp32p4.rom.libc.ld b/src/esp32p4/ld/esp32p4.rom.libc.ld new file mode 100644 index 0000000..9bc7c5c --- /dev/null +++ b/src/esp32p4/ld/esp32p4.rom.libc.ld @@ -0,0 +1,60 @@ +esp_rom_newlib_init_common_mutexes = 0x4fc00264; +memset = 0x4fc00268; +memcpy = 0x4fc0026c; +memmove = 0x4fc00270; +memcmp = 0x4fc00274; +strcpy = 0x4fc00278; +strncpy = 0x4fc0027c; +strcmp = 0x4fc00280; +strncmp = 0x4fc00284; +strlen = 0x4fc00288; +strstr = 0x4fc0028c; +bzero = 0x4fc00290; +sbrk = 0x4fc00298; +isalnum = 0x4fc0029c; +isalpha = 0x4fc002a0; +isascii = 0x4fc002a4; +isblank = 0x4fc002a8; +iscntrl = 0x4fc002ac; +isdigit = 0x4fc002b0; +islower = 0x4fc002b4; +isgraph = 0x4fc002b8; +isprint = 0x4fc002bc; +ispunct = 0x4fc002c0; +isspace = 0x4fc002c4; +isupper = 0x4fc002c8; +toupper = 0x4fc002cc; +tolower = 0x4fc002d0; +toascii = 0x4fc002d4; +memccpy = 0x4fc002d8; +memchr = 0x4fc002dc; +memrchr = 0x4fc002e0; +strcasecmp = 0x4fc002e4; +strcasestr = 0x4fc002e8; +strcat = 0x4fc002ec; +strchr = 0x4fc002f4; +strcspn = 0x4fc002f8; +strcoll = 0x4fc002fc; +strlcat = 0x4fc00300; +strlcpy = 0x4fc00304; +strlwr = 0x4fc00308; +strncasecmp = 0x4fc0030c; +strncat = 0x4fc00310; +strnlen = 0x4fc00318; +strrchr = 0x4fc0031c; +strsep = 0x4fc00320; +strspn = 0x4fc00324; +strtok_r = 0x4fc00328; +strupr = 0x4fc0032c; +longjmp = 0x4fc00330; +setjmp = 0x4fc00334; +abs = 0x4fc00338; +div = 0x4fc0033c; +labs = 0x4fc00340; +ldiv = 0x4fc00344; +qsort = 0x4fc00348; +utoa = 0x4fc00358; +itoa = 0x4fc0035c; +/* Data (.data, .bss, .rodata) */ +syscall_table_ptr = 0x4ff3ffe4; +_global_impure_ptr = 0x4ff3ffe0; diff --git a/src/esp32s2/CMakeLists.txt b/src/esp32s2/CMakeLists.txt index 3271bce..fe373ea 100644 --- a/src/esp32s2/CMakeLists.txt +++ b/src/esp32s2/CMakeLists.txt @@ -11,3 +11,4 @@ target_include_directories(${ESP_TARGET_LIB} ) target_link_options(${ESP_TARGET_LIB} PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32s2.rom.ld) +target_link_options(${ESP_TARGET_LIB} PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32s2.rom.libc-funcs.ld) diff --git a/src/esp32s2/ld/esp32s2.rom.libc-funcs.ld b/src/esp32s2/ld/esp32s2.rom.libc-funcs.ld new file mode 100644 index 0000000..892f37a --- /dev/null +++ b/src/esp32s2/ld/esp32s2.rom.libc-funcs.ld @@ -0,0 +1,63 @@ +/** + * These are the newlib functions present in ESP32-S2 ROM. + * See also esp32s2.rom.newlib-data.ld for the list of .data/.bss symbols used by these functions. + + * Unlike other ROM functions which are exported using PROVIDE, which declare 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 = 0x40000618; +PROVIDE ( __assert = 0x4001a430 ); +PROVIDE ( __assert_func = 0x4001a408 ); +bzero = 0x400078c8; +div = 0x40000620; +isalnum = 0x400078d8; +isalpha = 0x400078e8; +isascii = 0x4001aaec; +isblank = 0x400078f8; +iscntrl = 0x40007918; +isdigit = 0x40007930; +isgraph = 0x40007968; +islower = 0x40007948; +isprint = 0x40007980; +ispunct = 0x40007994; +isspace = 0x400079ac; +isupper = 0x400079c4; +labs = 0x40000648; +ldiv = 0x40000650; +longjmp = 0x400005a4; +memccpy = 0x4001ab00; +memchr = 0x4001ab24; +memcmp = 0x4001ab40; +memcpy = 0x4001aba8; +memmove = 0x4001acb0; +memrchr = 0x4001acec; +memset = 0x4001ad3c; +qsort = 0x400006f4; +setjmp = 0x40000540; +strcat = 0x4001ad90; +strchr = 0x4001adb0; +strcmp = 0x40007be4; +strcoll = 0x40007ce8; +strcpy = 0x40007cfc; +strcspn = 0x4001adcc; +strlcat = 0x40007db8; +strlcpy = 0x4001adf8; +strlen = 0x40007e08; +strlwr = 0x40007e68; +strncasecmp = 0x40007e94; +strncat = 0x4001ae34; +strncmp = 0x4001ae64; +strncpy = 0x40007f20; +strnlen = 0x4001ae9c; +strrchr = 0x40008040; +strsep = 0x4000806c; +strspn = 0x4001aebc; +strstr = 0x4001aee8; +__strtok_r = 0x4001af18; +strtok_r = 0x4001af7c; +strupr = 0x40008084; +toascii = 0x4001af90; +tolower = 0x40008158; +toupper = 0x40008174; diff --git a/src/esp32s3/CMakeLists.txt b/src/esp32s3/CMakeLists.txt index 829e8c6..f251e41 100644 --- a/src/esp32s3/CMakeLists.txt +++ b/src/esp32s3/CMakeLists.txt @@ -11,3 +11,4 @@ target_include_directories(${ESP_TARGET_LIB} ) target_link_options(${ESP_TARGET_LIB} PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32s3.rom.ld) +target_link_options(${ESP_TARGET_LIB} PUBLIC -T${CMAKE_CURRENT_LIST_DIR}/ld/esp32s3.rom.libc.ld) diff --git a/src/esp32s3/ld/esp32s3.rom.libc.ld b/src/esp32s3/ld/esp32s3.rom.libc.ld new file mode 100644 index 0000000..4fb6fb0 --- /dev/null +++ b/src/esp32s3/ld/esp32s3.rom.libc.ld @@ -0,0 +1,61 @@ +esp_rom_newlib_init_common_mutexes = 0x400011dc; +memset = 0x400011e8; +memcpy = 0x400011f4; +memmove = 0x40001200; +memcmp = 0x4000120c; +strcpy = 0x40001218; +strncpy = 0x40001224; +strcmp = 0x40001230; +strncmp = 0x4000123c; +strlen = 0x40001248; +strstr = 0x40001254; +bzero = 0x40001260; +sbrk = 0x40001278; +isalnum = 0x40001284; +isalpha = 0x40001290; +isascii = 0x4000129c; +isblank = 0x400012a8; +iscntrl = 0x400012b4; +isdigit = 0x400012c0; +islower = 0x400012cc; +isgraph = 0x400012d8; +isprint = 0x400012e4; +ispunct = 0x400012f0; +isspace = 0x400012fc; +isupper = 0x40001308; +toupper = 0x40001314; +tolower = 0x40001320; +toascii = 0x4000132c; +memccpy = 0x40001338; +memchr = 0x40001344; +memrchr = 0x40001350; +strcasecmp = 0x4000135c; +strcasestr = 0x40001368; +strcat = 0x40001374; +strchr = 0x4000138c; +strcspn = 0x40001398; +strcoll = 0x400013a4; +strlcat = 0x400013b0; +strlcpy = 0x400013bc; +strlwr = 0x400013c8; +strncasecmp = 0x400013d4; +strncat = 0x400013e0; +strnlen = 0x400013f8; +strrchr = 0x40001404; +strsep = 0x40001410; +strspn = 0x4000141c; +strtok_r = 0x40001428; +strupr = 0x40001434; +longjmp = 0x40001440; +setjmp = 0x4000144c; +abs = 0x40001458; +div = 0x40001464; +labs = 0x40001470; +ldiv = 0x4000147c; +qsort = 0x40001488; +rand_r = 0x40001494; +utoa = 0x400014b8; +itoa = 0x400014c4; +/* Data (.data, .bss, .rodata) */ +syscall_table_ptr = 0x3fceffd4; +_global_impure_ptr = 0x3fceffd0;