K60系列学习(二)链接脚本1

本文详细探讨了链接脚本在K60系列中的应用,包括MEMORY命令解释,例如sram内存区域的描述,以及OUTPUT_ARCH()命令的作用,它用于指定输出文件的体系结构。同时,文章介绍了BFD库在目标文件操作中的重要性,解释了不同工具链如Sourcery_G++和gcc在BFD后端支持上的差异。此外,还讨论了SEARCH_DIR(), GROUP, ENTRY, EXTERN和PROVIDE等链接脚本命令的用法。" 8249931,292791,Windows管道实现跨进程函数调用,"['C++', '进程通讯', '管道', '函数调用']
摘要由CSDN通过智能技术生成
/*
 *
 *
 */
MEMORY
{
    flash  : ORIGIN = 0x00000000, LENGTH = 512k
    sram   : ORIGIN = 0x1FFF0000, LENGTH = 128k
}

OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm","elf32-littlearm") 
OUTPUT_ARCH(arm)

SEARCH_DIR(.)
GROUP(-lgcc -lc -lm -lcs3 -lcs3unhosted)

ENTRY(system_start)


/* These force the linker to search for particular symbols from
 * the start of the link process and thus ensure the user's
 * overrides are picked up
 */
EXTERN(__cs3_start_c main __cs3_stack __cs3_heap_end)
/* force exit to be picked up in a hosted or os environment */
/* EXTERN(exit atexit) */


PROVIDE(__cs3_heap_start = _end);
PROVIDE(__cs3_heap_end = __cs3_region_start_ram + __cs3_region_size_ram);
PROVIDE(__cs3_region_num = (__cs3_regions_end - __cs3_regions) / 20);
/*__libc_fini = _fini;*/
PROVIDE(__cs3_stack = __cs3_region_start_ram + __cs3_region_size_ram);

SECTIONS
{
	
	. = ALIGN(4);
	/* .text */	
	.text :     
    {	
        __text = . ; 
        KEEP(*(.vector))
        *(.text*)
        *(.glue_7t)
        *(.glue_7)
    } > sram

	.eh_frame_hdr : ALIGN (4)
  	{
    	KEEP (*(.eh_frame_hdr))
  	} > sram

 	.eh_frame : ALIGN (4)
  	{
    	KEEP (*(.eh_frame))
  	} > sram

	/* .ARM.exidx is sorted, so has to go in its own output section.  */
  	__exidx_start = .;
  	.ARM.exidx :
  	{
    	*(.ARM.exidx* .gnu.linkonce.armexidx.*)
  	} > sram
  	__exidx_end = .;

   	.rodata : ALIGN(4)
	{ 
		*(.rodata .rodata.* .gnu.linkonce.r.*)

    	. = ALIGN(4);
    	__cs3_regions = .;
    	LONG (0)
    	LONG (__cs3_region_init_ram)
    	LONG (__cs3_region_start_ram)
    	LONG (__cs3_region_init_size_ram)
    	LONG (__cs3_region_zero_size_ram)
    	__cs3_regions_end = .;

    	. = ALIGN (8);
    	_etext = .;
	} > sram 
	
	. = ALIGN(4);
    __idata_start = . ;
    .data   :  ALIGN(8) 
    {
		__cs3_region_start_ram = .;
   
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值