本文共 1583 字,大约阅读时间需要 5 分钟。
1. Reference
arm-2011.03/share/doc/arm-arm-none-eabi/pdf/ld.pdf
2. An example
OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
/* Use OUTPUT_FORMAT with three arguments to use different formats based on the ‘-EB’ and ‘-EL’ command line options. This permits the linker script to set the output format based on the desired endianness.*/
MEMORY
{ rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00008000 ram (rwx) : ORIGIN = 0x10000000, LENGTH = 0x00002000 } /* Program code and read-only data go into the ROM. Read-write data goes into the RAM. An image of the initialized data is loaded into the ROM and will be copied during system start into the RAM.*/
/* Section Definitions */ SECTIONS { .text : { KEEP(*(.isr_vector .isr_vector.*)) *(.text .text.* .gnu.linkonce.t.*) *(.glue_7t) *(.glue_7) *(.rodata .rodata* .gnu.linkonce.r.*) } > rom.ARM.extab :
{ *(.ARM.extab* .gnu.linkonce.armextab.*) } > rom .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } > rom. = ALIGN(4);
_etext = .;
/* Program code */
_sidata = .;
/* Initialized data is at _sidata */ .data : AT (_etext) { _sdata = .; *(.data .data.*) . = ALIGN(4); _edata = . ; } > ram/* Initialized data will be
copied during system start into the RAM */
/* None initialized data will be placed to the RAM */
/* stack section */
.co_stack (NOLOAD): { . = ALIGN(8); *(.co_stack .co_stack.*) } > ram/* Other ram are used as stack */
转载地址:http://kgmvi.baihongyu.com/