### General question about linker script, heap and stack

Posted:

**Fri Mar 08, 2019 9:39 pm**Hi,

in my linker script heap is defined as follows:
And in my startup file there is this line:
These two files are not from the same firmware package, I pulled the startup file from CMSIS and the linker file from my MCU verndor.

Am I correct, that the bottom part is redundant in this case and effectively doubles my heap?

What would be the best approach?

in my linker script heap is defined as follows:

Code: Select all

```
.heap : {
__heap_start__ = .;
end = __heap_start__;
_heap_start = __heap_start__;
_end = end;
__end = end;
. = . + HEAPSIZE;
KEEP(*(.heap))
__heap_end__ = .;
__HeapLimit = __heap_end__;
_heap_end = __heap_end__;
} > REGION_HEAP
```

Code: Select all

```
#define __HEAP_SIZE 0x00002000
#if __HEAP_SIZE > 0
static uint8_t heap[__HEAP_SIZE] __attribute__ ((aligned(8), used, section(".heap")));
#endif
```

Am I correct, that the bottom part is redundant in this case and effectively doubles my heap?

What would be the best approach?