1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-17 02:52:12 +01:00

OP-423 also claim (at run-time) the remaining un-used bytes (between heap and end of RAM) that are for data growth (needed at compile time).

CAREFULL: the heap section need to be the last section in RAM to avoid overwritting data...

Tested with GCC 4.5.2 this gives 1K of free bytes usable in heap right away (including the 200 bytes saved just by using the new gcc).
This does not include any code re-org yet!
This commit is contained in:
Mathieu Rondonneau 2011-06-14 22:13:30 -07:00
parent 3780de8d3e
commit ab4e15e9aa
2 changed files with 12 additions and 0 deletions

View File

@ -101,6 +101,11 @@ SECTIONS
_init_stack_top = . - 4 ;
} > SRAM
/* keep the heap section at the end of the SRAM */
/* this will allow to claim the remaining bytes not used
/* at run time! (done by the reset vector).
. = ALIGN(4);
_end = . ;

View File

@ -49,6 +49,7 @@ defined in linker script */
.word _ebss
.equ BootRAM, 0xF108F85F
.equ _eram, 0x20005000
/**
* @brief This is the code that gets called when the processor first
* starts execution following a reset event. Only the absolutely
@ -130,7 +131,13 @@ LoopFillZerobss:
add r0, #0
msr control, r0
/* add heap_post_rtos to the heap (if the capability/function exist) */
/* Also claim the unused memory (between end of heap to end of memory */
/* CAREFULL: the heap section must be the last section in RAM in order this to work */
ldr r0, = _init_stack_size
ldr r1, = _eheap_post_rtos
ldr r2, = _eram
subs r2, r2, r1
adds r0, r0, r2
bl xPortIncreaseHeapSize
/* Start the FreeRTOS scheduler which never returns.*/
bl vTaskStartScheduler