Skip to content
Snippets Groups Projects
Commit cb8e3f19 authored by Joakim Nohlgård's avatar Joakim Nohlgård
Browse files

kinetis: Use one ldscript for all CPUs

parent 0dabad20
No related branches found
No related tags found
No related merge requests found
...@@ -10,8 +10,28 @@ export INCLUDES += -I$(RIOTCPU)/kinetis_common/include ...@@ -10,8 +10,28 @@ export INCLUDES += -I$(RIOTCPU)/kinetis_common/include
# Add search path for linker scripts # Add search path for linker scripts
export LINKFLAGS += -L$(RIOTCPU)/kinetis_common/ldscripts export LINKFLAGS += -L$(RIOTCPU)/kinetis_common/ldscripts
# Use generic linkerscripts for all Kinetis based CPUs # Use generic linker script for all Kinetis based CPUs
export LINKER_SCRIPT ?= $(LD_$(shell echo $(CPU_MODEL) | tr a-z A-Z)) LINKER_SCRIPT = kinetis.ld
ROM_START_ADDR = 0x00000000
RAM_BASE_ADDR = 0x20000000
RAM_START_ADDR = $$(($(RAM_BASE_ADDR)-($(KINETIS_SRAM_L_SIZE) * 1024)))
ROM_LEN = $$(($(KINETIS_ROMSIZE) * 1024))
RAM_LEN = $$(($(KINETIS_RAMSIZE) * 1024))
CFLAGS += \
-DKINETIS_CORE_$(KINETIS_CORE) \
-DKINETIS_SERIES_$(KINETIS_SERIES) \
-DKINETIS_FAMILY=$(KINETIS_FAMILY) \
-DKINETIS_SUBFAMILY=$(KINETIS_SUBFAMILY) \
-DKINETIS_ROMSIZE=$(KINETIS_ROMSIZE) \
#
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_rom_start_addr=$(ROM_START_ADDR)
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_ram_base_addr=$(RAM_BASE_ADDR)
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_ram_start_addr=$(RAM_START_ADDR)
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_rom_length=$(ROM_LEN)
LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_ram_length=$(RAM_LEN)
# add the CPU specific code for the linker # add the CPU specific code for the linker
export UNDEF += $(BINDIR)/kinetis_common/fcfield.o export UNDEF += $(BINDIR)/kinetis_common/fcfield.o
......
/* /*
* Copyright (C) 2015 PHYTEC Messtechnik GmbH * Copyright (C) 2015 PHYTEC Messtechnik GmbH
* Copyright (C) 2015 Eistec AB * Copyright (C) 2015-2017 Eistec AB
* *
* This file is subject to the terms and conditions of the GNU Lesser * 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 * General Public License v2.1. See the file LICENSE in the top level
...@@ -19,6 +19,19 @@ ...@@ -19,6 +19,19 @@
* *
* @} * @}
*/ */
OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
OUTPUT_ARCH(arm)
_vectors_length = 0x400;
_flashsec_length = 0x10;
MEMORY
{
vectors (rx) : ORIGIN = _rom_start_addr, LENGTH = _vectors_length
flashsec (rx) : ORIGIN = _rom_start_addr + _vectors_length, LENGTH = _flashsec_length
rom (rx) : ORIGIN = _rom_start_addr + _vectors_length + _flashsec_length, LENGTH = _rom_length - (_vectors_length + _flashsec_length)
ram (rwx) : ORIGIN = _ram_start_addr, LENGTH = _ram_length
}
SECTIONS SECTIONS
{ {
......
/*
* NXP Kinetis CPU with the following memory layout:
* 1024 kB flash @ 0x00000000
* 256 kB RAM, split into two banks: 64 kB SRAM_L, 192 kB SRAM_U.
* SRAM_L ends at 0x1fffffff, SRAM_U begins at 0x20000000
*/
OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
OUTPUT_ARCH(arm)
MEMORY
{
vectors (rx) : ORIGIN = 0x00000000, LENGTH = 0x400
flashsec (rx) : ORIGIN = 0x00000400, LENGTH = 0x10
rom (rx) : ORIGIN = 0x00000410, LENGTH = 1024K - 0x410
ram (rwx) : ORIGIN = 0x20000000 - 64K, LENGTH = 256K
}
INCLUDE kinetis.ld
/*
* NXP Kinetis CPU with the following memory layout:
* 256 kB flash @ 0x00000000
* 32 kB RAM, split into two banks: 16 kB SRAM_L, 16 kB SRAM_U.
* SRAM_L ends at 0x1fffffff, SRAM_U begins at 0x20000000
*/
OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
OUTPUT_ARCH(arm)
MEMORY
{
vectors (rx) : ORIGIN = 0x00000000, LENGTH = 0x400
flashsec (rx) : ORIGIN = 0x00000400, LENGTH = 0x10
rom (rx) : ORIGIN = 0x00000410, LENGTH = 256K - 0x410
ram (rwx) : ORIGIN = 0x20000000 - 16K, LENGTH = 32K
}
INCLUDE kinetis.ld
/*
* NXP Kinetis CPU with the following memory layout:
* 256 kB flash @ 0x00000000
* 64 kB RAM, split into two banks: 32 kB SRAM_L, 32 kB SRAM_U.
* SRAM_L ends at 0x1fffffff, SRAM_U begins at 0x20000000
*/
OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
OUTPUT_ARCH(arm)
MEMORY
{
vectors (rx) : ORIGIN = 0x00000000, LENGTH = 0x400
flashsec (rx) : ORIGIN = 0x00000400, LENGTH = 0x10
rom (rx) : ORIGIN = 0x00000410, LENGTH = 256K - 0x410
ram (rwx) : ORIGIN = 0x20000000 - 32K, LENGTH = 64K
}
INCLUDE kinetis.ld
/*
* NXP Kinetis CPU with the following memory layout:
* 512 kB flash @ 0x00000000
* 64 kB RAM, split into two banks: 32 kB SRAM_L, 32 kB SRAM_U.
* SRAM_L ends at 0x1fffffff, SRAM_U begins at 0x20000000
*/
OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
OUTPUT_ARCH(arm)
MEMORY
{
vectors (rx) : ORIGIN = 0x00000000, LENGTH = 0x400
flashsec (rx) : ORIGIN = 0x00000400, LENGTH = 0x10
rom (rx) : ORIGIN = 0x00000410, LENGTH = 512K - 0x410
ram (rwx) : ORIGIN = 0x20000000 - 32K, LENGTH = 64K
}
INCLUDE kinetis.ld
/*
* NXP Kinetis CPU with the following memory layout:
* 512 kB flash @ 0x00000000
* 128 kB RAM, split into two banks: 64 kB SRAM_L, 64 kB SRAM_U.
* SRAM_L ends at 0x1fffffff, SRAM_U begins at 0x20000000
*/
OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
OUTPUT_ARCH(arm)
MEMORY
{
vectors (rx) : ORIGIN = 0x00000000, LENGTH = 0x400
flashsec (rx) : ORIGIN = 0x00000400, LENGTH = 0x10
rom (rx) : ORIGIN = 0x00000410, LENGTH = 512K - 0x410
ram (rwx) : ORIGIN = 0x20000000 - 64K, LENGTH = 128K
}
INCLUDE kinetis.ld
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment