# If the Newlib 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.
#
#
# Note: the only difference between esp32-spiram-rom-functions-c.lf
# and esp32-spiram-rom-functions-psram-workaround.lf is the archive name.

[mapping:libc]
archive:
  if NEWLIB_NANO_FORMAT = y:
    libc_nano.a
  else:
    libc.a
entries:
  if SPIRAM_CACHE_WORKAROUND = y:
    lib_a-utoa (noflash)
    lib_a-longjmp (noflash)
    lib_a-setjmp (noflash)
    lib_a-abs (noflash)
    lib_a-div (noflash)
    lib_a-labs (noflash)
    lib_a-ldiv (noflash)
    lib_a-quorem (noflash)
    lib_a-utoa (noflash)
    lib_a-itoa (noflash)
    lib_a-atoi (noflash)
    lib_a-atol (noflash)
    lib_a-strtol (noflash)
    lib_a-strtoul (noflash)
    lib_a-wcrtomb (noflash)
    lib_a-fvwrite (noflash)
    lib_a-wbuf (noflash)
    lib_a-wsetup (noflash)
    lib_a-fputwc (noflash)
    lib_a-wctomb_r (noflash)
    lib_a-ungetc (noflash)
    lib_a-makebuf (noflash)
    lib_a-fflush (noflash)
    lib_a-refill (noflash)
    lib_a-s_fpclassify (noflash)
    lib_a-asctime (noflash)
    lib_a-ctime (noflash)
    lib_a-ctime_r (noflash)
    lib_a-lcltime (noflash)
    lib_a-lcltime_r (noflash)
    lib_a-gmtime (noflash)
    lib_a-gmtime_r (noflash)
    lib_a-strftime (noflash)
    lib_a-mktime (noflash)
    lib_a-syswrite (noflash)
    lib_a-tzset_r (noflash)
    lib_a-tzset (noflash)
    lib_a-toupper (noflash)
    lib_a-tolower (noflash)
    lib_a-toascii (noflash)
    lib_a-systimes (noflash)
    lib_a-time (noflash)
    lib_a-gettzinfo (noflash)
    lib_a-strupr (noflash)
    lib_a-asctime_r (noflash)
    lib_a-bzero (noflash)
    lib_a-close (noflash)
    lib_a-creat (noflash)
    lib_a-environ (noflash)
    lib_a-fclose (noflash)
    lib_a-isalnum (noflash)
    lib_a-isalpha (noflash)
    lib_a-isascii (noflash)
    lib_a-isblank (noflash)
    lib_a-iscntrl (noflash)
    lib_a-isdigit (noflash)
    lib_a-isgraph (noflash)
    lib_a-islower (noflash)
    lib_a-isprint (noflash)
    lib_a-ispunct (noflash)
    lib_a-isspace (noflash)
    lib_a-isupper (noflash)
    lib_a-memccpy (noflash)
    lib_a-memchr (noflash)
    lib_a-memcmp (noflash)
    lib_a-memcpy (noflash)
    lib_a-memmove (noflash)
    lib_a-memrchr (noflash)
    lib_a-memset (noflash)
    lib_a-open (noflash)
    lib_a-rand (noflash)
    lib_a-rand_r (noflash)
    lib_a-read (noflash)
    lib_a-rshift (noflash)
    lib_a-sbrk (noflash)
    lib_a-srand (noflash)
    lib_a-strcasecmp (noflash)
    lib_a-strcasestr (noflash)
    lib_a-strcat (noflash)
    lib_a-strchr (noflash)
    lib_a-strcmp (noflash)
    lib_a-strcoll (noflash)
    lib_a-strcpy (noflash)
    lib_a-strcspn (noflash)
    lib_a-strdup (noflash)
    lib_a-strlcat (noflash)
    lib_a-strlcpy (noflash)
    lib_a-strlen (noflash)
    lib_a-strlwr (noflash)
    lib_a-strncasecmp (noflash)
    lib_a-strncat (noflash)
    lib_a-strncmp (noflash)
    lib_a-strncpy (noflash)
    lib_a-strndup (noflash)
    lib_a-strnlen (noflash)
    lib_a-strrchr (noflash)
    lib_a-strsep (noflash)
    lib_a-strspn (noflash)
    lib_a-strstr (noflash)
    lib_a-strtok_r (noflash)
    lib_a-strupr (noflash)
    lib_a-stdio (noflash)
    lib_a-syssbrk (noflash)
    lib_a-sysclose (noflash)
    lib_a-sysopen (noflash)
    creat (noflash)
    lib_a-sysread (noflash)
    lib_a-syswrite (noflash)
    lib_a-impure (noflash)
    lib_a-tzvars (noflash)
    lib_a-sf_nan (noflash)
    lib_a-tzcalc_limits (noflash)
    lib_a-month_lengths (noflash)
    lib_a-timelocal (noflash)
    lib_a-findfp (noflash)
    lock (noflash)
    lib_a-getenv_r (noflash)
    isatty (noflash)
    lib_a-fwalk (noflash)
    lib_a-getenv_r (noflash)
    lib_a-tzlock (noflash)
    lib_a-ctype_ (noflash)
    lib_a-sccl (noflash)
    lib_a-strptime (noflash)
    lib_a-envlock (noflash)
    lib_a-raise (noflash)
    lib_a-strdup_r (noflash)
    lib_a-system (noflash)
    lib_a-strndup_r (noflash)
