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.
If a section does not appear in the map file, then it is simply not used.
Hi Schick, but anyway the program needs stack to run, then where is the stack section reserved? Thanks.
"the program" means what? Baremetal, Linux? Check the startup code to see how the stack is setup.
Hi Schick, I am using Baremetal. Can you please provide an example of start-up code for core 0? Thanks.
No I can't. But there shall be plenty around in the internet.
Hi Snick. Thanks a lot for your suggestion.