esp32-spiram-rom-functions-c.lf 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. # If the Newlib functions in ROM aren't used (eg because the external SPI RAM workaround is active), these functions will
  2. # be linked into the application directly instead. Normally, they would end up in flash, which is undesirable because esp-idf
  3. # and/or applications may assume that because these functions normally are in ROM, they are accessible even when flash is
  4. # inaccessible. To work around this, this ld fragment places these functions in RAM instead. If the ROM functions are used,
  5. # these defines do nothing, so they can still be included in that situation.
  6. #
  7. #
  8. # Note: the only difference between esp32-spiram-rom-functions-c.lf
  9. # and esp32-spiram-rom-functions-psram-workaround.lf is the archive name.
  10. [mapping:libc]
  11. archive:
  12. if NEWLIB_NANO_FORMAT = y:
  13. libc_nano.a
  14. else:
  15. libc.a
  16. entries:
  17. if SPIRAM_CACHE_WORKAROUND = y:
  18. # The following libs are either used in a lot of places or in critical
  19. # code. (such as panic or abort)
  20. # Thus, they shall always be placed in IRAM.
  21. if IDF_TOOLCHAIN = "gcc": # TODO: IDF-8134
  22. libc_a-itoa (noflash)
  23. libc_a-memcmp (noflash)
  24. libc_a-memcpy (noflash)
  25. libc_a-memset (noflash)
  26. libc_a-strcat (noflash)
  27. libc_a-strcmp (noflash)
  28. libc_a-strlen (noflash)
  29. else:
  30. lib_a-itoa (noflash)
  31. lib_a-memcmp (noflash)
  32. lib_a-memcpy (noflash)
  33. lib_a-memset (noflash)
  34. lib_a-strcat (noflash)
  35. lib_a-strcmp (noflash)
  36. lib_a-strlen (noflash)
  37. if SPIRAM_CACHE_LIBJMP_IN_IRAM = y:
  38. if IDF_TOOLCHAIN = "gcc":
  39. libc_a-longjmp (noflash)
  40. libc_a-setjmp (noflash)
  41. else:
  42. lib_a-longjmp (noflash)
  43. lib_a-setjmp (noflash)
  44. if SPIRAM_CACHE_LIBMATH_IN_IRAM = y:
  45. if IDF_TOOLCHAIN = "gcc":
  46. libc_a-abs (noflash)
  47. libc_a-div (noflash)
  48. libc_a-labs (noflash)
  49. libc_a-ldiv (noflash)
  50. libc_a-quorem (noflash)
  51. libc_a-s_fpclassify (noflash)
  52. libc_a-sf_nan (noflash)
  53. else:
  54. lib_a-abs (noflash)
  55. lib_a-div (noflash)
  56. lib_a-labs (noflash)
  57. lib_a-ldiv (noflash)
  58. lib_a-quorem (noflash)
  59. lib_a-s_fpclassify (noflash)
  60. lib_a-sf_nan (noflash)
  61. if SPIRAM_CACHE_LIBNUMPARSER_IN_IRAM = y:
  62. if IDF_TOOLCHAIN = "gcc":
  63. libc_a-utoa (noflash)
  64. libc_a-atoi (noflash)
  65. libc_a-atol (noflash)
  66. libc_a-strtol (noflash)
  67. libc_a-strtoul (noflash)
  68. else:
  69. lib_a-utoa (noflash)
  70. lib_a-atoi (noflash)
  71. lib_a-atol (noflash)
  72. lib_a-strtol (noflash)
  73. lib_a-strtoul (noflash)
  74. if SPIRAM_CACHE_LIBIO_IN_IRAM = y:
  75. if IDF_TOOLCHAIN = "gcc":
  76. libc_a-wcrtomb (noflash)
  77. libc_a-fvwrite (noflash)
  78. libc_a-wbuf (noflash)
  79. libc_a-wsetup (noflash)
  80. libc_a-fputwc (noflash)
  81. libc_a-wctomb_r (noflash)
  82. libc_a-ungetc (noflash)
  83. libc_a-makebuf (noflash)
  84. libc_a-fflush (noflash)
  85. libc_a-refill (noflash)
  86. libc_a-sccl (noflash)
  87. else:
  88. lib_a-wcrtomb (noflash)
  89. lib_a-fvwrite (noflash)
  90. lib_a-wbuf (noflash)
  91. lib_a-wsetup (noflash)
  92. lib_a-fputwc (noflash)
  93. lib_a-wctomb_r (noflash)
  94. lib_a-ungetc (noflash)
  95. lib_a-makebuf (noflash)
  96. lib_a-fflush (noflash)
  97. lib_a-refill (noflash)
  98. lib_a-sccl (noflash)
  99. if SPIRAM_CACHE_LIBTIME_IN_IRAM = y:
  100. if IDF_TOOLCHAIN = "gcc":
  101. libc_a-asctime (noflash)
  102. libc_a-asctime_r (noflash)
  103. libc_a-ctime (noflash)
  104. libc_a-ctime_r (noflash)
  105. libc_a-lcltime (noflash)
  106. libc_a-lcltime_r (noflash)
  107. libc_a-gmtime (noflash)
  108. libc_a-gmtime_r (noflash)
  109. libc_a-strftime (noflash)
  110. libc_a-mktime (noflash)
  111. libc_a-tzset_r (noflash)
  112. libc_a-tzset (noflash)
  113. libc_a-time (noflash)
  114. libc_a-gettzinfo (noflash)
  115. libc_a-systimes (noflash)
  116. libc_a-month_lengths (noflash)
  117. libc_a-timelocal (noflash)
  118. libc_a-tzvars (noflash)
  119. libc_a-tzlock (noflash)
  120. libc_a-tzcalc_limits (noflash)
  121. libc_a-strptime (noflash)
  122. else:
  123. lib_a-asctime (noflash)
  124. lib_a-asctime_r (noflash)
  125. lib_a-ctime (noflash)
  126. lib_a-ctime_r (noflash)
  127. lib_a-lcltime (noflash)
  128. lib_a-lcltime_r (noflash)
  129. lib_a-gmtime (noflash)
  130. lib_a-gmtime_r (noflash)
  131. lib_a-strftime (noflash)
  132. lib_a-mktime (noflash)
  133. lib_a-tzset_r (noflash)
  134. lib_a-tzset (noflash)
  135. lib_a-time (noflash)
  136. lib_a-gettzinfo (noflash)
  137. lib_a-systimes (noflash)
  138. lib_a-month_lengths (noflash)
  139. lib_a-timelocal (noflash)
  140. lib_a-tzvars (noflash)
  141. lib_a-tzlock (noflash)
  142. lib_a-tzcalc_limits (noflash)
  143. lib_a-strptime (noflash)
  144. if SPIRAM_CACHE_LIBCHAR_IN_IRAM = y:
  145. if IDF_TOOLCHAIN = "gcc":
  146. libc_a-ctype_ (noflash)
  147. libc_a-toupper (noflash)
  148. libc_a-tolower (noflash)
  149. libc_a-toascii (noflash)
  150. libc_a-strupr (noflash)
  151. libc_a-bzero (noflash)
  152. libc_a-isalnum (noflash)
  153. libc_a-isalpha (noflash)
  154. libc_a-isascii (noflash)
  155. libc_a-isblank (noflash)
  156. libc_a-iscntrl (noflash)
  157. libc_a-isdigit (noflash)
  158. libc_a-isgraph (noflash)
  159. libc_a-islower (noflash)
  160. libc_a-isprint (noflash)
  161. libc_a-ispunct (noflash)
  162. libc_a-isspace (noflash)
  163. libc_a-isupper (noflash)
  164. else:
  165. lib_a-ctype_ (noflash)
  166. lib_a-toupper (noflash)
  167. lib_a-tolower (noflash)
  168. lib_a-toascii (noflash)
  169. lib_a-strupr (noflash)
  170. lib_a-bzero (noflash)
  171. lib_a-isalnum (noflash)
  172. lib_a-isalpha (noflash)
  173. lib_a-isascii (noflash)
  174. lib_a-isblank (noflash)
  175. lib_a-iscntrl (noflash)
  176. lib_a-isdigit (noflash)
  177. lib_a-isgraph (noflash)
  178. lib_a-islower (noflash)
  179. lib_a-isprint (noflash)
  180. lib_a-ispunct (noflash)
  181. lib_a-isspace (noflash)
  182. lib_a-isupper (noflash)
  183. if SPIRAM_CACHE_LIBMEM_IN_IRAM = y:
  184. if IDF_TOOLCHAIN = "gcc":
  185. libc_a-memccpy (noflash)
  186. libc_a-memchr (noflash)
  187. libc_a-memmove (noflash)
  188. libc_a-memrchr (noflash)
  189. else:
  190. lib_a-memccpy (noflash)
  191. lib_a-memchr (noflash)
  192. lib_a-memmove (noflash)
  193. lib_a-memrchr (noflash)
  194. if SPIRAM_CACHE_LIBSTR_IN_IRAM = y:
  195. if IDF_TOOLCHAIN = "gcc":
  196. libc_a-strcasecmp (noflash)
  197. libc_a-strcasestr (noflash)
  198. libc_a-strchr (noflash)
  199. libc_a-strcoll (noflash)
  200. libc_a-strcpy (noflash)
  201. libc_a-strcspn (noflash)
  202. libc_a-strdup (noflash)
  203. libc_a-strdup_r (noflash)
  204. libc_a-strlcat (noflash)
  205. libc_a-strlcpy (noflash)
  206. libc_a-strlwr (noflash)
  207. libc_a-strncasecmp (noflash)
  208. libc_a-strncat (noflash)
  209. libc_a-strncmp (noflash)
  210. libc_a-strncpy (noflash)
  211. libc_a-strndup (noflash)
  212. libc_a-strndup_r (noflash)
  213. libc_a-strnlen (noflash)
  214. libc_a-strrchr (noflash)
  215. libc_a-strsep (noflash)
  216. libc_a-strspn (noflash)
  217. libc_a-strstr (noflash)
  218. libc_a-strtok_r (noflash)
  219. libc_a-strupr (noflash)
  220. else:
  221. lib_a-strcasecmp (noflash)
  222. lib_a-strcasestr (noflash)
  223. lib_a-strchr (noflash)
  224. lib_a-strcoll (noflash)
  225. lib_a-strcpy (noflash)
  226. lib_a-strcspn (noflash)
  227. lib_a-strdup (noflash)
  228. lib_a-strdup_r (noflash)
  229. lib_a-strlcat (noflash)
  230. lib_a-strlcpy (noflash)
  231. lib_a-strlwr (noflash)
  232. lib_a-strncasecmp (noflash)
  233. lib_a-strncat (noflash)
  234. lib_a-strncmp (noflash)
  235. lib_a-strncpy (noflash)
  236. lib_a-strndup (noflash)
  237. lib_a-strndup_r (noflash)
  238. lib_a-strnlen (noflash)
  239. lib_a-strrchr (noflash)
  240. lib_a-strsep (noflash)
  241. lib_a-strspn (noflash)
  242. lib_a-strstr (noflash)
  243. lib_a-strtok_r (noflash)
  244. lib_a-strupr (noflash)
  245. if SPIRAM_CACHE_LIBRAND_IN_IRAM = y:
  246. if IDF_TOOLCHAIN = "gcc":
  247. libc_a-srand (noflash)
  248. libc_a-rand (noflash)
  249. libc_a-rand_r (noflash)
  250. else:
  251. lib_a-srand (noflash)
  252. lib_a-rand (noflash)
  253. lib_a-rand_r (noflash)
  254. if SPIRAM_CACHE_LIBENV_IN_IRAM = y:
  255. if IDF_TOOLCHAIN = "gcc":
  256. libc_a-environ (noflash)
  257. libc_a-envlock (noflash)
  258. libc_a-getenv_r (noflash)
  259. else:
  260. lib_a-environ (noflash)
  261. lib_a-envlock (noflash)
  262. lib_a-getenv_r (noflash)
  263. if SPIRAM_CACHE_LIBFILE_IN_IRAM = y:
  264. lock (noflash)
  265. isatty (noflash)
  266. creat (noflash)
  267. if IDF_TOOLCHAIN = "gcc":
  268. libc_a-fclose (noflash)
  269. libc_a-open (noflash)
  270. libc_a-close (noflash)
  271. libc_a-creat (noflash)
  272. libc_a-read (noflash)
  273. libc_a-rshift (noflash)
  274. libc_a-sbrk (noflash)
  275. libc_a-stdio (noflash)
  276. libc_a-syssbrk (noflash)
  277. libc_a-sysclose (noflash)
  278. libc_a-sysopen (noflash)
  279. libc_a-sysread (noflash)
  280. libc_a-syswrite (noflash)
  281. libc_a-impure (noflash)
  282. libc_a-fwalk (noflash)
  283. libc_a-findfp (noflash)
  284. else:
  285. lib_a-fclose (noflash)
  286. lib_a-open (noflash)
  287. lib_a-close (noflash)
  288. lib_a-creat (noflash)
  289. lib_a-read (noflash)
  290. lib_a-rshift (noflash)
  291. lib_a-sbrk (noflash)
  292. lib_a-stdio (noflash)
  293. lib_a-syssbrk (noflash)
  294. lib_a-sysclose (noflash)
  295. lib_a-sysopen (noflash)
  296. lib_a-sysread (noflash)
  297. lib_a-syswrite (noflash)
  298. lib_a-impure (noflash)
  299. lib_a-fwalk (noflash)
  300. lib_a-findfp (noflash)
  301. if SPIRAM_CACHE_LIBMISC_IN_IRAM = y:
  302. if IDF_TOOLCHAIN = "gcc":
  303. libc_a-raise (noflash)
  304. libc_a-system (noflash)
  305. else:
  306. lib_a-raise (noflash)
  307. lib_a-system (noflash)