From 294529b9326be9f5b2c754b2811312f85582b082 Mon Sep 17 00:00:00 2001 From: "yuhuan.du" Date: Thu, 23 Feb 2023 17:45:51 +0800 Subject: [PATCH] [Add] Declaring the memalign function is not supported --- components/libc_stub/newlib_stub.c | 8 ++++++++ hardware/chip/x2000/package.yaml | 1 + kernel/rhino/k_sys.c | 3 +++ 3 files changed, 12 insertions(+) diff --git a/components/libc_stub/newlib_stub.c b/components/libc_stub/newlib_stub.c index 6df15aa0..a133a4f2 100644 --- a/components/libc_stub/newlib_stub.c +++ b/components/libc_stub/newlib_stub.c @@ -369,6 +369,14 @@ void *__wrap__malloc_r(struct _reent *ptr, size_t size) return mem; } +extern int first_task_start; +void *__wrap__memalign_r(struct _reent *ptr, size_t boundary, size_t size) +{ + if(first_task_start) + printf("Error! Function \"memalign\" not supported !\n"); + return NULL; +} + void *__wrap__realloc_r(struct _reent *ptr, void *old, size_t newlen) { void *mem; diff --git a/hardware/chip/x2000/package.yaml b/hardware/chip/x2000/package.yaml index 2500639e..a6c64f73 100644 --- a/hardware/chip/x2000/package.yaml +++ b/hardware/chip/x2000/package.yaml @@ -96,6 +96,7 @@ build_config: -Wl,--wrap=localtime_r -Wl,--wrap=localtime -Wl,--wrap=_malloc_r + -Wl,--wrap=_memalign_r -Wl,--wrap=_realloc_r -Wl,--wrap=_calloc_r -Wl,--wrap=_free_r diff --git a/kernel/rhino/k_sys.c b/kernel/rhino/k_sys.c index 8d124154..498b013d 100644 --- a/kernel/rhino/k_sys.c +++ b/kernel/rhino/k_sys.c @@ -4,6 +4,8 @@ #include "k_api.h" +int first_task_start = 0; + RHINO_INLINE void rhino_stack_check_init(void) { #if (RHINO_CONFIG_INTRPT_STACK_OVF_CHECK > 0) @@ -114,6 +116,7 @@ kstat_t krhino_start(void) #endif g_sys_stat = RHINO_RUNNING; + first_task_start = 1; cpu_first_task_start(); /* should not be here */ -- Gitee