This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Set stack size in linker file for Cortex-A72

Hi all.

May I know how to set the stack size in linker file for Cortex-A72?

I use the below linker file but I cannot see the ".stack" section in map file.

STACKSIZE = DEFINED(STACKSIZE) ? STACKSIZE : 0x80000;
HEAPSIZE = DEFINED(HEAPSIZE) ? HEAPSIZE : 0x80000;

MEMORY
{
    DDR4 :        o = 0x80000,  l = 0x40000000  /* 1GB external DDR */ 
}

SECTIONS
{
    .text :
	{
		KEEP(*(.text.boot)) *(.text .text.* .gnu.linkonce.t*)
	} > DDR4

    .rodata :
	{
		*(.rodata .rodata.* .gnu.linkonce.r*)
	} > DDR4
    PROVIDE(_data = .);
    .data :
	{
		*(.data .data.* .gnu.linkonce.d*)
	} > DDR4
    .bss (NOLOAD) :
	{
        . = ALIGN(16);
        __bss_start = .;
        *(.bss .bss.*)
        *(COMMON)
        __bss_end = .;
    } > DDR4
    
    .heap (NOLOAD):
    {
        /* The line below can be used to FILL the memory with a known value and
         * debug any stack overruns. For this to work, the specifier (NOLOAD) above 
         * must be removed at the expense of an increase in the output binary size */
        FILL(0xDEADBEEF)
        . = ALIGN(16);
        __end__ = .;
        end = __end__;
        /* The line below created to be compatible with Linaro's semihosting support */
        __HeapBase = __end__; 
        *(.heap*)
        . = . + HEAPSIZE;
        __HeapLimit = .; 
    } > DDR4

    /* .stack section doesn't contain any symbols. It is only
     * used for linker to calculate size of stack sections, and assign
     * values to stack symbols later */
    .stack (NOLOAD):
    {
        /* The line below can be used to FILL the memory with a known value and
         * debug any stack overruns. For this to work, the specifier (NOLOAD) above 
         * must be removed at the expense of an increase in the output binary size */
        FILL(0xBAD0BAD0)
        . = ALIGN(16);
        __StackLimit = . ;
        *(.stack*)
        . = . + STACKSIZE;
        __StackTop = . ;
        /* The line below created to be compatible with Linaro's semihosting support */
        __StackBase = . ;
    } > DDR4

    PROVIDE(__stack = __StackTop);
    _end = .;

   /DISCARD/ : { *(.comment) *(.gnu*) *(.note*) *(.eh_frame*) }
}

__bss_size = (__bss_end - __bss_start)>>3;

Thanks a lot.