一段链接文件code

/* -------------------------------------------------------------------------
 * File: conf/default.dld
 *
 * This is the linker command file which dld uses by default if no linker
 * command file is specified.
 *
 * It specifies how the object files in a build will be linked and located.
 * Combined with other linker command files provided with the compiler, it
 * provides a base to build your own file for your particular system.
 *
 * For a description of the different statements in this file, please refer
 * to the D-LD section of the User's Guide

 * ------------------------------------------------------------------------ */

/* The MEMORY command defines a single memory area using a name intended
 * to suggest its purpose:
 *
 *   32k RAM at address 0xA0000000
 *		Bootstrap is loaded from offet 0 and can be 3800 in length
 *		The remainer is used for uninitialized data and stacks.
 * ------------------------------------------------------------------------ */

MEMORY	/* memory map of Soc init sram */
{
	boot (rw):	org = 0xA0000000, len = 0x3800
	ram  (rw):	org = 0xA0003800, len = 0x4800
}

/* The sizes of the stacks used by the application. NOTE: you need to adjust */
LOG_SIZE       = 2048;       //这段用来保存bootloader 的 log
C_STACK_SIZE   = 4096;       //堆栈大小
IRQ_STACK_SIZE = 32;         //各种异常模式的堆栈大小
FIQ_STACK_SIZE = 32;
SVC_STACK_SIZE = 32;
ABT_STACK_SIZE = 32;
UND_STACK_SIZE = 32;

SECTIONS                     //段的具体结构
{
	/* The first GROUP contains code and constant data.
	 */
	GROUP : {            //第一个group用来放代码和常量数据
		/* Take all code from all objects and libraries. */

		.text (TEXT) : {
			crt0.o /* make sure this is first */
			*(.text)
			*(.rdata)
			*(.rodata)
			*(.frame_info)
			*(.j_class_table)
			*(.init)
			*(.fini)
		. = ALIGN(4);          //4字节对齐
		}
		.sdata2 (TEXT)	: {}   /* small CONST area for some targets */
	} > boot

	/* The second GROUP allocates space for the initialized data and
	 * uninitialized data in the "ram" section.
	 */
	GROUP BLOCK(4) : {           //第二个group
		__DATA_ROM	= .;
		__DATA_RAM	= .;
		.data (DATA) : {}
		.j_pdata (DATA) : {}

		/* constructor and destructor function ptrs */
		.ctors ALIGN(4) : { ctordtor.o(.ctors) *(.ctors) }
		.dtors ALIGN(4) : { ctordtor.o(.dtors) *(.dtors) }

		/* .sdata is the "small data area" for some targets. */
		.sdata ALIGN(4) (DATA)	: { *(.sdata) *(.j_spdata) }

		__DATA_END	= .;
	} > boot
	
	GROUP : {                   //第三个group
		__LOG_START = .;    //LOG 区 
		. += LOG_SIZE;
		__LOG_END = .;

		/* Allocate uninitialized sections.			    */

		__BSS_START	= .;      //BSS 区 紧接着 LOG 区
		.sbss (BSS)		: {}
		.bss  (BSS)		: {}
		.tibss (BSS)	: {}
		__BSS_END = .;

		/* Special stacks which shouldn't normally be used */
		. += IRQ_STACK_SIZE;        //然后是各种 异常堆栈区
		. = ALIGN (4);
		__IRQ_STACK_INIT = . ;

		. += FIQ_STACK_SIZE;
		. = ALIGN (4);
		__FIQ_STACK_INIT = . ;

		. += SVC_STACK_SIZE;
		. = ALIGN (4);
		__SVC_STACK_INIT = . ;

        . += ABT_STACK_SIZE;
        . = ALIGN (4);
        __ABT_STACK_INIT = . ;

        . += UND_STACK_SIZE;
        . = ALIGN (4);
        __UND_STACK_INIT = . ;

		/* Any remaining space will be used as a heap.		    */

		__HEAP_START	= .;        //最后是堆
	} > ram
}

__SP_END		= ADDR(ram)+SIZEOF(ram);                //堆栈结束地址
__SP_START		= __SP_END-C_STACK_SIZE;		//堆栈起始地址                   /* Stack size (defined above).	*/
__HEAP_END		= __SP_START;		    		//堆结束地址,刚好是堆栈的起始地址  /* Heap contiguous with stack.	*/

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值