From 516b4b6c7faa8f963ccfc4aff6d0b19c3489c7e2 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Sun, 18 Sep 2022 17:23:05 +0200 Subject: [PATCH 1/4] cpu/nrf51: use cortexm.ld --- cpu/nrf51/Makefile.include | 16 ++++++++++++++++ cpu/nrf51/ldscripts/nrf51x22xxaa.ld | 27 --------------------------- cpu/nrf51/ldscripts/nrf51x22xxab.ld | 27 --------------------------- cpu/nrf51/ldscripts/nrf51x22xxac.ld | 27 --------------------------- cpu/nrf52/Makefile.include | 5 ----- cpu/nrf5x_common/Makefile.include | 5 +++++ cpu/nrf9160/Makefile.include | 5 ----- 7 files changed, 21 insertions(+), 91 deletions(-) delete mode 100644 cpu/nrf51/ldscripts/nrf51x22xxaa.ld delete mode 100644 cpu/nrf51/ldscripts/nrf51x22xxab.ld delete mode 100644 cpu/nrf51/ldscripts/nrf51x22xxac.ld diff --git a/cpu/nrf51/Makefile.include b/cpu/nrf51/Makefile.include index 500a78244b9a..c95ad04470c1 100644 --- a/cpu/nrf51/Makefile.include +++ b/cpu/nrf51/Makefile.include @@ -1,2 +1,18 @@ +ROM_START_ADDR ?= 0 + +# Set ROM and RAM lengths according to CPU model +ifneq (,$(filter nrf51x22xxaa nrf51x22xxab,$(CPU_MODEL))) + ROM_LEN ?= 0x40000 + RAM_LEN ?= 0x4000 +endif +ifneq (,$(filter nrf51x22xxaa,$(CPU_MODEL))) + ROM_LEN ?= 0x20000 + RAM_LEN ?= 0x4000 +endif +ifneq (,$(filter nrf51x22xxac,$(CPU_MODEL))) + ROM_LEN ?= 0x40000 + RAM_LEN ?= 0x8000 +endif + include $(RIOTCPU)/nrf5x_common/Makefile.include include $(RIOTMAKE)/arch/cortexm.inc.mk diff --git a/cpu/nrf51/ldscripts/nrf51x22xxaa.ld b/cpu/nrf51/ldscripts/nrf51x22xxaa.ld deleted file mode 100644 index 50dbd4e65294..000000000000 --- a/cpu/nrf51/ldscripts/nrf51x22xxaa.ld +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2015 Freie Universität Berlin - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @addtogroup cpu_nrf51822 - * @{ - * - * @file - * @brief Memory definitions for the NRF51X22XXAA - * - * @author Hauke Petersen - * - * @} - */ - -MEMORY -{ - rom (rx) : ORIGIN = 0x00000000, LENGTH = 256K - ram (w!rx) : ORIGIN = 0x20000000, LENGTH = 16K -} - -INCLUDE cortexm_base.ld diff --git a/cpu/nrf51/ldscripts/nrf51x22xxab.ld b/cpu/nrf51/ldscripts/nrf51x22xxab.ld deleted file mode 100644 index 805bf913c733..000000000000 --- a/cpu/nrf51/ldscripts/nrf51x22xxab.ld +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2015 Freie Universität Berlin - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @addtogroup cpu_nrf51822 - * @{ - * - * @file - * @brief Memory definitions for the NRF51X22XXAB - * - * @author Hauke Petersen - * - * @} - */ - -MEMORY -{ - rom (rx) : ORIGIN = 0x00000000, LENGTH = 128K - ram (w!rx) : ORIGIN = 0x20000000, LENGTH = 16K -} - -INCLUDE cortexm_base.ld diff --git a/cpu/nrf51/ldscripts/nrf51x22xxac.ld b/cpu/nrf51/ldscripts/nrf51x22xxac.ld deleted file mode 100644 index 6b755b32bbea..000000000000 --- a/cpu/nrf51/ldscripts/nrf51x22xxac.ld +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2015 Freie Universität Berlin - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @addtogroup cpu_nrf51822 - * @{ - * - * @file - * @brief Memory definitions for the NRF51X22XXAC - * - * @author Stephane D'Alu - * - * @} - */ - -MEMORY -{ - rom (rx) : ORIGIN = 0x00000000, LENGTH = 256K - ram (w!rx) : ORIGIN = 0x20000000, LENGTH = 32K -} - -INCLUDE cortexm_base.ld diff --git a/cpu/nrf52/Makefile.include b/cpu/nrf52/Makefile.include index 1fa7f149cfba..98e984bf8754 100644 --- a/cpu/nrf52/Makefile.include +++ b/cpu/nrf52/Makefile.include @@ -35,11 +35,6 @@ ifneq (,$(filter nrf52840xxaa,$(CPU_MODEL))) RAM_LEN ?= 0x40000 endif -ROM_START_ADDR ?= 0x00000000 -RAM_START_ADDR ?= 0x20000000 - -LINKER_SCRIPT ?= cortexm.ld - VECTORS_O ?= $(BINDIR)/nrf52_vectors/vectors_$(CPU_MODEL).o include $(RIOTCPU)/nrf5x_common/Makefile.include diff --git a/cpu/nrf5x_common/Makefile.include b/cpu/nrf5x_common/Makefile.include index c4b3dec38835..649ecdb290f6 100644 --- a/cpu/nrf5x_common/Makefile.include +++ b/cpu/nrf5x_common/Makefile.include @@ -1,3 +1,8 @@ CFLAGS += -DCPU_FAM_$(call uppercase_and_underscore,$(CPU_FAM)) +ROM_START_ADDR ?= 0x00000000 +RAM_START_ADDR ?= 0x20000000 + +LINKER_SCRIPT ?= cortexm.ld + INCLUDES += -I$(RIOTCPU)/nrf5x_common/include diff --git a/cpu/nrf9160/Makefile.include b/cpu/nrf9160/Makefile.include index b1d2242c3f1f..118ee9668cd9 100644 --- a/cpu/nrf9160/Makefile.include +++ b/cpu/nrf9160/Makefile.include @@ -2,11 +2,6 @@ ROM_LEN ?= 0x100000 RAM_LEN ?= 0x40000 -ROM_START_ADDR ?= 0x00000000 -RAM_START_ADDR ?= 0x20000000 - -LINKER_SCRIPT ?= cortexm.ld - FLASHFILE ?= $(BINFILE) PROGRAMMER ?= jlink From 338f0ff60484b6189c0b5cff039417e2eecc57b3 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Sun, 18 Sep 2022 17:25:50 +0200 Subject: [PATCH 2/4] cpu/sam_common: make use of cortexm.ld --- cpu/sam_common/Makefile.include | 9 +++++++-- cpu/sam_common/ldscripts/sam3x8e.ld | 27 --------------------------- 2 files changed, 7 insertions(+), 29 deletions(-) delete mode 100644 cpu/sam_common/ldscripts/sam3x8e.ld diff --git a/cpu/sam_common/Makefile.include b/cpu/sam_common/Makefile.include index ff1e3f42ca0d..103ee94dd745 100644 --- a/cpu/sam_common/Makefile.include +++ b/cpu/sam_common/Makefile.include @@ -4,7 +4,12 @@ CFLAGS += -DCPU_FAM_$(call uppercase_and_underscore,$(CPU_FAM)) # this CPU implementation doesn't use CMSIS initialization CFLAGS += -DDONT_USE_CMSIS_INIT -# for the sam[drl] CPUs we hold all linkerscripts in the sam0 common folder -LINKFLAGS += -L$(RIOTCPU)/sam_common/ldscripts +ROM_START_ADDR ?= 0x80000 +RAM_START_ADDR ?= 0x20070000 + +ROM_LEN ?= 0x80000 +RAM_LEN ?= 0x18000 + +LINKER_SCRIPT ?= cortexm.ld INCLUDES += -I$(RIOTCPU)/sam_common/include diff --git a/cpu/sam_common/ldscripts/sam3x8e.ld b/cpu/sam_common/ldscripts/sam3x8e.ld deleted file mode 100644 index 0a9d6ddc8bf0..000000000000 --- a/cpu/sam_common/ldscripts/sam3x8e.ld +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2015 Freie Universität Berlin - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License v2.1. See the file LICENSE in the top level - * directory for more details. - */ - -/** - * @addtogroup cpu_sam3 - * @{ - * - * @file - * @brief Memory definitions for the SAM3X8E - * - * @author Hauke Petersen - * - * @} - */ - -MEMORY -{ - rom (rx) : ORIGIN = 0x00080000, LENGTH = 512K - ram (w!rx) : ORIGIN = 0x20070000, LENGTH = 96K -} - -INCLUDE cortexm_base.ld From adeeb2a3e4b8d9d4cc5b146078f0362a65a8af6e Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Sun, 18 Sep 2022 17:29:41 +0200 Subject: [PATCH 3/4] cpu/lpc1768: make use of cortexm.ld --- cpu/lpc1768/Makefile.include | 6 ++++++ cpu/lpc1768/ldscripts/lpc1768.ld | 4 +--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cpu/lpc1768/Makefile.include b/cpu/lpc1768/Makefile.include index ea1a0f256b72..00d062d71726 100644 --- a/cpu/lpc1768/Makefile.include +++ b/cpu/lpc1768/Makefile.include @@ -1 +1,7 @@ +ROM_START_ADDR ?= 0x0 +RAM_START_ADDR ?= 0x100000C8 + +ROM_LEN ?= 0x80000 +RAM_LEN ?= 0x7f38 # 32K - 0xC8 + include $(RIOTMAKE)/arch/cortexm.inc.mk diff --git a/cpu/lpc1768/ldscripts/lpc1768.ld b/cpu/lpc1768/ldscripts/lpc1768.ld index e954ee0c11da..5381a6ac83e1 100644 --- a/cpu/lpc1768/ldscripts/lpc1768.ld +++ b/cpu/lpc1768/ldscripts/lpc1768.ld @@ -20,10 +20,8 @@ MEMORY { - rom (rx) : ORIGIN = 0x00000000, LENGTH = 512K - ram (w!rx) : ORIGIN = 0x100000C8, LENGTH = (32K - 0xC8) usb_ram : ORIGIN = 0x2007C000, LENGTH = 16K eth_ram : ORIGIN = 0x20080000, LENGTH = 16K } -INCLUDE cortexm_base.ld +INCLUDE cortexm.ld From a3b23827e17b567658b35fe0dbc538cf2fa899cb Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Sun, 18 Sep 2022 17:32:49 +0200 Subject: [PATCH 4/4] cpu/lm4f120: make use of cortexm.ld --- cpu/lm4f120/Makefile.include | 8 ++++++++ cpu/lm4f120/ldscripts/LM4F120H5QR.ld | 26 -------------------------- 2 files changed, 8 insertions(+), 26 deletions(-) delete mode 100644 cpu/lm4f120/ldscripts/LM4F120H5QR.ld diff --git a/cpu/lm4f120/Makefile.include b/cpu/lm4f120/Makefile.include index 717f1ea64fa6..0bf9fc06cac4 100644 --- a/cpu/lm4f120/Makefile.include +++ b/cpu/lm4f120/Makefile.include @@ -1,3 +1,11 @@ +ROM_LEN ?= 0x40000 +RAM_LEN ?= 0x8000 + +ROM_START_ADDR ?= 0x00000000 +RAM_START_ADDR ?= 0x20000000 + +LINKER_SCRIPT ?= cortexm.ld + include $(RIOTMAKE)/arch/cortexm.inc.mk include $(RIOTCPU)/stellaris_common/Makefile.include diff --git a/cpu/lm4f120/ldscripts/LM4F120H5QR.ld b/cpu/lm4f120/ldscripts/LM4F120H5QR.ld deleted file mode 100644 index 798e0b5966a4..000000000000 --- a/cpu/lm4f120/ldscripts/LM4F120H5QR.ld +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2015 Rakendra Thapa - * - * @} - */ -MEMORY -{ - rom (rx) : ORIGIN = 0x00000000, LENGTH = 256K - ram (w!rx) : ORIGIN = 0x20000000, LENGTH = 32K -} - -INCLUDE cortexm_base.ld