S5PV210之uboot.lds链接脚本

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_33894122/article/details/82317171

简介

lds文件,决定一个可执行程序的各个段的存储位置,以及入口地址,这也是链接定位的作用。这里以u-boot.lds为例说明uboot的链接过程。

代码详解

OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") #输出格式为elf32小端格式
OUTPUT_ARCH(arm)                                                   #输出格式架构为arm
ENTRY(_start)                                                      #指定输出文件的起始代码是_start
SECTIONS
{
    . = 0x00000000;                                                 #指定链接地址为0x0000 0000 ,但是却不是实际uboot的链接地址,主要原因是Makefile中的LDFLAGS变量 ,其中有一句  LDFLAGS += -Ttext $(TEXT_BASE)  ,以LDFLAGS变量指定的链接地址为准
    #  .表示现在地址,就是现在地址为0x0000 0000
    . = ALIGN(4);                                                   #4字节对齐
    .text      :                                                    #代码段开始
    {
      cpu/s5pc11x/start.o   (.text)
      cpu/s5pc11x/s5pc110/cpu_init.o    (.text)
      board/samsung/x210/lowlevel_init.o    (.text)
          cpu/s5pc11x/onenand_cp.o      (.text)                 
          cpu/s5pc11x/nand_cp.o (.text)                     
          cpu/s5pc11x/movi.o (.text) 
          common/secure_boot.o (.text) 
      common/ace_sha1.o (.text)
      cpu/s5pc11x/pmic.o (.text)
      *(.text)
    }

    . = ALIGN(4);
    .rodata : { *(.rodata) }

    . = ALIGN(4);
    .data : { *(.data) }

    . = ALIGN(4);
    .got : { *(.got) }                                            #自定义段

    __u_boot_cmd_start = .;                                       #uboot命令函数存放段
    .u_boot_cmd : { *(.u_boot_cmd) }
    __u_boot_cmd_end = .;

    . = ALIGN(4);
    .mmudata : { *(.mmudata) }

    . = ALIGN(4);
    __bss_start = .;
    .bss : { *(.bss) }
    _end = .;
}

猜你喜欢

转载自blog.csdn.net/qq_33894122/article/details/82317171