/*
* STM32F407VE Linkerscript for updater RAM code execution
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
*
* This file is part of 'Shimatta Reflow Controller'.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 2 of the License.
*
* This code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this template.  If not, see <http://www.gnu.org/licenses/>.
* --------------------------------------------------------------------
* FLASH: 512K
* RAM: 128K
* CCM RAM: 64L
* FPU: fpv4-sp-d16
*/ 

ENTRY(Reset_Handler)
__ld_top_of_stack = 0x20020000; /* One byte above the end of the SRAM. Stack is pre-decrewmenting, so this is okay */

/* Available memory areas */
MEMORY
{
	FLASH (xr)	: ORIGIN = 0x08000000, LENGTH = 512K
	RAM (xrw)	: ORIGIN = 0x20000000, LENGTH = 128K	
	CCM (rw)	: ORIGIN = 0x10000000, LENGTH = 64K
}

SECTIONS
{
	.vectors :
	{
		. = ALIGN(4);
		__ld_vector_start = .;
		KEEP(*(.vectors));
		. = ALIGN(4);
	} > RAM
	
	.text :
	{
		. = ALIGN(4);
		*(.text)           /* .text sections (code) */
    		*(.text*)          /* .text* sections (code) */
    		*(.rodata)         /* .rodata sections (constants, strings, etc.) */
    		*(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
    		*(.glue_7)         /* glue arm to thumb code */
    		*(.glue_7t)        /* glue thumb to arm code */
		*(.eh_frame)
		KEEP(*(.init))	   /* Constructors */
		KEEP(*(.fini))     /* Destructors  */
	} > RAM
	
	.data :
	{
		. = ALIGN(4);
		*(.data)
		*(.data*)
		. = ALIGN(4);
	} > RAM
	
	.bss (NOLOAD) :
	{
		. = ALIGN(4);
		__ld_sbss = .;
		*(.bss)
		*(.bss*)
		*(COMMON)
		. = ALIGN(4);
		__ld_ebss = .;
	} > RAM

}
