From 4cc3fd9397de94253b91dc2636155142b37dcee2 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Mon, 31 Aug 2020 23:02:41 +0200 Subject: [PATCH] assign size --- armsrc/BigBuf.c | 3 --- armsrc/umm_malloc.c | 8 +++++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/armsrc/BigBuf.c b/armsrc/BigBuf.c index f7d25176a..f6c111d85 100644 --- a/armsrc/BigBuf.c +++ b/armsrc/BigBuf.c @@ -21,9 +21,6 @@ extern uint8_t _stack_start, __bss_end__; // We know that bss is aligned to 4 bytes. static uint8_t *BigBuf = &__bss_end__; -void *UMM_MALLOC_CFG_HEAP_ADDR = &__bss_end__; -uint32_t UMM_MALLOC_CFG_HEAP_SIZE = (uint32_t)&_stack_start - (uint32_t)&__bss_end__; - /* BigBuf memory layout: Pointer to highest available memory: s_bigbuf_hi high s_bigbuf_size diff --git a/armsrc/umm_malloc.c b/armsrc/umm_malloc.c index 44573f75d..8aa302c1c 100644 --- a/armsrc/umm_malloc.c +++ b/armsrc/umm_malloc.c @@ -49,11 +49,9 @@ #define DBGLOG_LEVEL 0 -//#include "dbglog/dbglog.h" #include "dbprint.h" -extern void *UMM_MALLOC_CFG_HEAP_ADDR; -extern uint32_t UMM_MALLOC_CFG_HEAP_SIZE; +extern uint8_t _stack_start, __bss_end__; /* ------------------------------------------------------------------------- */ @@ -232,6 +230,10 @@ static uint16_t umm_assimilate_down( uint16_t c, uint16_t freemask ) { /* ------------------------------------------------------------------------- */ void umm_init( void ) { + + void *UMM_MALLOC_CFG_HEAP_ADDR = &__bss_end__; + uint32_t UMM_MALLOC_CFG_HEAP_SIZE = (uint32_t)&_stack_start - (uint32_t)&__bss_end__; + /* init heap pointer and size, and memset it to 0 */ umm_heap = (umm_block *)UMM_MALLOC_CFG_HEAP_ADDR; umm_numblocks = (UMM_MALLOC_CFG_HEAP_SIZE / sizeof(umm_block));