mirror of
https://github.com/espressif/esp-idf
synced 2025-03-06 22:59:09 -05:00
feat(newlib): add picolibc support
This commit is contained in:
parent
22a38779fb
commit
888b5f7e8d
@ -1,4 +1,4 @@
|
||||
[codespell]
|
||||
skip = build,*.yuv,components/fatfs/src/*,alice.txt,*.rgb,components/wpa_supplicant/*,components/esp_wifi/*,*.pem
|
||||
skip = build,*.yuv,components/fatfs/src/*,alice.txt,*.rgb,components/wpa_supplicant/*,components/esp_wifi/*,*.pem,components/newlib/COPYING.*
|
||||
ignore-words-list = ser,dout,rsource,fram,inout,shs,ans,aci,unstall,unstalling,hart,wheight,wel,ot,fane,assertIn,registr,oen,parms
|
||||
write-changes = true
|
||||
|
@ -14,6 +14,7 @@ repos:
|
||||
# 2 - any file matching *test*/*expected* (for host tests, if possible use this naming pattern always)
|
||||
# 3 - any directory named 'testdata'
|
||||
# 4 - protobuf auto-generated files
|
||||
# 5 - COPYING files
|
||||
exclude: &whitespace_excludes |
|
||||
(?x)^(
|
||||
.+\.(md|rst|map|bin)|
|
||||
@ -23,7 +24,8 @@ repos:
|
||||
.*.pb-c.h|
|
||||
.*.pb-c.c|
|
||||
.*.yuv|
|
||||
.*.rgb
|
||||
.*.rgb|
|
||||
.*COPYING.*
|
||||
)$
|
||||
- id: end-of-file-fixer
|
||||
exclude: *whitespace_excludes
|
||||
|
1
Kconfig
1
Kconfig
@ -696,3 +696,4 @@ mainmenu "Espressif IoT Development Framework Configuration"
|
||||
- CONFIG_ESP_WIFI_ENABLE_ROAMING_APP
|
||||
- CONFIG_USB_HOST_EXT_PORT_SUPPORT_LS
|
||||
- CONFIG_USB_HOST_EXT_PORT_RESET_ATTEMPTS
|
||||
- CONFIG_LIBC_PICOLIBC
|
||||
|
@ -134,8 +134,10 @@ static int selected_boot_partition(const bootloader_state_t *bs)
|
||||
return boot_index;
|
||||
}
|
||||
|
||||
#if CONFIG_LIBC_NEWLIB
|
||||
// Return global reent struct if any newlib functions are linked to bootloader
|
||||
struct _reent *__getreent(void)
|
||||
{
|
||||
return _GLOBAL_REENT;
|
||||
}
|
||||
#endif
|
||||
|
@ -20,6 +20,7 @@
|
||||
#define _HASH_MAP_H_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
struct hash_map_t;
|
||||
|
@ -112,7 +112,8 @@
|
||||
// On Linux, we don't need __fbufsize (see comments below), and
|
||||
// __fbufsize not available on MacOS (which is also considered "Linux" target)
|
||||
#include <stdio_ext.h> // for __fbufsize
|
||||
#endif
|
||||
#endif // !CONFIG_IDF_TARGET_LINUX
|
||||
#include <stddef.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@ -226,10 +227,15 @@ static void flushWrite(void) {
|
||||
// Performance on Linux is not considered as critical as on chip targets. Additionally,
|
||||
// MacOS does not have __fbufsize.
|
||||
#if !CONFIG_IDF_TARGET_LINUX
|
||||
if (__fbufsize(stdout) > 0) {
|
||||
#if CONFIG_LIBC_PICOLIBC
|
||||
if (((struct __file_bufio *)(stdout))->len > 0)
|
||||
#else // CONFIG_LIBC_PICOLIBC
|
||||
if (__fbufsize(stdout) > 0)
|
||||
#endif // CONFIG_LIBC_PICOLIBC
|
||||
{
|
||||
fflush(stdout);
|
||||
}
|
||||
#endif
|
||||
#endif // !CONFIG_IDF_TARGET_LINUX
|
||||
fsync(fileno(stdout));
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#include <sys/lock.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "esp_log.h"
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "unity.h"
|
||||
#include "unity_test_utils.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_newlib.h"
|
||||
|
||||
// Some resources are lazy allocated in the TWAI driver, the threshold is left for that case
|
||||
#define TEST_MEMORY_LEAK_THRESHOLD (200)
|
||||
|
@ -17,6 +17,7 @@
|
||||
#else
|
||||
#include "sha/sha_block.h"
|
||||
#endif
|
||||
#include "esp_newlib.h"
|
||||
|
||||
#if SOC_SHA_SUPPORT_SHA512
|
||||
#define SHA_TYPE SHA2_512
|
||||
|
@ -4,6 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <sys/lock.h>
|
||||
#include <sys/param.h>
|
||||
#include "hal/gpio_ll.h"
|
||||
#include "hal/cam_ll.h"
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "unity_test_runner.h"
|
||||
#include "unity_test_utils.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_newlib.h"
|
||||
|
||||
// Some resources are lazy allocated in gpio/rtcio driver, the threshold is left for that case
|
||||
#define TEST_MEMORY_LEAK_THRESHOLD (100)
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "unity.h"
|
||||
#include "unity_test_utils.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_newlib.h"
|
||||
|
||||
// Some resources are lazy allocated in the driver, the threshold is left for that case
|
||||
#define TEST_MEMORY_LEAK_THRESHOLD (300)
|
||||
|
@ -4,6 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <sys/lock.h>
|
||||
#include "esp_check.h"
|
||||
#include "esp_clk_tree.h"
|
||||
#include "esp_private/esp_clk_tree_common.h"
|
||||
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include <sys/lock.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "sdkconfig.h"
|
||||
|
@ -4,6 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/param.h>
|
||||
#include "esp_types.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "unity.h"
|
||||
#include "unity_test_utils.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_newlib.h"
|
||||
|
||||
// Some resources are lazy allocated in LEDC driver, the threshold is left for that case
|
||||
// This leak is large since LEDC driver does not provide channel delete mechanism
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "unity_test_runner.h"
|
||||
#include "unity_test_utils.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_newlib.h"
|
||||
|
||||
// Some resources are lazy allocated in pulse_cnt driver, the threshold is left for that case
|
||||
#define TEST_MEMORY_LEAK_THRESHOLD (400)
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/lock.h>
|
||||
#include "sdkconfig.h"
|
||||
#include "driver/ppa.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "unity.h"
|
||||
#include "unity_test_runner.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_newlib.h"
|
||||
#include "unity_test_utils.h"
|
||||
|
||||
// Some resources are lazy allocated in the driver, the threshold is left for that case
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "unity_test_runner.h"
|
||||
#include "unity_test_utils.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_newlib.h"
|
||||
|
||||
// Some resources are lazy allocated in RMT driver, so we reserved this threadhold when checking memory leak
|
||||
// A better way to check a potential memory leak is running a same case by twice, for the second time, the memory usage delta should be zero
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "unity.h"
|
||||
#include "unity_test_utils.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_newlib.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#define TEST_MEMORY_LEAK_THRESHOLD (300)
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "unity.h"
|
||||
#include "unity_test_utils.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_newlib.h"
|
||||
|
||||
// iterator to load partition tables in `test spi bus lock, with flash` will lead memory not free
|
||||
#define TEST_MEMORY_LEAK_THRESHOLD (350)
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "unity.h"
|
||||
#include "unity_test_utils.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_newlib.h"
|
||||
|
||||
#define TEST_MEMORY_LEAK_THRESHOLD (200)
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "unity.h"
|
||||
#include "unity_test_utils.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_newlib.h"
|
||||
|
||||
#define TEST_MEMORY_LEAK_THRESHOLD (200)
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "unity.h"
|
||||
#include "unity_test_utils.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_newlib.h"
|
||||
|
||||
#define TEST_MEMORY_LEAK_THRESHOLD (200)
|
||||
|
||||
|
@ -27,17 +27,17 @@
|
||||
// Token signifying that no character is available
|
||||
#define NONE -1
|
||||
|
||||
#if CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF
|
||||
#if CONFIG_LIBC_STDOUT_LINE_ENDING_CRLF
|
||||
# define DEFAULT_TX_MODE ESP_LINE_ENDINGS_CRLF
|
||||
#elif CONFIG_NEWLIB_STDOUT_LINE_ENDING_CR
|
||||
#elif CONFIG_LIBC_STDOUT_LINE_ENDING_CR
|
||||
# define DEFAULT_TX_MODE ESP_LINE_ENDINGS_CR
|
||||
#else
|
||||
# define DEFAULT_TX_MODE ESP_LINE_ENDINGS_LF
|
||||
#endif
|
||||
|
||||
#if CONFIG_NEWLIB_STDIN_LINE_ENDING_CRLF
|
||||
#if CONFIG_LIBC_STDIN_LINE_ENDING_CRLF
|
||||
# define DEFAULT_RX_MODE ESP_LINE_ENDINGS_CRLF
|
||||
#elif CONFIG_NEWLIB_STDIN_LINE_ENDING_CR
|
||||
#elif CONFIG_LIBC_STDIN_LINE_ENDING_CR
|
||||
# define DEFAULT_RX_MODE ESP_LINE_ENDINGS_CR
|
||||
#else
|
||||
# define DEFAULT_RX_MODE ESP_LINE_ENDINGS_LF
|
||||
@ -226,6 +226,8 @@ static int uart_rx_char_via_driver(int fd)
|
||||
static ssize_t uart_write(int fd, const void * data, size_t size)
|
||||
{
|
||||
assert(fd >= 0 && fd < 3);
|
||||
tx_func_t tx_func = s_ctx[fd]->tx_func;
|
||||
esp_line_endings_t tx_mode = s_ctx[fd]->tx_mode;
|
||||
const char *data_c = (const char *)data;
|
||||
/* Even though newlib does stream locking on each individual stream, we need
|
||||
* a dedicated UART lock if two streams (stdout and stderr) point to the
|
||||
@ -234,13 +236,13 @@ static ssize_t uart_write(int fd, const void * data, size_t size)
|
||||
_lock_acquire_recursive(&s_ctx[fd]->write_lock);
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
int c = data_c[i];
|
||||
if (c == '\n' && s_ctx[fd]->tx_mode != ESP_LINE_ENDINGS_LF) {
|
||||
s_ctx[fd]->tx_func(fd, '\r');
|
||||
if (s_ctx[fd]->tx_mode == ESP_LINE_ENDINGS_CR) {
|
||||
if (c == '\n' && tx_mode != ESP_LINE_ENDINGS_LF) {
|
||||
tx_func(fd, '\r');
|
||||
if (tx_mode == ESP_LINE_ENDINGS_CR) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
s_ctx[fd]->tx_func(fd, c);
|
||||
tx_func(fd, c);
|
||||
}
|
||||
_lock_release_recursive(&s_ctx[fd]->write_lock);
|
||||
return size;
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "unity_test_runner.h"
|
||||
#include "unity_test_utils.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_newlib.h"
|
||||
|
||||
#define TEST_MEMORY_LEAK_THRESHOLD (200)
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "unity_test_runner.h"
|
||||
#include "unity_test_utils.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_newlib.h"
|
||||
|
||||
#define TEST_MEMORY_LEAK_THRESHOLD (212)
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "unity.h"
|
||||
#include "unity_test_utils.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_newlib.h"
|
||||
|
||||
// Some resources are lazy allocated, the threadhold is left for that case
|
||||
#define TEST_MEMORY_LEAK_THRESHOLD (500)
|
||||
|
@ -35,17 +35,17 @@
|
||||
// Token signifying that no character is available
|
||||
#define NONE -1
|
||||
|
||||
#if CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF
|
||||
#if CONFIG_LIBC_STDOUT_LINE_ENDING_CRLF
|
||||
# define DEFAULT_TX_MODE ESP_LINE_ENDINGS_CRLF
|
||||
#elif CONFIG_NEWLIB_STDOUT_LINE_ENDING_CR
|
||||
#elif CONFIG_LIBC_STDOUT_LINE_ENDING_CR
|
||||
# define DEFAULT_TX_MODE ESP_LINE_ENDINGS_CR
|
||||
#else
|
||||
# define DEFAULT_TX_MODE ESP_LINE_ENDINGS_LF
|
||||
#endif
|
||||
|
||||
#if CONFIG_NEWLIB_STDIN_LINE_ENDING_CRLF
|
||||
#if CONFIG_LIBC_STDIN_LINE_ENDING_CRLF
|
||||
# define DEFAULT_RX_MODE ESP_LINE_ENDINGS_CRLF
|
||||
#elif CONFIG_NEWLIB_STDIN_LINE_ENDING_CR
|
||||
#elif CONFIG_LIBC_STDIN_LINE_ENDING_CR
|
||||
# define DEFAULT_RX_MODE ESP_LINE_ENDINGS_CR
|
||||
#else
|
||||
# define DEFAULT_RX_MODE ESP_LINE_ENDINGS_LF
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "unity.h"
|
||||
#include "unity_test_utils.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_newlib.h"
|
||||
|
||||
// Some resources are lazy allocated, the threadhold is left for that case
|
||||
#define TEST_MEMORY_LEAK_THRESHOLD (500)
|
||||
|
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "sys/reent.h"
|
||||
#include "esp_gdbstub.h"
|
||||
#include "esp_gdbstub_common.h"
|
||||
#include "esp_gdbstub_memory_regions.h"
|
||||
@ -21,6 +22,7 @@
|
||||
#include "hal/wdt_hal.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#ifdef CONFIG_ESP_GDBSTUB_SUPPORT_TASKS
|
||||
static inline int gdb_tid_to_task_index(int tid);
|
||||
@ -41,7 +43,6 @@ static bool command_name_matches(const char *pattern, const unsigned char *ucmd,
|
||||
#endif // (CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME || CONFIG_ESP_GDBSTUB_SUPPORT_TASKS)
|
||||
|
||||
static void send_reason(void);
|
||||
static char gdb_packet(char *dest_buff, char *src_buff, int len);
|
||||
|
||||
esp_gdbstub_scratch_t s_scratch;
|
||||
esp_gdbstub_gdb_regfile_t *gdb_local_regfile = &s_scratch.regfile;
|
||||
@ -237,8 +238,12 @@ void gdbstub_handle_uart_int(esp_gdbstub_frame_t *regs_frame)
|
||||
if (doDebug) {
|
||||
process_gdb_kill = false;
|
||||
/* To enable console output in GDB, we replace the default stdout->_write function */
|
||||
#if CONFIG_LIBC_NEWLIB
|
||||
stdout->_write = gdbstub__swrite;
|
||||
stderr->_write = gdbstub__swrite;
|
||||
#else
|
||||
// TODO IDF-11287
|
||||
#endif
|
||||
/* Stall other core until GDB exit */
|
||||
esp_gdbstub_stall_other_cpus_start();
|
||||
#ifdef CONFIG_ESP_GDBSTUB_SUPPORT_TASKS
|
||||
@ -753,8 +758,12 @@ int esp_gdbstub_handle_command(unsigned char *cmd, int len)
|
||||
} else if (cmd[0] == 'k') {
|
||||
/* Kill GDB and continue without */
|
||||
/* By exit from GDB we have to replcae stdout->_write back */
|
||||
#if CONFIG_LIBC_NEWLIB
|
||||
stdout->_write = __swrite;
|
||||
stderr->_write = __swrite;
|
||||
#else
|
||||
// TODO IDF-11287
|
||||
#endif
|
||||
process_gdb_kill = true;
|
||||
return GDBSTUB_ST_CONT;
|
||||
} else if (cmd[0] == 's') {
|
||||
@ -784,6 +793,35 @@ int esp_gdbstub_handle_command(unsigned char *cmd, int len)
|
||||
}
|
||||
return GDBSTUB_ST_OK;
|
||||
}
|
||||
|
||||
#if CONFIG_LIBC_NEWLIB
|
||||
/** @brief Convert to ASCI
|
||||
* Function convert byte value to two ASCI carecters
|
||||
*/
|
||||
void gdb_get_asci_char(unsigned char data, char *buff)
|
||||
{
|
||||
const char *hex_chars = "0123456789abcdef";
|
||||
buff[0] = hex_chars[(data >> 4) & 0x0f];
|
||||
buff[1] = hex_chars[(data) & 0x0f];
|
||||
}
|
||||
|
||||
/** @brief Prepare GDB packet
|
||||
* Function build GDB asci packet and return checksum
|
||||
*
|
||||
* Return checksum
|
||||
*/
|
||||
char gdb_packet(char *dest_buff, char *src_buff, int len)
|
||||
{
|
||||
char s_chsum = 0;
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
gdb_get_asci_char(src_buff[i], &dest_buff[i * 2 + 0]);
|
||||
}
|
||||
for (size_t i = 0; i < len * 2; i++) {
|
||||
s_chsum += dest_buff[i];
|
||||
}
|
||||
return s_chsum;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace standard __swrite function for GDB
|
||||
*/
|
||||
@ -813,38 +851,12 @@ int gdbstub__swrite(struct _reent *data1, void *data2, const char *buff, int len
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
/** @brief Convert to ASCI
|
||||
* Function convert byte value to two ASCI carecters
|
||||
*/
|
||||
void gdb_get_asci_char(unsigned char data, char *buff)
|
||||
{
|
||||
const char *hex_chars = "0123456789abcdef";
|
||||
buff[0] = hex_chars[(data >> 4) & 0x0f];
|
||||
buff[1] = hex_chars[(data) & 0x0f];
|
||||
}
|
||||
|
||||
#else
|
||||
// TODO IDF-11287
|
||||
#endif // CONFIG_LIBC_NEWLIB
|
||||
|
||||
/* Everything below is related to the support for listing FreeRTOS tasks as threads in GDB */
|
||||
|
||||
/** @brief Prepare GDB packet
|
||||
* Function build GDB asci packet and return checksum
|
||||
*
|
||||
* Return checksum
|
||||
*/
|
||||
char gdb_packet(char *dest_buff, char *src_buff, int len)
|
||||
{
|
||||
char s_chsum = 0;
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
gdb_get_asci_char(src_buff[i], &dest_buff[i * 2 + 0]);
|
||||
}
|
||||
for (size_t i = 0; i < len * 2; i++) {
|
||||
s_chsum += dest_buff[i];
|
||||
}
|
||||
return s_chsum;
|
||||
}
|
||||
|
||||
#if (CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME || CONFIG_ESP_GDBSTUB_SUPPORT_TASKS)
|
||||
static bool command_name_matches(const char *pattern, const unsigned char *ucmd, int len)
|
||||
{
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "unity.h"
|
||||
#include "unity_test_runner.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_newlib.h"
|
||||
#include "unity_test_utils.h"
|
||||
|
||||
// Some resources are lazy allocated in the driver, the threshold is left for that case
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "unity.h"
|
||||
#include "unity_test_utils.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_newlib.h"
|
||||
|
||||
// load partition table in tests will use memory
|
||||
#define TEST_MEMORY_LEAK_THRESHOLD (450)
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "unity.h"
|
||||
#include "unity_test_utils.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_newlib.h"
|
||||
|
||||
// load partition table in tests will use memory
|
||||
#define TEST_MEMORY_LEAK_THRESHOLD (450)
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
@ -101,7 +102,7 @@ void esp_netif_sntp_deinit(void);
|
||||
/**
|
||||
* @brief Wait for time sync event
|
||||
* @param tout Specified timeout in RTOS ticks
|
||||
* @return ESP_TIMEOUT if sync event didn't came withing the timeout
|
||||
* @return ESP_TIMEOUT if sync event didn't came within the timeout
|
||||
* ESP_ERR_NOT_FINISHED if the sync event came, but we're in smooth update mode and still in progress (SNTP_SYNC_STATUS_IN_PROGRESS)
|
||||
* ESP_OK if time sync'ed
|
||||
*/
|
||||
|
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <sys/lock.h>
|
||||
#include "esp_phy_init.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "sys/lock.h"
|
||||
#include "esp_check.h"
|
||||
#include "esp_log.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
@ -147,22 +147,30 @@ if(BOOTLOADER_BUILD)
|
||||
|
||||
if(CONFIG_ESP_ROM_HAS_NEWLIB)
|
||||
if(target STREQUAL "esp32" OR target STREQUAL "esp32s2")
|
||||
rom_linker_script("newlib-funcs")
|
||||
rom_linker_script("libc-funcs")
|
||||
else()
|
||||
rom_linker_script("newlib")
|
||||
rom_linker_script("libc")
|
||||
if(CONFIG_LIBC_NEWLIB)
|
||||
rom_linker_script("newlib")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
else() # Regular app build
|
||||
if(target STREQUAL "esp32")
|
||||
rom_linker_script("newlib-data")
|
||||
rom_linker_script("syscalls")
|
||||
if(CONFIG_LIBC_NEWLIB)
|
||||
rom_linker_script("newlib-data")
|
||||
rom_linker_script("syscalls")
|
||||
endif()
|
||||
|
||||
if(NOT CONFIG_SPIRAM_CACHE_WORKAROUND)
|
||||
# ESP32 only: these ROM functions may only be used if PSRAM cache workaround is disabled.
|
||||
# Otherwise we need to link to a multilib version of libc compiled with PSRAM workaround.
|
||||
rom_linker_script("newlib-funcs")
|
||||
rom_linker_script("libc-funcs")
|
||||
if(CONFIG_LIBC_NEWLIB)
|
||||
rom_linker_script("newlib-reent-funcs")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT CONFIG_SPI_FLASH_ROM_DRIVER_PATCH)
|
||||
@ -175,8 +183,11 @@ else() # Regular app build
|
||||
endif()
|
||||
|
||||
elseif(target STREQUAL "esp32s2")
|
||||
rom_linker_script("newlib-funcs")
|
||||
rom_linker_script("newlib-data")
|
||||
rom_linker_script("libc-funcs")
|
||||
if(CONFIG_LIBC_NEWLIB)
|
||||
rom_linker_script("newlib-reent-funcs")
|
||||
rom_linker_script("newlib-data")
|
||||
endif()
|
||||
|
||||
# For ESP32S2, inclusion of ROM driver do not depend on CONFIG_SPI_FLASH_ROM_IMPL
|
||||
rom_linker_script("spiflash_legacy")
|
||||
@ -282,9 +293,12 @@ else() # Regular app build
|
||||
|
||||
if(CONFIG_ESP_ROM_HAS_NEWLIB AND NOT target STREQUAL "esp32" AND NOT target STREQUAL "esp32s2")
|
||||
# ESP32 and S2 are a bit different, keep them as special cases in the target specific include section
|
||||
rom_linker_script("newlib")
|
||||
rom_linker_script("libc")
|
||||
if(CONFIG_LIBC_NEWLIB)
|
||||
rom_linker_script("newlib")
|
||||
endif()
|
||||
|
||||
if(CONFIG_ESP_ROM_HAS_NEWLIB_NANO_FORMAT AND CONFIG_NEWLIB_NANO_FORMAT)
|
||||
if(CONFIG_ESP_ROM_HAS_NEWLIB_NANO_FORMAT AND CONFIG_LIBC_NEWLIB AND CONFIG_NEWLIB_NANO_FORMAT)
|
||||
if(NOT CONFIG_ESP_ROM_HAS_NEWLIB_32BIT_TIME AND NOT CONFIG_ESP_ROM_HAS_NEWLIB_NANO_PRINTF_FLOAT_BUG)
|
||||
# Newlib-nano functions contains time_t related functions
|
||||
# and cannot be used if they were compiled with 32 bit time_t
|
||||
@ -292,7 +306,7 @@ else() # Regular app build
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CONFIG_ESP_ROM_HAS_NEWLIB_NORMAL_FORMAT AND NOT CONFIG_NEWLIB_NANO_FORMAT)
|
||||
if(CONFIG_ESP_ROM_HAS_NEWLIB_NORMAL_FORMAT AND CONFIG_LIBC_NEWLIB AND NOT CONFIG_NEWLIB_NANO_FORMAT)
|
||||
rom_linker_script("newlib-normal")
|
||||
endif()
|
||||
endif()
|
||||
|
@ -1,3 +1,8 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.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
|
||||
@ -13,33 +18,10 @@
|
||||
*/
|
||||
|
||||
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;
|
||||
@ -65,23 +47,8 @@ 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;
|
||||
@ -90,8 +57,6 @@ strcmp = 0x40001274;
|
||||
strcoll = 0x40001398;
|
||||
strcpy = 0x400013ac;
|
||||
strcspn = 0x4000c558;
|
||||
strdup = 0x4000143c;
|
||||
_strdup_r = 0x40001450;
|
||||
strlcat = 0x40001470;
|
||||
strlcpy = 0x4000c584;
|
||||
strlen = 0x400014c0;
|
||||
@ -100,31 +65,15 @@ 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;
|
61
components/esp_rom/esp32/ld/esp32.rom.newlib-reent-funcs.ld
Normal file
61
components/esp_rom/esp32/ld/esp32.rom.newlib-reent-funcs.ld
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
_cleanup = 0x40001df8;
|
||||
_cleanup_r = 0x40001d48;
|
||||
creat = 0x40000e8c;
|
||||
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;
|
||||
__swbuf = 0x40058cb4;
|
||||
__swbuf_r = 0x40058bec;
|
||||
__swrite = 0x40001150;
|
||||
__sread = 0x40001118;
|
||||
__sseek = 0x40001184;
|
||||
ungetc = 0x400590f4;
|
||||
_ungetc_r = 0x40058fa0;
|
||||
srand = 0x40001004;
|
||||
rand_r = 0x400010d4;
|
||||
rand = 0x40001058;
|
||||
atoi = 0x400566c4;
|
||||
_atoi_r = 0x400566d4;
|
||||
atol = 0x400566ec;
|
||||
_atol_r = 0x400566fc;
|
||||
strdup = 0x4000143c;
|
||||
_strdup_r = 0x40001450;
|
||||
strndup = 0x400016b0;
|
||||
_strndup_r = 0x400016c4;
|
||||
__strtok_r = 0x4000c6a8;
|
||||
strtok_r = 0x4000c70c;
|
||||
strtol = 0x4005681c;
|
||||
_strtol_r = 0x40056714;
|
||||
strtoul = 0x4005692c;
|
||||
_strtoul_r = 0x40056834;
|
||||
__ascii_wctomb = 0x40058ef0;
|
||||
__sclose = 0x400011b8;
|
||||
__seofread = 0x40001148;
|
||||
wcrtomb = 0x40058920;
|
||||
_wcrtomb_r = 0x400588d8;
|
||||
_wctomb_r = 0x40058f14;
|
||||
__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;
|
||||
__env_lock = 0x40001fd4;
|
||||
__env_unlock = 0x40001fe0;
|
||||
_getenv_r = 0x40001fbc;
|
90
components/esp_rom/esp32c2/ld/esp32c2.rom.libc.ld
Normal file
90
components/esp_rom/esp32c2/ld/esp32c2.rom.libc.ld
Normal file
@ -0,0 +1,90 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
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;
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -10,77 +10,23 @@
|
||||
*
|
||||
* Compatible with ROM where ECO version equal or greater to 1.
|
||||
*
|
||||
* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
* THIS FILE WAS AUTOMATICALLY GENERATED. !!! BUT EDITED !!!
|
||||
* The file was originally generated for use with newlib, but it was split into
|
||||
* multiple files to make it compatible with picolibc.
|
||||
*/
|
||||
|
||||
|
||||
/***************************************
|
||||
Group newlib
|
||||
***************************************/
|
||||
|
||||
/* Functions */
|
||||
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;
|
||||
_isatty_r = 0x400004b4;
|
||||
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;
|
||||
strdup = 0x40000510;
|
||||
strchr = 0x40000514;
|
||||
strcspn = 0x40000518;
|
||||
strcoll = 0x4000051c;
|
||||
strlcat = 0x40000520;
|
||||
strlcpy = 0x40000524;
|
||||
strlwr = 0x40000528;
|
||||
strncasecmp = 0x4000052c;
|
||||
strncat = 0x40000530;
|
||||
strndup = 0x40000534;
|
||||
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;
|
||||
rand_r = 0x4000056c;
|
||||
rand = 0x40000570;
|
||||
srand = 0x40000574;
|
||||
utoa = 0x40000578;
|
||||
itoa = 0x4000057c;
|
||||
atoi = 0x40000580;
|
||||
atol = 0x40000584;
|
||||
strtol = 0x40000588;
|
||||
@ -104,29 +50,6 @@ _strtol_r = 0x400005cc;
|
||||
strtol_l = 0x400005d0;
|
||||
_strtoul_r = 0x400005d4;
|
||||
strtoul_l = 0x400005d8;
|
||||
__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;
|
||||
asctime = 0x40000638;
|
||||
asctime_r = 0x4000063c;
|
||||
atof = 0x40000640;
|
||||
@ -139,9 +62,4 @@ __ascii_mbtowc = 0x40000658;
|
||||
puts = 0x4000065c;
|
||||
putc = 0x40000660;
|
||||
putchar = 0x40000664;
|
||||
nan = 0x40000668;
|
||||
nanf = 0x4000066c;
|
||||
__errno = 0x40000670;
|
||||
/* Data (.data, .bss, .rodata) */
|
||||
syscall_table_ptr = 0x3fcdffd8;
|
||||
_global_impure_ptr = 0x3fcdffd4;
|
||||
|
65
components/esp_rom/esp32c3/ld/esp32c3.rom.libc.ld
Normal file
65
components/esp_rom/esp32c3/ld/esp32c3.rom.libc.ld
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
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;
|
@ -1,3 +1,8 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
/* ROM function interface esp32c3.rom.newlib.ld for esp32c3
|
||||
*
|
||||
*
|
||||
@ -5,7 +10,9 @@
|
||||
*
|
||||
* Compatible with ROM where ECO version equal or greater to 0.
|
||||
*
|
||||
* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
* THIS FILE WAS AUTOMATICALLY GENERATED. !!! BUT EDITED !!!
|
||||
* The file was originally generated for use with newlib, but it was split into
|
||||
* multiple files to make it compatible with picolibc.
|
||||
*/
|
||||
|
||||
/***************************************
|
||||
@ -13,68 +20,11 @@
|
||||
***************************************/
|
||||
|
||||
/* Functions */
|
||||
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;
|
||||
strdup = 0x400003dc;
|
||||
strchr = 0x400003e0;
|
||||
strcspn = 0x400003e4;
|
||||
strcoll = 0x400003e8;
|
||||
strlcat = 0x400003ec;
|
||||
strlcpy = 0x400003f0;
|
||||
strlwr = 0x400003f4;
|
||||
strncasecmp = 0x400003f8;
|
||||
strncat = 0x400003fc;
|
||||
strndup = 0x40000400;
|
||||
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;
|
||||
rand_r = 0x40000438;
|
||||
rand = 0x4000043c;
|
||||
srand = 0x40000440;
|
||||
utoa = 0x40000444;
|
||||
itoa = 0x40000448;
|
||||
atoi = 0x4000044c;
|
||||
atol = 0x40000450;
|
||||
strtol = 0x40000454;
|
||||
@ -85,6 +35,3 @@ PROVIDE( _fwalk = 0x40000464 );
|
||||
PROVIDE( _fwalk_reent = 0x40000468 );
|
||||
PROVIDE( __swbuf_r = 0x40000474 );
|
||||
__swbuf = 0x40000478;
|
||||
/* Data (.data, .bss, .rodata) */
|
||||
syscall_table_ptr = 0x3fcdffe0;
|
||||
_global_impure_ptr = 0x3fcdffdc;
|
||||
|
65
components/esp_rom/esp32c5/ld/esp32c5.rom.libc.ld
Normal file
65
components/esp_rom/esp32c5/ld/esp32c5.rom.libc.ld
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
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;
|
@ -10,7 +10,9 @@
|
||||
*
|
||||
* Compatible with ROM where ECO version equal or greater to 0.
|
||||
*
|
||||
* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
* THIS FILE WAS AUTOMATICALLY GENERATED. !!! BUT EDITED !!!
|
||||
* The file was originally generated for use with newlib, but it was split into
|
||||
* multiple files to make it compatible with picolibc.
|
||||
*/
|
||||
|
||||
/***************************************
|
||||
@ -18,69 +20,12 @@
|
||||
***************************************/
|
||||
|
||||
/* Functions */
|
||||
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;
|
||||
_isatty_r = 0x400004e4;
|
||||
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;
|
||||
strdup = 0x40000540;
|
||||
strchr = 0x40000544;
|
||||
strcspn = 0x40000548;
|
||||
strcoll = 0x4000054c;
|
||||
strlcat = 0x40000550;
|
||||
strlcpy = 0x40000554;
|
||||
strlwr = 0x40000558;
|
||||
strncasecmp = 0x4000055c;
|
||||
strncat = 0x40000560;
|
||||
strndup = 0x40000564;
|
||||
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;
|
||||
rand_r = 0x4000059c;
|
||||
rand = 0x400005a0;
|
||||
srand = 0x400005a4;
|
||||
utoa = 0x400005a8;
|
||||
itoa = 0x400005ac;
|
||||
atoi = 0x400005b0;
|
||||
atol = 0x400005b4;
|
||||
strtol = 0x400005b8;
|
||||
@ -94,6 +39,3 @@ __swhatbuf_r = 0x400005d4;
|
||||
__swbuf_r = 0x400005d8;
|
||||
__swbuf = 0x400005dc;
|
||||
__swsetup_r = 0x400005e0;
|
||||
/* Data (.data, .bss, .rodata) */
|
||||
syscall_table_ptr = 0x4085ffd4;
|
||||
_global_impure_ptr = 0x4085ffd0;
|
||||
|
65
components/esp_rom/esp32c6/ld/esp32c6.rom.libc.ld
Normal file
65
components/esp_rom/esp32c6/ld/esp32c6.rom.libc.ld
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
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;
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -10,7 +10,9 @@
|
||||
*
|
||||
* Compatible with ROM where ECO version equal or greater to 0.
|
||||
*
|
||||
* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
* THIS FILE WAS AUTOMATICALLY GENERATED. !!! BUT EDITED !!!
|
||||
* The file was originally generated for use with newlib, but it was split into
|
||||
* multiple files to make it compatible with picolibc.
|
||||
*/
|
||||
|
||||
/***************************************
|
||||
@ -18,69 +20,12 @@
|
||||
***************************************/
|
||||
|
||||
/* Functions */
|
||||
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;
|
||||
_isatty_r = 0x400004d4;
|
||||
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;
|
||||
strdup = 0x40000530;
|
||||
strchr = 0x40000534;
|
||||
strcspn = 0x40000538;
|
||||
strcoll = 0x4000053c;
|
||||
strlcat = 0x40000540;
|
||||
strlcpy = 0x40000544;
|
||||
strlwr = 0x40000548;
|
||||
strncasecmp = 0x4000054c;
|
||||
strncat = 0x40000550;
|
||||
strndup = 0x40000554;
|
||||
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;
|
||||
rand_r = 0x4000058c;
|
||||
rand = 0x40000590;
|
||||
srand = 0x40000594;
|
||||
utoa = 0x40000598;
|
||||
itoa = 0x4000059c;
|
||||
atoi = 0x400005a0;
|
||||
atol = 0x400005a4;
|
||||
strtol = 0x400005a8;
|
||||
@ -94,6 +39,3 @@ __swhatbuf_r = 0x400005c4;
|
||||
__swbuf_r = 0x400005c8;
|
||||
__swbuf = 0x400005cc;
|
||||
__swsetup_r = 0x400005d0;
|
||||
/* Data (.data, .bss, .rodata) */
|
||||
syscall_table_ptr = 0x4087ffd4;
|
||||
_global_impure_ptr = 0x4087ffd0;
|
||||
|
65
components/esp_rom/esp32c61/ld/esp32c61.rom.libc.ld
Normal file
65
components/esp_rom/esp32c61/ld/esp32c61.rom.libc.ld
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
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;
|
@ -10,7 +10,9 @@
|
||||
*
|
||||
* Compatible with ROM where ECO version equal or greater to 0.
|
||||
*
|
||||
* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
* THIS FILE WAS AUTOMATICALLY GENERATED. !!! BUT EDITED !!!
|
||||
* The file was originally generated for use with newlib, but it was split into
|
||||
* multiple files to make it compatible with picolibc.
|
||||
*/
|
||||
|
||||
/***************************************
|
||||
@ -18,69 +20,12 @@
|
||||
***************************************/
|
||||
|
||||
/* Functions */
|
||||
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;
|
||||
_isatty_r = 0x400004e4;
|
||||
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;
|
||||
strdup = 0x40000540;
|
||||
strchr = 0x40000544;
|
||||
strcspn = 0x40000548;
|
||||
strcoll = 0x4000054c;
|
||||
strlcat = 0x40000550;
|
||||
strlcpy = 0x40000554;
|
||||
strlwr = 0x40000558;
|
||||
strncasecmp = 0x4000055c;
|
||||
strncat = 0x40000560;
|
||||
strndup = 0x40000564;
|
||||
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;
|
||||
rand_r = 0x4000059c;
|
||||
rand = 0x400005a0;
|
||||
srand = 0x400005a4;
|
||||
utoa = 0x400005a8;
|
||||
itoa = 0x400005ac;
|
||||
atoi = 0x400005b0;
|
||||
atol = 0x400005b4;
|
||||
strtol = 0x400005b8;
|
||||
@ -94,6 +39,3 @@ __swhatbuf_r = 0x400005d4;
|
||||
__swbuf_r = 0x400005d8;
|
||||
__swbuf = 0x400005dc;
|
||||
__swsetup_r = 0x400005e0;
|
||||
/* Data (.data, .bss, .rodata) */
|
||||
syscall_table_ptr = 0x4084ffd4;
|
||||
_global_impure_ptr = 0x4084ffd0;
|
||||
|
65
components/esp_rom/esp32h2/ld/esp32h2.rom.libc.ld
Normal file
65
components/esp_rom/esp32h2/ld/esp32h2.rom.libc.ld
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
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;
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -10,7 +10,9 @@
|
||||
*
|
||||
* Compatible with ROM where ECO version equal or greater to 0.
|
||||
*
|
||||
* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
* THIS FILE WAS AUTOMATICALLY GENERATED. !!! BUT EDITED !!!
|
||||
* The file was originally generated for use with newlib, but it was split into
|
||||
* multiple files to make it compatible with picolibc.
|
||||
*/
|
||||
|
||||
/***************************************
|
||||
@ -18,69 +20,12 @@
|
||||
***************************************/
|
||||
|
||||
/* Functions */
|
||||
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;
|
||||
_isatty_r = 0x400004cc;
|
||||
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;
|
||||
strdup = 0x40000528;
|
||||
strchr = 0x4000052c;
|
||||
strcspn = 0x40000530;
|
||||
strcoll = 0x40000534;
|
||||
strlcat = 0x40000538;
|
||||
strlcpy = 0x4000053c;
|
||||
strlwr = 0x40000540;
|
||||
strncasecmp = 0x40000544;
|
||||
strncat = 0x40000548;
|
||||
strndup = 0x4000054c;
|
||||
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;
|
||||
rand_r = 0x40000584;
|
||||
rand = 0x40000588;
|
||||
srand = 0x4000058c;
|
||||
utoa = 0x40000590;
|
||||
itoa = 0x40000594;
|
||||
atoi = 0x40000598;
|
||||
atol = 0x4000059c;
|
||||
strtol = 0x400005a0;
|
||||
@ -94,6 +39,3 @@ __swhatbuf_r = 0x400005bc;
|
||||
__swbuf_r = 0x400005c0;
|
||||
__swbuf = 0x400005c4;
|
||||
__swsetup_r = 0x400005c8;
|
||||
/* Data (.data, .bss, .rodata) */
|
||||
syscall_table_ptr = 0x4084ffd4;
|
||||
_global_impure_ptr = 0x4084ffd0;
|
||||
|
65
components/esp_rom/esp32p4/ld/esp32p4.rom.libc.ld
Normal file
65
components/esp_rom/esp32p4/ld/esp32p4.rom.libc.ld
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
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;
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -10,7 +10,9 @@
|
||||
*
|
||||
* Compatible with ROM where ECO version equal or greater to 0.
|
||||
*
|
||||
* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
* THIS FILE WAS AUTOMATICALLY GENERATED. !!! BUT EDITED !!!
|
||||
* The file was originally generated for use with newlib, but it was split into
|
||||
* multiple files to make it compatible with picolibc.
|
||||
*/
|
||||
|
||||
/***************************************
|
||||
@ -18,69 +20,12 @@
|
||||
***************************************/
|
||||
|
||||
/* Functions */
|
||||
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;
|
||||
_isatty_r = 0x4fc00294;
|
||||
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;
|
||||
strdup = 0x4fc002f0;
|
||||
strchr = 0x4fc002f4;
|
||||
strcspn = 0x4fc002f8;
|
||||
strcoll = 0x4fc002fc;
|
||||
strlcat = 0x4fc00300;
|
||||
strlcpy = 0x4fc00304;
|
||||
strlwr = 0x4fc00308;
|
||||
strncasecmp = 0x4fc0030c;
|
||||
strncat = 0x4fc00310;
|
||||
strndup = 0x4fc00314;
|
||||
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;
|
||||
rand_r = 0x4fc0034c;
|
||||
rand = 0x4fc00350;
|
||||
srand = 0x4fc00354;
|
||||
utoa = 0x4fc00358;
|
||||
itoa = 0x4fc0035c;
|
||||
atoi = 0x4fc00360;
|
||||
atol = 0x4fc00364;
|
||||
strtol = 0x4fc00368;
|
||||
@ -94,6 +39,3 @@ __swhatbuf_r = 0x4fc00384;
|
||||
__swbuf_r = 0x4fc00388;
|
||||
__swbuf = 0x4fc0038c;
|
||||
__swsetup_r = 0x4fc00390;
|
||||
/* Data (.data, .bss, .rodata) */
|
||||
syscall_table_ptr = 0x4ff3ffe4;
|
||||
_global_impure_ptr = 0x4ff3ffe0;
|
||||
|
@ -11,6 +11,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
/**
|
||||
* 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.
|
||||
@ -8,24 +13,10 @@
|
||||
*/
|
||||
|
||||
abs = 0x40000618;
|
||||
__ascii_mbtowc = 0x40007a04;
|
||||
__ascii_wctomb = 0x400018d0;
|
||||
PROVIDE ( __assert = 0x4001a430 );
|
||||
PROVIDE ( __assert_func = 0x4001a408 );
|
||||
bzero = 0x400078c8;
|
||||
_cleanup_r = 0x4001a480;
|
||||
creat = 0x4000788c;
|
||||
div = 0x40000620;
|
||||
fclose = 0x4001a804;
|
||||
_fclose_r = 0x4001a714;
|
||||
fflush = 0x40001bb8;
|
||||
_fflush_r = 0x40001b30;
|
||||
__fp_unlock_all = 0x4001a64c;
|
||||
__fputwc = 0x40001770;
|
||||
fputwc = 0x40001864;
|
||||
_fputwc_r = 0x400017f8;
|
||||
_fwalk = 0x4001bcec;
|
||||
_fwalk_reent = 0x4001bd24;
|
||||
isalnum = 0x400078d8;
|
||||
isalpha = 0x400078e8;
|
||||
isascii = 0x4001aaec;
|
||||
@ -40,11 +31,7 @@ isspace = 0x400079ac;
|
||||
isupper = 0x400079c4;
|
||||
labs = 0x40000648;
|
||||
ldiv = 0x40000650;
|
||||
__locale_ctype_ptr = 0x40001c2c;
|
||||
__locale_ctype_ptr_l = 0x40001c24;
|
||||
__locale_mb_cur_max = 0x40001c0c;
|
||||
longjmp = 0x400005a4;
|
||||
_mbtowc_r = 0x400079e0;
|
||||
memccpy = 0x4001ab00;
|
||||
memchr = 0x4001ab24;
|
||||
memcmp = 0x4001ab40;
|
||||
@ -52,35 +39,14 @@ memcpy = 0x4001aba8;
|
||||
memmove = 0x4001acb0;
|
||||
memrchr = 0x4001acec;
|
||||
memset = 0x4001ad3c;
|
||||
open = 0x400080c4;
|
||||
qsort = 0x400006f4;
|
||||
rand_r = 0x40007af4;
|
||||
__sclose = 0x4001a700;
|
||||
__seofread = 0x4001a690;
|
||||
setjmp = 0x40000540;
|
||||
setlocale = 0x40001c44;
|
||||
_setlocale_r = 0x40001bdc;
|
||||
__sflush_r = 0x400019dc;
|
||||
__sfmoreglue = 0x4001a4c8;
|
||||
__sfp = 0x4001a590;
|
||||
__sfp_lock_acquire = 0x4001a508;
|
||||
__sfp_lock_release = 0x4001a514;
|
||||
__sinit = 0x4001a538;
|
||||
__sinit_lock_acquire = 0x4001a520;
|
||||
__sinit_lock_release = 0x4001a52c;
|
||||
srand = 0x40007a24;
|
||||
__sread = 0x4001a660;
|
||||
__sseek = 0x4001a6cc;
|
||||
strcasecmp = 0x40007b38;
|
||||
strcasestr = 0x40007b7c;
|
||||
strcat = 0x4001ad90;
|
||||
strchr = 0x4001adb0;
|
||||
strcmp = 0x40007be4;
|
||||
strcoll = 0x40007ce8;
|
||||
strcpy = 0x40007cfc;
|
||||
strcspn = 0x4001adcc;
|
||||
strdup = 0x40007d84;
|
||||
_strdup_r = 0x40007d98;
|
||||
strlcat = 0x40007db8;
|
||||
strlcpy = 0x4001adf8;
|
||||
strlen = 0x40007e08;
|
||||
@ -89,8 +55,6 @@ strncasecmp = 0x40007e94;
|
||||
strncat = 0x4001ae34;
|
||||
strncmp = 0x4001ae64;
|
||||
strncpy = 0x40007f20;
|
||||
strndup = 0x40007fe8;
|
||||
_strndup_r = 0x40007ffc;
|
||||
strnlen = 0x4001ae9c;
|
||||
strrchr = 0x40008040;
|
||||
strsep = 0x4000806c;
|
||||
@ -99,12 +63,6 @@ strstr = 0x4001aee8;
|
||||
__strtok_r = 0x4001af18;
|
||||
strtok_r = 0x4001af7c;
|
||||
strupr = 0x40008084;
|
||||
__swbuf = 0x4000167c;
|
||||
__swbuf_r = 0x400015bc;
|
||||
__swrite = 0x4001a698;
|
||||
toascii = 0x4001af90;
|
||||
tolower = 0x40008158;
|
||||
toupper = 0x40008174;
|
||||
wcrtomb = 0x400012f4;
|
||||
_wcrtomb_r = 0x400012a0;
|
||||
_wctomb_r = 0x400018ac;
|
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
_cleanup_r = 0x4001a480;
|
||||
creat = 0x4000788c;
|
||||
open = 0x400080c4;
|
||||
fclose = 0x4001a804;
|
||||
_fclose_r = 0x4001a714;
|
||||
fflush = 0x40001bb8;
|
||||
_fflush_r = 0x40001b30;
|
||||
__fp_unlock_all = 0x4001a64c;
|
||||
__fputwc = 0x40001770;
|
||||
fputwc = 0x40001864;
|
||||
_fputwc_r = 0x400017f8;
|
||||
_fwalk = 0x4001bcec;
|
||||
_fwalk_reent = 0x4001bd24;
|
||||
__sflush_r = 0x400019dc;
|
||||
__swbuf = 0x4000167c;
|
||||
__swbuf_r = 0x400015bc;
|
||||
__swrite = 0x4001a698;
|
||||
__sread = 0x4001a660;
|
||||
__sseek = 0x4001a6cc;
|
||||
srand = 0x40007a24;
|
||||
__ascii_mbtowc = 0x40007a04;
|
||||
__ascii_wctomb = 0x400018d0;
|
||||
_mbtowc_r = 0x400079e0;
|
||||
rand_r = 0x40007af4;
|
||||
__sclose = 0x4001a700;
|
||||
__seofread = 0x4001a690;
|
||||
setlocale = 0x40001c44;
|
||||
_setlocale_r = 0x40001bdc;
|
||||
__sfmoreglue = 0x4001a4c8;
|
||||
__sfp = 0x4001a590;
|
||||
__sfp_lock_acquire = 0x4001a508;
|
||||
__sfp_lock_release = 0x4001a514;
|
||||
__sinit = 0x4001a538;
|
||||
__sinit_lock_acquire = 0x4001a520;
|
||||
__sinit_lock_release = 0x4001a52c;
|
||||
strndup = 0x40007fe8;
|
||||
_strndup_r = 0x40007ffc;
|
||||
wcrtomb = 0x400012f4;
|
||||
_wcrtomb_r = 0x400012a0;
|
||||
_wctomb_r = 0x400018ac;
|
||||
strdup = 0x40007d84;
|
||||
_strdup_r = 0x40007d98;
|
||||
__locale_ctype_ptr = 0x40001c2c;
|
||||
__locale_ctype_ptr_l = 0x40001c24;
|
||||
__locale_mb_cur_max = 0x40001c0c;
|
||||
strcasecmp = 0x40007b38;
|
||||
strcasestr = 0x40007b7c;
|
66
components/esp_rom/esp32s3/ld/esp32s3.rom.libc.ld
Normal file
66
components/esp_rom/esp32s3/ld/esp32s3.rom.libc.ld
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
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;
|
@ -1,3 +1,8 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
/* ROM function interface esp32s3.rom.newlib.ld for esp32s3
|
||||
*
|
||||
*
|
||||
@ -5,76 +10,15 @@
|
||||
*
|
||||
* Compatible with ROM where ECO version equal or greater to 0.
|
||||
*
|
||||
* THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
* THIS FILE WAS AUTOMATICALLY GENERATED. !!! BUT EDITED !!!
|
||||
* The file was originally generated for use with newlib, but it was split into
|
||||
* multiple files to make it compatible with picolibc.
|
||||
*/
|
||||
|
||||
/***************************************
|
||||
Group newlib
|
||||
***************************************/
|
||||
|
||||
/* Functions */
|
||||
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;
|
||||
strdup = 0x40001380;
|
||||
strchr = 0x4000138c;
|
||||
strcspn = 0x40001398;
|
||||
strcoll = 0x400013a4;
|
||||
strlcat = 0x400013b0;
|
||||
strlcpy = 0x400013bc;
|
||||
strlwr = 0x400013c8;
|
||||
strncasecmp = 0x400013d4;
|
||||
strncat = 0x400013e0;
|
||||
strndup = 0x400013ec;
|
||||
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;
|
||||
rand = 0x400014a0;
|
||||
srand = 0x400014ac;
|
||||
utoa = 0x400014b8;
|
||||
itoa = 0x400014c4;
|
||||
atoi = 0x400014d0;
|
||||
atol = 0x400014dc;
|
||||
strtol = 0x400014e8;
|
||||
@ -85,6 +29,3 @@ PROVIDE( _fwalk = 0x40001518 );
|
||||
PROVIDE( _fwalk_reent = 0x40001524 );
|
||||
PROVIDE( __swbuf_r = 0x40001548 );
|
||||
__swbuf = 0x40001554;
|
||||
/* Data (.data, .bss, .rodata) */
|
||||
syscall_table_ptr = 0x3fceffd4;
|
||||
_global_impure_ptr = 0x3fceffd0;
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "esp_rom_multi_heap.h"
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "esp_rom_caps.h"
|
||||
#include "esp_rom_tlsf.h"
|
||||
|
@ -15,6 +15,9 @@
|
||||
#include "esp_log.h"
|
||||
#include "spi_flash_mmap.h"
|
||||
#include "esp_flash_internal.h"
|
||||
#if CONFIG_NEWLIB_ENABLED
|
||||
#include "esp_newlib.h"
|
||||
#endif
|
||||
#include "esp_newlib.h"
|
||||
#include "esp_xt_wdt.h"
|
||||
#include "esp_cpu.h"
|
||||
@ -86,7 +89,7 @@ ESP_SYSTEM_INIT_FN(init_brownout, CORE, BIT(0), 104)
|
||||
|
||||
ESP_SYSTEM_INIT_FN(init_newlib_time, CORE, BIT(0), 105)
|
||||
{
|
||||
esp_newlib_time_init();
|
||||
esp_libc_time_init();
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ CORE: 100: init_heap in components/heap/heap_caps_init.c on BIT(0)
|
||||
# esp_timer early initialization is required for esp_timer_get_time to work.
|
||||
CORE: 101: esp_timer_init_nonos in components/esp_timer/src/esp_timer_init.c on BIT(0)
|
||||
|
||||
CORE: 102: init_newlib in components/newlib/newlib_init.c on BIT(0)
|
||||
CORE: 102: init_libc in components/newlib/src/init.c on BIT(0)
|
||||
|
||||
# Add the psram to heap, psram vaddr region is reserved when initialising the heap, after
|
||||
# psram is initialised (and necessary reservation for psram usage), the rest of the psram
|
||||
@ -57,7 +57,7 @@ CORE: 111: init_vfs_usj in components/esp_driver_usb_serial_jtag/src/usb_serial_
|
||||
CORE: 112: init_vfs_usj_sec in components/esp_driver_usb_serial_jtag/src/usb_serial_jtag_vfs.c on BIT(0)
|
||||
CORE: 113: init_vfs_nullfs in components/vfs/nullfs.c on BIT(0)
|
||||
CORE: 114: init_vfs_console in components/esp_vfs_console/vfs_console.c on BIT(0)
|
||||
CORE: 115: init_newlib_stdio in components/newlib/newlib_init.c on BIT(0)
|
||||
CORE: 115: init_libc_stdio in components/newlib/src/init.c on BIT(0)
|
||||
|
||||
CORE: 130: init_flash in components/esp_system/startup_funcs.c on BIT(0)
|
||||
CORE: 140: init_efuse in components/efuse/src/esp_efuse_startup.c on BIT(0)
|
||||
|
@ -24,9 +24,9 @@
|
||||
|
||||
// Newline conversion mode when transmitting
|
||||
static esp_line_endings_t s_tx_mode =
|
||||
#if CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF
|
||||
#if CONFIG_LIBC_STDOUT_LINE_ENDING_CRLF
|
||||
ESP_LINE_ENDINGS_CRLF;
|
||||
#elif CONFIG_NEWLIB_STDOUT_LINE_ENDING_CR
|
||||
#elif CONFIG_LIBC_STDOUT_LINE_ENDING_CR
|
||||
ESP_LINE_ENDINGS_CR;
|
||||
#else
|
||||
ESP_LINE_ENDINGS_LF;
|
||||
@ -34,9 +34,9 @@ static esp_line_endings_t s_tx_mode =
|
||||
|
||||
// Newline conversion mode when receiving
|
||||
static esp_line_endings_t s_rx_mode =
|
||||
#if CONFIG_NEWLIB_STDIN_LINE_ENDING_CRLF
|
||||
#if CONFIG_LIBC_STDIN_LINE_ENDING_CRLF
|
||||
ESP_LINE_ENDINGS_CRLF;
|
||||
#elif CONFIG_NEWLIB_STDIN_LINE_ENDING_CR
|
||||
#elif CONFIG_LIBC_STDIN_LINE_ENDING_CR
|
||||
ESP_LINE_ENDINGS_CR;
|
||||
#else
|
||||
ESP_LINE_ENDINGS_LF;
|
||||
|
@ -29,6 +29,10 @@ struct cached_data{
|
||||
#endif
|
||||
FILINFO fileinfo;
|
||||
};
|
||||
#endif // CONFIG_VFS_SUPPORT_DIR
|
||||
|
||||
#if !defined(FILENAME_MAX)
|
||||
#define FILENAME_MAX 255
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
|
@ -35,7 +35,11 @@
|
||||
|
||||
/* ----------------------- System -------------------------- */
|
||||
|
||||
#if CONFIG_LIBC_NEWLIB
|
||||
#define configUSE_NEWLIB_REENTRANT 1
|
||||
#else
|
||||
#define configUSE_NEWLIB_REENTRANT 0
|
||||
#endif
|
||||
|
||||
/* - FreeRTOS provides default for configTLS_BLOCK_TYPE.
|
||||
* - We simply provide our own INIT and DEINIT functions
|
||||
|
@ -62,7 +62,11 @@
|
||||
|
||||
/* ----------------------- System -------------------------- */
|
||||
|
||||
#if CONFIG_LIBC_NEWLIB
|
||||
#define configUSE_NEWLIB_REENTRANT 1
|
||||
#else
|
||||
#define configUSE_NEWLIB_REENTRANT 0
|
||||
#endif
|
||||
|
||||
/* - FreeRTOS provides default for configTLS_BLOCK_TYPE.
|
||||
* - We simply provide our own INIT and DEINIT functions
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "mbedtls/aes.h"
|
||||
#include "memory_checks.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "esp_newlib.h"
|
||||
|
||||
/* setUp runs before every test */
|
||||
void setUp(void)
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
#include "test_mbedtls_utils.h"
|
||||
|
||||
static inline char to_hex_digit(unsigned val)
|
||||
|
@ -14,38 +14,53 @@ if(non_os_build)
|
||||
endif()
|
||||
|
||||
set(srcs
|
||||
"abort.c"
|
||||
"assert.c"
|
||||
"heap.c"
|
||||
"flockfile.c"
|
||||
"locks.c"
|
||||
"poll.c"
|
||||
"pthread.c"
|
||||
"random.c"
|
||||
"getentropy.c"
|
||||
"reent_init.c"
|
||||
"newlib_init.c"
|
||||
"syscalls.c"
|
||||
"termios.c"
|
||||
"stdatomic.c"
|
||||
"time.c"
|
||||
"sysconf.c"
|
||||
"realpath.c"
|
||||
"scandir.c"
|
||||
)
|
||||
"src/init.c"
|
||||
"src/abort.c"
|
||||
"src/assert.c"
|
||||
"src/heap.c"
|
||||
"src/locks.c"
|
||||
"src/poll.c"
|
||||
"src/pthread.c"
|
||||
"src/random.c"
|
||||
"src/getentropy.c"
|
||||
"src/termios.c"
|
||||
"src/stdatomic.c"
|
||||
"src/time.c"
|
||||
"src/sysconf.c"
|
||||
"src/realpath.c"
|
||||
"src/scandir.c"
|
||||
"src/syscalls.c"
|
||||
"src/reent_syscalls.c"
|
||||
"src/port/esp_time_impl.c")
|
||||
|
||||
if(CONFIG_STDATOMIC_S32C1I_SPIRAM_WORKAROUND)
|
||||
list(APPEND srcs "port/xtensa/stdatomic_s32c1i.c")
|
||||
list(APPEND srcs "src/port/xtensa/stdatomic_s32c1i.c")
|
||||
endif()
|
||||
|
||||
if(CONFIG_LIBC_NEWLIB)
|
||||
list(APPEND srcs
|
||||
"src/flockfile.c"
|
||||
"src/reent_init.c"
|
||||
"src/newlib_init.c")
|
||||
else()
|
||||
list(APPEND srcs
|
||||
"src/picolibc/picolibc_init.c"
|
||||
"src/picolibc/rand.c"
|
||||
"src/picolibc/open_memstream.c")
|
||||
endif()
|
||||
|
||||
list(APPEND ldfragments "src/newlib.lf" "src/system_libs.lf")
|
||||
|
||||
if(CONFIG_SPIRAM_CACHE_WORKAROUND)
|
||||
set(ldfragments "esp32-spiram-rom-functions-c.lf")
|
||||
if(CONFIG_LIBC_NEWLIB)
|
||||
list(APPEND ldfragments src/esp32-spiram-rom-functions-c.lf)
|
||||
else()
|
||||
list(APPEND ldfragments src/picolibc/esp32-spiram-rom-functions-c.lf)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND ldfragments "newlib.lf" "system_libs.lf")
|
||||
|
||||
idf_component_register(SRCS "${srcs}"
|
||||
INCLUDE_DIRS "${include_dirs}"
|
||||
INCLUDE_DIRS platform_include
|
||||
PRIV_INCLUDE_DIRS priv_include
|
||||
PRIV_REQUIRES soc spi_flash
|
||||
LDFRAGMENTS "${ldfragments}")
|
||||
@ -57,22 +72,22 @@ target_link_libraries(${COMPONENT_LIB} INTERFACE c m ${CONFIG_COMPILER_RT_LIB_NA
|
||||
set_source_files_properties(heap.c PROPERTIES COMPILE_FLAGS -fno-builtin)
|
||||
|
||||
if(CONFIG_STDATOMIC_S32C1I_SPIRAM_WORKAROUND)
|
||||
set_source_files_properties("port/xtensa/stdatomic_s32c1i.c"
|
||||
set_source_files_properties("src/port/xtensa/stdatomic_s32c1i.c"
|
||||
PROPERTIES COMPILE_FLAGS "-mno-disable-hardware-atomics")
|
||||
endif()
|
||||
|
||||
# Forces the linker to include heap, syscall, pthread, assert, and retargetable locks from this component,
|
||||
# instead of the implementations provided by newlib.
|
||||
list(APPEND EXTRA_LINK_FLAGS "-u newlib_include_heap_impl")
|
||||
list(APPEND EXTRA_LINK_FLAGS "-u newlib_include_syscalls_impl")
|
||||
list(APPEND EXTRA_LINK_FLAGS "-u newlib_include_pthread_impl")
|
||||
list(APPEND EXTRA_LINK_FLAGS "-u newlib_include_assert_impl")
|
||||
list(APPEND EXTRA_LINK_FLAGS "-u newlib_include_getentropy_impl")
|
||||
list(APPEND EXTRA_LINK_FLAGS "-u esp_libc_include_heap_impl")
|
||||
list(APPEND EXTRA_LINK_FLAGS "-u esp_libc_include_reent_syscalls_impl")
|
||||
list(APPEND EXTRA_LINK_FLAGS "-u esp_libc_include_syscalls_impl")
|
||||
list(APPEND EXTRA_LINK_FLAGS "-u esp_libc_include_pthread_impl")
|
||||
list(APPEND EXTRA_LINK_FLAGS "-u esp_libc_include_assert_impl")
|
||||
list(APPEND EXTRA_LINK_FLAGS "-u esp_libc_include_getentropy_impl")
|
||||
list(APPEND EXTRA_LINK_FLAGS "-u esp_libc_include_init_funcs")
|
||||
list(APPEND EXTRA_LINK_FLAGS "-u esp_libc_init_funcs")
|
||||
target_link_libraries(${COMPONENT_LIB} INTERFACE "${EXTRA_LINK_FLAGS}")
|
||||
|
||||
# Forces the linker to include newlib_init.c
|
||||
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u newlib_include_init_funcs")
|
||||
|
||||
if(CONFIG_NEWLIB_NANO_FORMAT)
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
set(libc_dir_cmd ${CMAKE_C_COMPILER})
|
||||
@ -89,7 +104,7 @@ if(CONFIG_NEWLIB_NANO_FORMAT)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_subdirectory(port)
|
||||
add_subdirectory(src/port)
|
||||
|
||||
# if lwip is included in the build, add it as a public requirement so that
|
||||
# #include <sys/socket.h> works without any special provisions.
|
||||
|
6332
components/newlib/COPYING.picolibc
Normal file
6332
components/newlib/COPYING.picolibc
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,19 @@
|
||||
menu "Newlib"
|
||||
menu "LibC"
|
||||
|
||||
choice NEWLIB_STDOUT_LINE_ENDING
|
||||
choice LIBC
|
||||
prompt "LibC to build application with"
|
||||
default LIBC_NEWLIB
|
||||
|
||||
config LIBC_NEWLIB
|
||||
bool "NewLib"
|
||||
config LIBC_PICOLIBC
|
||||
bool "Picolibc (EXPERIMENTAL)"
|
||||
depends on !IDF_TOOLCHAIN_CLANG && IDF_EXPERIMENTAL_FEATURES
|
||||
endchoice
|
||||
|
||||
choice LIBC_STDOUT_LINE_ENDING
|
||||
prompt "Line ending for console output"
|
||||
default NEWLIB_STDOUT_LINE_ENDING_CRLF
|
||||
default LIBC_STDOUT_LINE_ENDING_CRLF
|
||||
depends on VFS_SUPPORT_IO
|
||||
help
|
||||
This option allows configuring the desired line endings sent to console
|
||||
@ -17,17 +28,17 @@ menu "Newlib"
|
||||
|
||||
This option doesn't affect behavior of the UART driver (drivers/uart.h).
|
||||
|
||||
config NEWLIB_STDOUT_LINE_ENDING_CRLF
|
||||
config LIBC_STDOUT_LINE_ENDING_CRLF
|
||||
bool "CRLF"
|
||||
config NEWLIB_STDOUT_LINE_ENDING_LF
|
||||
config LIBC_STDOUT_LINE_ENDING_LF
|
||||
bool "LF"
|
||||
config NEWLIB_STDOUT_LINE_ENDING_CR
|
||||
config LIBC_STDOUT_LINE_ENDING_CR
|
||||
bool "CR"
|
||||
endchoice
|
||||
|
||||
choice NEWLIB_STDIN_LINE_ENDING
|
||||
choice LIBC_STDIN_LINE_ENDING
|
||||
prompt "Line ending for console input"
|
||||
default NEWLIB_STDIN_LINE_ENDING_CR
|
||||
default LIBC_STDIN_LINE_ENDING_CR
|
||||
depends on VFS_SUPPORT_IO
|
||||
help
|
||||
This option allows configuring which input sequence on console produces
|
||||
@ -42,17 +53,18 @@ menu "Newlib"
|
||||
|
||||
This option doesn't affect behavior of the UART driver (drivers/uart.h).
|
||||
|
||||
config NEWLIB_STDIN_LINE_ENDING_CRLF
|
||||
config LIBC_STDIN_LINE_ENDING_CRLF
|
||||
bool "CRLF"
|
||||
config NEWLIB_STDIN_LINE_ENDING_LF
|
||||
config LIBC_STDIN_LINE_ENDING_LF
|
||||
bool "LF"
|
||||
config NEWLIB_STDIN_LINE_ENDING_CR
|
||||
config LIBC_STDIN_LINE_ENDING_CR
|
||||
bool "CR"
|
||||
endchoice
|
||||
|
||||
config NEWLIB_NANO_FORMAT
|
||||
config LIBC_NEWLIB_NANO_FORMAT
|
||||
bool "Enable 'nano' formatting options for printf/scanf family"
|
||||
default y if IDF_TARGET_ESP32C2
|
||||
depends on LIBC_NEWLIB
|
||||
help
|
||||
In most chips the ROM contains parts of newlib C library, including printf/scanf family
|
||||
of functions. These functions have been compiled with so-called "nano"
|
||||
@ -76,9 +88,9 @@ menu "Newlib"
|
||||
If you need 64-bit integer formatting support or C99 features, keep this
|
||||
option disabled.
|
||||
|
||||
choice NEWLIB_TIME_SYSCALL
|
||||
choice LIBC_TIME_SYSCALL
|
||||
prompt "Timers used for gettimeofday function"
|
||||
default NEWLIB_TIME_SYSCALL_USE_RTC_HRT
|
||||
default LIBC_TIME_SYSCALL_USE_RTC_HRT
|
||||
help
|
||||
This setting defines which hardware timers are used to
|
||||
implement 'gettimeofday' and 'time' functions in C library.
|
||||
@ -104,22 +116,22 @@ menu "Newlib"
|
||||
- When RTC is used for timekeeping, two RTC_STORE registers are
|
||||
used to keep time in deep sleep mode.
|
||||
|
||||
config NEWLIB_TIME_SYSCALL_USE_RTC_HRT
|
||||
config LIBC_TIME_SYSCALL_USE_RTC_HRT
|
||||
bool "RTC and high-resolution timer"
|
||||
select ESP_TIME_FUNCS_USE_RTC_TIMER
|
||||
select ESP_TIME_FUNCS_USE_ESP_TIMER
|
||||
config NEWLIB_TIME_SYSCALL_USE_RTC
|
||||
config LIBC_TIME_SYSCALL_USE_RTC
|
||||
bool "RTC"
|
||||
select ESP_TIME_FUNCS_USE_RTC_TIMER
|
||||
config NEWLIB_TIME_SYSCALL_USE_HRT
|
||||
config LIBC_TIME_SYSCALL_USE_HRT
|
||||
bool "High-resolution timer"
|
||||
select ESP_TIME_FUNCS_USE_ESP_TIMER
|
||||
config NEWLIB_TIME_SYSCALL_USE_NONE
|
||||
config LIBC_TIME_SYSCALL_USE_NONE
|
||||
bool "None"
|
||||
select ESP_TIME_FUNCS_USE_NONE
|
||||
endchoice
|
||||
|
||||
endmenu # Newlib
|
||||
endmenu # LibC
|
||||
|
||||
config STDATOMIC_S32C1I_SPIRAM_WORKAROUND
|
||||
bool
|
||||
|
@ -41,6 +41,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <sdkconfig.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
@ -65,6 +66,7 @@ extern "C" {
|
||||
* Host to big endian, host to little endian, big endian to host, and little
|
||||
* endian to host byte order functions as detailed in byteorder(9).
|
||||
*/
|
||||
#if CONFIG_LIBC_NEWLIB
|
||||
#if _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
#define htobe16(x) bswap16((x))
|
||||
#define htobe32(x) bswap32((x))
|
||||
@ -94,6 +96,7 @@ extern "C" {
|
||||
#define le32toh(x) bswap32((x))
|
||||
#define le64toh(x) bswap64((x))
|
||||
#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */
|
||||
#endif /* CONFIG_LIBC_NEWLIB */
|
||||
|
||||
/* Alignment-agnostic encode/decode bytestream to/from little/big endian. */
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/* TODO IDF-11226 rename this file to esp_libc.h */
|
||||
#pragma once
|
||||
|
||||
#include <sys/reent.h>
|
||||
@ -12,18 +12,17 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialize newlib time functions
|
||||
*/
|
||||
void esp_newlib_time_init(void);
|
||||
|
||||
/**
|
||||
* Replacement for newlib's _REENT_INIT_PTR and __sinit.
|
||||
* Function which sets up newlib in ROM for use with ESP-IDF
|
||||
*
|
||||
* Called from startup code and FreeRTOS, not intended to be called from
|
||||
* application code.
|
||||
* Includes defining the syscall table, setting up any common locks, etc.
|
||||
*
|
||||
* Called from the startup code, not intended to be called from application
|
||||
* code.
|
||||
*/
|
||||
void esp_reent_init(struct _reent* r);
|
||||
void esp_libc_init(void);
|
||||
|
||||
void esp_setup_syscall_table(void) __attribute__((deprecated("Please call esp_libc_init() in newer code")));
|
||||
|
||||
/**
|
||||
* Postponed _GLOBAL_REENT stdio FPs initialization.
|
||||
@ -34,25 +33,29 @@ void esp_reent_init(struct _reent* r);
|
||||
* application code.
|
||||
*
|
||||
*/
|
||||
void esp_newlib_init_global_stdio(const char* stdio_dev);
|
||||
#if CONFIG_VFS_SUPPORT_IO
|
||||
void esp_libc_init_global_stdio(const char *stdio_dev);
|
||||
#else
|
||||
void esp_libc_init_global_stdio(void);
|
||||
#endif
|
||||
|
||||
void esp_libc_time_init(void);
|
||||
|
||||
#if CONFIG_LIBC_NEWLIB
|
||||
/**
|
||||
* Replacement for newlib's _REENT_INIT_PTR and __sinit.
|
||||
*
|
||||
* Called from startup code and FreeRTOS, not intended to be called from
|
||||
* application code.
|
||||
*/
|
||||
void esp_reent_init(struct _reent* r);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Clean up some of lazily allocated buffers in REENT structures.
|
||||
*/
|
||||
void esp_reent_cleanup(void);
|
||||
|
||||
/**
|
||||
* Function which sets up newlib in ROM for use with ESP-IDF
|
||||
*
|
||||
* Includes defining the syscall table, setting up any common locks, etc.
|
||||
*
|
||||
* Called from the startup code, not intended to be called from application
|
||||
* code.
|
||||
*/
|
||||
void esp_newlib_init(void);
|
||||
|
||||
void esp_setup_syscall_table(void) __attribute__((deprecated("Please call esp_newlib_init() in newer code")));
|
||||
|
||||
/**
|
||||
* Update current microsecond time from RTC
|
||||
*/
|
||||
@ -67,9 +70,14 @@ void esp_sync_timekeeping_timers(void);
|
||||
#define esp_sync_counters_rtc_and_frc esp_sync_timekeeping_timers
|
||||
|
||||
/**
|
||||
* Initialize newlib static locks
|
||||
* Initialize libc static locks
|
||||
*/
|
||||
void esp_newlib_locks_init(void);
|
||||
void esp_libc_locks_init(void);
|
||||
|
||||
/* TODO IDF-11226 */
|
||||
void esp_newlib_time_init(void) __attribute__((deprecated("Please use esp_libc_time_init instead")));
|
||||
void esp_newlib_init(void) __attribute__((deprecated("Please use esp_libc_init instead")));
|
||||
void esp_newlib_locks_init(void) __attribute__((deprecated("Please use esp_libc_locks_init instead")));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
14
components/newlib/platform_include/stdio.h
Normal file
14
components/newlib/platform_include/stdio.h
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#include_next <stdio.h>
|
||||
|
||||
#if CONFIG_LIBC_PICOLIBC
|
||||
FILE *open_memstream(char **, size_t *);
|
||||
#endif
|
14
components/newlib/platform_include/stdio_ext.h
Normal file
14
components/newlib/platform_include/stdio_ext.h
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#if CONFIG_LIBC_NEWLIB
|
||||
#include_next <stdio_ext.h>
|
||||
#else
|
||||
#include <stdio-bufio.h>
|
||||
#endif
|
@ -7,7 +7,8 @@
|
||||
#ifndef _ESP_PLATFORM_ERRNO_H_
|
||||
#define _ESP_PLATFORM_ERRNO_H_
|
||||
|
||||
#include_next "errno.h"
|
||||
#include_next "sys/errno.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
//
|
||||
// Possibly define some missing errors
|
||||
@ -28,4 +29,9 @@
|
||||
#define EAI_BADFLAGS 3 /* invalid value for ai_flags */
|
||||
#endif
|
||||
|
||||
#if CONFIG_LIBC_PICOLIBC
|
||||
#undef __errno_r
|
||||
#define __errno_r(r) errno
|
||||
#endif
|
||||
|
||||
#endif // _ESP_PLATFORM_ERRNO_H_
|
@ -8,6 +8,10 @@
|
||||
#include_next <sys/lock.h>
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef _RETARGETABLE_LOCKING
|
||||
|
||||
/* Actual platfrom-specific definition of struct __lock.
|
||||
@ -48,4 +52,12 @@ int _lock_try_acquire_recursive(_lock_t *plock);
|
||||
void _lock_release(_lock_t *plock);
|
||||
void _lock_release_recursive(_lock_t *plock);
|
||||
|
||||
#if CONFIG_LIBC_PICOLIBC
|
||||
#define __lock_try_acquire(lock) _lock_try_acquire(&(lock))
|
||||
#define __lock_try_acquire_recursive(lock) _lock_try_acquire_recursive(&(lock))
|
||||
#endif // CONFIG_LIBC_PICOLIBC
|
||||
#endif // _RETARGETABLE_LOCKING
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -5,22 +5,37 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#if CONFIG_LIBC_NEWLIB
|
||||
#define _REENT_BACKWARD_BINARY_COMPAT
|
||||
#define _REENT_SDIDINIT(_ptr) ((_ptr)->_reserved_0)
|
||||
#define _REENT_SGLUE(_ptr) (__sglue)
|
||||
|
||||
#include_next<sys/reent.h>
|
||||
#endif // CONFIG_LIBC_NEWLIB
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if CONFIG_LIBC_NEWLIB
|
||||
|
||||
extern void __sinit(struct _reent *);
|
||||
|
||||
extern struct _glue __sglue;
|
||||
extern struct _reent * _global_impure_ptr;
|
||||
|
||||
#else // CONFIG_LIBC_NEWLIB
|
||||
|
||||
struct _reent {};
|
||||
#define __getreent() NULL
|
||||
|
||||
int _system_r(struct _reent *r, const char *str);
|
||||
int _raise_r(struct _reent *r, int sig);
|
||||
|
||||
#endif // CONFIG_LIBC_NEWLIB
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -5,8 +5,6 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
void esp_time_impl_init(void);
|
||||
|
||||
uint64_t esp_time_impl_get_time(void);
|
||||
|
||||
uint64_t esp_time_impl_get_time_since_boot(void);
|
||||
@ -16,3 +14,7 @@ uint32_t esp_time_impl_get_time_resolution(void);
|
||||
void esp_time_impl_set_boot_time(uint64_t t);
|
||||
|
||||
uint64_t esp_time_impl_get_boot_time(void);
|
||||
|
||||
void esp_sync_timekeeping_timers(void);
|
||||
|
||||
void esp_set_time_from_rtc(void);
|
||||
|
17
components/newlib/sdkconfig.rename
Normal file
17
components/newlib/sdkconfig.rename
Normal file
@ -0,0 +1,17 @@
|
||||
# sdkconfig replacement configurations for deprecated options formatted as
|
||||
# CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION
|
||||
|
||||
CONFIG_NEWLIB_STDOUT_LINE_ENDING CONFIG_LIBC_STDOUT_LINE_ENDING
|
||||
CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF CONFIG_LIBC_STDOUT_LINE_ENDING_CRLF
|
||||
CONFIG_NEWLIB_STDOUT_LINE_ENDING_LF CONFIG_LIBC_STDOUT_LINE_ENDING_LF
|
||||
CONFIG_NEWLIB_STDOUT_LINE_ENDING_CR CONFIG_LIBC_STDOUT_LINE_ENDING_CR
|
||||
CONFIG_NEWLIB_STDIN_LINE_ENDING CONFIG_LIBC_STDIN_LINE_ENDING
|
||||
CONFIG_NEWLIB_STDIN_LINE_ENDING_CRLF CONFIG_LIBC_STDIN_LINE_ENDING_CRLF
|
||||
CONFIG_NEWLIB_STDIN_LINE_ENDING_LF CONFIG_LIBC_STDIN_LINE_ENDING_LF
|
||||
CONFIG_NEWLIB_STDIN_LINE_ENDING_CR CONFIG_LIBC_STDIN_LINE_ENDING_CR
|
||||
CONFIG_NEWLIB_NANO_FORMAT CONFIG_LIBC_NEWLIB_NANO_FORMAT
|
||||
CONFIG_NEWLIB_TIME_SYSCALL CONFIG_LIBC_TIME_SYSCALL
|
||||
CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC_HRT CONFIG_LIBC_TIME_SYSCALL_USE_RTC_HRT
|
||||
CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC CONFIG_LIBC_TIME_SYSCALL_USE_RTC
|
||||
CONFIG_NEWLIB_TIME_SYSCALL_USE_HRT CONFIG_LIBC_TIME_SYSCALL_USE_HRT
|
||||
CONFIG_NEWLIB_TIME_SYSCALL_USE_NONE CONFIG_LIBC_TIME_SYSCALL_USE_NONE
|
@ -1,9 +1,9 @@
|
||||
# sdkconfig replacement configurations for deprecated options formatted as
|
||||
# CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION
|
||||
|
||||
CONFIG_ESP32_TIME_SYSCALL_USE_RTC_HRT CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC_HRT
|
||||
CONFIG_ESP32_TIME_SYSCALL_USE_RTC CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC
|
||||
CONFIG_ESP32_TIME_SYSCALL_USE_HRT CONFIG_NEWLIB_TIME_SYSCALL_USE_HRT
|
||||
CONFIG_ESP32_TIME_SYSCALL_USE_NONE CONFIG_NEWLIB_TIME_SYSCALL_USE_NONE
|
||||
CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1 CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC_HRT
|
||||
CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 CONFIG_NEWLIB_TIME_SYSCALL_USE_HRT
|
||||
CONFIG_ESP32_TIME_SYSCALL_USE_RTC_HRT CONFIG_LIBC_TIME_SYSCALL_USE_RTC_HRT
|
||||
CONFIG_ESP32_TIME_SYSCALL_USE_RTC CONFIG_LIBC_TIME_SYSCALL_USE_RTC
|
||||
CONFIG_ESP32_TIME_SYSCALL_USE_HRT CONFIG_LIBC_TIME_SYSCALL_USE_HRT
|
||||
CONFIG_ESP32_TIME_SYSCALL_USE_NONE CONFIG_LIBC_TIME_SYSCALL_USE_NONE
|
||||
CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1 CONFIG_LIBC_TIME_SYSCALL_USE_RTC_HRT
|
||||
CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 CONFIG_LIBC_TIME_SYSCALL_USE_HRT
|
||||
|
@ -1,7 +1,7 @@
|
||||
# sdkconfig replacement configurations for deprecated options formatted as
|
||||
# CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION
|
||||
|
||||
CONFIG_ESP32C3_TIME_SYSCALL_USE_RTC_SYSTIMER CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC_HRT
|
||||
CONFIG_ESP32C3_TIME_SYSCALL_USE_RTC CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC
|
||||
CONFIG_ESP32C3_TIME_SYSCALL_USE_SYSTIMER CONFIG_NEWLIB_TIME_SYSCALL_USE_HRT
|
||||
CONFIG_ESP32C3_TIME_SYSCALL_USE_NONE CONFIG_NEWLIB_TIME_SYSCALL_USE_NONE
|
||||
CONFIG_ESP32C3_TIME_SYSCALL_USE_RTC_SYSTIMER CONFIG_LIBC_TIME_SYSCALL_USE_RTC_HRT
|
||||
CONFIG_ESP32C3_TIME_SYSCALL_USE_RTC CONFIG_LIBC_TIME_SYSCALL_USE_RTC
|
||||
CONFIG_ESP32C3_TIME_SYSCALL_USE_SYSTIMER CONFIG_LIBC_TIME_SYSCALL_USE_HRT
|
||||
CONFIG_ESP32C3_TIME_SYSCALL_USE_NONE CONFIG_LIBC_TIME_SYSCALL_USE_NONE
|
||||
|
@ -1,9 +1,9 @@
|
||||
# sdkconfig replacement configurations for deprecated options formatted as
|
||||
# CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION
|
||||
|
||||
CONFIG_ESP32S2_TIME_SYSCALL_USE_RTC_SYSTIMER CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC_HRT
|
||||
CONFIG_ESP32S2_TIME_SYSCALL_USE_RTC CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC
|
||||
CONFIG_ESP32S2_TIME_SYSCALL_USE_SYSTIMER CONFIG_NEWLIB_TIME_SYSCALL_USE_HRT
|
||||
CONFIG_ESP32S2_TIME_SYSCALL_USE_NONE CONFIG_NEWLIB_TIME_SYSCALL_USE_NONE
|
||||
CONFIG_ESP32S2_TIME_SYSCALL_USE_RTC_FRC1 CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC_HRT
|
||||
CONFIG_ESP32S2_TIME_SYSCALL_USE_FRC1 CONFIG_NEWLIB_TIME_SYSCALL_USE_HRT
|
||||
CONFIG_ESP32S2_TIME_SYSCALL_USE_RTC_SYSTIMER CONFIG_LIBC_TIME_SYSCALL_USE_RTC_HRT
|
||||
CONFIG_ESP32S2_TIME_SYSCALL_USE_RTC CONFIG_LIBC_TIME_SYSCALL_USE_RTC
|
||||
CONFIG_ESP32S2_TIME_SYSCALL_USE_SYSTIMER CONFIG_LIBC_TIME_SYSCALL_USE_HRT
|
||||
CONFIG_ESP32S2_TIME_SYSCALL_USE_NONE CONFIG_LIBC_TIME_SYSCALL_USE_NONE
|
||||
CONFIG_ESP32S2_TIME_SYSCALL_USE_RTC_FRC1 CONFIG_LIBC_TIME_SYSCALL_USE_RTC_HRT
|
||||
CONFIG_ESP32S2_TIME_SYSCALL_USE_FRC1 CONFIG_LIBC_TIME_SYSCALL_USE_HRT
|
||||
|
@ -1,9 +1,9 @@
|
||||
# sdkconfig replacement configurations for deprecated options formatted as
|
||||
# CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION
|
||||
|
||||
CONFIG_ESP32S3_TIME_SYSCALL_USE_RTC_SYSTIMER CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC_HRT
|
||||
CONFIG_ESP32S3_TIME_SYSCALL_USE_RTC CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC
|
||||
CONFIG_ESP32S3_TIME_SYSCALL_USE_SYSTIMER CONFIG_NEWLIB_TIME_SYSCALL_USE_HRT
|
||||
CONFIG_ESP32S3_TIME_SYSCALL_USE_NONE CONFIG_NEWLIB_TIME_SYSCALL_USE_NONE
|
||||
CONFIG_ESP32S3_TIME_SYSCALL_USE_RTC_FRC1 CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC_HRT
|
||||
CONFIG_ESP32S3_TIME_SYSCALL_USE_FRC1 CONFIG_NEWLIB_TIME_SYSCALL_USE_HRT
|
||||
CONFIG_ESP32S3_TIME_SYSCALL_USE_RTC_SYSTIMER CONFIG_LIBC_TIME_SYSCALL_USE_RTC_HRT
|
||||
CONFIG_ESP32S3_TIME_SYSCALL_USE_RTC CONFIG_LIBC_TIME_SYSCALL_USE_RTC
|
||||
CONFIG_ESP32S3_TIME_SYSCALL_USE_SYSTIMER CONFIG_LIBC_TIME_SYSCALL_USE_HRT
|
||||
CONFIG_ESP32S3_TIME_SYSCALL_USE_NONE CONFIG_LIBC_TIME_SYSCALL_USE_NONE
|
||||
CONFIG_ESP32S3_TIME_SYSCALL_USE_RTC_FRC1 CONFIG_LIBC_TIME_SYSCALL_USE_RTC_HRT
|
||||
CONFIG_ESP32S3_TIME_SYSCALL_USE_FRC1 CONFIG_LIBC_TIME_SYSCALL_USE_HRT
|
||||
|
@ -81,12 +81,16 @@ void __attribute__((noreturn)) __assert_func(const char *file, int line, const c
|
||||
#endif /* CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT */
|
||||
}
|
||||
|
||||
#if CONFIG_LIBC_NEWLIB
|
||||
void __attribute__((noreturn)) __assert(const char *file, int line, const char *failedexpr)
|
||||
#else
|
||||
void __attribute__((noreturn)) __assert(const char *file, const char *failedexpr, int line)
|
||||
#endif
|
||||
{
|
||||
__assert_func(file, line, NULL, failedexpr);
|
||||
}
|
||||
|
||||
/* No-op function, used to force linker to include these changes */
|
||||
void newlib_include_assert_impl(void)
|
||||
void esp_libc_include_assert_impl(void)
|
||||
{
|
||||
}
|
@ -29,7 +29,7 @@ int getentropy(void *buffer, size_t length)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void newlib_include_getentropy_impl(void)
|
||||
void esp_libc_include_getentropy_impl(void)
|
||||
{
|
||||
// Linker hook, exists for no other purpose
|
||||
}
|
@ -24,11 +24,6 @@ void* malloc(size_t size)
|
||||
return heap_caps_malloc_default(size);
|
||||
}
|
||||
|
||||
void* calloc(size_t n, size_t size)
|
||||
{
|
||||
return _calloc_r(_REENT, n, size);
|
||||
}
|
||||
|
||||
void* realloc(void* ptr, size_t size)
|
||||
{
|
||||
return heap_caps_realloc_default(ptr, size);
|
||||
@ -39,22 +34,8 @@ void free(void *ptr)
|
||||
heap_caps_free(ptr);
|
||||
}
|
||||
|
||||
void* _malloc_r(struct _reent *r, size_t size)
|
||||
{
|
||||
return heap_caps_malloc_default(size);
|
||||
}
|
||||
|
||||
void _free_r(struct _reent *r, void* ptr)
|
||||
{
|
||||
heap_caps_free(ptr);
|
||||
}
|
||||
|
||||
void* _realloc_r(struct _reent *r, void* ptr, size_t size)
|
||||
{
|
||||
return heap_caps_realloc_default(ptr, size);
|
||||
}
|
||||
|
||||
void* _calloc_r(struct _reent *r, size_t nmemb, size_t size)
|
||||
ESP_COMPILER_DIAGNOSTIC_PUSH_IGNORE("-Wanalyzer-malloc-leak")
|
||||
void* calloc(size_t nmemb, size_t size)
|
||||
{
|
||||
void *result;
|
||||
size_t size_bytes;
|
||||
@ -68,6 +49,29 @@ void* _calloc_r(struct _reent *r, size_t nmemb, size_t size)
|
||||
}
|
||||
return result;
|
||||
}
|
||||
ESP_COMPILER_DIAGNOSTIC_POP("-Wanalyzer-malloc-leak")
|
||||
|
||||
#if CONFIG_LIBC_NEWLIB
|
||||
void _free_r(struct _reent *r, void* ptr)
|
||||
{
|
||||
heap_caps_free(ptr);
|
||||
}
|
||||
|
||||
void* _realloc_r(struct _reent *r, void* ptr, size_t size)
|
||||
{
|
||||
return heap_caps_realloc_default(ptr, size);
|
||||
}
|
||||
|
||||
void* _malloc_r(struct _reent *r, size_t size)
|
||||
{
|
||||
return heap_caps_malloc_default(size);
|
||||
}
|
||||
|
||||
void* _calloc_r(struct _reent *r, size_t nmemb, size_t size)
|
||||
{
|
||||
return calloc(nmemb, size);
|
||||
}
|
||||
#endif
|
||||
|
||||
void* memalign(size_t alignment, size_t n)
|
||||
{
|
||||
@ -99,7 +103,7 @@ int posix_memalign(void **out_ptr, size_t alignment, size_t size)
|
||||
/* No-op function, used to force linking this file,
|
||||
instead of the heap implementation from newlib.
|
||||
*/
|
||||
void newlib_include_heap_impl(void)
|
||||
void esp_libc_include_heap_impl(void)
|
||||
{
|
||||
}
|
||||
|
30
components/newlib/src/init.c
Normal file
30
components/newlib/src/init.c
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_newlib.h"
|
||||
#include "esp_private/startup_internal.h"
|
||||
#include "esp_bit_defs.h"
|
||||
|
||||
ESP_SYSTEM_INIT_FN(init_libc, CORE, BIT(0), 102)
|
||||
{
|
||||
esp_libc_init();
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
ESP_SYSTEM_INIT_FN(init_libc_stdio, CORE, BIT(0), 115)
|
||||
{
|
||||
#if CONFIG_VFS_SUPPORT_IO
|
||||
esp_libc_init_global_stdio("/dev/console");
|
||||
#else
|
||||
esp_libc_init_global_stdio();
|
||||
#endif
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
// Hook to force the linker to include this file
|
||||
void esp_libc_init_funcs(void)
|
||||
{
|
||||
}
|
@ -14,6 +14,8 @@
|
||||
#include "freertos/portable.h"
|
||||
#include "esp_rom_caps.h"
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
||||
/* Notes on our newlib lock implementation:
|
||||
*
|
||||
* - Use FreeRTOS mutex semaphores as locks.
|
||||
@ -24,12 +26,16 @@
|
||||
* protected by lock_init_spinlock.
|
||||
* - Race conditions around lazy initialisation (via lock_acquire) are
|
||||
* protected against.
|
||||
* - Anyone calling lock_close is reponsible for ensuring noone else
|
||||
* - Anyone calling lock_close is responsible for ensuring no one else
|
||||
* is holding the lock at this time.
|
||||
* - Race conditions between lock_close & lock_init (for the same lock)
|
||||
* are the responsibility of the caller.
|
||||
*/
|
||||
|
||||
#if CONFIG_LIBC_PICOLIBC
|
||||
struct __lock __lock___libc_recursive_mutex;
|
||||
#endif
|
||||
|
||||
static portMUX_TYPE lock_init_spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
|
||||
/* Initialize the given lock by allocating a new mutex semaphore
|
||||
@ -359,23 +365,13 @@ extern StaticSemaphore_t __attribute__((alias("s_common_mutex"))) __lock___tz_mu
|
||||
extern StaticSemaphore_t __attribute__((alias("s_common_mutex"))) __lock___dd_hash_mutex;
|
||||
extern StaticSemaphore_t __attribute__((alias("s_common_mutex"))) __lock___arc4random_mutex;
|
||||
|
||||
void esp_newlib_locks_init(void)
|
||||
#if CONFIG_LIBC_NEWLIB
|
||||
static void esp_libc_newlib_locks_init(void)
|
||||
{
|
||||
/* Initialize the two mutexes used for the locks above.
|
||||
* Asserts below check our assumption that SemaphoreHandle_t will always
|
||||
* point to the corresponding StaticSemaphore_t structure.
|
||||
*/
|
||||
SemaphoreHandle_t handle;
|
||||
handle = xSemaphoreCreateMutexStatic(&s_common_mutex);
|
||||
assert(handle == (SemaphoreHandle_t) &s_common_mutex);
|
||||
handle = xSemaphoreCreateRecursiveMutexStatic(&s_common_recursive_mutex);
|
||||
assert(handle == (SemaphoreHandle_t) &s_common_recursive_mutex);
|
||||
(void) handle;
|
||||
|
||||
/* Chip ROMs are built with older versions of newlib, and rely on different lock variables.
|
||||
* Initialize these locks to the same values.
|
||||
*/
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
/* Newlib 2.2.0 is used in ROM, the following lock symbols are defined: */
|
||||
extern _lock_t __sfp_lock;
|
||||
__sfp_lock = (_lock_t) &s_common_recursive_mutex;
|
||||
@ -385,7 +381,7 @@ void esp_newlib_locks_init(void)
|
||||
__env_lock_object = (_lock_t) &s_common_recursive_mutex;
|
||||
extern _lock_t __tz_lock_object;
|
||||
__tz_lock_object = (_lock_t) &s_common_mutex;
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
|
||||
#elif CONFIG_IDF_TARGET_ESP32S2
|
||||
/* Newlib 3.0.0 is used in ROM, the following lock symbols are defined: */
|
||||
extern _lock_t __sinit_recursive_mutex;
|
||||
__sinit_recursive_mutex = (_lock_t) &s_common_recursive_mutex;
|
||||
@ -405,3 +401,28 @@ void esp_newlib_locks_init(void)
|
||||
#error Unsupported target
|
||||
#endif
|
||||
}
|
||||
#endif // CONFIG_LIBC_NEWLIB
|
||||
|
||||
/* TODO IDF-11226 */
|
||||
void esp_newlib_locks_init(void) __attribute__((alias("esp_libc_locks_init")));
|
||||
void esp_libc_locks_init(void)
|
||||
{
|
||||
/* Initialize the two mutexes used for the locks above.
|
||||
* Asserts below check our assumption that SemaphoreHandle_t will always
|
||||
* point to the corresponding StaticSemaphore_t structure.
|
||||
*/
|
||||
SemaphoreHandle_t handle;
|
||||
handle = xSemaphoreCreateMutexStatic(&s_common_mutex);
|
||||
assert(handle == (SemaphoreHandle_t) &s_common_mutex);
|
||||
handle = xSemaphoreCreateRecursiveMutexStatic(&s_common_recursive_mutex);
|
||||
assert(handle == (SemaphoreHandle_t) &s_common_recursive_mutex);
|
||||
#if CONFIG_LIBC_PICOLIBC
|
||||
handle = xSemaphoreCreateRecursiveMutexStatic((StaticQueue_t *) &__lock___libc_recursive_mutex);
|
||||
assert(handle == (SemaphoreHandle_t) &__lock___libc_recursive_mutex);
|
||||
#endif
|
||||
(void) handle;
|
||||
|
||||
#if CONFIG_LIBC_NEWLIB
|
||||
esp_libc_newlib_locks_init();
|
||||
#endif
|
||||
}
|
@ -21,7 +21,6 @@
|
||||
#include "soc/soc_caps.h"
|
||||
#include "esp_rom_caps.h"
|
||||
#include "esp_rom_libc_stubs.h"
|
||||
#include "esp_private/startup_internal.h"
|
||||
|
||||
extern int _printf_float(struct _reent *rptr,
|
||||
void *pdata,
|
||||
@ -126,7 +125,9 @@ static struct syscall_stub_table s_stub_table = {
|
||||
#endif
|
||||
};
|
||||
|
||||
void esp_newlib_init(void)
|
||||
/* TODO IDF-11226 */
|
||||
void esp_newlib_init(void) __attribute__((alias("esp_libc_init")));
|
||||
void esp_libc_init(void)
|
||||
{
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
syscall_table_ptr_pro = syscall_table_ptr_app = &s_stub_table;
|
||||
@ -150,16 +151,10 @@ void esp_newlib_init(void)
|
||||
}
|
||||
environ[0] = NULL;
|
||||
|
||||
esp_newlib_locks_init();
|
||||
esp_libc_locks_init();
|
||||
}
|
||||
|
||||
ESP_SYSTEM_INIT_FN(init_newlib, CORE, BIT(0), 102)
|
||||
{
|
||||
esp_newlib_init();
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
void esp_setup_newlib_syscalls(void) __attribute__((alias("esp_newlib_init")));
|
||||
void esp_setup_newlib_syscalls(void) __attribute__((alias("esp_libc_init")));
|
||||
|
||||
/**
|
||||
* Postponed _GLOBAL_REENT stdio FPs initialization.
|
||||
@ -169,46 +164,39 @@ void esp_setup_newlib_syscalls(void) __attribute__((alias("esp_newlib_init")));
|
||||
* Called from startup code and FreeRTOS, not intended to be called from
|
||||
* application code.
|
||||
*/
|
||||
void esp_newlib_init_global_stdio(const char *stdio_dev)
|
||||
#if CONFIG_VFS_SUPPORT_IO
|
||||
void esp_libc_init_global_stdio(const char *stdio_dev)
|
||||
{
|
||||
if (stdio_dev == NULL) {
|
||||
_GLOBAL_REENT->__cleanup = NULL;
|
||||
_REENT_SDIDINIT(_GLOBAL_REENT) = 0;
|
||||
__sinit(_GLOBAL_REENT);
|
||||
_GLOBAL_REENT->__cleanup = esp_cleanup_r;
|
||||
_REENT_SDIDINIT(_GLOBAL_REENT) = 1;
|
||||
} else {
|
||||
_REENT_STDIN(_GLOBAL_REENT) = fopen(stdio_dev, "r");
|
||||
_REENT_STDOUT(_GLOBAL_REENT) = fopen(stdio_dev, "w");
|
||||
_REENT_STDERR(_GLOBAL_REENT) = fopen(stdio_dev, "w");
|
||||
_REENT_STDIN(_GLOBAL_REENT) = fopen(stdio_dev, "r");
|
||||
_REENT_STDOUT(_GLOBAL_REENT) = fopen(stdio_dev, "w");
|
||||
_REENT_STDERR(_GLOBAL_REENT) = fopen(stdio_dev, "w");
|
||||
#if ESP_ROM_NEEDS_SWSETUP_WORKAROUND
|
||||
/*
|
||||
- This workaround for printf functions using 32-bit time_t after the 64-bit time_t upgrade
|
||||
- The 32-bit time_t usage is triggered through ROM Newlib functions printf related functions calling __swsetup_r() on
|
||||
the first call to a particular file pointer (i.e., stdin, stdout, stderr)
|
||||
- Thus, we call the toolchain version of __swsetup_r() now (before any printf calls are made) to setup all of the
|
||||
file pointers. Thus, the ROM newlib code will never call the ROM version of __swsetup_r().
|
||||
- See IDFGH-7728 for more details
|
||||
*/
|
||||
extern int __swsetup_r(struct _reent *, FILE *);
|
||||
__swsetup_r(_GLOBAL_REENT, _REENT_STDIN(_GLOBAL_REENT));
|
||||
__swsetup_r(_GLOBAL_REENT, _REENT_STDOUT(_GLOBAL_REENT));
|
||||
__swsetup_r(_GLOBAL_REENT, _REENT_STDERR(_GLOBAL_REENT));
|
||||
/*
|
||||
- This workaround for printf functions using 32-bit time_t after the 64-bit time_t upgrade
|
||||
- The 32-bit time_t usage is triggered through ROM Newlib functions printf related functions calling __swsetup_r() on
|
||||
the first call to a particular file pointer (i.e., stdin, stdout, stderr)
|
||||
- Thus, we call the toolchain version of __swsetup_r() now (before any printf calls are made) to setup all of the
|
||||
file pointers. Thus, the ROM newlib code will never call the ROM version of __swsetup_r().
|
||||
- See IDFGH-7728 for more details
|
||||
*/
|
||||
extern int __swsetup_r(struct _reent *, FILE *);
|
||||
__swsetup_r(_GLOBAL_REENT, _REENT_STDIN(_GLOBAL_REENT));
|
||||
__swsetup_r(_GLOBAL_REENT, _REENT_STDOUT(_GLOBAL_REENT));
|
||||
__swsetup_r(_GLOBAL_REENT, _REENT_STDERR(_GLOBAL_REENT));
|
||||
#endif /* ESP_ROM_NEEDS_SWSETUP_WORKAROUND */
|
||||
}
|
||||
}
|
||||
|
||||
ESP_SYSTEM_INIT_FN(init_newlib_stdio, CORE, BIT(0), 115)
|
||||
#else /* CONFIG_VFS_SUPPORT_IO */
|
||||
void esp_libc_init_global_stdio(void)
|
||||
{
|
||||
#if defined(CONFIG_VFS_SUPPORT_IO)
|
||||
esp_newlib_init_global_stdio("/dev/console");
|
||||
#else
|
||||
esp_newlib_init_global_stdio(NULL);
|
||||
#endif
|
||||
return ESP_OK;
|
||||
_GLOBAL_REENT->__cleanup = NULL;
|
||||
_REENT_SDIDINIT(_GLOBAL_REENT) = 0;
|
||||
__sinit(_GLOBAL_REENT);
|
||||
_GLOBAL_REENT->__cleanup = esp_cleanup_r;
|
||||
_REENT_SDIDINIT(_GLOBAL_REENT) = 1;
|
||||
}
|
||||
#endif /* CONFIG_VFS_SUPPORT_IO */
|
||||
|
||||
// Hook to force the linker to include this file
|
||||
void newlib_include_init_funcs(void)
|
||||
void esp_libc_include_init_funcs(void)
|
||||
{
|
||||
}
|
162
components/newlib/src/picolibc/esp32-spiram-rom-functions-c.lf
Normal file
162
components/newlib/src/picolibc/esp32-spiram-rom-functions-c.lf
Normal file
@ -0,0 +1,162 @@
|
||||
# If the Picolibc functions in ROM aren't used (eg because the external SPI RAM workaround is active), these functions will
|
||||
# be linked into the application directly instead. Normally, they would end up in flash, which is undesirable because esp-idf
|
||||
# and/or applications may assume that because these functions normally are in ROM, they are accessible even when flash is
|
||||
# inaccessible. To work around this, this ld fragment places these functions in RAM instead. If the ROM functions are used,
|
||||
# these defines do nothing, so they can still be included in that situation.
|
||||
|
||||
[mapping:libc]
|
||||
archive:
|
||||
libc.a
|
||||
entries:
|
||||
if SPIRAM_CACHE_WORKAROUND = y:
|
||||
# The following libs are either used in a lot of places or in critical code. (such as panic or abort)
|
||||
# Thus, they shall always be placed in IRAM.
|
||||
libc_stdlib_itoa (noflash)
|
||||
libc_string_memcmp (noflash)
|
||||
libc_machine_xtensa_memcpy (noflash)
|
||||
libc_machine_xtensa_memset (noflash)
|
||||
libc_string_strcat (noflash)
|
||||
libc_machine_xtensa_strcmp (noflash)
|
||||
libc_machine_xtensa_strlen (noflash)
|
||||
|
||||
if SPIRAM_CACHE_LIBJMP_IN_IRAM = y:
|
||||
libc_machine_xtensa_longjmp (noflash)
|
||||
libc_machine_xtensa_setjmp (noflash)
|
||||
|
||||
if SPIRAM_CACHE_LIBMATH_IN_IRAM = y:
|
||||
libc_stdlib_abs (noflash)
|
||||
libc_stdlib_div (noflash)
|
||||
libc_stdlib_labs (noflash)
|
||||
libc_stdlib_ldiv (noflash)
|
||||
libm_common_quorem (noflash)
|
||||
libm_common_s_fpclassify (noflash)
|
||||
libm_common_sf_nan (noflash)
|
||||
|
||||
if SPIRAM_CACHE_LIBNUMPARSER_IN_IRAM = y:
|
||||
libc_stdlib_utoa (noflash)
|
||||
libc_stdlib_atoi (noflash)
|
||||
libc_stdlib_atol (noflash)
|
||||
libc_tinystdio_strtol (noflash)
|
||||
libc_tinystdio_strtoul (noflash)
|
||||
|
||||
if SPIRAM_CACHE_LIBIO_IN_IRAM = y:
|
||||
libc_stdlib_wcrtomb (noflash)
|
||||
libc_stdlib_fvwrite (noflash)
|
||||
libc_stdlib_wbuf (noflash)
|
||||
libc_stdlib_wsetup (noflash)
|
||||
libc_tinystdio_fputwc (noflash)
|
||||
libc_stdlib_wctomb_r (noflash)
|
||||
libc_tinystdio_ungetc (noflash)
|
||||
libc_tinystdio_makebuf (noflash)
|
||||
libc_tinystdio_fflush (noflash)
|
||||
libc_stdlib_refill (noflash)
|
||||
libc_stdlib_sccl (noflash)
|
||||
|
||||
if SPIRAM_CACHE_LIBTIME_IN_IRAM = y:
|
||||
libc_time_asctime (noflash)
|
||||
libc_time_asctime_r (noflash)
|
||||
libc_time_ctime (noflash)
|
||||
libc_time_ctime_r (noflash)
|
||||
libc_time_lcltime (noflash)
|
||||
libc_time_lcltime_r (noflash)
|
||||
libc_time_gmtime (noflash)
|
||||
libc_time_gmtime_r (noflash)
|
||||
libc_time_strftime (noflash)
|
||||
libc_time_mktime (noflash)
|
||||
libc_time_tzset_r (noflash)
|
||||
libc_time_tzset (noflash)
|
||||
libc_time_time (noflash)
|
||||
libc_time_gettzinfo (noflash)
|
||||
libc_time_systimes (noflash)
|
||||
libc_time_month_lengths (noflash)
|
||||
libc_time_timelocal (noflash)
|
||||
libc_time_tzvars (noflash)
|
||||
libc_time_tzlock (noflash)
|
||||
libc_time_tzcalc_limits (noflash)
|
||||
libc_time_strptime (noflash)
|
||||
|
||||
if SPIRAM_CACHE_LIBCHAR_IN_IRAM = y:
|
||||
libc_ctype_ctype_ (noflash)
|
||||
libc_ctype_toupper (noflash)
|
||||
libc_ctype_tolower (noflash)
|
||||
libc_ctype_toascii (noflash)
|
||||
libc_string_strupr (noflash)
|
||||
libc_string_bzero (noflash)
|
||||
libc_ctype_isalnum (noflash)
|
||||
libc_ctype_isalpha (noflash)
|
||||
libc_ctype_isascii (noflash)
|
||||
libc_ctype_isblank (noflash)
|
||||
libc_ctype_iscntrl (noflash)
|
||||
libc_ctype_isdigit (noflash)
|
||||
libc_ctype_isgraph (noflash)
|
||||
libc_ctype_islower (noflash)
|
||||
libc_ctype_isprint (noflash)
|
||||
libc_ctype_ispunct (noflash)
|
||||
libc_ctype_isspace (noflash)
|
||||
libc_ctype_isupper (noflash)
|
||||
|
||||
if SPIRAM_CACHE_LIBMEM_IN_IRAM = y:
|
||||
libc_string_memccpy (noflash)
|
||||
libc_string_memchr (noflash)
|
||||
libc_string_memmove (noflash)
|
||||
libc_string_memrchr (noflash)
|
||||
|
||||
if SPIRAM_CACHE_LIBSTR_IN_IRAM = y:
|
||||
libc_string_strcasecmp (noflash)
|
||||
libc_string_strcasestr (noflash)
|
||||
libc_string_strchr (noflash)
|
||||
libc_string_strcoll (noflash)
|
||||
libc_string_strcpy (noflash)
|
||||
libc_string_strcspn (noflash)
|
||||
libc_string_strdup (noflash)
|
||||
libc_string_strdup_r (noflash)
|
||||
libc_string_strlcat (noflash)
|
||||
libc_string_strlcpy (noflash)
|
||||
libc_string_strlwr (noflash)
|
||||
libc_string_strncasecmp (noflash)
|
||||
libc_string_strncat (noflash)
|
||||
libc_string_strncmp (noflash)
|
||||
libc_string_strncpy (noflash)
|
||||
libc_string_strndup (noflash)
|
||||
libc_string_strndup_r (noflash)
|
||||
libc_string_strnlen (noflash)
|
||||
libc_string_strrchr (noflash)
|
||||
libc_string_strsep (noflash)
|
||||
libc_string_strspn (noflash)
|
||||
libc_string_strstr (noflash)
|
||||
libc_string_strtok_r (noflash)
|
||||
libc_string_strupr (noflash)
|
||||
|
||||
if SPIRAM_CACHE_LIBRAND_IN_IRAM = y:
|
||||
libc_stdlib_srand (noflash)
|
||||
libc_stdlib_rand (noflash)
|
||||
libc_stdlib_rand_r (noflash)
|
||||
|
||||
if SPIRAM_CACHE_LIBENV_IN_IRAM = y:
|
||||
libc_stdlib_environ (noflash)
|
||||
libc_stdlib_envlock (noflash)
|
||||
libc_stdlib_getenv_r (noflash)
|
||||
|
||||
if SPIRAM_CACHE_LIBFILE_IN_IRAM = y:
|
||||
libc_tinystdio_lock (noflash)
|
||||
libc_tinystdio_isatty (noflash)
|
||||
libc_tinystdio_fclose (noflash)
|
||||
libc_tinystdio_open (noflash)
|
||||
libc_tinystdio_close (noflash)
|
||||
libc_tinystdio_creat (noflash)
|
||||
libc_tinystdio_read (noflash)
|
||||
libc_tinystdio_rshift (noflash)
|
||||
libc_tinystdio_sbrk (noflash)
|
||||
libc_tinystdio_stdio (noflash)
|
||||
libc_tinystdio_syssbrk (noflash)
|
||||
libc_tinystdio_sysclose (noflash)
|
||||
libc_tinystdio_sysopen (noflash)
|
||||
libc_tinystdio_sysread (noflash)
|
||||
libc_tinystdio_syswrite (noflash)
|
||||
libc_tinystdio_impure (noflash)
|
||||
libc_tinystdio_fwalk (noflash)
|
||||
libc_tinystdio_findfp (noflash)
|
||||
|
||||
if SPIRAM_CACHE_LIBMISC_IN_IRAM = y:
|
||||
libc_stdlib_raise (noflash)
|
||||
libc_stdlib_system (noflash)
|
128
components/newlib/src/picolibc/open_memstream.c
Normal file
128
components/newlib/src/picolibc/open_memstream.c
Normal file
@ -0,0 +1,128 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include <stdio-bufio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define GET_BUF(mf) (*(mf->pbuf))
|
||||
#define GET_SIZE(mf) (*(mf->psize))
|
||||
|
||||
struct __file_mem {
|
||||
struct __file_ext xfile;
|
||||
char **pbuf;
|
||||
size_t *psize; // == strlen(*pbuf);
|
||||
size_t len; // Total allocated size
|
||||
size_t pos;
|
||||
};
|
||||
|
||||
static int __fmem_put(char c, FILE *f)
|
||||
{
|
||||
struct __file_mem *mf = (struct __file_mem *) f;
|
||||
if (mf->len == mf->pos) {
|
||||
size_t newsize = mf->len * 3 / 2;
|
||||
char *tmp = realloc(GET_BUF(mf), newsize);
|
||||
if (!tmp) {
|
||||
return _FDEV_ERR;
|
||||
}
|
||||
GET_BUF(mf) = tmp;
|
||||
mf->len = newsize;
|
||||
}
|
||||
GET_BUF(mf)[mf->pos++] = c;
|
||||
if (mf->pos > GET_SIZE(mf)) {
|
||||
GET_SIZE(mf) = mf->pos;
|
||||
}
|
||||
return (unsigned char) c;
|
||||
}
|
||||
|
||||
static int __fmem_get(FILE *f)
|
||||
{
|
||||
struct __file_mem *mf = (struct __file_mem *) f;
|
||||
int c;
|
||||
if (mf->pos < GET_SIZE(mf)) {
|
||||
c = (unsigned char) GET_BUF(mf)[mf->pos++];
|
||||
if (c == '\0') {
|
||||
c = _FDEV_EOF;
|
||||
}
|
||||
} else {
|
||||
c = _FDEV_ERR;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
static int __fmem_flush(FILE *f)
|
||||
{
|
||||
struct __file_mem *mf = (struct __file_mem *) f;
|
||||
GET_BUF(mf)[mf->pos] = '\0';
|
||||
GET_SIZE(mf) = mf->pos;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static off_t __fmem_seek(FILE *f, off_t pos, int whence)
|
||||
{
|
||||
struct __file_mem *mf = (struct __file_mem *) f;
|
||||
|
||||
switch (whence) {
|
||||
case SEEK_SET:
|
||||
break;
|
||||
case SEEK_CUR:
|
||||
pos += mf->pos;
|
||||
break;
|
||||
case SEEK_END:
|
||||
pos += GET_SIZE(mf);
|
||||
break;
|
||||
}
|
||||
if (pos < 0 || GET_SIZE(mf) < (size_t) pos) {
|
||||
return EOF;
|
||||
}
|
||||
mf->pos = pos;
|
||||
return pos;
|
||||
}
|
||||
|
||||
static int __fmem_close(FILE *f)
|
||||
{
|
||||
__fmem_flush(f);
|
||||
free(f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
FILE *
|
||||
open_memstream(char **buf, size_t *size)
|
||||
{
|
||||
struct __file_mem *mf;
|
||||
|
||||
if (!buf || !size) {
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
/* Allocate file structure and necessary buffers */
|
||||
mf = calloc(1, sizeof(struct __file_mem));
|
||||
|
||||
if (mf == NULL) {
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*buf = malloc(BUFSIZ);
|
||||
if (*buf == NULL) {
|
||||
errno = ENOMEM;
|
||||
free(mf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*mf = (struct __file_mem) {
|
||||
.xfile = FDEV_SETUP_EXT(__fmem_put, __fmem_get, __fmem_flush, __fmem_close,
|
||||
__fmem_seek, NULL, __SWR),
|
||||
.pbuf = buf,
|
||||
.psize = size,
|
||||
.len = BUFSIZ,
|
||||
.pos = 0,
|
||||
};
|
||||
*size = 0;
|
||||
*buf[0] = '\0';
|
||||
return (FILE *) mf;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user