1. 程式人生 > >uboot 之 lds檔案詳解

uboot 之 lds檔案詳解

OUTPUT_FORMAT("elf32­littlearm", "elf32­littlearm", "elf32­littlearm")
                                                        ;指定輸出可執行檔案是elf格式,32位ARM指令,小端
OUTPUT_ARCH(arm)
                                                        ;指定輸出可執行檔案的平臺為ARM
ENTRY(_start)
                                                        ;指定輸出可執行檔案的起始程式碼段為_start.
SECTIONS
{
        . = 0x00000000             ; 定位當前地址為0地址
        . = ALIGN(4)                 ; 程式碼以4位元組對齊
        .text :                                       ;指定程式碼段
        {
           cpu/arm920t/start.o (.text)  ; 程式碼的第一個程式碼部分
          *(.text)                        ;其它程式碼部分
        }
        . = ALIGN(4)
        .rodata : { *(.rodata) }         ;指定只讀資料段
        . = ALIGN(4);
        .data : { *(.data) }             ;指定讀/寫資料段
        . = ALIGN(4);
        .got : { *(.got) }                        ;指定got段, got段式是uboot自定義的一個段, 非標準段
         __u_boot_cmd_start = .          ;把__u_boot_cmd_start賦值為當前位置, 即起始位置
        .u_boot_cmd : { *(.u_boot_cmd) }          ;指定u_boot_cmd段, uboot把所有的uboot命令放在該段.
         __u_boot_cmd_end = .                          ;把__u_boot_cmd_end賦值為當前位置,即結束位置
        . = ALIGN(4);
         __bss_start = .                                       ; 把__bss_start賦值為當前位置,即bss段的開始位置
        .bss : { *(.bss) }                        ; 指定bss段
         _end = .                                  ; 把_end賦值為當前位置,即bss段的結束位置
}