Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] .ld for 2148

2005-12-30 by Marko Panger

Hi,

I'm just re-sending this as it seems that it didn't arrived the first 
time. See below.

marko

Hi !

I am attaching two .ld files I am using. I don't remember where do I 
grab them (it was on www.gnuarm or somewhere else on this forum) 
exactly. I adopted them to suit my needs on the LPC2138. Modifying them 
for 2148 should be straight forward.

The ROM_fiq.ld file has a special ".fiqisr" section which is placed 
directly on the exception vector (no extra jump needed) for optimum 
performance when executing an FIQ from flash. If you define your 
"fiqisr" section it will be placed right there.

Hope it helps !

marko,

uSmartX RTOS - mixing preemptive and non-preemptive worlds !
http://usmartx.sourceforge.net/


paloalgodon wrote:

>I admit I'm a little disappointed about getting no replies on this 
>one.  Looking over the exisiting .ld files I have, it would appear to 
>be less than an hour's work (?).  I just figure, why re-invent the 
>wheel, when there's probably a bunch of *tested* copies running around 
>(especially when I'm a newbie).  I was actually suprized that there 
>wasn't already a complete set of .ld files for all the lpc parts in the 
>files section of our group.  I understand that .ld files are typically 
>customized a bit, just like makefiles, but a straightforward one that 
>runs from rom and calls global ctors would be fine for most beginners, 
>I would think.  I will certainly post if/when I get one 
>working...course that could be counterproductive if we're trying to 
>keep all the folks used to having the hard stuff done for them (WinAVR) 
>off of our list <wink><wink>
>
>Steve
>
>
>
>
>
>
>
> 
>Yahoo! Groups Links
>
>
>
> 
>
>
>
>  
>



  ----------

/***********************************************************************/
/*                                                                     */
/*  RAM.ld:  Linker Script File                                        */
/*                                                                     */
/***********************************************************************/
ENTRY(_start)
STACK_SIZE = 0x400;

RAM_LIMIT = 0x40008000;


/* Memory Definitions */
MEMORY
{
	FLASH (rx) : ORIGIN = 0x0, LENGTH = 0x80000			/* 512Kb of internal FLASH */
	SRAM (rwx) : ORIGIN = 0x40000000, LENGTH = 0x8000	/* 32Kb of internal SRAM */
}

/* Section Definitions */
SECTIONS
{
  	/* first section is .text which is used for code */
  	.text :
  	{    		
		*crt0.o (.text)
    	*(EXCLUDE_FILE(*crt0.o).text)         /* remaining code */
    	*(.rodata)               			  /* read-only data (constants) */
    	*(.rodata*)
    	*(.glue_7)
    	*(.glue_7t)
  	} > FLASH

	. = ALIGN(4);	
	_etext = . ;

  /* .data section which is used for initialized data */
  .data  : AT (_etext)
  {
    _data = .;
    *(.data)
    . = ALIGN(4);
    _edata = .;
  } > SRAM

  /* .bss section which is used for uninitialized data */
  .bss (NOLOAD) :
  {
    _bss = . ;
    *(.bss)
    *(COMMON)
    . = ALIGN(4);
    _ebss = .;
  } > SRAM
    
/*  .heap ALIGN(4) :*/
/*  { */
/*  	_heap_begin = .;*/
/*  	*(.data_heap)*/
/*  } > SRAM**/
           
  /*. += 0x4000;*/
/*  _heap_end = .;*/
   
  . = RAM_LIMIT - 8 - 4 - 4 - 4 - 1024 - 1024; 
  .stack ALIGN(4) :
  {
  	_stack = .;
  	. += 4;
  	_undefined_stack = .;
  	
  	. += 4;
  	_abort_stack = .;
  	
  	. += 4;
	_fiq_stack = .;
	
	. += 4;
	_svc_stack = .;
		
	. += 1024;
	_usr_stack = .;	
	
	. += 1024;
	_irq_stack = .;
	_estack = .;
  } > SRAM
  
  _end = . ;
  PROVIDE (end = .);

  /* Stabs debugging sections.  */
  .stab          0 : { *(.stab) }
  .stabstr       0 : { *(.stabstr) }
  .stab.excl     0 : { *(.stab.excl) }
  .stab.exclstr  0 : { *(.stab.exclstr) }
  .stab.index    0 : { *(.stab.index) }
  .stab.indexstr 0 : { *(.stab.indexstr) }
  .comment       0 : { *(.comment) }
  /* DWARF debug sections.
     Symbols in the DWARF debugging sections are relative to the beginning
     of the section so we begin them at 0.  */
  /* DWARF 1 */
  .debug          0 : { *(.debug) }
  .line           0 : { *(.line) }
  /* GNU DWARF 1 extensions */
  .debug_srcinfo  0 : { *(.debug_srcinfo) }
  .debug_sfnames  0 : { *(.debug_sfnames) }
  /* DWARF 1.1 and DWARF 2 */
  .debug_aranges  0 : { *(.debug_aranges) }
  .debug_pubnames 0 : { *(.debug_pubnames) }
  /* DWARF 2 */
  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
  .debug_abbrev   0 : { *(.debug_abbrev) }
  .debug_line     0 : { *(.debug_line) }
  .debug_frame    0 : { *(.debug_frame) }
  .debug_str      0 : { *(.debug_str) }
  .debug_loc      0 : { *(.debug_loc) }
  .debug_macinfo  0 : { *(.debug_macinfo) }
  /* SGI/MIPS DWARF 2 extensions */
  .debug_weaknames 0 : { *(.debug_weaknames) }
  .debug_funcnames 0 : { *(.debug_funcnames) }
  .debug_typenames 0 : { *(.debug_typenames) }
  .debug_varnames  0 : { *(.debug_varnames) }
}


  ----------

/***********************************************************************/
/*                                                                     */
/*  RAM.ld:  Linker Script File                                        */
/*                                                                     */
/***********************************************************************/
ENTRY(_start)
STACK_SIZE = 0x400;

RAM_LIMIT = 0x40004000;


/* Memory Definitions */
MEMORY
{
	FLASH (rx) : ORIGIN = 0x0, LENGTH = 0x20000			/* 512Kb of internal FLASH */
	SRAM (rwx) : ORIGIN = 0x40000000, LENGTH = 0x4000	/* 32Kb of internal SRAM */
}

/* Section Definitions */
SECTIONS
{
  	/* first section is .text which is used for code */
  	.text :
  	{    
		crt0.o (.vectors)
		*(.fiqisr)
		crt0.o (.text)
    	*(EXCLUDE_FILE(crt0.o).text)         /* remaining code */
    	*(.rodata)               			  /* read-only data (constants) */
    	*(.rodata*)
    	*(.glue_7)
    	*(.glue_7t)
  	} > FLASH

	. = ALIGN(4);	
	_etext = . ;

  /* .data section which is used for initialized data */
  .data  : AT (_etext)
  {
    _data = .;
    *(.data)
    . = ALIGN(4);
    _edata = .;
  } > SRAM

  /* .bss section which is used for uninitialized data */
  .bss (NOLOAD) :
  {
    _bss = . ;
    *(.bss)
    *(COMMON)
    . = ALIGN(4);
    _ebss = .;
  } > SRAM
    
/*  .heap ALIGN(4) :*/
/*  { */
/*  	_heap_begin = .;*/
/*  	*(.data_heap)*/
/*  } > SRAM**/
           
  /*. += 0x4000;*/
/*  _heap_end = .;*/
   
  . = RAM_LIMIT - 8 - 4 - 4 - 4 - 1024 - 1024; 
  .stack ALIGN(4) :
  {
  	_stack = .;
  	. += 4;
  	_undefined_stack = .;
  	
  	. += 4;
  	_abort_stack = .;
  	
  	. += 4;
	_fiq_stack = .;
	
	. += 4;
	_svc_stack = .;
		
	. += 1024;
	_usr_stack = .;	
	
	. += 1024;
	_irq_stack = .;
	_estack = .;
  } > SRAM
  
  _end = . ;
  PROVIDE (end = .);

  /* Stabs debugging sections.  */
  .stab          0 : { *(.stab) }
  .stabstr       0 : { *(.stabstr) }
  .stab.excl     0 : { *(.stab.excl) }
  .stab.exclstr  0 : { *(.stab.exclstr) }
  .stab.index    0 : { *(.stab.index) }
  .stab.indexstr 0 : { *(.stab.indexstr) }
  .comment       0 : { *(.comment) }
  /* DWARF debug sections.
     Symbols in the DWARF debugging sections are relative to the beginning
     of the section so we begin them at 0.  */
  /* DWARF 1 */
  .debug          0 : { *(.debug) }
  .line           0 : { *(.line) }
  /* GNU DWARF 1 extensions */
  .debug_srcinfo  0 : { *(.debug_srcinfo) }
  .debug_sfnames  0 : { *(.debug_sfnames) }
  /* DWARF 1.1 and DWARF 2 */
  .debug_aranges  0 : { *(.debug_aranges) }
  .debug_pubnames 0 : { *(.debug_pubnames) }
  /* DWARF 2 */
  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
  .debug_abbrev   0 : { *(.debug_abbrev) }
  .debug_line     0 : { *(.debug_line) }
  .debug_frame    0 : { *(.debug_frame) }
  .debug_str      0 : { *(.debug_str) }
  .debug_loc      0 : { *(.debug_loc) }
  .debug_macinfo  0 : { *(.debug_macinfo) }
  /* SGI/MIPS DWARF 2 extensions */
  .debug_weaknames 0 : { *(.debug_weaknames) }
  .debug_funcnames 0 : { *(.debug_funcnames) }
  .debug_typenames 0 : { *(.debug_typenames) }
  .debug_varnames  0 : { *(.debug_varnames) }
}



[Non-text portions of this message have been removed]

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.