From 22c52bd3a837127e34f2fcb8d9abb094e1d8f9c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Nohlg=C3=A5rd?= <joakim.nohlgard@eistec.se> Date: Fri, 27 Oct 2017 01:26:26 +0200 Subject: [PATCH] kinetis: Unify all Kinetis CPUs in one directory --- boards/frdm-common/Makefile.include | 6 +- boards/frdm-k22f/Makefile.dep | 2 +- boards/frdm-k22f/Makefile.features | 3 +- boards/frdm-k22f/Makefile.include | 2 +- boards/frdm-k22f/include/periph_conf.h | 2 +- boards/frdm-k64f/Makefile.dep | 2 +- boards/frdm-k64f/Makefile.features | 3 +- boards/frdm-k64f/Makefile.include | 2 +- boards/frdm-k64f/include/periph_conf.h | 2 +- boards/mulle/Makefile.dep | 4 +- boards/mulle/Makefile.features | 3 +- boards/mulle/Makefile.include | 8 +- boards/mulle/include/periph_conf.h | 2 +- boards/pba-d-01-kw2x/Makefile.dep | 2 +- boards/pba-d-01-kw2x/Makefile.features | 3 +- boards/pba-d-01-kw2x/Makefile.include | 10 +- boards/pba-d-01-kw2x/include/periph_conf.h | 2 +- cpu/k22f/Makefile | 7 - cpu/k22f/Makefile.dep | 1 - cpu/k22f/Makefile.features | 1 - cpu/k22f/Makefile.include | 22 ---- cpu/k60/Makefile | 7 - cpu/k60/Makefile.features | 1 - cpu/k60/Makefile.include | 19 --- cpu/k60/include/cpu_conf.h | 51 -------- cpu/k60/periph/Makefile | 1 - cpu/k64f/Makefile | 7 - cpu/k64f/Makefile.dep | 1 - cpu/k64f/Makefile.features | 1 - cpu/k64f/Makefile.include | 19 --- cpu/k64f/include/cpu_conf.h | 45 ------- cpu/k64f/periph/Makefile | 1 - cpu/kinetis/Makefile | 10 ++ cpu/{kinetis_common => kinetis}/Makefile.dep | 0 cpu/kinetis/Makefile.features | 5 + .../Makefile.include | 21 ++- cpu/{kinetis_common => kinetis}/cpu.c | 2 +- cpu/{kinetis_common => kinetis}/dist/Makefile | 0 .../dist/README.md | 0 .../dist/calc_spi_scalers/Makefile | 0 .../dist/calc_spi_scalers/calc_spi_scalers.c | 0 .../dist/check-fcfield-elf.sh | 0 .../dist/check-fcfield-hex.sh | 0 .../dist/wdog-disable.s | 0 cpu/{kinetis_common => kinetis}/doc.txt | 76 +++++------ cpu/{kinetis_common => kinetis}/fcfield.c | 2 +- cpu/kinetis/include/cpu_conf.h | 50 ++++++++ .../include/cpu_conf_kinetis.h | 2 +- cpu/kinetis/include/cpu_conf_kinetis_k.h | 120 ++++++++++++++++++ .../include/cpu_conf_kinetis_l.h} | 25 ++-- cpu/kinetis/include/cpu_conf_kinetis_m.h | 40 ++++++ cpu/kinetis/include/cpu_conf_kinetis_v.h | 40 ++++++ cpu/kinetis/include/cpu_conf_kinetis_w.h | 79 ++++++++++++ cpu/{kinetis_common => kinetis}/include/mcg.h | 4 +- .../include/periph_cpu.h | 2 +- .../include/vectors_kinetis.h | 0 .../include/vendor/MK22F12.h | 0 .../include/vendor/MK22F12810.h | 0 .../include/vendor/MK22F25612.h | 0 .../include/vendor/MK22F51212.h | 0 .../include/vendor/MK22FA12.h | 0 cpu/{k60 => kinetis}/include/vendor/MK60D10.h | 0 .../include/vendor/MK64F12.h | 0 .../include/vendor/MKW21D5.h | 0 .../include/vendor/MKW22D5.h | 0 .../include/vendor/MKW24D5.h | 0 .../include/wdog.h | 4 +- cpu/{kinetis_common => kinetis}/isr_kinetis.c | 2 +- .../kinetis-info.mk | 0 .../ldscripts/kinetis.ld | 0 cpu/{k22f => kinetis}/periph/Makefile | 0 cpu/{kinetis_common => kinetis}/periph/adc.c | 2 +- cpu/{kinetis_common => kinetis}/periph/dac.c | 2 +- cpu/{kinetis_common => kinetis}/periph/gpio.c | 2 +- .../periph/hwrng.c | 2 +- cpu/{kinetis_common => kinetis}/periph/i2c.c | 0 cpu/{kinetis_common => kinetis}/periph/mcg.c | 2 +- cpu/{kinetis_common => kinetis}/periph/pm.c | 2 +- cpu/{kinetis_common => kinetis}/periph/pwm.c | 2 +- cpu/{kinetis_common => kinetis}/periph/rtc.c | 2 +- cpu/{kinetis_common => kinetis}/periph/rtt.c | 2 +- cpu/{kinetis_common => kinetis}/periph/spi.c | 2 +- .../periph/timer.c | 2 +- cpu/{kinetis_common => kinetis}/periph/uart.c | 2 +- cpu/{kinetis_common => kinetis}/periph/wdog.c | 2 +- cpu/{kinetis_common => kinetis}/vectors.c | 0 cpu/kinetis_common/Makefile | 9 -- cpu/kinetis_common/Makefile.features | 4 - cpu/kinetis_common/periph/Makefile | 3 - cpu/kinetis_common/periph/hwrng_rngb.c | 73 ----------- cpu/kw2xd/Makefile | 7 - cpu/kw2xd/Makefile.dep | 1 - cpu/kw2xd/Makefile.features | 1 - cpu/kw2xd/Makefile.include | 20 --- cpu/kw2xd/include/cpu_conf.h | 94 -------------- cpu/kw2xd/periph/Makefile | 1 - doc/doxygen/src/mainpage.md | 2 +- 97 files changed, 454 insertions(+), 513 deletions(-) delete mode 100644 cpu/k22f/Makefile delete mode 100644 cpu/k22f/Makefile.dep delete mode 100644 cpu/k22f/Makefile.features delete mode 100644 cpu/k22f/Makefile.include delete mode 100644 cpu/k60/Makefile delete mode 100644 cpu/k60/Makefile.features delete mode 100644 cpu/k60/Makefile.include delete mode 100644 cpu/k60/include/cpu_conf.h delete mode 100644 cpu/k60/periph/Makefile delete mode 100644 cpu/k64f/Makefile delete mode 100644 cpu/k64f/Makefile.dep delete mode 100644 cpu/k64f/Makefile.features delete mode 100644 cpu/k64f/Makefile.include delete mode 100644 cpu/k64f/include/cpu_conf.h delete mode 100644 cpu/k64f/periph/Makefile create mode 100644 cpu/kinetis/Makefile rename cpu/{kinetis_common => kinetis}/Makefile.dep (100%) create mode 100644 cpu/kinetis/Makefile.features rename cpu/{kinetis_common => kinetis}/Makefile.include (69%) rename cpu/{kinetis_common => kinetis}/cpu.c (96%) rename cpu/{kinetis_common => kinetis}/dist/Makefile (100%) rename cpu/{kinetis_common => kinetis}/dist/README.md (100%) rename cpu/{kinetis_common => kinetis}/dist/calc_spi_scalers/Makefile (100%) rename cpu/{kinetis_common => kinetis}/dist/calc_spi_scalers/calc_spi_scalers.c (100%) rename cpu/{kinetis_common => kinetis}/dist/check-fcfield-elf.sh (100%) rename cpu/{kinetis_common => kinetis}/dist/check-fcfield-hex.sh (100%) rename cpu/{kinetis_common => kinetis}/dist/wdog-disable.s (100%) rename cpu/{kinetis_common => kinetis}/doc.txt (89%) rename cpu/{kinetis_common => kinetis}/fcfield.c (97%) create mode 100644 cpu/kinetis/include/cpu_conf.h rename cpu/{kinetis_common => kinetis}/include/cpu_conf_kinetis.h (98%) create mode 100644 cpu/kinetis/include/cpu_conf_kinetis_k.h rename cpu/{k22f/include/cpu_conf.h => kinetis/include/cpu_conf_kinetis_l.h} (60%) create mode 100644 cpu/kinetis/include/cpu_conf_kinetis_m.h create mode 100644 cpu/kinetis/include/cpu_conf_kinetis_v.h create mode 100644 cpu/kinetis/include/cpu_conf_kinetis_w.h rename cpu/{kinetis_common => kinetis}/include/mcg.h (98%) rename cpu/{kinetis_common => kinetis}/include/periph_cpu.h (99%) rename cpu/{kinetis_common => kinetis}/include/vectors_kinetis.h (100%) rename cpu/{k22f => kinetis}/include/vendor/MK22F12.h (100%) rename cpu/{k22f => kinetis}/include/vendor/MK22F12810.h (100%) rename cpu/{k22f => kinetis}/include/vendor/MK22F25612.h (100%) rename cpu/{k22f => kinetis}/include/vendor/MK22F51212.h (100%) rename cpu/{k22f => kinetis}/include/vendor/MK22FA12.h (100%) rename cpu/{k60 => kinetis}/include/vendor/MK60D10.h (100%) rename cpu/{k64f => kinetis}/include/vendor/MK64F12.h (100%) rename cpu/{kw2xd => kinetis}/include/vendor/MKW21D5.h (100%) rename cpu/{kw2xd => kinetis}/include/vendor/MKW22D5.h (100%) rename cpu/{kw2xd => kinetis}/include/vendor/MKW24D5.h (100%) rename cpu/{kinetis_common => kinetis}/include/wdog.h (94%) rename cpu/{kinetis_common => kinetis}/isr_kinetis.c (99%) rename cpu/{kinetis_common => kinetis}/kinetis-info.mk (100%) rename cpu/{kinetis_common => kinetis}/ldscripts/kinetis.ld (100%) rename cpu/{k22f => kinetis}/periph/Makefile (100%) rename cpu/{kinetis_common => kinetis}/periph/adc.c (99%) rename cpu/{kinetis_common => kinetis}/periph/dac.c (98%) rename cpu/{kinetis_common => kinetis}/periph/gpio.c (99%) rename cpu/{kinetis_common => kinetis}/periph/hwrng.c (97%) rename cpu/{kinetis_common => kinetis}/periph/i2c.c (100%) rename cpu/{kinetis_common => kinetis}/periph/mcg.c (99%) rename cpu/{kinetis_common => kinetis}/periph/pm.c (96%) rename cpu/{kinetis_common => kinetis}/periph/pwm.c (99%) rename cpu/{kinetis_common => kinetis}/periph/rtc.c (98%) rename cpu/{kinetis_common => kinetis}/periph/rtt.c (99%) rename cpu/{kinetis_common => kinetis}/periph/spi.c (99%) rename cpu/{kinetis_common => kinetis}/periph/timer.c (99%) rename cpu/{kinetis_common => kinetis}/periph/uart.c (99%) rename cpu/{kinetis_common => kinetis}/periph/wdog.c (98%) rename cpu/{kinetis_common => kinetis}/vectors.c (100%) delete mode 100644 cpu/kinetis_common/Makefile delete mode 100644 cpu/kinetis_common/Makefile.features delete mode 100644 cpu/kinetis_common/periph/Makefile delete mode 100644 cpu/kinetis_common/periph/hwrng_rngb.c delete mode 100644 cpu/kw2xd/Makefile delete mode 100644 cpu/kw2xd/Makefile.dep delete mode 100644 cpu/kw2xd/Makefile.features delete mode 100644 cpu/kw2xd/Makefile.include delete mode 100644 cpu/kw2xd/include/cpu_conf.h delete mode 100644 cpu/kw2xd/periph/Makefile diff --git a/boards/frdm-common/Makefile.include b/boards/frdm-common/Makefile.include index b88c3a260e..b88ed26267 100644 --- a/boards/frdm-common/Makefile.include +++ b/boards/frdm-common/Makefile.include @@ -19,12 +19,12 @@ ifeq (1,$(USE_OLD_OPENOCD)) # wdog-disable.bin is a precompiled binary which will disable the watchdog and # return control to the debugger (OpenOCD) export OPENOCD_PRE_VERIFY_CMDS += \ - -c 'load_image $(RIOTCPU)/kinetis_common/dist/wdog-disable.bin 0x20000000 bin' \ + -c 'load_image $(RIOTCPU)/$(CPU)/dist/wdog-disable.bin 0x20000000 bin' \ -c 'resume 0x20000000' export OPENOCD_EXTRA_INIT .PHONY: flash -flash: $(RIOTCPU)/kinetis_common/dist/wdog-disable.bin +flash: $(RIOTCPU)/$(CPU)/dist/wdog-disable.bin # Reset the default goal. .DEFAULT_GOAL := @@ -36,7 +36,7 @@ endif export OPENOCD_CONFIG ?= $(RIOTBOARD)/frdm-common/dist/openocd-$(FRDM_IFACE)-$(CPU_FAMILY).cfg # Check the flash configuration field before flashing -export PRE_FLASH_CHECK_SCRIPT = $(RIOTCPU)/kinetis_common/dist/check-fcfield-elf.sh +export PRE_FLASH_CHECK_SCRIPT = $(RIOTCPU)/$(CPU)/dist/check-fcfield-elf.sh # setup serial terminal include $(RIOTMAKE)/tools/serial.inc.mk diff --git a/boards/frdm-k22f/Makefile.dep b/boards/frdm-k22f/Makefile.dep index 6ff51fd647..a73981801a 100644 --- a/boards/frdm-k22f/Makefile.dep +++ b/boards/frdm-k22f/Makefile.dep @@ -3,4 +3,4 @@ ifneq (,$(filter saul_default,$(USEMODULE))) USEMODULE += saul_adc endif --include $(RIOTCPU)/k22f/Makefile.dep +include $(RIOTCPU)/kinetis/Makefile.dep diff --git a/boards/frdm-k22f/Makefile.features b/boards/frdm-k22f/Makefile.features index b9d64e4911..6a5f7c94c3 100644 --- a/boards/frdm-k22f/Makefile.features +++ b/boards/frdm-k22f/Makefile.features @@ -1,6 +1,5 @@ # Put defined MCU peripherals here (in alphabetical order) FEATURES_PROVIDED += periph_adc -FEATURES_PROVIDED += periph_gpio FEATURES_PROVIDED += periph_i2c FEATURES_PROVIDED += periph_pwm FEATURES_PROVIDED += periph_rtc @@ -12,4 +11,4 @@ FEATURES_PROVIDED += periph_uart # The board MPU family (used for grouping by the CI system) FEATURES_MCU_GROUP = cortex_m4_1 --include $(RIOTCPU)/k22f/Makefile.features +include $(RIOTCPU)/kinetis/Makefile.features diff --git a/boards/frdm-k22f/Makefile.include b/boards/frdm-k22f/Makefile.include index 5251374c92..d6d6feec03 100644 --- a/boards/frdm-k22f/Makefile.include +++ b/boards/frdm-k22f/Makefile.include @@ -1,5 +1,5 @@ # define the cpu used by the board -export CPU = k22f +export CPU = kinetis export CPU_MODEL = mk22fn512vlh12 # Include default FRDM board config diff --git a/boards/frdm-k22f/include/periph_conf.h b/boards/frdm-k22f/include/periph_conf.h index ea8e753bfa..937399c377 100644 --- a/boards/frdm-k22f/include/periph_conf.h +++ b/boards/frdm-k22f/include/periph_conf.h @@ -161,7 +161,7 @@ static const pwm_conf_t pwm_config[] = { * Clock configuration values based on the configured 48Mhz module clock. * * Auto-generated by: - * cpu/kinetis_common/dist/calc_spi_scalers/calc_spi_scalers.c + * cpu/kinetis/dist/calc_spi_scalers/calc_spi_scalers.c * * @{ */ diff --git a/boards/frdm-k64f/Makefile.dep b/boards/frdm-k64f/Makefile.dep index 45e7479a38..98782c48fb 100644 --- a/boards/frdm-k64f/Makefile.dep +++ b/boards/frdm-k64f/Makefile.dep @@ -1 +1 @@ --include $(RIOTCPU)/k64f/Makefile.dep +include $(RIOTCPU)/kinetis/Makefile.dep diff --git a/boards/frdm-k64f/Makefile.features b/boards/frdm-k64f/Makefile.features index 0c12be814e..6a5f7c94c3 100644 --- a/boards/frdm-k64f/Makefile.features +++ b/boards/frdm-k64f/Makefile.features @@ -1,6 +1,5 @@ # Put defined MCU peripherals here (in alphabetical order) FEATURES_PROVIDED += periph_adc -FEATURES_PROVIDED += periph_gpio FEATURES_PROVIDED += periph_i2c FEATURES_PROVIDED += periph_pwm FEATURES_PROVIDED += periph_rtc @@ -12,4 +11,4 @@ FEATURES_PROVIDED += periph_uart # The board MPU family (used for grouping by the CI system) FEATURES_MCU_GROUP = cortex_m4_1 --include $(RIOTCPU)/k64f/Makefile.features +include $(RIOTCPU)/kinetis/Makefile.features diff --git a/boards/frdm-k64f/Makefile.include b/boards/frdm-k64f/Makefile.include index 4747c0d791..0599e132bd 100644 --- a/boards/frdm-k64f/Makefile.include +++ b/boards/frdm-k64f/Makefile.include @@ -1,5 +1,5 @@ # define the cpu used by the FRDM-K64F board -export CPU = k64f +export CPU = kinetis export CPU_MODEL = mk64fn1m0vll12 # Include default FRDM board config diff --git a/boards/frdm-k64f/include/periph_conf.h b/boards/frdm-k64f/include/periph_conf.h index ba79176c59..f99f67e4f4 100644 --- a/boards/frdm-k64f/include/periph_conf.h +++ b/boards/frdm-k64f/include/periph_conf.h @@ -156,7 +156,7 @@ static const pwm_conf_t pwm_config[] = { * Clock configuration values based on the configured 30Mhz module clock. * * Auto-generated by: - * cpu/kinetis_common/dist/calc_spi_scalers/calc_spi_scalers.c + * cpu/kinetis/dist/calc_spi_scalers/calc_spi_scalers.c * * @{ */ diff --git a/boards/mulle/Makefile.dep b/boards/mulle/Makefile.dep index fe3cb539a2..f6ca7bf86e 100644 --- a/boards/mulle/Makefile.dep +++ b/boards/mulle/Makefile.dep @@ -12,10 +12,12 @@ USEMODULE += nvram USEMODULE += devfs USEMODULE += mtd_spi_nor -# mulle always uses it's rtt +# mulle always uses the rtt for the oscillator USEMODULE += periph_rtt ifneq (,$(filter saul_default,$(USEMODULE))) USEMODULE += saul_gpio USEMODULE += saul_adc endif + +include $(RIOTCPU)/kinetis/Makefile.dep diff --git a/boards/mulle/Makefile.features b/boards/mulle/Makefile.features index 519a78a3f4..83519b33a0 100644 --- a/boards/mulle/Makefile.features +++ b/boards/mulle/Makefile.features @@ -1,7 +1,6 @@ # Put defined MCU peripherals here (in alphabetical order) FEATURES_PROVIDED += periph_adc FEATURES_PROVIDED += periph_dac -FEATURES_PROVIDED += periph_gpio FEATURES_PROVIDED += periph_i2c FEATURES_PROVIDED += periph_pwm FEATURES_PROVIDED += periph_rtc @@ -13,4 +12,4 @@ FEATURES_PROVIDED += periph_uart # The board MPU family (used for grouping by the CI system) FEATURES_MCU_GROUP = cortex_m4_2 --include $(RIOTCPU)/k60/Makefile.features +include $(RIOTCPU)/kinetis/Makefile.features diff --git a/boards/mulle/Makefile.include b/boards/mulle/Makefile.include index fa6f4baa7a..620be56ca0 100644 --- a/boards/mulle/Makefile.include +++ b/boards/mulle/Makefile.include @@ -1,5 +1,5 @@ # define the cpu used by the Mulle board -export CPU = k60 +export CPU = kinetis # Default GDB port export GDBPORT ?= 3333 @@ -84,13 +84,13 @@ endif # wdog-disable.bin is a precompiled binary which will disable the watchdog and # return control to the debugger (OpenOCD) export OPENOCD_PRE_VERIFY_CMDS += \ - -c 'load_image $(RIOTCPU)/kinetis_common/dist/wdog-disable.bin 0x20000000 bin' \ + -c 'load_image $(RIOTCPU)/$(CPU)/dist/wdog-disable.bin 0x20000000 bin' \ -c 'resume 0x20000000' export OPENOCD_EXTRA_INIT -export PRE_FLASH_CHECK_SCRIPT = $(RIOTCPU)/kinetis_common/dist/check-fcfield-elf.sh +export PRE_FLASH_CHECK_SCRIPT = $(RIOTCPU)/$(CPU)/dist/check-fcfield-elf.sh .PHONY: flash -flash: $(RIOTCPU)/kinetis_common/dist/wdog-disable.bin +flash: $(RIOTCPU)/$(CPU)/dist/wdog-disable.bin # Reset the default goal. .DEFAULT_GOAL := diff --git a/boards/mulle/include/periph_conf.h b/boards/mulle/include/periph_conf.h index 8be821e343..d9a3dd0c45 100644 --- a/boards/mulle/include/periph_conf.h +++ b/boards/mulle/include/periph_conf.h @@ -238,7 +238,7 @@ static const pwm_conf_t pwm_config[] = { * Clock configuration values based on the configured 47988736Hz module clock. * * Auto-generated by: - * cpu/kinetis_common/dist/calc_spi_scalers/calc_spi_scalers.c + * cpu/kinetis/dist/calc_spi_scalers/calc_spi_scalers.c * * @{ */ diff --git a/boards/pba-d-01-kw2x/Makefile.dep b/boards/pba-d-01-kw2x/Makefile.dep index 28cd67a5dc..d35a2e11ea 100644 --- a/boards/pba-d-01-kw2x/Makefile.dep +++ b/boards/pba-d-01-kw2x/Makefile.dep @@ -12,4 +12,4 @@ ifneq (,$(filter saul_default,$(USEMODULE))) USEMODULE += tmp006 endif --include $(RIOTCPU)/kw2xd/Makefile.dep +include $(RIOTCPU)/kinetis/Makefile.dep diff --git a/boards/pba-d-01-kw2x/Makefile.features b/boards/pba-d-01-kw2x/Makefile.features index 51ba5500b9..ee69accdd4 100644 --- a/boards/pba-d-01-kw2x/Makefile.features +++ b/boards/pba-d-01-kw2x/Makefile.features @@ -1,6 +1,5 @@ # Put defined MCU peripherals here (in alphabetical order) FEATURES_PROVIDED += periph_adc -FEATURES_PROVIDED += periph_gpio FEATURES_PROVIDED += periph_i2c FEATURES_PROVIDED += periph_pwm FEATURES_PROVIDED += periph_rtc @@ -12,4 +11,4 @@ FEATURES_PROVIDED += periph_uart # The board MPU family (used for grouping by the CI system) FEATURES_MCU_GROUP = cortex_m4_3 --include $(RIOTCPU)/kw2xd/Makefile.features +include $(RIOTCPU)/kinetis/Makefile.features diff --git a/boards/pba-d-01-kw2x/Makefile.include b/boards/pba-d-01-kw2x/Makefile.include index 7d9871dd4d..84b620e03d 100644 --- a/boards/pba-d-01-kw2x/Makefile.include +++ b/boards/pba-d-01-kw2x/Makefile.include @@ -1,10 +1,10 @@ # define the cpu used by the phyWAVE-KW22 board -export CPU = kw2xd +export CPU = kinetis # the pba-d-01-kw2x board can embed either a kw21d256, kw21d512 or kw22d512 cpu. # The default set up is kw21d256, the variable is overrideable to use the other # cpu if needed. -export CPU_MODEL ?= kw21d256 +export CPU_MODEL ?= mkw21d256vha5 export MCPU = cortex-m4 @@ -13,7 +13,7 @@ PORT_LINUX ?= /dev/ttyACM0 PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) .PHONY: flash -flash: $(RIOTCPU)/kinetis_common/dist/wdog-disable.bin +flash: $(RIOTCPU)/$(CPU)/dist/wdog-disable.bin # Reset the default goal. .DEFAULT_GOAL := @@ -23,10 +23,10 @@ flash: $(RIOTCPU)/kinetis_common/dist/wdog-disable.bin # wdog-disable.bin is a precompiled binary which will disable the watchdog and # return control to the debugger (OpenOCD) export OPENOCD_PRE_VERIFY_CMDS += \ - -c 'load_image $(RIOTCPU)/kinetis_common/dist/wdog-disable.bin 0x20000000 bin' \ + -c 'load_image $(RIOTCPU)/$(CPU)/dist/wdog-disable.bin 0x20000000 bin' \ -c 'resume 0x20000000' export OPENOCD_EXTRA_INIT -export PRE_FLASH_CHECK_SCRIPT = $(RIOTCPU)/kinetis_common/dist/check-fcfield-elf.sh +export PRE_FLASH_CHECK_SCRIPT = $(RIOTCPU)/$(CPU)/dist/check-fcfield-elf.sh # Add board selector (USB serial) to OpenOCD options if specified. # Use /dist/tools/usb-serial/list-ttys.sh to find out serial number. diff --git a/boards/pba-d-01-kw2x/include/periph_conf.h b/boards/pba-d-01-kw2x/include/periph_conf.h index 25ea7dbdb1..1e11edfe90 100644 --- a/boards/pba-d-01-kw2x/include/periph_conf.h +++ b/boards/pba-d-01-kw2x/include/periph_conf.h @@ -171,7 +171,7 @@ static const pwm_conf_t pwm_config[] = { * Clock configuration values based on the configured 48Mhz module clock. * * Auto-generated by: - * cpu/kinetis_common/dist/calc_spi_scalers/calc_spi_scalers.c + * cpu/kinetis/dist/calc_spi_scalers/calc_spi_scalers.c * * @{ */ diff --git a/cpu/k22f/Makefile b/cpu/k22f/Makefile deleted file mode 100644 index 4e53b72929..0000000000 --- a/cpu/k22f/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# define the module that is build -MODULE = cpu - -# add a list of subdirectories that should also be built -DIRS = periph $(RIOTCPU)/cortexm_common $(KINETIS_COMMON) - -include $(RIOTBASE)/Makefile.base diff --git a/cpu/k22f/Makefile.dep b/cpu/k22f/Makefile.dep deleted file mode 100644 index 419f33923e..0000000000 --- a/cpu/k22f/Makefile.dep +++ /dev/null @@ -1 +0,0 @@ --include $(RIOTCPU)/kinetis_common/Makefile.dep diff --git a/cpu/k22f/Makefile.features b/cpu/k22f/Makefile.features deleted file mode 100644 index e08d42cd26..0000000000 --- a/cpu/k22f/Makefile.features +++ /dev/null @@ -1 +0,0 @@ --include $(RIOTCPU)/kinetis_common/Makefile.features diff --git a/cpu/k22f/Makefile.include b/cpu/k22f/Makefile.include deleted file mode 100644 index 6d51867500..0000000000 --- a/cpu/k22f/Makefile.include +++ /dev/null @@ -1,22 +0,0 @@ -# define the CPU architecture for the k22f -export CPU_ARCH = cortex-m4 -export CPU_FAMILY = kx - -# map CPU models to generic Kinetis linker script -LD_MK22FN512VLH12 = kinetis_f512l64u64.ld -LD_MK22FN512VLL12 = kinetis_f512l64u64.ld -LD_MK22FN512VDC12 = kinetis_f512l64u64.ld -LD_MK22FN512VMP12 = kinetis_f512l64u64.ld - -# tell the build system that the CPU depends on the Kinetis common files -export USEMODULE += kinetis_common - -# define path to kinetis module, which is needed for this CPU -export KINETIS_COMMON = $(RIOTCPU)/kinetis_common/ -# CPU depends on the kinetis module, so include it -include $(KINETIS_COMMON)Makefile.include - -# this CPU implementation is using kinetis common startup -export COMMON_STARTUP = $(KINETIS_COMMON) - -include $(RIOTMAKE)/arch/cortexm.inc.mk diff --git a/cpu/k60/Makefile b/cpu/k60/Makefile deleted file mode 100644 index 12ba41f9cf..0000000000 --- a/cpu/k60/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# define the module that is build -MODULE = cpu - -# add a list of subdirectories, that should also be build -DIRS = periph $(RIOTCPU)/cortexm_common $(KINETIS_COMMON) - -include $(RIOTBASE)/Makefile.base diff --git a/cpu/k60/Makefile.features b/cpu/k60/Makefile.features deleted file mode 100644 index e08d42cd26..0000000000 --- a/cpu/k60/Makefile.features +++ /dev/null @@ -1 +0,0 @@ --include $(RIOTCPU)/kinetis_common/Makefile.features diff --git a/cpu/k60/Makefile.include b/cpu/k60/Makefile.include deleted file mode 100644 index f5fb578716..0000000000 --- a/cpu/k60/Makefile.include +++ /dev/null @@ -1,19 +0,0 @@ -# define the CPU architecture for the k60 -export CPU_ARCH = cortex-m4 - -# map CPU models to generic Kinetis linkerscript -LD_MK60DN256VLL10 = kinetis_f256l16u16.ld -LD_MK60DN512VLL10 = kinetis_f512l64u64.ld - -# tell the build system that the CPU depends on the Kinetis common files -export USEMODULE += kinetis_common - -# define path to kinetis module, which is needed for this CPU -export KINETIS_COMMON = $(RIOTCPU)/kinetis_common/ -# CPU depends on the kinetis module, so include it -include $(KINETIS_COMMON)Makefile.include - -# this CPU implementation is using kinetis common startup -export COMMON_STARTUP = $(KINETIS_COMMON) - -include $(RIOTMAKE)/arch/cortexm.inc.mk diff --git a/cpu/k60/include/cpu_conf.h b/cpu/k60/include/cpu_conf.h deleted file mode 100644 index 942d954bcd..0000000000 --- a/cpu/k60/include/cpu_conf.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2015 Eistec AB - * - * 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. - */ - -/** - * @defgroup cpu_k60 NXP Kinetis K60 - * @ingroup cpu - * @brief CPU specific implementations for the NXP Kinetis K60 - * Cortex-M4 MCU - * @{ - * - * @file - * @brief Implementation specific CPU configuration options - * - * @author Joakim Nohlgård <joakim.nohlgard@eistec.se> - */ - -#ifndef CPU_CONF_H -#define CPU_CONF_H - -#if defined(CPU_MODEL_MK60DN512VLL10) || defined(CPU_MODEL_MK60DN256VLL10) -#include "vendor/MK60D10.h" - -/* K60 rev 2.x replaced the RNG module in 1.x by the RNGA PRNG module */ -#define KINETIS_RNGA (RNG) -#else -#error Unknown CPU model. Update Makefile.include in the board directory. -#endif - -#include "cpu_conf_kinetis.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - -/** - * @brief This CPU provides an additional ADC clock divider as CFG1[ADICLK]=1 - */ -#define KINETIS_HAVE_ADICLK_BUS_DIV_2 1 - -#ifdef __cplusplus -} -#endif - -#endif /* CPU_CONF_H */ -/** @} */ diff --git a/cpu/k60/periph/Makefile b/cpu/k60/periph/Makefile deleted file mode 100644 index a36df249ac..0000000000 --- a/cpu/k60/periph/Makefile +++ /dev/null @@ -1 +0,0 @@ -include $(RIOTMAKE)/periph.mk diff --git a/cpu/k64f/Makefile b/cpu/k64f/Makefile deleted file mode 100644 index 12ba41f9cf..0000000000 --- a/cpu/k64f/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# define the module that is build -MODULE = cpu - -# add a list of subdirectories, that should also be build -DIRS = periph $(RIOTCPU)/cortexm_common $(KINETIS_COMMON) - -include $(RIOTBASE)/Makefile.base diff --git a/cpu/k64f/Makefile.dep b/cpu/k64f/Makefile.dep deleted file mode 100644 index 419f33923e..0000000000 --- a/cpu/k64f/Makefile.dep +++ /dev/null @@ -1 +0,0 @@ --include $(RIOTCPU)/kinetis_common/Makefile.dep diff --git a/cpu/k64f/Makefile.features b/cpu/k64f/Makefile.features deleted file mode 100644 index e08d42cd26..0000000000 --- a/cpu/k64f/Makefile.features +++ /dev/null @@ -1 +0,0 @@ --include $(RIOTCPU)/kinetis_common/Makefile.features diff --git a/cpu/k64f/Makefile.include b/cpu/k64f/Makefile.include deleted file mode 100644 index 3d0eb9a1cd..0000000000 --- a/cpu/k64f/Makefile.include +++ /dev/null @@ -1,19 +0,0 @@ -# define the CPU architecture for the k64f -export CPU_ARCH = cortex-m4 -export CPU_FAMILY = kx - -# map CPU models to generic Kinetis linkerscript -LD_MK64FN1M0VLL12 = kinetis_f1024l64u192.ld - -# tell the build system that the CPU depends on the Kinetis common files -export USEMODULE += kinetis_common - -# define path to kinetis module, which is needed for this CPU -export KINETIS_COMMON = $(RIOTCPU)/kinetis_common/ -# CPU depends on the kinetis module, so include it -include $(KINETIS_COMMON)Makefile.include - -# this CPU implementation is using kinetis common startup -export COMMON_STARTUP = $(KINETIS_COMMON) - -include $(RIOTMAKE)/arch/cortexm.inc.mk diff --git a/cpu/k64f/include/cpu_conf.h b/cpu/k64f/include/cpu_conf.h deleted file mode 100644 index ce8840a030..0000000000 --- a/cpu/k64f/include/cpu_conf.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2015 Freie Universität Berlin - * Copyright (C) 2015 PHYTEC Messtechnik GmbH - * - * 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. - */ - -/** - * @defgroup cpu_k64f NXP Kinetis K64F - * @ingroup cpu - * @brief CPU specific implementations for the NXP Kinetis K64F - * Cortex-M4 MCU - * @{ - * - * @file - * @brief Implementation specific CPU configuration options - * - * @author Hauke Petersen <hauke.petersen@fu-berlin.de> - * @author Johann Fischer <j.fischer@phytec.de> - */ - -#ifndef CPU_CONF_H -#define CPU_CONF_H - -#ifdef CPU_MODEL_MK64FN1M0VLL12 -#include "vendor/MK64F12.h" -#else -#error "undefined CPU_MODEL" -#endif - -#include "cpu_conf_kinetis.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* CPU_CONF_H */ -/** @} */ diff --git a/cpu/k64f/periph/Makefile b/cpu/k64f/periph/Makefile deleted file mode 100644 index a36df249ac..0000000000 --- a/cpu/k64f/periph/Makefile +++ /dev/null @@ -1 +0,0 @@ -include $(RIOTMAKE)/periph.mk diff --git a/cpu/kinetis/Makefile b/cpu/kinetis/Makefile new file mode 100644 index 0000000000..88d8b3d2f0 --- /dev/null +++ b/cpu/kinetis/Makefile @@ -0,0 +1,10 @@ +# define the module that is build +MODULE = cpu + +# add a list of subdirectories that should also be built +DIRS = periph $(RIOTCPU)/cortexm_common + +# (file triggers compiler bug. see https://github.com/RIOT-OS/RIOT/issues/5775) +SRC_NOLTO += vectors.c + +include $(RIOTBASE)/Makefile.base diff --git a/cpu/kinetis_common/Makefile.dep b/cpu/kinetis/Makefile.dep similarity index 100% rename from cpu/kinetis_common/Makefile.dep rename to cpu/kinetis/Makefile.dep diff --git a/cpu/kinetis/Makefile.features b/cpu/kinetis/Makefile.features new file mode 100644 index 0000000000..2045a3cedd --- /dev/null +++ b/cpu/kinetis/Makefile.features @@ -0,0 +1,5 @@ +FEATURES_PROVIDED += periph_cpuid +FEATURES_PROVIDED += periph_hwrng +FEATURES_PROVIDED += periph_gpio + +include $(RIOTCPU)/cortexm_common/Makefile.features diff --git a/cpu/kinetis_common/Makefile.include b/cpu/kinetis/Makefile.include similarity index 69% rename from cpu/kinetis_common/Makefile.include rename to cpu/kinetis/Makefile.include index 24ece8ab4c..046337a006 100644 --- a/cpu/kinetis_common/Makefile.include +++ b/cpu/kinetis/Makefile.include @@ -4,11 +4,8 @@ ifeq (,$(KINETIS_SERIES)) include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/kinetis-info.mk endif -# include module specific includes -export INCLUDES += -I$(RIOTCPU)/kinetis_common/include - # Add search path for linker scripts -export LINKFLAGS += -L$(RIOTCPU)/kinetis_common/ldscripts +LINKFLAGS += -L$(RIOTCPU)/$(CPU)/ldscripts # Use generic linker script for all Kinetis based CPUs LINKER_SCRIPT = kinetis.ld @@ -33,14 +30,10 @@ 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 -export UNDEF += $(BINDIR)/kinetis_common/fcfield.o - -# add the CPU specific interrupt vector table definition for the linker -export UNDEF += $(BINDIR)/kinetis_common/vectors.o +# add the CPU specific flash configuration field for the linker +export UNDEF += $(BINDIR)/cpu/fcfield.o -# include kinetis common periph drivers -USEMODULE += kinetis_common_periph +# include common periph drivers USEMODULE += periph_common # select kinetis periph drivers @@ -48,8 +41,10 @@ USEMODULE += periph_mcg USEMODULE += periph_wdog # Define a recipe to build the watchdog disable binary, used when flashing -$(RIOTCPU)/kinetis_common/dist/wdog-disable.bin: $(RIOTCPU)/kinetis_common/dist/wdog-disable.s - $(Q)$(MAKE) -C $(RIOTCPU)/kinetis_common/dist/ $(notdir $@) +$(RIOTCPU)/$(CPU)/dist/wdog-disable.bin: $(RIOTCPU)/$(CPU)/dist/wdog-disable.s + $(Q)$(MAKE) -C $(RIOTCPU)/$(CPU)/dist/ $(notdir $@) # Reset the default goal to not make wdog-disable.bin the default target. .DEFAULT_GOAL := + +include $(RIOTMAKE)/arch/cortexm.inc.mk diff --git a/cpu/kinetis_common/cpu.c b/cpu/kinetis/cpu.c similarity index 96% rename from cpu/kinetis_common/cpu.c rename to cpu/kinetis/cpu.c index b4182c7334..2460cb7894 100644 --- a/cpu/kinetis_common/cpu.c +++ b/cpu/kinetis/cpu.c @@ -7,7 +7,7 @@ */ /** - * @ingroup cpu_kinetis_common + * @ingroup cpu_kinetis * @{ * * @file diff --git a/cpu/kinetis_common/dist/Makefile b/cpu/kinetis/dist/Makefile similarity index 100% rename from cpu/kinetis_common/dist/Makefile rename to cpu/kinetis/dist/Makefile diff --git a/cpu/kinetis_common/dist/README.md b/cpu/kinetis/dist/README.md similarity index 100% rename from cpu/kinetis_common/dist/README.md rename to cpu/kinetis/dist/README.md diff --git a/cpu/kinetis_common/dist/calc_spi_scalers/Makefile b/cpu/kinetis/dist/calc_spi_scalers/Makefile similarity index 100% rename from cpu/kinetis_common/dist/calc_spi_scalers/Makefile rename to cpu/kinetis/dist/calc_spi_scalers/Makefile diff --git a/cpu/kinetis_common/dist/calc_spi_scalers/calc_spi_scalers.c b/cpu/kinetis/dist/calc_spi_scalers/calc_spi_scalers.c similarity index 100% rename from cpu/kinetis_common/dist/calc_spi_scalers/calc_spi_scalers.c rename to cpu/kinetis/dist/calc_spi_scalers/calc_spi_scalers.c diff --git a/cpu/kinetis_common/dist/check-fcfield-elf.sh b/cpu/kinetis/dist/check-fcfield-elf.sh similarity index 100% rename from cpu/kinetis_common/dist/check-fcfield-elf.sh rename to cpu/kinetis/dist/check-fcfield-elf.sh diff --git a/cpu/kinetis_common/dist/check-fcfield-hex.sh b/cpu/kinetis/dist/check-fcfield-hex.sh similarity index 100% rename from cpu/kinetis_common/dist/check-fcfield-hex.sh rename to cpu/kinetis/dist/check-fcfield-hex.sh diff --git a/cpu/kinetis_common/dist/wdog-disable.s b/cpu/kinetis/dist/wdog-disable.s similarity index 100% rename from cpu/kinetis_common/dist/wdog-disable.s rename to cpu/kinetis/dist/wdog-disable.s diff --git a/cpu/kinetis_common/doc.txt b/cpu/kinetis/doc.txt similarity index 89% rename from cpu/kinetis_common/doc.txt rename to cpu/kinetis/doc.txt index 0eddb15312..d1461f2fbb 100644 --- a/cpu/kinetis_common/doc.txt +++ b/cpu/kinetis/doc.txt @@ -1,13 +1,13 @@ /** - * @defgroup cpu_kinetis_common NXP Kinetis MCU + * @defgroup cpu_kinetis NXP Kinetis * @ingroup cpu - * @brief NXP Kinetis CPU peripheral drivers + * @brief NXP Kinetis Cortex-M MCU specific implementation */ /** - * @defgroup cpu_kinetis_common_adc Kinetis ADC - * @ingroup cpu_kinetis_common - * @brief ADC driver + * @defgroup cpu_kinetis_adc Kinetis ADC + * @ingroup cpu_kinetis + * @brief Kinetis ADC driver * * ### ADC configuration example (for periph_conf.h) ### * @@ -25,17 +25,17 @@ */ /** - * @defgroup cpu_kinetis_common_cpuid Kinetis CPUID - * @ingroup cpu_kinetis_common - * @brief CPUID driver + * @defgroup cpu_kinetis_cpuid Kinetis CPUID + * @ingroup cpu_kinetis + * @brief Kinetis CPUID driver * * No configuration is necessary. */ /** - * @defgroup cpu_kinetis_common_gpio Kinetis GPIO - * @ingroup cpu_kinetis_common - * @brief GPIO driver + * @defgroup cpu_kinetis_gpio Kinetis GPIO + * @ingroup cpu_kinetis + * @brief Kinetis GPIO driver * * The GPIO driver uses the @ref GPIO_PIN(port, pin) macro to declare pins. * @@ -43,9 +43,9 @@ */ /** - * @defgroup cpu_kinetis_common_i2c Kinetis I2C - * @ingroup cpu_kinetis_common - * @brief I2C driver + * @defgroup cpu_kinetis_i2c Kinetis I2C + * @ingroup cpu_kinetis + * @brief Kinetis I2C driver * * ### I2C configuration example (for periph_conf.h) ### * @@ -81,9 +81,9 @@ */ /** - * @defgroup cpu_kinetis_common_pwm Kinetis PWM - * @ingroup cpu_kinetis_common - * @brief PWM driver + * @defgroup cpu_kinetis_pwm Kinetis PWM + * @ingroup cpu_kinetis + * @brief Kinetis PWM driver * * ### PWM configuration example (for periph_conf.h) ### * @@ -112,9 +112,9 @@ */ /** - * @defgroup cpu_kinetis_common_rnga Kinetis RNGA - * @ingroup cpu_kinetis_common - * @brief Driver for Freescale's RNGA module. RNGA generates data that + * @defgroup cpu_kinetis_rnga Kinetis RNGA + * @ingroup cpu_kinetis + * @brief Driver for NXP Kinetis RNGA module. RNGA generates data that * looks random. Reference Manual recommends to use the RNGA as entropy * source. * @@ -127,10 +127,10 @@ */ /** - * @defgroup cpu_kinetis_common_rngb Kinetis RNGB - * @ingroup cpu_kinetis_common + * @defgroup cpu_kinetis_rngb Kinetis RNGB + * @ingroup cpu_kinetis * @brief Low-level random number generator driver implementation. - * Driver for Freescale's RNGB module. RNGB generates data that + * Driver for NXP Kinetis RNGB module. RNGB generates data that * looks random. Reference Manual recommends to use the RNGB as entropy * source. * @@ -143,9 +143,12 @@ */ /** - * @defgroup cpu_kinetis_common_rtc Kinetis RTC - * @ingroup cpu_kinetis_common - * @brief RTC is clocked by a 32.768 kHz clock. + * @defgroup cpu_kinetis_rtc Kinetis RTC + * @ingroup cpu_kinetis + * @brief Kinetis RTC driver + * + * RTC is clocked by a 32.768 kHz clock. + * * Please note the manual of your MCU or SiP for the * clock setting for the RTC module. After initialization * Time Seconds Register (TSR) increments once a second. @@ -168,16 +171,16 @@ */ /** - * @defgroup cpu_kinetis_common_spi Kinetis SPI - * @ingroup cpu_kinetis_common - * @brief Kinetis SPI driver for MCUs with Cortex-M4 core. + * @defgroup cpu_kinetis_spi Kinetis SPI + * @ingroup cpu_kinetis + * @brief Kinetis SPI driver * * The SPI baud rate and other timings are generated from the bus * clock via prescalers, the hardware module allows for very * detailed timing configuration, but a tool exists to generate a * standard timing configuration for any given module clock frequency. * The timing configuration tool is found in - * cpu/kinetis_common/dist/calc_spi_scalers + * cpu/kinetis/dist/calc_spi_scalers * * Finer tuning of timings than the RIOT SPI API is capable of is * supported by modifying the generated configuration. See the @@ -203,7 +206,7 @@ * ### SPI configuration example (for periph_conf.h): ### * * static const uint32_t spi_clk_config[] = { - * // Use cpu/kinetis_common/dist/calc_spi_scalers to + * // Use cpu/kinetis/dist/calc_spi_scalers to * // generate the timing configuration * }; * @@ -244,8 +247,8 @@ */ /** - * @defgroup cpu_kinetis_common_timer Kinetis Timer - * @ingroup cpu_kinetis_common + * @defgroup cpu_kinetis_timer Kinetis Timer + * @ingroup cpu_kinetis * @brief Periodic Interrupt Timer (PIT) and Low-Power Timer (LPTMR) driver. * * The PIT is a count down timer, in order to use it with riot-os @@ -289,9 +292,10 @@ */ /** - * @defgroup cpu_kinetis_common_uart Kinetis UART - * @ingroup cpu_kinetis_common - * @brief Kinetis UART driver. + * @defgroup cpu_kinetis_uart Kinetis UART + * @ingroup cpu_kinetis + * @brief Kinetis UART driver + * * There are different implementations of the UART interface. * The treatment of interrupts is also slightly different. * The register UARTx_BDH to UARTx_C4 look almost the same. diff --git a/cpu/kinetis_common/fcfield.c b/cpu/kinetis/fcfield.c similarity index 97% rename from cpu/kinetis_common/fcfield.c rename to cpu/kinetis/fcfield.c index b09202416d..10e986919d 100644 --- a/cpu/kinetis_common/fcfield.c +++ b/cpu/kinetis/fcfield.c @@ -8,7 +8,7 @@ */ /** - * @ingroup cpu_kinetis_common + * @ingroup cpu_kinetis * @{ * * @file diff --git a/cpu/kinetis/include/cpu_conf.h b/cpu/kinetis/include/cpu_conf.h new file mode 100644 index 0000000000..c3391b19fe --- /dev/null +++ b/cpu/kinetis/include/cpu_conf.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2017 Eistec AB + * + * 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. + */ + +/** + * @ingroup cpu_kinetis + * @{ + * + * @file + * @brief Implementation specific CPU configuration options + * + * @author Joakim Nohlgård <joakim.nohlgard@eistec.se> + */ + +#ifndef CPU_CONF_H +#define CPU_CONF_H + +/* Dispatch to a separate file per family */ +#if defined(KINETIS_SERIES_K) +#include "cpu_conf_kinetis_k.h" +#elif defined(KINETIS_SERIES_L) +#include "cpu_conf_kinetis_l.h" +#elif defined(KINETIS_SERIES_M) +#include "cpu_conf_kinetis_m.h" +#elif defined(KINETIS_SERIES_V) +#include "cpu_conf_kinetis_v.h" +#elif defined(KINETIS_SERIES_W) +#include "cpu_conf_kinetis_w.h" +#endif /* defined(KINETIS_SERIES_x) */ + +#ifndef MCU_MEM_MAP_VERSION +#error Missing vendor header for the chosen CPU_MODEL +#endif +#include "cpu_conf_kinetis.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* CPU_CONF_H */ +/** @} */ diff --git a/cpu/kinetis_common/include/cpu_conf_kinetis.h b/cpu/kinetis/include/cpu_conf_kinetis.h similarity index 98% rename from cpu/kinetis_common/include/cpu_conf_kinetis.h rename to cpu/kinetis/include/cpu_conf_kinetis.h index 6a2299b595..dd5ef1da83 100644 --- a/cpu/kinetis_common/include/cpu_conf_kinetis.h +++ b/cpu/kinetis/include/cpu_conf_kinetis.h @@ -7,7 +7,7 @@ */ /** - * @ingroup cpu_kinetis_common + * @ingroup cpu_kinetis * @{ * * @file diff --git a/cpu/kinetis/include/cpu_conf_kinetis_k.h b/cpu/kinetis/include/cpu_conf_kinetis_k.h new file mode 100644 index 0000000000..9a3ac1aa27 --- /dev/null +++ b/cpu/kinetis/include/cpu_conf_kinetis_k.h @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2017 Eistec AB + * + * 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. + */ + +/** + * @ingroup cpu_kinetis + * @brief CPU specific implementations for the NXP Kinetis K series of + * Cortex-M MCUs + * @{ + * + * @file + * @brief Implementation specific CPU configuration options + * + * @author Joakim Nohlgård <joakim.nohlgard@eistec.se> + */ + +#ifndef CPU_CONF_KINETIS_K_H +#define CPU_CONF_KINETIS_K_H + +#if (KINETIS_FAMILY == 2) +#if (KINETIS_SUBFAMILY == 2) +/* Kinetis K22 */ +#if defined(CPU_MODEL_MK22FX512VLH12) || \ + defined(CPU_MODEL_MK22FN1M0VLH12) || \ + defined(CPU_MODEL_MK22FX512VLK12) || \ + defined(CPU_MODEL_MK22FN1M0VLK12) || \ + defined(CPU_MODEL_MK22FX512VLL12) || \ + defined(CPU_MODEL_MK22FN1M0VLL12) || \ + defined(CPU_MODEL_MK22FX512VLQ12) || \ + defined(CPU_MODEL_MK22FN1M0VLQ12) || \ + defined(CPU_MODEL_MK22FX512VMC12) || \ + defined(CPU_MODEL_MK22FN1M0VMC12) || \ + defined(CPU_MODEL_MK22FX512VMD12) || \ + defined(CPU_MODEL_MK22FN1M0VMD12) +#include "vendor/MK22F12.h" +#elif defined(CPU_MODEL_MK22FN128VDC10) || \ + defined(CPU_MODEL_MK22FN128VLH10) || \ + defined(CPU_MODEL_MK22FN128VLL10) || \ + defined(CPU_MODEL_MK22FN128VMP10) +#include "vendor/MK22F12810.h" +#elif defined(CPU_MODEL_MK22FN128CAH12) || \ + defined(CPU_MODEL_MK22FN256CAH12) || \ + defined(CPU_MODEL_MK22FN256VDC12) || \ + defined(CPU_MODEL_MK22FN256VLH12) || \ + defined(CPU_MODEL_MK22FN256VLL12) || \ + defined(CPU_MODEL_MK22FN256VMP12) +#include "vendor/MK22F25612.h" +#elif defined(CPU_MODEL_MK22FN512CAP12) || \ + defined(CPU_MODEL_MK22FN512VDC12) || \ + defined(CPU_MODEL_MK22FN512VFX12) || \ + defined(CPU_MODEL_MK22FN512VLH12) || \ + defined(CPU_MODEL_MK22FN512VLL12) || \ + defined(CPU_MODEL_MK22FN512VMP12) +#include "vendor/MK22F51212.h" +#elif defined(CPU_MODEL_MK22FN1M0AVLH12) || \ + defined(CPU_MODEL_MK22FN1M0AVLK12) || \ + defined(CPU_MODEL_MK22FN1M0AVLL12) || \ + defined(CPU_MODEL_MK22FN1M0AVLQ12) || \ + defined(CPU_MODEL_MK22FN1M0AVMC12) || \ + defined(CPU_MODEL_MK22FN1M0AVMD12) || \ + defined(CPU_MODEL_MK22FX512AVLH12) || \ + defined(CPU_MODEL_MK22FX512AVLK12) || \ + defined(CPU_MODEL_MK22FX512AVLL12) || \ + defined(CPU_MODEL_MK22FX512AVLQ12) || \ + defined(CPU_MODEL_MK22FX512AVMC12) || \ + defined(CPU_MODEL_MK22FX512AVMD12) +#include "vendor/MK22FA12.h" +#endif +#endif /* (KINETIS_SUBFAMILY == y) */ +#elif (KINETIS_FAMILY == 6) +#if (KINETIS_SUBFAMILY == 0) +#if defined(CPU_MODEL_MK60DN256VLL10) || \ + defined(CPU_MODEL_MK60DN256VLQ10) || \ + defined(CPU_MODEL_MK60DN256VMC10) || \ + defined(CPU_MODEL_MK60DN256VMD10) || \ + defined(CPU_MODEL_MK60DN512VLL10) || \ + defined(CPU_MODEL_MK60DN512VLQ10) || \ + defined(CPU_MODEL_MK60DN512VMC10) || \ + defined(CPU_MODEL_MK60DN512VMD10) || \ + defined(CPU_MODEL_MK60DX256VLL10) || \ + defined(CPU_MODEL_MK60DX256VLQ10) || \ + defined(CPU_MODEL_MK60DX256VMC10) || \ + defined(CPU_MODEL_MK60DX256VMD10) +#include "vendor/MK60D10.h" +#endif +/** + * @brief This CPU provides an additional ADC clock divider as CFG1[ADICLK]=1 + */ +#define KINETIS_HAVE_ADICLK_BUS_DIV_2 1 + +#elif (KINETIS_SUBFAMILY == 4) +#if defined(CPU_MODEL_MK64FN1M0CAJ12) || \ + defined(CPU_MODEL_MK64FN1M0VDC12) || \ + defined(CPU_MODEL_MK64FN1M0VLL12) || \ + defined(CPU_MODEL_MK64FN1M0VLQ12) || \ + defined(CPU_MODEL_MK64FN1M0VMD12) || \ + defined(CPU_MODEL_MK64FX512VDC12) || \ + defined(CPU_MODEL_MK64FX512VLL12) || \ + defined(CPU_MODEL_MK64FX512VLQ12) || \ + defined(CPU_MODEL_MK64FX512VMD12) +#include "vendor/MK64F12.h" +#endif +#endif /* (KINETIS_SUBFAMILY == y) */ +#endif /* (KINETIS_FAMILY == x) */ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* CPU_CONF_KINETIS_K_H */ +/** @} */ diff --git a/cpu/k22f/include/cpu_conf.h b/cpu/kinetis/include/cpu_conf_kinetis_l.h similarity index 60% rename from cpu/k22f/include/cpu_conf.h rename to cpu/kinetis/include/cpu_conf_kinetis_l.h index 935d694ea5..e9e446e1b7 100644 --- a/cpu/k22f/include/cpu_conf.h +++ b/cpu/kinetis/include/cpu_conf_kinetis_l.h @@ -7,10 +7,9 @@ */ /** - * @defgroup cpu_k22f NXP Kinetis K22F - * @ingroup cpu - * @brief CPU specific implementations for the NXP Kinetis K22F - * Cortex-M4 MCU + * @ingroup cpu_kinetis + * @brief CPU specific implementations for the NXP Kinetis L series of + * Cortex-M MCUs * @{ * * @file @@ -19,16 +18,14 @@ * @author Joakim Nohlgård <joakim.nohlgard@eistec.se> */ -#ifndef CPU_CONF_H -#define CPU_CONF_H +#ifndef CPU_CONF_KINETIS_L_H +#define CPU_CONF_KINETIS_L_H -#ifdef CPU_MODEL_MK22FN512VLH12 -#include "vendor/MK22F51212.h" -#else -#error "undefined CPU_MODEL" -#endif - -#include "cpu_conf_kinetis.h" +#if (KINETIS_FAMILY == 2) +#if (KINETIS_SUBFAMILY == 2) +/* Put your vendor includes here */ +#endif /* (KINETIS_SUBFAMILY == y) */ +#endif /* (KINETIS_FAMILY == x) */ #ifdef __cplusplus extern "C" @@ -39,5 +36,5 @@ extern "C" } #endif -#endif /* CPU_CONF_H */ +#endif /* CPU_CONF_KINETIS_L_H */ /** @} */ diff --git a/cpu/kinetis/include/cpu_conf_kinetis_m.h b/cpu/kinetis/include/cpu_conf_kinetis_m.h new file mode 100644 index 0000000000..3df55c0651 --- /dev/null +++ b/cpu/kinetis/include/cpu_conf_kinetis_m.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2017 Eistec AB + * + * 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. + */ + +/** + * @ingroup cpu_kinetis + * @brief CPU specific implementations for the NXP Kinetis M series of + * Cortex-M MCUs + * @{ + * + * @file + * @brief Implementation specific CPU configuration options + * + * @author Joakim Nohlgård <joakim.nohlgard@eistec.se> + */ + +#ifndef CPU_CONF_KINETIS_M_H +#define CPU_CONF_KINETIS_M_H + +#if (KINETIS_FAMILY == 2) +#if (KINETIS_SUBFAMILY == 2) +/* Put your vendor includes here */ +#endif /* (KINETIS_SUBFAMILY == y) */ +#endif /* (KINETIS_FAMILY == x) */ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* CPU_CONF_KINETIS_M_H */ +/** @} */ diff --git a/cpu/kinetis/include/cpu_conf_kinetis_v.h b/cpu/kinetis/include/cpu_conf_kinetis_v.h new file mode 100644 index 0000000000..bffb164cf1 --- /dev/null +++ b/cpu/kinetis/include/cpu_conf_kinetis_v.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2017 Eistec AB + * + * 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. + */ + +/** + * @ingroup cpu_kinetis + * @brief CPU specific implementations for the NXP Kinetis V series of + * Cortex-M MCUs + * @{ + * + * @file + * @brief Implementation specific CPU configuration options + * + * @author Joakim Nohlgård <joakim.nohlgard@eistec.se> + */ + +#ifndef CPU_CONF_KINETIS_V_H +#define CPU_CONF_KINETIS_V_H + +#if (KINETIS_FAMILY == 2) +#if (KINETIS_SUBFAMILY == 2) +/* Put your vendor includes here */ +#endif /* (KINETIS_SUBFAMILY == y) */ +#endif /* (KINETIS_FAMILY == x) */ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* CPU_CONF_KINETIS_V_H */ +/** @} */ diff --git a/cpu/kinetis/include/cpu_conf_kinetis_w.h b/cpu/kinetis/include/cpu_conf_kinetis_w.h new file mode 100644 index 0000000000..48ada52039 --- /dev/null +++ b/cpu/kinetis/include/cpu_conf_kinetis_w.h @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2017 Eistec AB + * + * 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. + */ + +/** + * @ingroup cpu_kinetis + * @brief CPU specific implementations for the NXP Kinetis K series of + * Cortex-M MCUs + * @{ + * + * @file + * @brief Implementation specific CPU configuration options + * + * @author Joakim Nohlgård <joakim.nohlgard@eistec.se> + */ + +#ifndef CPU_CONF_KINETIS_W_H +#define CPU_CONF_KINETIS_W_H + +#if defined(KINETIS_CORE_D) +/* Kinetis KW2xD */ +#if defined(CPU_MODEL_MKW21D256VHA5) || \ + defined(CPU_MODEL_MKW21D512VHA5) +#include "vendor/MKW21D5.h" +#elif defined(CPU_MODEL_MKW22D512VHA5) +#include "vendor/MKW22D5.h" +#elif defined(CPU_MODEL_MKW24D512VHA5) +#include "vendor/MKW24D5.h" +#endif + +/** + * @brief This CPU provides an additional ADC clock divider as CFG1[ADICLK]=1 + */ +#define KINETIS_HAVE_ADICLK_BUS_DIV_2 1 +/** + * @name KW2XD SiP internal interconnects between MCU and radio + * + * @{ + */ +#define KW2XDRF_PORT_DEV PORTB /**< MCU Port connected to radio*/ +#define KW2XDRF_PORT PORT_B /**< MCU Port connected to radio*/ +#define KW2XDRF_GPIO GPIOB /**< GPIO Device connected to radio */ +#define KW2XDRF_PORT_IRQn PORTB_IRQn +/** Clock Enable for PORTB */ +#define KW2XDRF_PORT_CLKEN() (BITBAND_REG32(SIM->SCGC5, SIM_SCGC5_PORTB_SHIFT) = 1) +#define KW2XDRF_PIN_AF 2 /**< Pin Muxing Parameter for GPIO Device*/ +#define KW2XDRF_PCS0_PIN 10 /**< Radio SPI chip select pin */ +#define KW2XDRF_SCK_PIN 11 /**< Radio SPI clock pin */ +#define KW2XDRF_SOUT_PIN 16 /**< Radio SPI MOSI pin */ +#define KW2XDRF_SIN_PIN 17 /**< Radio SPI MISO pin */ +#define KW2XDRF_RST_PIN 19 /**< Radio reset pin */ +#define KW2XDRF_IRQ_PIN 3 /**< radio IRQ pin (active low) */ +#define KW2XDRF_CLK_CTRL_PORT PORT_C /**< CLK_OUT control pin port */ +#define KW2XDRF_CLK_CTRL_PORT_DEV PORTC /**< CLK_OUT control pin PORT device */ +#define KW2XDRF_CLK_CTRL_GPIO GPIOC /**< CLK_OUT control pin GPIO device */ +#define KW2XDRF_CLK_CTRL_CLKEN() (BITBAND_REG32(SIM->SCGC5, SIM_SCGC5_PORTC_SHIFT) = 1) +#define KW2XDRF_CLK_CTRL_PIN 0 /**< CLK_OUT control pin */ +/** @} */ + +#elif defined(KINETIS_CORE_Z) +/* Kinetis KWxxZ */ +/* TODO */ +#endif /* KINETIS_CORE_x */ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* CPU_CONF_KINETIS_W_H */ +/** @} */ diff --git a/cpu/kinetis_common/include/mcg.h b/cpu/kinetis/include/mcg.h similarity index 98% rename from cpu/kinetis_common/include/mcg.h rename to cpu/kinetis/include/mcg.h index 04ebabb56d..241ed38f8a 100644 --- a/cpu/kinetis_common/include/mcg.h +++ b/cpu/kinetis/include/mcg.h @@ -8,8 +8,8 @@ */ /** - * @defgroup cpu_kinetis_common_mcg Kinetis MCG - * @ingroup cpu_kinetis_common + * @defgroup cpu_kinetis_mcg Kinetis MCG + * @ingroup cpu_kinetis * @brief Implementation of the Kinetis Multipurpose Clock Generator * (MCG) driver * diff --git a/cpu/kinetis_common/include/periph_cpu.h b/cpu/kinetis/include/periph_cpu.h similarity index 99% rename from cpu/kinetis_common/include/periph_cpu.h rename to cpu/kinetis/include/periph_cpu.h index 246fb0e87d..ba5f4a2da9 100644 --- a/cpu/kinetis_common/include/periph_cpu.h +++ b/cpu/kinetis/include/periph_cpu.h @@ -7,7 +7,7 @@ */ /** - * @ingroup cpu_kinetis_common + * @ingroup cpu_kinetis * @{ * * @file diff --git a/cpu/kinetis_common/include/vectors_kinetis.h b/cpu/kinetis/include/vectors_kinetis.h similarity index 100% rename from cpu/kinetis_common/include/vectors_kinetis.h rename to cpu/kinetis/include/vectors_kinetis.h diff --git a/cpu/k22f/include/vendor/MK22F12.h b/cpu/kinetis/include/vendor/MK22F12.h similarity index 100% rename from cpu/k22f/include/vendor/MK22F12.h rename to cpu/kinetis/include/vendor/MK22F12.h diff --git a/cpu/k22f/include/vendor/MK22F12810.h b/cpu/kinetis/include/vendor/MK22F12810.h similarity index 100% rename from cpu/k22f/include/vendor/MK22F12810.h rename to cpu/kinetis/include/vendor/MK22F12810.h diff --git a/cpu/k22f/include/vendor/MK22F25612.h b/cpu/kinetis/include/vendor/MK22F25612.h similarity index 100% rename from cpu/k22f/include/vendor/MK22F25612.h rename to cpu/kinetis/include/vendor/MK22F25612.h diff --git a/cpu/k22f/include/vendor/MK22F51212.h b/cpu/kinetis/include/vendor/MK22F51212.h similarity index 100% rename from cpu/k22f/include/vendor/MK22F51212.h rename to cpu/kinetis/include/vendor/MK22F51212.h diff --git a/cpu/k22f/include/vendor/MK22FA12.h b/cpu/kinetis/include/vendor/MK22FA12.h similarity index 100% rename from cpu/k22f/include/vendor/MK22FA12.h rename to cpu/kinetis/include/vendor/MK22FA12.h diff --git a/cpu/k60/include/vendor/MK60D10.h b/cpu/kinetis/include/vendor/MK60D10.h similarity index 100% rename from cpu/k60/include/vendor/MK60D10.h rename to cpu/kinetis/include/vendor/MK60D10.h diff --git a/cpu/k64f/include/vendor/MK64F12.h b/cpu/kinetis/include/vendor/MK64F12.h similarity index 100% rename from cpu/k64f/include/vendor/MK64F12.h rename to cpu/kinetis/include/vendor/MK64F12.h diff --git a/cpu/kw2xd/include/vendor/MKW21D5.h b/cpu/kinetis/include/vendor/MKW21D5.h similarity index 100% rename from cpu/kw2xd/include/vendor/MKW21D5.h rename to cpu/kinetis/include/vendor/MKW21D5.h diff --git a/cpu/kw2xd/include/vendor/MKW22D5.h b/cpu/kinetis/include/vendor/MKW22D5.h similarity index 100% rename from cpu/kw2xd/include/vendor/MKW22D5.h rename to cpu/kinetis/include/vendor/MKW22D5.h diff --git a/cpu/kw2xd/include/vendor/MKW24D5.h b/cpu/kinetis/include/vendor/MKW24D5.h similarity index 100% rename from cpu/kw2xd/include/vendor/MKW24D5.h rename to cpu/kinetis/include/vendor/MKW24D5.h diff --git a/cpu/kinetis_common/include/wdog.h b/cpu/kinetis/include/wdog.h similarity index 94% rename from cpu/kinetis_common/include/wdog.h rename to cpu/kinetis/include/wdog.h index 1f28e8685f..56870adb8e 100644 --- a/cpu/kinetis_common/include/wdog.h +++ b/cpu/kinetis/include/wdog.h @@ -8,8 +8,8 @@ */ /** - * @defgroup cpu_kinetis_common_wdog Kinetis WDOG - * @ingroup cpu_kinetis_common + * @defgroup cpu_kinetis_wdog Kinetis WDOG + * @ingroup cpu_kinetis * @brief Driver for Freescale WDOG device. * There are different implementations of the Watchdog devices. * Currently, it is only possible to turn the Watchdog off. diff --git a/cpu/kinetis_common/isr_kinetis.c b/cpu/kinetis/isr_kinetis.c similarity index 99% rename from cpu/kinetis_common/isr_kinetis.c rename to cpu/kinetis/isr_kinetis.c index 0ce5c0fbaf..2fa00cd8fa 100644 --- a/cpu/kinetis_common/isr_kinetis.c +++ b/cpu/kinetis/isr_kinetis.c @@ -7,7 +7,7 @@ */ /** - * @ingroup cpu_kinetis_common + * @ingroup cpu_kinetis * @{ * * @file diff --git a/cpu/kinetis_common/kinetis-info.mk b/cpu/kinetis/kinetis-info.mk similarity index 100% rename from cpu/kinetis_common/kinetis-info.mk rename to cpu/kinetis/kinetis-info.mk diff --git a/cpu/kinetis_common/ldscripts/kinetis.ld b/cpu/kinetis/ldscripts/kinetis.ld similarity index 100% rename from cpu/kinetis_common/ldscripts/kinetis.ld rename to cpu/kinetis/ldscripts/kinetis.ld diff --git a/cpu/k22f/periph/Makefile b/cpu/kinetis/periph/Makefile similarity index 100% rename from cpu/k22f/periph/Makefile rename to cpu/kinetis/periph/Makefile diff --git a/cpu/kinetis_common/periph/adc.c b/cpu/kinetis/periph/adc.c similarity index 99% rename from cpu/kinetis_common/periph/adc.c rename to cpu/kinetis/periph/adc.c index 15b6fc788c..072c64a6e0 100644 --- a/cpu/kinetis_common/periph/adc.c +++ b/cpu/kinetis/periph/adc.c @@ -9,7 +9,7 @@ */ /** - * @ingroup cpu_kinetis_common + * @ingroup cpu_kinetis * @ingroup drivers_periph_adc * @{ * diff --git a/cpu/kinetis_common/periph/dac.c b/cpu/kinetis/periph/dac.c similarity index 98% rename from cpu/kinetis_common/periph/dac.c rename to cpu/kinetis/periph/dac.c index b8034a6a64..36e4ac0c13 100644 --- a/cpu/kinetis_common/periph/dac.c +++ b/cpu/kinetis/periph/dac.c @@ -7,7 +7,7 @@ */ /** - * @ingroup cpu_kinetis_common + * @ingroup cpu_kinetis * @ingroup drivers_periph_dac * * @{ diff --git a/cpu/kinetis_common/periph/gpio.c b/cpu/kinetis/periph/gpio.c similarity index 99% rename from cpu/kinetis_common/periph/gpio.c rename to cpu/kinetis/periph/gpio.c index f665123c5a..c01ae9fa01 100644 --- a/cpu/kinetis_common/periph/gpio.c +++ b/cpu/kinetis/periph/gpio.c @@ -9,7 +9,7 @@ */ /** - * @ingroup cpu_kinetis_common + * @ingroup cpu_kinetis * @ingroup drivers_periph_gpio * * @{ diff --git a/cpu/kinetis_common/periph/hwrng.c b/cpu/kinetis/periph/hwrng.c similarity index 97% rename from cpu/kinetis_common/periph/hwrng.c rename to cpu/kinetis/periph/hwrng.c index a2d749e6c2..0348102b59 100644 --- a/cpu/kinetis_common/periph/hwrng.c +++ b/cpu/kinetis/periph/hwrng.c @@ -8,7 +8,7 @@ */ /** - * @ingroup cpu_kinetis_common + * @ingroup cpu_kinetis * @ingroup drivers_periph_hwng * * @{ diff --git a/cpu/kinetis_common/periph/i2c.c b/cpu/kinetis/periph/i2c.c similarity index 100% rename from cpu/kinetis_common/periph/i2c.c rename to cpu/kinetis/periph/i2c.c diff --git a/cpu/kinetis_common/periph/mcg.c b/cpu/kinetis/periph/mcg.c similarity index 99% rename from cpu/kinetis_common/periph/mcg.c rename to cpu/kinetis/periph/mcg.c index b5eaa3f734..6179fb1d3f 100644 --- a/cpu/kinetis_common/periph/mcg.c +++ b/cpu/kinetis/periph/mcg.c @@ -8,7 +8,7 @@ */ /** - * @ingroup cpu_kinetis_common + * @ingroup cpu_kinetis * @ingroup drivers_periph_mcg * @{ * diff --git a/cpu/kinetis_common/periph/pm.c b/cpu/kinetis/periph/pm.c similarity index 96% rename from cpu/kinetis_common/periph/pm.c rename to cpu/kinetis/periph/pm.c index 63373a87a9..4a9961ba7a 100644 --- a/cpu/kinetis_common/periph/pm.c +++ b/cpu/kinetis/periph/pm.c @@ -9,7 +9,7 @@ */ /** - * @ingroup cpu_kinetis_common + * @ingroup cpu_kinetis * @ingroup drivers_periph_pm * @{ * diff --git a/cpu/kinetis_common/periph/pwm.c b/cpu/kinetis/periph/pwm.c similarity index 99% rename from cpu/kinetis_common/periph/pwm.c rename to cpu/kinetis/periph/pwm.c index e5494ba58a..5f2fd448b7 100644 --- a/cpu/kinetis_common/periph/pwm.c +++ b/cpu/kinetis/periph/pwm.c @@ -9,7 +9,7 @@ */ /** - * @ingroup cpu_kinetis_common + * @ingroup cpu_kinetis * @ingroup drivers_periph_pwm * * @{ diff --git a/cpu/kinetis_common/periph/rtc.c b/cpu/kinetis/periph/rtc.c similarity index 98% rename from cpu/kinetis_common/periph/rtc.c rename to cpu/kinetis/periph/rtc.c index fe5489fcbd..f0d877a4c9 100644 --- a/cpu/kinetis_common/periph/rtc.c +++ b/cpu/kinetis/periph/rtc.c @@ -7,7 +7,7 @@ */ /** - * @ingroup cpu_kinetis_common + * @ingroup cpu_kinetis * @ingroup drivers_periph_rtc * * @{ diff --git a/cpu/kinetis_common/periph/rtt.c b/cpu/kinetis/periph/rtt.c similarity index 99% rename from cpu/kinetis_common/periph/rtt.c rename to cpu/kinetis/periph/rtt.c index 5fdbed8df6..1f5874bfb7 100644 --- a/cpu/kinetis_common/periph/rtt.c +++ b/cpu/kinetis/periph/rtt.c @@ -8,7 +8,7 @@ */ /** - * @ingroup cpu_kinetis_common + * @ingroup cpu_kinetis * @ingroup drivers_periph_rtt * * @{ diff --git a/cpu/kinetis_common/periph/spi.c b/cpu/kinetis/periph/spi.c similarity index 99% rename from cpu/kinetis_common/periph/spi.c rename to cpu/kinetis/periph/spi.c index 095fa50419..9ed06bd496 100644 --- a/cpu/kinetis_common/periph/spi.c +++ b/cpu/kinetis/periph/spi.c @@ -10,7 +10,7 @@ */ /** - * @ingroup cpu_kinetis_common + * @ingroup cpu_kinetis * @ingroup drivers_periph_spi * * @{ diff --git a/cpu/kinetis_common/periph/timer.c b/cpu/kinetis/periph/timer.c similarity index 99% rename from cpu/kinetis_common/periph/timer.c rename to cpu/kinetis/periph/timer.c index f928944420..ca1ea8130c 100644 --- a/cpu/kinetis_common/periph/timer.c +++ b/cpu/kinetis/periph/timer.c @@ -9,7 +9,7 @@ */ /** - * @ingroup cpu_kinetis_common + * @ingroup cpu_kinetis * @ingroup drivers_periph_timer * * @{ diff --git a/cpu/kinetis_common/periph/uart.c b/cpu/kinetis/periph/uart.c similarity index 99% rename from cpu/kinetis_common/periph/uart.c rename to cpu/kinetis/periph/uart.c index 40b153ad09..892701b57e 100644 --- a/cpu/kinetis_common/periph/uart.c +++ b/cpu/kinetis/periph/uart.c @@ -9,7 +9,7 @@ */ /** - * @ingroup cpu_kinetis_common + * @ingroup cpu_kinetis * @ingroup drivers_periph_uart * * @{ diff --git a/cpu/kinetis_common/periph/wdog.c b/cpu/kinetis/periph/wdog.c similarity index 98% rename from cpu/kinetis_common/periph/wdog.c rename to cpu/kinetis/periph/wdog.c index 530ba7a285..e0c995678a 100644 --- a/cpu/kinetis_common/periph/wdog.c +++ b/cpu/kinetis/periph/wdog.c @@ -8,7 +8,7 @@ */ /** - * @ingroup cpu_kinetis_common + * @ingroup cpu_kinetis * @ingroup drivers_periph_watchdog * * @{ diff --git a/cpu/kinetis_common/vectors.c b/cpu/kinetis/vectors.c similarity index 100% rename from cpu/kinetis_common/vectors.c rename to cpu/kinetis/vectors.c diff --git a/cpu/kinetis_common/Makefile b/cpu/kinetis_common/Makefile deleted file mode 100644 index 8b1b43dea4..0000000000 --- a/cpu/kinetis_common/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# define the module that is build -MODULE = kinetis_common - -DIRS += periph - -# (file triggers compiler bug. see #5775) -SRC_NOLTO += vectors.c - -include $(RIOTBASE)/Makefile.base diff --git a/cpu/kinetis_common/Makefile.features b/cpu/kinetis_common/Makefile.features deleted file mode 100644 index 894817aedb..0000000000 --- a/cpu/kinetis_common/Makefile.features +++ /dev/null @@ -1,4 +0,0 @@ -FEATURES_PROVIDED += periph_cpuid -FEATURES_PROVIDED += periph_hwrng - --include $(RIOTCPU)/cortexm_common/Makefile.features diff --git a/cpu/kinetis_common/periph/Makefile b/cpu/kinetis_common/periph/Makefile deleted file mode 100644 index 4cc46a1c00..0000000000 --- a/cpu/kinetis_common/periph/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -MODULE = kinetis_common_periph - -include $(RIOTMAKE)/periph.mk diff --git a/cpu/kinetis_common/periph/hwrng_rngb.c b/cpu/kinetis_common/periph/hwrng_rngb.c deleted file mode 100644 index 0a42eccf75..0000000000 --- a/cpu/kinetis_common/periph/hwrng_rngb.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2014-2016 Freie Universität Berlin - * Copyright (C) 2014 PHYTEC Messtechnik GmbH - * Copyright (C) 2015 Eistec AB - * - * 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. - */ - -/** - * @ingroup cpu_kinetis_common - * @ingroup drivers_periph_hwng - * @{ - * - * @file - * @brief HWRNG interface implementation - * - * @author Joakim Nohlgård <joakim.nohlgard@eistec.se> (adaption for Freescale's RNGB) - * @author Johann Fischer <j.fischer@phytec.de> (adaption for Freescale's RNGA) - * @author Hauke Petersen <hauke.petersen@fu-berlin.de> - * - * @} - */ - -#include "cpu.h" -#include "periph/hwrng.h" -#include "periph_conf.h" - -#ifdef KINETIS_RNGB - -void hwrng_init(void) -{ - /* nothing to be done here */ -} - -void hwrng_read(void *buf, unsigned int num) -{ - unsigned int count = 0; - uint8_t *b = (uint8_t *)buf; - - HWRNG_CLKEN(); - - if ((KINETIS_RNGB->VER & RNG_VER_TYPE_MASK) != 0b0001) { - /* Wrong type of RNG */ - /* TODO: Handle */ - } - - /* Software reset, bit is self-clearing */ - BITBAND_REG32(KINETIS_RNGB->CMD, RNG_CMD_SR_SHIFT) = 1; - /* Set up automatic reseed */ - KINETIS_RNGB->CR = RNG_CR_AR_MASK | RNG_CR_MASKERR_MASK | RNG_CR_MASKDONE_MASK; - - while (count < num) { - uint32_t tmp; - - /* wait for random data to be ready to read */ - while (!(KINETIS_RNGB->SR & RNG_SR_FIFO_LVL_MASK)); - - tmp = KINETIS_RNGB->OUT; - - /* copy data into result vector */ - for (int i = 0; i < 4 && count < num; i++) { - b[count++] = (uint8_t)tmp; - tmp = tmp >> 8; - } - } - - KINETIS_RNGB->CR = 0; - HWRNG_CLKDIS(); -} - -#endif /* KINETIS_RNGB */ diff --git a/cpu/kw2xd/Makefile b/cpu/kw2xd/Makefile deleted file mode 100644 index 12ba41f9cf..0000000000 --- a/cpu/kw2xd/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# define the module that is build -MODULE = cpu - -# add a list of subdirectories, that should also be build -DIRS = periph $(RIOTCPU)/cortexm_common $(KINETIS_COMMON) - -include $(RIOTBASE)/Makefile.base diff --git a/cpu/kw2xd/Makefile.dep b/cpu/kw2xd/Makefile.dep deleted file mode 100644 index 419f33923e..0000000000 --- a/cpu/kw2xd/Makefile.dep +++ /dev/null @@ -1 +0,0 @@ --include $(RIOTCPU)/kinetis_common/Makefile.dep diff --git a/cpu/kw2xd/Makefile.features b/cpu/kw2xd/Makefile.features deleted file mode 100644 index e08d42cd26..0000000000 --- a/cpu/kw2xd/Makefile.features +++ /dev/null @@ -1 +0,0 @@ --include $(RIOTCPU)/kinetis_common/Makefile.features diff --git a/cpu/kw2xd/Makefile.include b/cpu/kw2xd/Makefile.include deleted file mode 100644 index 7d634d17e5..0000000000 --- a/cpu/kw2xd/Makefile.include +++ /dev/null @@ -1,20 +0,0 @@ -# define the CPU architecture for the kw2xd -export CPU_ARCH = cortex-m4 - -# map CPU models to generic Kinetis linkerscript -LD_KW21D256 = kinetis_f256l16u16.ld -LD_KW21D512 = kinetis_f512l32u32.ld -LD_KW22D512 = kinetis_f512l32u32.ld - -# tell the build system that the CPU depends on the Kinetis common files -export USEMODULE += kinetis_common - -# define path to kinetis module, which is needed for this CPU -export KINETIS_COMMON = $(RIOTCPU)/kinetis_common/ -# CPU depends on the kinetis module, so include it -include $(KINETIS_COMMON)Makefile.include - -# this CPU implementation is using kinetis common startup -export COMMON_STARTUP = $(KINETIS_COMMON) - -include $(RIOTMAKE)/arch/cortexm.inc.mk diff --git a/cpu/kw2xd/include/cpu_conf.h b/cpu/kw2xd/include/cpu_conf.h deleted file mode 100644 index 53331f54ed..0000000000 --- a/cpu/kw2xd/include/cpu_conf.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2014 Freie Universität Berlin - * Copyright (C) 2014 PHYTEC Messtechnik GmbH - * - * 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. - */ - -/** - * @defgroup cpu_kw2xd NXP Kinetis KW2xD - * @ingroup cpu - * @brief CPU specific implementations for the NXP Kinetis KW2xD SiP - * - * The SiP incorporates a low power 2.4 GHz transceiver, and a - * Kinetis Cortex-M4 MCU. - * - * From the register map and functional description it seems - * like the transceiver is a close relative of the NXP MCR20A. - * @{ - * - * @file - * @brief Implementation specific CPU configuration options - * - * @author Hauke Petersen <hauke.petersen@fu-berlin.de> - * @author Johann Fischer <j.fischer@phytec.de> - */ - -#ifndef CPU_CONF_H -#define CPU_CONF_H - -#ifdef CPU_MODEL_KW21D256 -#include "vendor/MKW22D5.h" -#elif CPU_MODEL_KW21D512 -#include "vendor/MKW22D5.h" -#elif CPU_MODEL_KW22D512 -#include "vendor/MKW22D5.h" -#else -#error "undefined CPU_MODEL" -#endif - -#include "cpu_conf_kinetis.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - -/** - * @brief This CPU provides an additional ADC clock divider as CFG1[ADICLK]=1 - */ -#define KINETIS_HAVE_ADICLK_BUS_DIV_2 1 - -/** @name PORT module clock gates */ -/** @{ */ -#define PORTA_CLOCK_GATE (BITBAND_REG32(SIM->SCGC5, SIM_SCGC5_PORTA_SHIFT)) -#define PORTB_CLOCK_GATE (BITBAND_REG32(SIM->SCGC5, SIM_SCGC5_PORTB_SHIFT)) -#define PORTC_CLOCK_GATE (BITBAND_REG32(SIM->SCGC5, SIM_SCGC5_PORTC_SHIFT)) -#define PORTD_CLOCK_GATE (BITBAND_REG32(SIM->SCGC5, SIM_SCGC5_PORTD_SHIFT)) -#define PORTE_CLOCK_GATE (BITBAND_REG32(SIM->SCGC5, SIM_SCGC5_PORTE_SHIFT)) -/** @} */ - -/** - * @name KW2XD SiP internal interconnects between MCU and Modem. - * - * @{ - */ -#define KW2XDRF_PORT_DEV PORTB /**< MCU Port connected to Modem*/ -#define KW2XDRF_PORT PORT_B /**< MCU Port connected to Modem*/ -#define KW2XDRF_GPIO GPIOB /**< GPIO Device connected to Modem */ -#define KW2XDRF_PORT_IRQn PORTB_IRQn -/** Clock Enable for PORTB*/ -#define KW2XDRF_PORT_CLKEN() (PORTB_CLOCK_GATE = 1) -#define KW2XDRF_PIN_AF 2 /**< Pin Muxing Parameter for GPIO Device*/ -#define KW2XDRF_PCS0_PIN 10 /**< SPI Slave Select Pin */ -#define KW2XDRF_SCK_PIN 11 /**< SPI Clock Output Pin */ -#define KW2XDRF_SOUT_PIN 16 /**< SPI Master Data Output Pin */ -#define KW2XDRF_SIN_PIN 17 /**< SPI Master Data Input Pin */ -#define KW2XDRF_RST_PIN 19 /**< Reset pin */ -#define KW2XDRF_IRQ_PIN 3 /**< Modem's IRQ Output (activ low) */ -#define KW2XDRF_CLK_CTRL_PORT PORT_C /**< CLK_OUT control pin port */ -#define KW2XDRF_CLK_CTRL_PORT_DEV PORTC /**< CLK_OUT control pin PORT device */ -#define KW2XDRF_CLK_CTRL_GPIO GPIOC /**< CLK_OUT control pin GPIO device */ -#define KW2XDRF_CLK_CTRL_CLKEN() (PORTC_CLOCK_GATE = 1) -#define KW2XDRF_CLK_CTRL_PIN 0 /**< CLK_OUT control pin */ - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* CPU_CONF_H */ -/** @} */ diff --git a/cpu/kw2xd/periph/Makefile b/cpu/kw2xd/periph/Makefile deleted file mode 100644 index a36df249ac..0000000000 --- a/cpu/kw2xd/periph/Makefile +++ /dev/null @@ -1 +0,0 @@ -include $(RIOTMAKE)/periph.mk diff --git a/doc/doxygen/src/mainpage.md b/doc/doxygen/src/mainpage.md index 2fcadd9394..e3c5adaf1e 100644 --- a/doc/doxygen/src/mainpage.md +++ b/doc/doxygen/src/mainpage.md @@ -150,7 +150,7 @@ CPUs share the same code for task switching and interrupt handling). This shared code is put in its own directories, following a `xxxxx_common` naming scheme. Examples for this is code shared across architectures (e.g. `cortexm_common`, `msp430_comon`) or code shared among vendors (e.g. -`kinetis_common`). +`stm32_common`). See @ref cpu for more detailed informtation. -- GitLab