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

OP-423 Port to OP: 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...

also move address into linker (CC and OP)
This commit is contained in:
Mathieu Rondonneau 2011-06-15 18:54:35 -07:00
parent ab4e15e9aa
commit e8cdf22427
4 changed files with 15 additions and 1 deletions

View File

@ -11,6 +11,8 @@ PROVIDE ( xPortSysTickHandler = 0 ) ;
PROVIDE(pios_board_info_blob = ORIGIN(BD_INFO));
_estack = 0x20004FF0;
/* there is probably a way to get that from the MEMORY section */
_eram = 0x20005000;
/* Section Definitions */
SECTIONS

View File

@ -2,6 +2,8 @@
_irq_stack_size = 0x400;
/* This is the size of the stack for early init: life span is until scheduler starts */
_init_stack_size = 0x400;
/* there is probably a way to get that from the MEMORY section */
_eram = 0x20010000;
/* Check valid alignment for VTOR */
ASSERT(ORIGIN(FLASH) == ALIGN(ORIGIN(FLASH), 0x80), "Start of memory region flash not aligned for startup vector table");
@ -279,6 +281,10 @@ SECTIONS
_init_stack_top = . - 4 ;
} > RAM
/* 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).
PROVIDE ( end = _ebss );
PROVIDE ( _end = _ebss );

View File

@ -128,7 +128,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

View File

@ -49,7 +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