Browse Source

[libc] picolibc support heap. (#7571)

guo 2 years ago
parent
commit
7a4f9d0ada
1 changed files with 26 additions and 0 deletions
  1. 26 0
      components/libc/compilers/picolibc/syscall.c

+ 26 - 0
components/libc/compilers/picolibc/syscall.c

@@ -14,3 +14,29 @@ int pico_get_errno(void)
 {
     return rt_get_errno();
 }
+
+#ifdef RT_USING_HEAP /* Memory routine */
+void *malloc(size_t n)
+{
+    return rt_malloc(n);
+}
+RTM_EXPORT(malloc);
+
+void *realloc(void *rmem, size_t newsize)
+{
+    return rt_realloc(rmem, newsize);
+}
+RTM_EXPORT(realloc);
+
+void *calloc(size_t nelem, size_t elsize)
+{
+    return rt_calloc(nelem, elsize);
+}
+RTM_EXPORT(calloc);
+
+void free(void *rmem)
+{
+    rt_free(rmem);
+}
+RTM_EXPORT(free);
+#endif