From fa1f1ef485734d990f9a5aecb001d3a0aa0eb59a Mon Sep 17 00:00:00 2001 From: yangjie Date: Fri, 11 Jun 2021 10:00:23 +0800 Subject: [PATCH] [src] add RT_WEAK for rt_malloc_align,rt_free_align --- src/kservice.c | 4 ++-- src/memheap.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/kservice.c b/src/kservice.c index 7ed05b6651..40040f7885 100644 --- a/src/kservice.c +++ b/src/kservice.c @@ -1238,7 +1238,7 @@ RTM_EXPORT(rt_kprintf); * * @return the allocated memory block on successful, otherwise returns RT_NULL */ -void *rt_malloc_align(rt_size_t size, rt_size_t align) +RT_WEAK void *rt_malloc_align(rt_size_t size, rt_size_t align) { void *ptr; void *align_ptr; @@ -1284,7 +1284,7 @@ RTM_EXPORT(rt_malloc_align); * * @param ptr the memory block pointer */ -void rt_free_align(void *ptr) +RT_WEAK void rt_free_align(void *ptr) { void *real_ptr; diff --git a/src/memheap.c b/src/memheap.c index 35a04c14b1..80f27a461f 100644 --- a/src/memheap.c +++ b/src/memheap.c @@ -757,6 +757,8 @@ static struct rt_memheap _heap; void rt_system_heap_init(void *begin_addr, void *end_addr) { + RT_ASSERT((rt_uint32_t)end_addr > (rt_uint32_t)begin_addr); + /* initialize a default heap in the system */ rt_memheap_init(&_heap, "heap",