Main

12.1 EDK - How do I divide the ".text" section of the three different ".text" file sections on different memories in Linker script?

AR# 21639

Search For Another Answer

Topic EDK Hardware
Last Updated 11/10/2010
Status Active
Description

How do I divide the ".text" section of the three different ".text" file sections on different memories?

Solution


 ******************************************************************************
 *
 * Divided Instruction sides on Different Memories LINKER SCRIPT
 *
 * This linker script divide 3 different files .text sections on different
 * memories (one internal bram, and one external ddr). This is done to run
 * critical instructions on BRAM in order to speed it up.
 *
 * NOTE: Make sure you have set "-save-temps" compiler option for getting
 * object files.
 *
 *
 *****************************************************************************
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *****************************************************************************/

_STACK_SIZE = 1024k;
_HEAP_SIZE = 1024k; 

MEMORY
{
ddr : ORIGIN = 0x00000000, LENGTH = 64M /*external DDR SDRAM Memory*/
bram : ORIGIN = 0xFFFF0000, LENGTH = 64K - 4 /*internal Block RAM Memory*/
boot : ORIGIN = 0xfffffffc, LENGTH = 4
}

STARTUP(boot.o)
ENTRY(_boot)
GROUP(libxil.a libc.a)

SECTIONS
{

  .vectors :
{
  *(.vectors)
} > ddr

/*at least must be one section named .text */
 .text : { file1.o(.text) } > bram

/*the name of this section may be whatever*/
  .textDDR :
{
file2.o(.text)
file3.o(.text)
} > ddr

  .data :
{
  *(.data)
  *(.got2)
  *(.rodata)
  *(.fixup)
} > ddr

/* small data area (read/write): keep together! */
 .sdata : { *(.sdata) } > ddr

 .sbss :
{
. = ALIGN(4);
  *(.sbss)
. = ALIGN(4);
} > ddr

__sbss_start = ADDR(.sbss);
__sbss_end = ADDR(.sbss) + SIZEOF(.sbss);

/* small data area 2 (read only) */
.sdata2 : { *(.sdata2) } > ddr

.bss :
{
. = ALIGN(4);
 *(.bss)
 *(COMMON)
. = ALIGN(4);

__bss_end = .;

/* add stack and align to 16 byte boundary */
. = . + _STACK_SIZE;
. = ALIGN(16);
__stack = .;
_heap_start = .;
. = . + _HEAP_SIZE;
. = ALIGN(16);
_heap_end = .;

} > ddr

__bss_start = ADDR(.bss);
.boot0 :
{
 *(.boot0)
_end = .;
} > ddr

.boot : { *(.boot) } > boot

}

If this procedure is used in SDK, there is no need to use the "-save-temps" switch since SDK saves the object files automatically.

Please use a relative path to specify the file name in the linker script, for instance:
./src/file1.o(.text)
Applies To

Design Tools

  • EDK - 11.1
  • EDK - 11.2
  • EDK - 11.3
  • EDK - 11.4
  • EDK - 11.5
  • EDK - 12.1
  • EDK - 12.2
  • EDK - 12.3
 
 
/csi/footer.htm