Skip to content

Instantly share code, notes, and snippets.

@FreddieChopin
Created January 7, 2017 07:33
Show Gist options
  • Save FreddieChopin/31476ef866b95099526d3b6fc6879331 to your computer and use it in GitHub Desktop.
Save FreddieChopin/31476ef866b95099526d3b6fc6879331 to your computer and use it in GitHub Desktop.
/**
* \file
* \brief Linker script for STM32F407VG chip:
* - 1048576 bytes of rom at 0x8000000;
* - 131072 bytes of ram at 0x20000000;
* - 4096 bytes of bkpsram at 0x40024000;
* - 65536 bytes of ccm at 0x10000000;
*
* \author Copyright (C) 2014-2016 Kamil Szczygiel http://www.distortec.com http://www.freddiechopin.info
*
* \par License
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
* distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* \warning
* Automatically generated file - do not edit!
*
* \date 2017-01-06 20:05:57
*/
SEARCH_DIR(.);
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm");
OUTPUT_ARCH(arm);
/*---------------------------------------------------------------------------------------------------------------------+
| stacks sizes
+---------------------------------------------------------------------------------------------------------------------*/
/* Handler mode (core exceptions / interrupts) can use only main stack */
PROVIDE(__main_stack_size = ALIGN(1024, 8));
/* Thread mode can use main stack (default after reset) or process stack - selected in CONTROL special register */
PROVIDE(__process_stack_size = ALIGN(4128, 8));
/*---------------------------------------------------------------------------------------------------------------------+
| available memories
+---------------------------------------------------------------------------------------------------------------------*/
MEMORY
{
rom : org = 0x8000000, len = 1048576
ram : org = 0x20000000, len = 131072
bkpsram : org = 0x40024000, len = 4096
ccm : org = 0x10000000, len = 65536
}
PROVIDE(__rom_start = ORIGIN(rom));
PROVIDE(__rom_size = LENGTH(rom));
PROVIDE(__rom_end = ORIGIN(rom) + LENGTH(rom));
PROVIDE(__ram_start = ORIGIN(ram));
PROVIDE(__ram_size = LENGTH(ram));
PROVIDE(__ram_end = ORIGIN(ram) + LENGTH(ram));
PROVIDE(__bkpsram_start = ORIGIN(bkpsram));
PROVIDE(__bkpsram_size = LENGTH(bkpsram));
PROVIDE(__bkpsram_end = ORIGIN(bkpsram) + LENGTH(bkpsram));
PROVIDE(__ccm_start = ORIGIN(ccm));
PROVIDE(__ccm_size = LENGTH(ccm));
PROVIDE(__ccm_end = ORIGIN(ccm) + LENGTH(ccm));
/*---------------------------------------------------------------------------------------------------------------------+
| entry point
+---------------------------------------------------------------------------------------------------------------------*/
ENTRY(Reset_Handler);
/*---------------------------------------------------------------------------------------------------------------------+
| put data in sections
+---------------------------------------------------------------------------------------------------------------------*/
SECTIONS
{
.text :
{
. = ALIGN(4);
PROVIDE(__text_start = .);
/* sub-section: .vectors */
. = ALIGN(4);
PROVIDE(__vectors_start = .);
KEEP(*(.coreVectors));
KEEP(*(.chipVectors));
. = ALIGN(4);
PROVIDE(__vectors_end = .);
/* end of sub-section: .vectors */
*(.text* .gnu.linkonce.t.*);
*(.rodata* .gnu.linkonce.r.*);
*(.glue_7t .glue_7);
*(.ARM.extab* .gnu.linkonce.armextab.*); /* exception unwinding information */
*(.gcc_except_table); /* information used for stack unwinding during exception */
*(.eh_frame_hdr); /* additional information about .ex_frame section */
*(.eh_frame); /* information used for stack unwinding during exception */
/* sub-section: data_array */
. = ALIGN(4);
PROVIDE(__data_array_start = .);
LONG(LOADADDR(.data)); LONG(ADDR(.data)); LONG(ADDR(.data) + SIZEOF(.data));
LONG(LOADADDR(.bkpsram.data)); LONG(ADDR(.bkpsram.data)); LONG(ADDR(.bkpsram.data) + SIZEOF(.bkpsram.data));
LONG(LOADADDR(.ccm.data)); LONG(ADDR(.ccm.data)); LONG(ADDR(.ccm.data) + SIZEOF(.ccm.data));
. = ALIGN(4);
PROVIDE(__data_array_end = .);
/* end of sub-section: data_array */
/* sub-section: bss_array */
. = ALIGN(4);
PROVIDE(__bss_array_start = .);
LONG(0); LONG(ADDR(.bss)); LONG(ADDR(.bss) + SIZEOF(.bss));
LONG(0xed419f25); LONG(ADDR(.main_stack)); LONG(ADDR(.main_stack) + SIZEOF(.main_stack));
LONG(0xed419f25); LONG(ADDR(.process_stack)); LONG(ADDR(.process_stack) + SIZEOF(.process_stack));
LONG(0); LONG(ADDR(.bkpsram.bss)); LONG(ADDR(.bkpsram.bss) + SIZEOF(.bkpsram.bss));
LONG(0); LONG(ADDR(.ccm.bss)); LONG(ADDR(.ccm.bss) + SIZEOF(.ccm.bss));
. = ALIGN(4);
PROVIDE(__bss_array_end = .);
/* end of sub-section: bss_array */
/* sub-sections: init, preinit_array, init_array and fini_array */
KEEP(*(.init));
. = ALIGN(4);
PROVIDE(__preinit_array_start = .);
KEEP(*(.preinit_array));
. = ALIGN(4);
PROVIDE(__preinit_array_end = .);
. = ALIGN(4);
PROVIDE(__init_array_start = .);
KEEP(*(SORT(.init_array.*)));
KEEP(*(.init_array));
. = ALIGN(4);
PROVIDE(__init_array_end = .);
KEEP(*(.fini));
. = ALIGN(4);
PROVIDE(__fini_array_start = .);
KEEP(*(.fini_array));
KEEP(*(SORT(.fini_array.*)));
. = ALIGN(4);
PROVIDE(__fini_array_end = .);
/* end of sub-sections: init, preinit_array, init_array and fini_array */
. = ALIGN(4);
PROVIDE(__text_end = .);
} > rom AT > rom
. = ALIGN(4);
PROVIDE(__exidx_start = .);
.ARM.exidx :
{
*(.ARM.exidx* .gnu.linkonce.armexidx.*);
} > rom AT > rom /* index entries for section unwinding */
. = ALIGN(4);
PROVIDE(__exidx_end = .);
.main_stack :
{
. = ALIGN(8);
PROVIDE(__main_stack_start = .);
. += __main_stack_size;
. = ALIGN(8);
PROVIDE(__main_stack_end = .);
} > ram AT > ram
.bss :
{
. = ALIGN(4);
PROVIDE(__bss_start = .);
*(.bss* .gnu.linkonce.b.*);
*(COMMON);
. = ALIGN(4);
PROVIDE(__bss_end = .);
} > ram AT > ram
.data :
{
. = ALIGN(4);
PROVIDE(__data_init_start = LOADADDR(.data));
PROVIDE(__data_start = .);
*(.data* .gnu.linkonce.d.*);
. = ALIGN(4);
PROVIDE(__data_end = .);
} > ram AT > rom
.noinit (NOLOAD) :
{
. = ALIGN(4);
PROVIDE(__noinit_start = .);
*(.noinit);
. = ALIGN(4);
PROVIDE(__noinit_end = .);
} > ram AT > ram
. = ALIGN(8);
PROVIDE(__heap_start = .);
. = __ram_end - __process_stack_size;
PROVIDE(__heap_end = .);
.process_stack . :
{
. = ALIGN(8);
PROVIDE(__process_stack_start = .);
. += __process_stack_size;
. = ALIGN(8);
PROVIDE(__process_stack_end = .);
} > ram AT > ram
.bkpsram.bss :
{
. = ALIGN(4);
PROVIDE(__bkpsram_bss_start = .);
*(.bkpsram.bss);
. = ALIGN(4);
PROVIDE(__bkpsram_bss_end = .);
} > bkpsram AT > bkpsram
.bkpsram.data :
{
. = ALIGN(4);
PROVIDE(__bkpsram_data_init_start = LOADADDR(.bkpsram.data));
PROVIDE(__bkpsram_data_start = .);
*(.bkpsram.data);
. = ALIGN(4);
PROVIDE(__bkpsram_data_end = .);
} > bkpsram AT > rom
.bkpsram.noinit (NOLOAD) :
{
. = ALIGN(4);
PROVIDE(__bkpsram_noinit_start = .);
*(.bkpsram.noinit);
. = ALIGN(4);
PROVIDE(__bkpsram_noinit_end = .);
} > bkpsram AT > bkpsram
.ccm.bss :
{
. = ALIGN(4);
PROVIDE(__ccm_bss_start = .);
*(.ccm.bss);
. = ALIGN(4);
PROVIDE(__ccm_bss_end = .);
} > ccm AT > ccm
.ccm.data :
{
. = ALIGN(4);
PROVIDE(__ccm_data_init_start = LOADADDR(.ccm.data));
PROVIDE(__ccm_data_start = .);
*(.ccm.data);
. = ALIGN(4);
PROVIDE(__ccm_data_end = .);
} > ccm AT > rom
.ccm.noinit (NOLOAD) :
{
. = ALIGN(4);
PROVIDE(__ccm_noinit_start = .);
*(.ccm.noinit);
. = ALIGN(4);
PROVIDE(__ccm_noinit_end = .);
} > ccm AT > ccm
.stab 0 (NOLOAD) : { *(.stab); }
.stabstr 0 (NOLOAD) : { *(.stabstr); }
/* 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); }
.note.gnu.arm.ident 0 : { KEEP(*(.note.gnu.arm.ident)); }
.ARM.attributes 0 : { KEEP(*(.ARM.attributes)); }
/DISCARD/ : { *(.note.GNU-stack); }
}
PROVIDE(__text_size = SIZEOF(.text));
PROVIDE(__exidx_size = SIZEOF(.ARM.exidx));
PROVIDE(__bss_size = SIZEOF(.bss));
PROVIDE(__data_size = SIZEOF(.data));
PROVIDE(__noinit_size = SIZEOF(.noinit));
PROVIDE(__bkpsram_bss_size = SIZEOF(.bkpsram.bss));
PROVIDE(__bkpsram_data_size = SIZEOF(.bkpsram.data));
PROVIDE(__bkpsram_noinit_size = SIZEOF(.bkpsram.noinit));
PROVIDE(__ccm_bss_size = SIZEOF(.ccm.bss));
PROVIDE(__ccm_data_size = SIZEOF(.ccm.data));
PROVIDE(__ccm_noinit_size = SIZEOF(.ccm.noinit));
PROVIDE(__bss_start__ = __bss_start);
PROVIDE(__bss_end__ = __bss_end);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment