use libopencm3 ld files
This commit is contained in:
parent
f3410200b7
commit
31beaa5f74
20
Makefile
20
Makefile
|
@ -62,8 +62,17 @@ INCLUDE_DIR = $(OPENCM3_DIR)/include
|
||||||
LIB_DIR = $(OPENCM3_DIR)/lib
|
LIB_DIR = $(OPENCM3_DIR)/lib
|
||||||
SCRIPT_DIR = $(OPENCM3_DIR)/scripts
|
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
|
# 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)
|
ifeq ($(OPENCM3_DIR_EXISTS), 0)
|
||||||
$(info run "git submodule init" and "git submodule update" before runnig make)
|
$(info run "git submodule init" and "git submodule update" before runnig make)
|
||||||
$(error libopencm3 repository is not initialized)
|
$(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 += -I. -I$(INCLUDE_DIR) $(patsubst %,-I%,$(LIB))
|
||||||
CFLAGS += $(DEFS)
|
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
|
# linker flags
|
||||||
LDFLAGS += --static -nostartfiles
|
LDFLAGS += --static -nostartfiles
|
||||||
LDFLAGS += -L$(LIB_DIR)
|
LDFLAGS += -L$(LIB_DIR)
|
||||||
|
|
|
@ -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
|
|
|
@ -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
|
|
Loading…
Reference in New Issue