mirror of https://github.com/ARMmbed/mbed-os.git
Better generation of heap section.
With this change, the heap section occupy the whole space from the end of the bss section to the start of the stack section instead of taking a fixed size in RAM. This change allows applications to make a more efficient use of the RAM available and allows application to be compiled if the space between end of bss and start of stack is less than 2048 bytes.pull/1854/head
parent
000e04d768
commit
c0a6c7c6d4
|
@ -124,18 +124,20 @@ SECTIONS
|
||||||
__bss_end__ = .;
|
__bss_end__ = .;
|
||||||
} > RAM
|
} > RAM
|
||||||
|
|
||||||
.heap (COPY):
|
.heap (NOLOAD):
|
||||||
{
|
{
|
||||||
__end__ = .;
|
__end__ = .;
|
||||||
end = __end__;
|
end = __end__;
|
||||||
|
__HeapBase = .;
|
||||||
*(.heap*)
|
*(.heap*)
|
||||||
|
. = ORIGIN(RAM) + LENGTH(RAM) - Stack_Size;
|
||||||
__HeapLimit = .;
|
__HeapLimit = .;
|
||||||
} > RAM
|
} > RAM
|
||||||
|
|
||||||
/* .stack_dummy section doesn't contains any symbols. It is only
|
/* .stack_dummy section doesn't contains any symbols. It is only
|
||||||
* used for linker to calculate size of stack sections, and assign
|
* used for linker to calculate size of stack sections, and assign
|
||||||
* values to stack symbols later */
|
* values to stack symbols later */
|
||||||
.stack_dummy (COPY):
|
.stack_dummy (NOLOAD):
|
||||||
{
|
{
|
||||||
*(.stack*)
|
*(.stack*)
|
||||||
} > RAM
|
} > RAM
|
||||||
|
|
|
@ -124,18 +124,20 @@ SECTIONS
|
||||||
__bss_end__ = .;
|
__bss_end__ = .;
|
||||||
} > RAM
|
} > RAM
|
||||||
|
|
||||||
.heap (COPY):
|
.heap (NOLOAD):
|
||||||
{
|
{
|
||||||
__end__ = .;
|
__end__ = .;
|
||||||
end = __end__;
|
end = __end__;
|
||||||
|
__HeapBase = .;
|
||||||
*(.heap*)
|
*(.heap*)
|
||||||
|
. = ORIGIN(RAM) + LENGTH(RAM) - Stack_Size;
|
||||||
__HeapLimit = .;
|
__HeapLimit = .;
|
||||||
} > RAM
|
} > RAM
|
||||||
|
|
||||||
/* .stack_dummy section doesn't contains any symbols. It is only
|
/* .stack_dummy section doesn't contains any symbols. It is only
|
||||||
* used for linker to calculate size of stack sections, and assign
|
* used for linker to calculate size of stack sections, and assign
|
||||||
* values to stack symbols later */
|
* values to stack symbols later */
|
||||||
.stack_dummy (COPY):
|
.stack_dummy (NOLOAD):
|
||||||
{
|
{
|
||||||
*(.stack*)
|
*(.stack*)
|
||||||
} > RAM
|
} > RAM
|
||||||
|
|
|
@ -124,18 +124,20 @@ SECTIONS
|
||||||
__bss_end__ = .;
|
__bss_end__ = .;
|
||||||
} > RAM
|
} > RAM
|
||||||
|
|
||||||
.heap (COPY):
|
.heap (NOLOAD):
|
||||||
{
|
{
|
||||||
__end__ = .;
|
__end__ = .;
|
||||||
end = __end__;
|
end = __end__;
|
||||||
|
__HeapBase = .;
|
||||||
*(.heap*)
|
*(.heap*)
|
||||||
|
. = ORIGIN(RAM) + LENGTH(RAM) - Stack_Size;
|
||||||
__HeapLimit = .;
|
__HeapLimit = .;
|
||||||
} > RAM
|
} > RAM
|
||||||
|
|
||||||
/* .stack_dummy section doesn't contains any symbols. It is only
|
/* .stack_dummy section doesn't contains any symbols. It is only
|
||||||
* used for linker to calculate size of stack sections, and assign
|
* used for linker to calculate size of stack sections, and assign
|
||||||
* values to stack symbols later */
|
* values to stack symbols later */
|
||||||
.stack_dummy (COPY):
|
.stack_dummy (NOLOAD):
|
||||||
{
|
{
|
||||||
*(.stack*)
|
*(.stack*)
|
||||||
} > RAM
|
} > RAM
|
||||||
|
|
|
@ -43,6 +43,7 @@ expected to be copied into the application project folder prior to its use!
|
||||||
#else
|
#else
|
||||||
.equ Stack_Size, 2048
|
.equ Stack_Size, 2048
|
||||||
#endif
|
#endif
|
||||||
|
.globl Stack_Size
|
||||||
.globl __StackTop
|
.globl __StackTop
|
||||||
.globl __StackLimit
|
.globl __StackLimit
|
||||||
__StackLimit:
|
__StackLimit:
|
||||||
|
@ -53,20 +54,8 @@ __StackTop:
|
||||||
|
|
||||||
.section .heap
|
.section .heap
|
||||||
.align 3
|
.align 3
|
||||||
#ifdef __HEAP_SIZE
|
|
||||||
.equ Heap_Size, __HEAP_SIZE
|
|
||||||
#else
|
|
||||||
.equ Heap_Size, 2048
|
|
||||||
#endif
|
|
||||||
.globl __HeapBase
|
.globl __HeapBase
|
||||||
.globl __HeapLimit
|
.globl __HeapLimit
|
||||||
__HeapBase:
|
|
||||||
.if Heap_Size
|
|
||||||
.space Heap_Size
|
|
||||||
.endif
|
|
||||||
.size __HeapBase, . - __HeapBase
|
|
||||||
__HeapLimit:
|
|
||||||
.size __HeapLimit, . - __HeapLimit
|
|
||||||
|
|
||||||
.section .Vectors
|
.section .Vectors
|
||||||
.align 2
|
.align 2
|
||||||
|
@ -259,4 +248,3 @@ Default_Handler:
|
||||||
|
|
||||||
|
|
||||||
.end
|
.end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue