1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/cpu/kinetis/Makefile.include
Benjamin Valentin d5dce87e1b Makefile.include: rename MAKEFILEDIR to LAST_MAKEFILEDIR
Rename the variable to make it clearer that it refers to the last Makefile
included.
Usually this is the current file, but when another Makefile is included this
changes.
2020-04-28 15:45:27 +02:00

58 lines
1.9 KiB
Makefile

ifeq (,$(KINETIS_SERIES))
# Parse parameters from CPU_MODEL using the kinetis-info.mk script in the same
# directory as this Makefile.
include $(LAST_MAKEFILEDIR)/kinetis-info.mk
endif
# "The Vector table must be naturally aligned to a power of two whose alignment
# value is greater than or equal to number of Exceptions supported x 4"
# CPU_IRQ_NUMOF for KWxD and KxF boards is < 102+16 so (81*4 bytes = 472 bytes ~= 0x200)
# RIOTBOOT_HDR_LEN can be set to 0x200
ifneq (,$(filter FK DW,$(KINETIS_CORE)$(KINETIS_SERIES)))
RIOTBOOT_HDR_LEN ?= 0x200
endif
# Slot size is determined by "((total_flash_size - RIOTBOOT_LEN) / 2)".
# If RIOTBOOT_LEN uses an uneven number of flashpages, the remainder of the
# flash cannot be divided by two slots while staying FLASHPAGE_SIZE aligned.
ifeq (K, $(KINETIS_SERIES))
RIOTBOOT_LEN ?= 0x2000
endif
# Add search path for linker scripts
LINKFLAGS += -L$(RIOTCPU)/$(CPU)/ldscripts
# Use generic linker script for all Kinetis based CPUs
LINKER_SCRIPT = kinetis.ld
ROM_START_ADDR = 0x00000000
RAM_BASE_ADDR = 0x20000000
RAM_START_ADDR := $(shell printf "0x%08x" $$(($(RAM_BASE_ADDR)-($(KINETIS_SRAM_L_SIZE) * 1024))))
# Define ROM_LEN with a non arithmetic value as it must be
# evaluated in `cortexm_common` without a shell context
# The `K` is correctly handled by both the linker and `cortexm_common`.
ROM_LEN = $(KINETIS_ROMSIZE)K
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) \
#
# add the CPU specific flash configuration field for the linker
UNDEF += $(BINDIR)/cpu/fcfield.o
# select kinetis periph drivers
ifeq (EA,$(KINETIS_SERIES))
USEMODULE += periph_ics
else
USEMODULE += periph_mcg
endif
USEMODULE += periph_wdog
include $(RIOTMAKE)/arch/cortexm.inc.mk