/*************************************************
* linker script for STM32F4xx
************************************************/ 

ENTRY (CanFuctTable)


MEMORY
{
	/* оперативку не используем! */
	/* RAM (xrw) : ORIGIN = 0x20000000,  LENGTH = 0 */

	/* используем флеш 48K .. 64K */
	FLASH (rx)	: ORIGIN = (0x08000000 + 48K), LENGTH = 16K
}

/* higher address of the user mode stack */
PROVIDE ( _estack = ALIGN(ORIGIN(RAM) + LENGTH(RAM) - 8 ,8) );

SECTIONS
{

	.entrance_vector :
	{
		_stext = .;

		. = ALIGN(4);
		KEEP(*(.entrance_vector))
		. = ALIGN(4);
	} > FLASH    =0xFFFFFFFF

	.text :
	{
		__ctors_start__ = .;
		KEEP(SORT(*)(.init_array))  /* eabi uses .init_array for static constructor lists */
		__ctors_end__ = .;

		__dtors_start__ = .;
		__dtors_end__ = .;

		. = ALIGN(4);
		*(.text)                   /* remaining code */
		*(.text.*)
		*(.rodata)                 /* read-only data (constants) */
		*(.rodata*)

		*(.eh_frame_hdr)
		*(.eh_frame)
		*(.ARM.extab* .gnu.linkonce.armextab.*)
		*(.gcc_except_table)
		*(.eh_frame_hdr)
		*(.eh_frame)

		*(.glue_7)
		*(.glue_7t)
		. = ALIGN(4);
	} > FLASH    =0xFFFFFFFF

	/* .ARM.exidx is sorted, so has to go in its own output section.  */
	__exidx_start = .;
	.ARM.exidx :
	{
		*(.ARM.exidx* .gnu.linkonce.armexidx.*)
	} > FLASH    =0xFFFFFFFF
	__exidx_end = .;

	.text.align :
	{
		. = ALIGN(8);
		_etext = .;
		_sidata = _etext;		/* start of initialized data label */
	} > FLASH    =0xFFFFFFFF

	/* конец данных во флеш - кладём сюда таблицу с настройками и контрольную сумму */
	.text.SettingsCanName :
	{
		. = ALIGN(4);
		KEEP(*(.SettingsCanName))
	} > FLASH
	.text.SettingsVarName :
	{
		. = ALIGN(4);
		KEEP(*(.SettingsVarName))
	} > FLASH
	.text.SettingsTable :
	{
		. = ALIGN(4);
		KEEP(*(.SettingsTable))
	} > FLASH
	.text.CheckSum :
	{
		. = ALIGN(4);
		KEEP(*(.CheckSum))
	} > FLASH


/**************************************************************
* Remove the debugging information from the standard libraries
***************************************************************/ 

/* remove the debugging information from the standard libraries */
DISCARD :
	{
		libc.a ( * )
		libm.a ( * )
		libgcc.a ( * )
	}

/* 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) }


}
