Factor out ld scripts into one common script in the lib.

This commit is contained in:
Uwe Hermann 2009-07-24 23:19:44 +02:00
parent 732760ccd0
commit 50ba77bea9
4 changed files with 6 additions and 53 deletions

View File

@ -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

View File

@ -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

View File

@ -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
}