aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorUwe Hermann2009-07-24 23:19:44 +0200
committerUwe Hermann2009-07-24 23:19:44 +0200
commit50ba77bea9ff670767a02fef374f8c124199fe22 (patch)
tree903af47e932ae8817a73721e461fea868e1b7e50 /examples
parent732760ccd06671f297f2ba4e1614ad08837412e2 (diff)
Factor out ld scripts into one common script in the lib.
Diffstat (limited to 'examples')
-rw-r--r--examples/fancyblink/Makefile5
-rw-r--r--examples/fancyblink/fancyblink.ld49
-rw-r--r--examples/miniblink/Makefile5
-rw-r--r--examples/miniblink/miniblink.ld49
4 files changed, 6 insertions, 102 deletions
diff --git a/examples/fancyblink/Makefile b/examples/fancyblink/Makefile
index fde0bc8..b48c987 100644
--- a/examples/fancyblink/Makefile
+++ b/examples/fancyblink/Makefile
@@ -30,7 +30,8 @@ OBJDUMP = $(PREFIX)-objdump
TOOLCHAIN_DIR = ../..
CFLAGS = -O0 -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include -fno-common \
-mcpu=cortex-m3 -mthumb
-LDFLAGS = -T$(BINARY).ld -nostartfiles -L$(TOOLCHAIN_DIR)/lib
+LDSCRIPT = $(TOOLCHAIN_DIR)/lib/libopenstm32.ld
+LDFLAGS = -T$(LDSCRIPT) -nostartfiles -L$(TOOLCHAIN_DIR)/lib
OBJS = $(BINARY).o
OPENOCD = openocd
@@ -52,7 +53,7 @@ images: $(BINARY)
@printf " OBJDUMP $(BINARY).list\n"
$(Q)$(OBJDUMP) -S $(BINARY) > $(BINARY).list
-$(BINARY): $(OBJS) $(BINARY).ld
+$(BINARY): $(OBJS) $(LDSCRIPT)
@printf " LD $(subst $(shell pwd)/,,$(@))\n"
$(Q)$(LD) $(LDFLAGS) -o $(BINARY) $(OBJS) -lopenstm32
diff --git a/examples/fancyblink/fancyblink.ld b/examples/fancyblink/fancyblink.ld
deleted file mode 100644
index 2d819a7..0000000
--- a/examples/fancyblink/fancyblink.ld
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * This file is part of the libopenstm32 project.
- *
- * Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/* Linker script for Olimex STM32-H103 (STM32F103RBT6, 128K flash, 20K RAM). */
-
-/* Define memory regions. */
-MEMORY
-{
- rom (rx) : ORIGIN = 0x00000000, LENGTH = 128K
- ram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
-}
-
-/* Define sections. */
-SECTIONS
-{
- . = ORIGIN(rom);
-
- .text : {
- *(.vectors) /* Vector table */
- *(.text) /* Program code */
- *(.rodata) /* Read-only data */
- } >rom
-
- . = ORIGIN(ram);
-
- .data : {
- *(.data) /* Read-write initialized data */
- } >ram AT >rom
-
- .bss : {
- *(.bss) /* Read-write zero initialized data */
- } >ram AT >rom
-}
diff --git a/examples/miniblink/Makefile b/examples/miniblink/Makefile
index 9ae0449..0b5a57b 100644
--- a/examples/miniblink/Makefile
+++ b/examples/miniblink/Makefile
@@ -30,7 +30,8 @@ OBJDUMP = $(PREFIX)-objdump
TOOLCHAIN_DIR = ../..
CFLAGS = -O0 -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include -fno-common \
-mcpu=cortex-m3 -mthumb
-LDFLAGS = -T$(BINARY).ld -nostartfiles -L$(TOOLCHAIN_DIR)/lib
+LDSCRIPT = $(TOOLCHAIN_DIR)/lib/libopenstm32.ld
+LDFLAGS = -T$(LDSCRIPT) -nostartfiles -L$(TOOLCHAIN_DIR)/lib
OBJS = $(BINARY).o
OPENOCD = openocd
@@ -52,7 +53,7 @@ images: $(BINARY)
@printf " OBJDUMP $(BINARY).list\n"
$(Q)$(OBJDUMP) -S $(BINARY) > $(BINARY).list
-$(BINARY): $(OBJS) $(BINARY).ld
+$(BINARY): $(OBJS) $(LDSCRIPT)
@printf " LD $(subst $(shell pwd)/,,$(@))\n"
$(Q)$(LD) $(LDFLAGS) -o $(BINARY) $(OBJS) -lopenstm32
diff --git a/examples/miniblink/miniblink.ld b/examples/miniblink/miniblink.ld
deleted file mode 100644
index 2d819a7..0000000
--- a/examples/miniblink/miniblink.ld
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * This file is part of the libopenstm32 project.
- *
- * Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/* Linker script for Olimex STM32-H103 (STM32F103RBT6, 128K flash, 20K RAM). */
-
-/* Define memory regions. */
-MEMORY
-{
- rom (rx) : ORIGIN = 0x00000000, LENGTH = 128K
- ram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
-}
-
-/* Define sections. */
-SECTIONS
-{
- . = ORIGIN(rom);
-
- .text : {
- *(.vectors) /* Vector table */
- *(.text) /* Program code */
- *(.rodata) /* Read-only data */
- } >rom
-
- . = ORIGIN(ram);
-
- .data : {
- *(.data) /* Read-write initialized data */
- } >ram AT >rom
-
- .bss : {
- *(.bss) /* Read-write zero initialized data */
- } >ram AT >rom
-}