From af5b3792973e876a860dae5dc7b7f9140f0e3a24 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Mon, 21 Dec 2015 00:16:57 +0100 Subject: o Moving more init code to C. --- cmake/stm32.ld | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'cmake/stm32.ld') 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; } -- cgit v1.2.3