[liba] Overridable pointer for heap start/end

This commit is contained in:
Romain Goyet
2015-09-29 15:15:35 +02:00
parent 3726bc11cc
commit d384266ca6
4 changed files with 12 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
include ion/src/device/boot/Makefile
objs += $(addprefix ion/src/device/, init.o)
objs += $(addprefix ion/src/device/, init.o heap.o)
objs += $(addprefix ion/src/device/display/, display.o dma.o framebuffer.o gpio.o spi.o st7586.o)
objs += $(addprefix ion/src/device/keyboard/, keyboard.o)

View File

@@ -149,10 +149,10 @@ SECTIONS {
} >SRAM
.heap : {
_liba_heap_start = .;
_heap_start = .;
/* Note: We don't increment "." here, we set it. */
. = (ORIGIN(SRAM) + LENGTH(SRAM) - FRAMEBUFFER_SIZE - STACK_SIZE);
_liba_heap_end = .;
_heap_end = .;
} >SRAM
.framebuffer : {

5
ion/src/device/heap.c Normal file
View File

@@ -0,0 +1,5 @@
extern char _heap_start;
extern char _heap_end;
char * _liba_heap_start = &_heap_start;
char * _liba_heap_end = &_heap_end;

View File

@@ -2,8 +2,8 @@
#include <string.h>
#include <private/memconfig.h>
extern char _liba_heap_start;
extern char _liba_heap_end;
extern char * _liba_heap_start;
extern char * _liba_heap_end;
heap_config_t HeapConfig = {
.nHeap = 0
@@ -17,8 +17,8 @@ void * memsys5Realloc(void *pPrior, int nBytes);
int memsys5Roundup(int n);
static void configure_heap() {
HeapConfig.nHeap = (&_liba_heap_end - &_liba_heap_start);
HeapConfig.pHeap = &_liba_heap_start;
HeapConfig.nHeap = (_liba_heap_end - _liba_heap_start);
HeapConfig.pHeap = _liba_heap_start;
HeapConfig.mnReq = 1;
HeapConfig.bMemstat = 0;
HeapConfig.xLog = 0;