UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 21639

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

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.

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

Linked Answer Records

Master Answer Records

Answer Number Answer Title Version Found Version Resolved
34609 12.x EDK - Master Answer Record List N/A N/A
AR# 21639
Date Created 09/04/2007
Last Updated 03/05/2013
Status Active
Type General Article
Tools
  • EDK - 11.1
  • EDK - 11.2
  • EDK - 11.3
  • More
  • EDK - 11.4
  • EDK - 11.5
  • EDK - 12.1
  • EDK - 12.2
  • EDK - 12.3
  • Less