#---------------------------------------------------------------------------
#  Project:  NitroSDK - tools - makelcf
#  File:     ARM9-TEG.lcf
#
#  Copyright 2003-2008 Nintendo.  All rights reserved.
#
#  These coded instructions, statements, and computer programs contain
#  proprietary information of Nintendo of America Inc. and/or Nintendo
#  Company Ltd., and are protected by Federal copyright law.  They may
#  not be disclosed to third parties or copied or duplicated in any form,
#  in whole or in part, without the prior written consent of Nintendo.
#
#  $Log: ARM9-TEG.lcf,v $
#  Revision 1.9  2004/07/26 00:08:27  yasu
#  Fix label of exception table
#
#  Revision 1.8  2004/07/24 05:42:25  yasu
#  Set default values for SDK_AUTOGEN_xTCM_START
#
#  Revision 1.7  2004/07/23 11:32:14  yasu
#  Define labels for __exception_table_start__ and _end__
#
#  Revision 1.6  2004/07/13 00:03:46  yasu
#  Add SDK_AUTOLOAD_[ID]TCM_BSS_END
#
#  Revision 1.5  2004/07/08 04:04:59  yasu
#  fix small typo
#
#  Revision 1.4  2004/07/02 08:34:20  yasu
#  Add .itcm/.dtcm section
#
#  Revision 1.3  2004/07/01 09:41:50  yasu
#  support autoload
#
#  Revision 1.2  2004/05/07 05:13:47  yasu
#  remove STATICINIT for cw0.5
#
#  Revision 1.1  2004/03/26 06:04:32  yasu
#  move spec files
#
#  Revision 1.10  2004/02/20 04:06:52  yasu
#  change default IRQ stack size 0xa0 -> 0x400
#
#  Revision 1.9  2004/02/14 03:34:00  yasu
#  exchange .bss and .sbss
#
#  Revision 1.8  2004/02/13 07:13:16  yasu
#  support SDK_IRQ_STACKSIZE
#
#  Revision 1.7  2004/02/05 12:21:14  yasu
#  change SDK prefix iris -> nitro
#
#  Revision 1.6  2004/01/16 01:34:01  yasu
#  Clean up lcf to support ARENA functions
#
#  Revision 1.5  2004/01/15 13:10:03  yasu
#  clean unused variables
#
#  $NoKeywords: $
#---------------------------------------------------------------------------
MEMORY
{
	main       (RWX) : ORIGIN = 0x02004000,  LENGTH = 0x0
	bss        (RWX) : ORIGIN = AFTER(main), LENGTH = 0x0
	arena      (RW)  : ORIGIN = AFTER(bss),  LENGTH = 0x0
}

KEEP_SECTION
{
	.ctor
}

SECTIONS
{
	.main: AT 0x02004000
	{
	ALIGNALL(4);		. = ALIGN(32);
	
	SDK_STATIC_START	=.;
	SDK_STATIC_TEXT_START	=.;
				#:::::::::: text
				crt0.o (.text)
				* (.text)
				* (.itcm)
				* (.init)
				* (.exception)
				. = ALIGN(4);
	__exception_table_start__ =.;
				EXCEPTION
	__exception_table_end__	=.;
				. = ALIGN(4);
				* (.rodata)
	__sinit__		=.;
				* (.ctor)
				WRITEW	0;
				#:::::::::: text
				. = ALIGN(32);
	SDK_STATIC_TEXT_END	=.;
	
	SDK_STATIC_DATA_START	=.;
				#:::::::::: data
				* (.sdata)
				* (.data)
				* (.dtcm)
				#:::::::::: data
				. = ALIGN(32);
	SDK_STATIC_DATA_END	=.;
	SDK_STATIC_END		=.;
	
	SDK_STATIC_TEXT_SIZE	= SDK_STATIC_TEXT_END - SDK_STATIC_TEXT_START;
	SDK_STATIC_DATA_SIZE	= SDK_STATIC_DATA_END - SDK_STATIC_DATA_START;
	SDK_STATIC_SIZE		= SDK_STATIC_END      - SDK_STATIC_START;
	
	} > main
	
	
	.bss: AT 0x02004000 + SIZEOF(main)
	{
	ALIGNALL(4);		. = ALIGN(32);
	
	SDK_STATIC_BSS_START	=.;
				#:::::::::: bss
				* (.sbss)
				* (.bss)
				#:::::::::: bss
	SDK_STATIC_BSS_END	=.;
	
	SDK_STATIC_BSS_SIZE	= SDK_STATIC_BSS_END - SDK_STATIC_BSS_START;

	} > bss
	
	.area:
	{
				. = ALIGN(4);
	SDK_SECTION_ARENA_START =.;
	
	} > arena
	
	############################ AUTOLOAD_INFO ##########################
	SDK_AUTOLOAD_ITCM_START		= 0x01ff8000;
	SDK_AUTOLOAD_ITCM_END		= SDK_AUTOLOAD_ITCM_START;
	SDK_AUTOLOAD_ITCM_BSS_END	= SDK_AUTOLOAD_ITCM_START;
	SDK_AUTOLOAD_DTCM_START		= 0x02380000;
	SDK_AUTOLOAD_DTCM_END		= SDK_AUTOLOAD_DTCM_START;
	SDK_AUTOLOAD_DTCM_BSS_END	= SDK_AUTOLOAD_DTCM_START;
	SDK_AUTOLOAD_START		= SDK_STATIC_END;
	SDK_AUTOLOAD_SIZE		= 0;
	SDK_AUTOLOAD_NUMBER		= 0;
	SDK_AUTOLOAD_LIST		= SDK_AUTOLOAD_START;
	SDK_AUTOLOAD_LIST_END		= SDK_AUTOLOAD_START;

	############################ OVERLAYS ###############################
	SDK_OVERLAY_NUMBER 		= 0;
	
	############################ OTHERS #################################
	SDK_MAIN_ARENA_LO = SDK_SECTION_ARENA_START;
	SDK_IRQ_STACKSIZE = 0x400;	# allocated in DTCM
	SDK_SYS_STACKSIZE = 0;		# when 0 means all remains of DTCM
}
