
/* identify the Entry Point  */

ENTRY(_startup)



/* specify the LPC2129 memory areas  */

MEMORY 
{
flash		: ORIGIN = 0,          LENGTH = 524288	/* FLASH ROM	*/
ram		: ORIGIN = 0x40000000, LENGTH = 0x7FE0	/* free RAM area*/
ram_isp_high(A)	: ORIGIN = 0x40007FE0, LENGTH = 0x20	/* variables used by Philips ISP bootloader	*/
}

/* define a global symbol _stack_end  */

_stack_end = 0x40007EDC;

/* now define the output sections  */

SECTIONS 
{
	. = 0;	/* set location counter to address zero  */
	
	startup : { *(.startup)
		    _estartup = .;
	} >ram	/* the startup code goes into RAM */
	
	

	.text :		/* collect all sections that should go into RAM after startup  */ 
	{
		_text = .;
		crt.o(.text)		/* all .text sections (code)  */
		crt.o(.rodata)		/* all .rodata sections (constants, strings, etc.)  */
		crt.o(.rodata*)		/* all .rodata* sections (constants, strings, etc.)  */
		crt.o(.glue_7)		/* all .glue_7 sections  (no idea what these are) */
		crt.o(.glue_7t)		/* all .glue_7t sections (no idea what these are) */
		_etext = .;		/* define a global symbol _etext just after the last code byte */
	} >ram				/* put all the above into RAM */

	.kex :
	{
		_kex = .;
		*(.text)
		*(.rodata)
		*(.rodata*)
		*(.glue_7)
		*(.glue_7t)
		_ekex = .;
	} >ram AT >ram

	.data :			/* collect all initialized .data sections that go into RAM  */ 
	{
		_data = .;	/* create a global symbol marking the start of the .data section  */
		*(.data)	/* all .data sections  */
		_edata = .;	/* define a global symbol marking the end of the .data section  */
	} >ram AT >ram	/* put all the above into RAM (but load the LMA copy into FLASH) */

	.bss :			/* collect all uninitialized .bss sections that go into RAM  */
	{
		_bss_start = .;	/* define a global symbol marking the start of the .bss section */
		*(.bss)		/* all .bss sections  */
	} >ram			/* put all the above in RAM (it will be cleared in the startup code */

	. = ALIGN(4);		/* advance location counter to the next 32-bit boundary */
	_bss_end = . ;		/* define a global symbol marking the end of the .bss section */
}
	_end = .;		/* define a global symbol marking the end of application RAM */
