#---------------------------------------------------------------------------
#  Project:  NitroSDK - tools - makelcf
#  File:     ARM9-TS.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-TS.lcf,v $
#  Revision 1.14  2005/04/14 00:04:17  terui
#  Update copyright.
#
#  Revision 1.13  2005/04/13 12:51:15  terui
#  Change SDK_AUTOLOAD_DTCM_START 0x027c0000 -> 0x027e0000
#
#  Revision 1.12  2004/08/18 01:59:16  yasu
#  DTCM moves to 0x027c0000
#
#  Revision 1.11  2004/07/26 02:22:32  yasu
#  Change DTCM address to 0x023c0000
#
#  Revision 1.10  2004/07/26 00:08:27  yasu
#  Fix label of exception table
#
#  Revision 1.9  2004/07/24 05:42:25  yasu
#  Set default values for SDK_AUTOGEN_xTCM_START
#
#  Revision 1.8  2004/07/23 11:32:14  yasu
#  Define labels for __exception_table_start__ and _end__
#
#  Revision 1.7  2004/07/13 00:03:46  yasu
#  Add SDK_AUTOLOAD_[ID]TCM_BSS_END
#
#  Revision 1.6  2004/07/02 08:34:20  yasu
#  Add .itcm/.dtcm section
#
#  Revision 1.5  2004/07/01 10:41:46  yasu
#  support autoload
#
#  Revision 1.4  2004/06/08 07:46:40  yasu
#  move start address  0x02004000 ->  0x02000000
#
#  Revision 1.3  2004/06/02 07:42:09  yasu
#  Set libsyscall.a in FORCE_ACTIVE
#  Put NitroMain at the top of ROM image
#
#  Revision 1.2  2004/05/07 05:13:47  yasu
#  remove STATICINIT for cw0.5
#
#  Revision 1.1  2004/04/06 01:59:54  yasu
#  newly added
#
#  $NoKeywords: $
#---------------------------------------------------------------------------
MEMORY
{
	main       (RWX) : ORIGIN = 0x02000000,  LENGTH = 0x0
	bss        (RWX) : ORIGIN = AFTER(main), LENGTH = 0x0
	arena      (RW)  : ORIGIN = AFTER(bss),  LENGTH = 0x0
}

KEEP_SECTION
{
	.ctor
}

FORCE_ACTIVE
{
	SVC_SoftReset
}

SECTIONS
{
	.main: AT 0x02000000
	{
	ALIGNALL(4);		. = ALIGN(32);
	
	SDK_STATIC_START	=.;
	SDK_STATIC_TEXT_START	=.;
				#:::::::::: text
				libsyscall.a (.text)
				OBJECT (NitroMain,*)
				* (.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 0x02000000 + 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		= 0x027e0000;
	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
}
