S5PV210——start.s/tshell.lds

1.         .text
2.   .global  start
3.   .extern  main
4.    
5. start:
6.
7. clear_bss:  /* 清理BSS段 */
8.    ldr    r0, bss_start/* bss段起始地址 */
9.    ldr    r1, bss_end  /* bss段结束地址  */
10.    mov    r2, #0x00000000/* 清成 0 */
11.
12. clbss_l:
13.    str    r2, [r0]  /* 循环清理   */
14.    add    r0, r0, #4
15.    cmp    r0, r1
16.    ble    clbss_l
17.
18.    bl main
19.
20.    b   .
21.
22. bss_start:
23.    .word   __bss_start
24.
25. bss_end:
26.    .word   __end
27.

28.  .end

=========================================

arm-linux-ld 的连接控制文件shell.lds:.lds文件,决定一个可执行程序的各个段的存储位置,以及入口地址,也是链接定位的作用

u-boot.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段的结束位置

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值