#---------------------------------------------------------------------------
#  Project:  NitroSDK - tools - makelcf
#  File:     ARM7-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: ARM7-TS.lcf,v $
#  Revision 1.10  2005/04/14 00:04:17  terui
#  Update copyright.
#
#  Revision 1.9  2005/04/13 12:53:20  terui
#  Change SDK_SUBPRIV_ARENA_LO 0x027c0000 -> 0x027e0000
#
#  Revision 1.8  2004/08/18 01:59:32  yasu
#  Support SDK_SUBPRIV_ARENA_LO
#
#  Revision 1.7  2004/07/26 00:08:27  yasu
#  Fix label of exception table
#
#  Revision 1.6  2004/07/23 11:32:14  yasu
#  Define labels for __exception_table_start__ and _end__
#
#  Revision 1.5  2004/07/02 08:35:06  yasu
#  Add .wram section
#
#  Revision 1.4  2004/07/01 10:41:46  yasu
#  support autoload
#
#  Revision 1.3  2004/05/28 02:11:15  yasu
#  set WRAM arena region correctly
#
#  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 = 0x037f8000,  LENGTH = 0x0
	bss        (RWX) : ORIGIN = AFTER(main), LENGTH = 0x0
	arena      (RW)  : ORIGIN = AFTER(bss),  LENGTH = 0x0
	workram    (RWX) : ORIGIN = 0x037f8000,  LENGTH = 0x10000 > workram.check
}

KEEP_SECTION
{
	.ctor
}

SECTIONS
{
	.main: AT 0x037f8000
	{
	ALIGNALL(4);		. = ALIGN(4);
	
	SDK_STATIC_START	=.;
	SDK_STATIC_TEXT_START	=.;
				#:::::::::: text
				crt0.o (.text)
				* (.text)
				* (.wram)
				* (.init)
				* (.exception)
				. = ALIGN(4);
	__exception_table_start__ =.;
				EXCEPTION
	__exception_table_end__	=.;
				. = ALIGN(4);
				* (.rodata)
	__sinit__		=.;
				* (.ctor)
				WRITEW	0;
				#:::::::::: text
				. = ALIGN(4);
	SDK_STATIC_TEXT_END	=.;
	
	SDK_STATIC_DATA_START	=.;
				#:::::::::: data
				* (.sdata)
				* (.data)
				#:::::::::: data
				. = ALIGN(4);
	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 0x037f8000 + SIZEOF(main)
	{
	ALIGNALL(4);		. = ALIGN(4);
	
	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_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_SUBPRIV_ARENA_LO = 0x027e0000;
	SDK_WRAM_ARENA_LO    = SDK_SECTION_ARENA_START;
	SDK_IRQ_STACKSIZE = 0x200;	# allocated in PWRAM
	SDK_SYS_STACKSIZE = 0x400;	# allocated in PWRAM
	
	# work ram size checker
	.workram:
	{
		. = . + SDK_SECTION_ARENA_START - 0x037f8000 + SDK_IRQ_STACKSIZE + SDK_SYS_STACKSIZE;
	} > workram
}
