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?

描述

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

解决方案


******************************************************************************
*
* 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)

链接问答记录

主要问答记录

Answer Number 问答标题 问题版本 已解决问题的版本
34609 12.x EDK - 主要问答记录列表 N/A N/A
AR# 21639
日期 03/05/2013
状态 Active
Type 综合文章
Tools More Less
People Also Viewed