We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3327ffa commit ee1e854Copy full SHA for ee1e854
src/memheap.c
@@ -832,13 +832,16 @@ static struct rt_memheap _heap;
832
*/
833
void rt_system_heap_init(void *begin_addr, void *end_addr)
834
{
835
- RT_ASSERT((rt_uint32_t)end_addr > (rt_uint32_t)begin_addr);
+ RT_ASSERT((rt_size_t)end_addr > (rt_size_t)begin_addr);
836
+
837
+ rt_size_t begin_align = RT_ALIGN((rt_size_t)begin_addr, RT_ALIGN_SIZE);
838
+ rt_size_t end_align = RT_ALIGN_DOWN((rt_size_t)end_addr, RT_ALIGN_SIZE);
839
840
/* initialize a default heap in the system */
841
rt_memheap_init(&_heap,
842
"heap",
- begin_addr,
- (rt_uint32_t)end_addr - (rt_uint32_t)begin_addr);
843
+ (void *)begin_align,
844
+ end_align - begin_align);
845
}
846
847
/**
0 commit comments