aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2015-12-21 00:16:57 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2015-12-21 00:16:57 +0100
commitaf5b3792973e876a860dae5dc7b7f9140f0e3a24 (patch)
tree764c85b96e9d6070902b4a5d2676a7dc3bf03929 /cmake
parentacf22f18828595a0731d3558b7e2d2ba321c926d (diff)
downloadstm32f103-playground-af5b3792973e876a860dae5dc7b7f9140f0e3a24.tar.gz
stm32f103-playground-af5b3792973e876a860dae5dc7b7f9140f0e3a24.tar.bz2
stm32f103-playground-af5b3792973e876a860dae5dc7b7f9140f0e3a24.tar.xz
stm32f103-playground-af5b3792973e876a860dae5dc7b7f9140f0e3a24.zip
o Moving more init code to C.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/stm32.ld21
1 files changed, 13 insertions, 8 deletions
diff --git a/cmake/stm32.ld b/cmake/stm32.ld
index d15b4c2..fc69574 100644
--- a/cmake/stm32.ld
+++ b/cmake/stm32.ld
@@ -1,11 +1,5 @@
-/*
- * https://github.com/barrybingo/SunMoonSim/blob/master/LinkerScript/STM32F103-MD.ld
- */
-
-/* Entry Point */
ENTRY(_Reset_Handler)
-/* Specify the memory areas */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 64K
@@ -17,10 +11,19 @@ _estack = ORIGIN(RAM) + LENGTH(RAM);
SECTIONS
{
+ /* Put the ISR section at the start of the flash area */
+ .isr :
+ {
+ /* The first word has to be the initial stack pointer */
+ LONG(__initial_stack_pointer);
+ */init_high.cpp.obj(.isr_vectors)
+ } >FLASH
+ ASSERT(SIZEOF(.isr) > 100, "The isr_vectors section is too small")
+ ASSERT(SIZEOF(.isr) < 1000, "The isr_vectors section is too big")
+ ASSERT(ADDR(.isr) == ORIGIN(FLASH), "The isr_vectors section was not placed at the start of the flash area")
+
.text :
{
- *(.isr_vectors)
- init.s:(.text)
*(.text)
KEEP(*(.text.*))
*(.rodata*)
@@ -45,4 +48,6 @@ SECTIONS
_bss_start = ADDR(.bss);
_bss_end = _bss_start + SIZEOF(.bss);
+
+ __initial_stack_pointer = ORIGIN(RAM) + LENGTH(RAM) - 1;
}