use libopencm3 ld files

This commit is contained in:
King Kévin 2016-08-14 21:04:41 +02:00
parent f3410200b7
commit 31beaa5f74
3 changed files with 10 additions and 66 deletions

View File

@ -62,8 +62,17 @@ INCLUDE_DIR = $(OPENCM3_DIR)/include
LIB_DIR = $(OPENCM3_DIR)/lib
SCRIPT_DIR = $(OPENCM3_DIR)/scripts
# linker script
ifeq ($(BOARD),SYSTEM_BOARD)
LDSCRIPT = $(OPENCM3_DIR)/lib/stm32/f1/stm32f103x8.ld
else ifeq ($(BOARD),BLUE_PILL)
LDSCRIPT = $(OPENCM3_DIR)/lib/stm32/f1/stm32f103x8.ld
else ifeq ($(BOARD),MAPLE_MINI)
LDSCRIPT = $(OPENCM3_DIR)/lib/stm32/f1/stm32f103xb.ld
endif
# verify if libopencm3 has been downloaded
OPENCM3_DIR_EXISTS = $(shell [ -d $(OPENCM3_DIR) ] && echo 1 || echo 0 )
OPENCM3_DIR_EXISTS = $(shell [ -f $(LDSCRIPT) ] && echo 1 || echo 0 )
ifeq ($(OPENCM3_DIR_EXISTS), 0)
$(info run "git submodule init" and "git submodule update" before runnig make)
$(error libopencm3 repository is not initialized)
@ -79,15 +88,6 @@ CFLAGS += -fno-common -ffunction-sections -fdata-sections
CFLAGS += -I. -I$(INCLUDE_DIR) $(patsubst %,-I%,$(LIB))
CFLAGS += $(DEFS)
# linker script
ifeq ($(BOARD),SYSTEM_BOARD)
LDSCRIPT = stm32f103x8-dfu.ld
else ifeq ($(BOARD),BLUE_PILL)
LDSCRIPT = stm32f103x8-dfu.ld
else ifeq ($(BOARD),MAPLE_MINI)
LDSCRIPT = stm32f103xb-dfu.ld
endif
# linker flags
LDFLAGS += --static -nostartfiles
LDFLAGS += -L$(LIB_DIR)

View File

@ -1,28 +0,0 @@
/* 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 <http://www.gnu.org/licenses/>.
*/
/* linker script for STM32F103x8 based boards (64kB flash, 20kB RAM)
* with additional STM32duino-booloader USB DFU bootloader (8kB flash, 0kB RAM)
* from https://github.com/rogerclarkmelbourne/STM32duino-bootloader
*/
/* Define memory regions. */
MEMORY
{
rom (rx) : ORIGIN = 0x08002000, LENGTH = 56K
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
}
/* Include the common ld script. */
INCLUDE libopencm3_stm32f1.ld

View File

@ -1,28 +0,0 @@
/* 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 <http://www.gnu.org/licenses/>.
*/
/* linker script for STM32F103xB based boards (128kB flash, 20kB RAM)
* with additional STM32duino-booloader USB DFU bootloader (8kB flash, 0kB RAM)
* from https://github.com/rogerclarkmelbourne/STM32duino-bootloader
*/
/* Define memory regions. */
MEMORY
{
rom (rx) : ORIGIN = 0x08002000, LENGTH = 120K
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
}
/* Include the common ld script. */
INCLUDE libopencm3_stm32f1.ld