From 8318384cf1fec4d0b336e5d4deb1f126526584be Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Thu, 19 Jul 2012 22:41:52 +0000 Subject: More progress towards L1 support. Believe gpio is complete, but untested without finishing at least the RCC defines. RCC defines are a work in progress --- lib/stm32/l1/Makefile | 2 +- lib/stm32/l1/libopencm3_stm32l1.ld | 84 ++++++++++++++++++++++++++++++++++++++ lib/stm32/l1/stm32l15xx8.ld | 31 ++++++++++++++ lib/stm32/l1/stm32l15xxB.ld | 31 ++++++++++++++ 4 files changed, 147 insertions(+), 1 deletion(-) create mode 100644 lib/stm32/l1/libopencm3_stm32l1.ld create mode 100644 lib/stm32/l1/stm32l15xx8.ld create mode 100644 lib/stm32/l1/stm32l15xxB.ld (limited to 'lib') diff --git a/lib/stm32/l1/Makefile b/lib/stm32/l1/Makefile index d2cc1be..543c416 100644 --- a/lib/stm32/l1/Makefile +++ b/lib/stm32/l1/Makefile @@ -28,7 +28,7 @@ CFLAGS = -Os -g -Wall -Wextra -I../../../include -fno-common \ -ffunction-sections -fdata-sections -MD -DSTM32L1 # ARFLAGS = rcsv ARFLAGS = rcs -OBJS = vector.o desig.o crc.o +OBJS = vector.o desig.o crc.o gpio.o VPATH += ../../usb:../ diff --git a/lib/stm32/l1/libopencm3_stm32l1.ld b/lib/stm32/l1/libopencm3_stm32l1.ld new file mode 100644 index 0000000..a64a1f7 --- /dev/null +++ b/lib/stm32/l1/libopencm3_stm32l1.ld @@ -0,0 +1,84 @@ +/* + * 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. */ + +/* Memory regions must be defined in the ld script which includes this one. */ + +/* Enforce emmition of the vector table. */ +EXTERN (vector_table) + +/* Define the entry point of the output file. */ +ENTRY(reset_handler) + +/* Define sections. */ +SECTIONS +{ + . = ORIGIN(rom); + + .text : { + *(.vectors) /* Vector table */ + *(.text*) /* Program code */ + . = ALIGN(4); + *(.rodata*) /* Read-only data */ + . = ALIGN(4); + _etext = .; + } >rom + + /* + * Another section used by C++ stuff, appears when using newlib with + * 64bit (long long) printf support + */ + .ARM.extab : { + *(.ARM.extab*) + } >rom + .ARM.exidx : { + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + } >rom + + . = ORIGIN(ram); + + .data : AT (__exidx_end) { + _data = .; + *(.data*) /* Read-write initialized data */ + . = ALIGN(4); + _edata = .; + } >ram + + .bss : { + *(.bss*) /* Read-write zero initialized data */ + *(COMMON) + . = ALIGN(4); + _ebss = .; + } >ram AT >rom + + /* + * The .eh_frame section appears to be used for C++ exception handling. + * You may need to fix this if you're using C++. + */ + /DISCARD/ : { *(.eh_frame) } + + . = ALIGN(4); + end = .; +} + +PROVIDE(_stack = ORIGIN(ram) + LENGTH(ram)); + diff --git a/lib/stm32/l1/stm32l15xx8.ld b/lib/stm32/l1/stm32l15xx8.ld new file mode 100644 index 0000000..1f20f57 --- /dev/null +++ b/lib/stm32/l1/stm32l15xx8.ld @@ -0,0 +1,31 @@ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2012 Karl Palsson . + */ + +/* Linker script for STM32L15xx8, 64K flash, 10K RAM. */ + +/* Define memory regions. */ +MEMORY +{ + rom (rx) : ORIGIN = 0x08000000, LENGTH = 64K + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 10K +} + +/* Include the common ld script. */ +INCLUDE libopencm3_stm32l1.ld + diff --git a/lib/stm32/l1/stm32l15xxB.ld b/lib/stm32/l1/stm32l15xxB.ld new file mode 100644 index 0000000..4c14b71 --- /dev/null +++ b/lib/stm32/l1/stm32l15xxB.ld @@ -0,0 +1,31 @@ +/* + * This file is part of the libopencm3 project. + * + * Copyright (C) 2012 Karl Palsson . + */ + +/* Linker script for STM32L15xxB, 128K flash, 16K RAM. */ + +/* Define memory regions. */ +MEMORY +{ + rom (rx) : ORIGIN = 0x08000000, LENGTH = 128K + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 16K +} + +/* Include the common ld script. */ +INCLUDE libopencm3_stm32l1.ld + -- cgit v1.2.3