diff --git a/components/libc_stub/newlib_stub.c b/components/libc_stub/newlib_stub.c index 6df15aa0e0f33c0813bd4666e1eb8f4305a6c72c..a133a4f21cb474945d6ed136b892e7fe2cb257f8 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 2500639ea5bdb5441f1f64724f033a4ec9f1b730..a6c64f7321e765d519e443d4419b9d6dc70c9393 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 8d124154f210e76a9bd46a7dbc116994e0ea86f3..498b013dbed7e515455a970059e8ff9e59164c4e 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 */