/* * This file is part of the libopencm3 project. * * Copyright (C) 2009 Uwe Hermann * * This library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library. If not, see . */ /* Generic linker script for STM32 targets using libopencm3. */ /* Define memory regions. */ MEMORY { flash (rx) : ORIGIN = 0x08000000, LENGTH = 1024K ram (rwx) : ORIGIN = 0x20000000, LENGTH = 128K } _stack_size = 4K; _min_heap_size = 1K; /* required amount of heap */ _min_stack_size = 1K; /* required amount of stack */ /* Enforce emmition of the vector table. */ EXTERN (vector_table) /* Define sections. */ SECTIONS { . = ORIGIN(flash); .text : { *(.vectors) /* Vector table */ KEEP(progname.o (.info)) . = ALIGN(4); KEEP(versions.o (.version)) . = ALIGN(4); *(.text*) /* Program code */ . = ALIGN(4); *(.rodata*) /* Read-only data */ } >flash /* exception index - required due to libgcc.a issuing /0 exceptions */ __exidx_start = .; .ARM.exidx : { *(.ARM.exidx*) } > flash __exidx_end = .; _etext = .; .data : { _data = .; *(.data*) /* Read-write initialized data */ . = ALIGN(4); _edata = .; } >ram AT >flash .bss (NOLOAD) : { *(.bss*) /* Read-write zero initialized data */ *(COMMON) . = ALIGN(4); _ebss = .; } >ram /* exception unwind data - required due to libgcc.a issuing /0 exceptions */ .ARM.extab : { *(.ARM.extab*) } >ram PROVIDE(_sheap = _ebss); PROVIDE(_eheap = (ORIGIN(ram) + LENGTH(ram)) - _stack_size); PROVIDE(_stack = ORIGIN(ram) + LENGTH(ram)); /* This is the user heap stack section. * This is just to check that there is enough RAM left. * It should generate an error if it's full. */ .user_heap_stack : { . = ALIGN(4); PROVIDE(end = .); PROVIDE(_end = .); . = . + _min_heap_size; . = . + _min_stack_size; . = ALIGN(4); } } /* Include system calls stubs for STM32 binary file */ INPUT(syscalls.o)