在vmlinux.lds.s中将_stext定义为指向代码段的首地址,如下所示:
.text :
{
__text = .;
_text = .;
__stext = .;
TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
KPROBES_TEXT
*(.text.*)
*(.fixup)
. = ALIGN(16);
___start___ex_table = .;
*(__ex_table)
___stop___ex_table = .;
. = ALIGN(4);
__etext = .;
}
相应地我们也要在LDF文件中添加相应的内容:
.text
{
INPUT_SECTION_ALIGN(4)
. = (. + 3) / 4 * 4;
__text = .;
_text = .;
__stext = .;
INPUT_SECTIONS($OBJECTS_CORE_A(sdram_bank0) $LIBRARIES_CORE_A(sdram_bank0))
INPUT_SECTIONS($OBJECTS_CORE_A(VDK_ISR_code) $LIBRARIES_CORE_A(VDK_ISR_code))
INPUT_SECTIONS($OBJECTS_CORE_A(program) $LIBRARIES_CORE_A(program))
INPUT_SECTIONS($OBJECTS_CORE_A(noncache_code) $LIBRARIES_CORE_A(noncache_code))
INPUT_SECTIONS($LIBRARIES_CORE_A(.text.*))
INPUT_SECTIONS($LIBRARIES_CORE_A(.fixup))
INPUT_SECTION_ALIGN(16)
. = (. + 15) / 16 * 16;
___start___ex_table = .;
INPUT_SECTIONS($LIBRARIES_CORE_A(__ex_table))
___stop___ex_table = .;
INPUT_SECTION_ALIGN(4)
. = (. + 3) / 4 * 4;
__etext = .;
} > MEM_SDRAM
经过这样的修改后,原来的sdram段就不需要了。