diff --git a/boards/kea128ledlightrd/Makefile b/boards/kea128ledlightrd/Makefile new file mode 100644 index 000000000000..f8fcbb53a065 --- /dev/null +++ b/boards/kea128ledlightrd/Makefile @@ -0,0 +1,3 @@ +MODULE = board + +include $(RIOTBASE)/Makefile.base diff --git a/boards/kea128ledlightrd/Makefile.dep b/boards/kea128ledlightrd/Makefile.dep new file mode 100644 index 000000000000..25979d642fdf --- /dev/null +++ b/boards/kea128ledlightrd/Makefile.dep @@ -0,0 +1,6 @@ +USEMODULE += stdio_rtt + +# setup clock to run at 40MHz +CFLAGS += -DCLOCK_SETUP=1 + +include $(RIOTCPU)/kinetis/Makefile.dep diff --git a/boards/kea128ledlightrd/Makefile.features b/boards/kea128ledlightrd/Makefile.features new file mode 100644 index 000000000000..aee4e93482ab --- /dev/null +++ b/boards/kea128ledlightrd/Makefile.features @@ -0,0 +1,7 @@ +# Put defined MCU peripherals here (in alphabetical order) +FEATURES_PROVIDED += periph_timer + +# The board MPU family (used for grouping by the CI system) +FEATURES_MCU_GROUP = cortex_m0+ + +include $(RIOTCPU)/kinetis/Makefile.features diff --git a/boards/kea128ledlightrd/Makefile.include b/boards/kea128ledlightrd/Makefile.include new file mode 100644 index 000000000000..7e9bff5b1167 --- /dev/null +++ b/boards/kea128ledlightrd/Makefile.include @@ -0,0 +1,8 @@ +# define the cpu used by the KEA128LEDLIGHTRD board +export CPU = kinetis +export CPU_MODEL = s9keaz128aclh48 + +DEBUG_ADAPTER ?= arm-jtag-swd +OPENOCD_CONFIG ?= ${RIOTBOARD}/kea128ledlightrd/dist/openocd.cfg + +include ${RIOTMAKE}/tools/openocd.inc.mk diff --git a/boards/kea128ledlightrd/board.c b/boards/kea128ledlightrd/board.c new file mode 100644 index 000000000000..e93a5248dee0 --- /dev/null +++ b/boards/kea128ledlightrd/board.c @@ -0,0 +1,49 @@ +/* + * 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. + */ + +/** + * @ingroup boards_kea128ledlightrd + * @{ + * + * @file + * @brief Board specific implementations for the KEA128LEDLIGHTRD + * + * @author Johann Fischer + * @author Anton Gerasimov + * + * @} + */ + +#include "board.h" +#include "periph/gpio.h" +#include "tja1042.h" + +extern void SystemInit(void); + +void board_init(void) +{ + /* initialize clocks */ + SystemInit(); + + /* initialize the CPU core */ + cpu_init(); + + /* disable NMI on the pin used for LED2 */ + SIM->SOPT0 &= (~SIM_SOPT0_NMIE_MASK); + + /* initialize and turn off the on-board RGB-LED */ + gpio_init(LED0_PIN, GPIO_OUT); + gpio_init(LED1_PIN, GPIO_OUT); + gpio_init(LED2_PIN, GPIO_OUT); + gpio_init(LED3_PIN, GPIO_OUT); + gpio_set(LED0_PIN); + gpio_set(LED1_PIN); + gpio_set(LED2_PIN); + gpio_set(LED3_PIN); +} diff --git a/boards/kea128ledlightrd/dist/openocd.cfg b/boards/kea128ledlightrd/dist/openocd.cfg new file mode 100644 index 000000000000..90ada01274c8 --- /dev/null +++ b/boards/kea128ledlightrd/dist/openocd.cfg @@ -0,0 +1,2 @@ +# Kinetis KE series CPUs +source [find target/ke0x.cfg] diff --git a/boards/kea128ledlightrd/include/board.h b/boards/kea128ledlightrd/include/board.h new file mode 100644 index 000000000000..221382c54dc0 --- /dev/null +++ b/boards/kea128ledlightrd/include/board.h @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2014 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 boards_kea128ledlightrd NXP/Freescale KEA128LEDLIGHTRD Board + * @ingroup boards + * @brief Support for the NXP KEA128LEDLIGHTRD + * @{ + * + * @file + * @brief Board specific definitions for the KEA128LEDLIGHTRD + * + * @author Johann Fischer + * @author Anton Gerasimov + */ + +#ifndef BOARD_H +#define BOARD_H + +#include "cpu.h" +#include "periph_conf.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** + * @name LED pin definitions and handlers + * @{ + */ +#define LED0_PIN GPIO_PIN(PORT_A, 10) +#define LED1_PIN GPIO_PIN(PORT_A, 11) +#define LED2_PIN GPIO_PIN(PORT_A, 12) +#define LED3_PIN GPIO_PIN(PORT_A, 13) + +#define LED0_MASK (1 << 10) +#define LED1_MASK (1 << 11) +#define LED2_MASK (1 << 12) +#define LED3_MASK (1 << 13) + +#define LED0_ON (GPIOA->PCOR = LED0_MASK) +#define LED0_OFF (GPIOA->PSOR = LED0_MASK) +#define LED0_TOGGLE (GPIOA->PTOR = LED0_MASK) + +#define LED1_ON (GPIOA->PCOR = LED1_MASK) +#define LED1_OFF (GPIOA->PSOR = LED1_MASK) +#define LED1_TOGGLE (GPIOA->PTOR = LED1_MASK) + +#define LED2_ON (GPIOA->PCOR = LED2_MASK) +#define LED2_OFF (GPIOA->PSOR = LED2_MASK) +#define LED2_TOGGLE (GPIOA->PTOR = LED2_MASK) + +#define LED3_ON (GPIOA->PCOR = LED3_MASK) +#define LED3_OFF (GPIOA->PSOR = LED3_MASK) +#define LED3_TOGGLE (GPIOA->PTOR = LED3_MASK) + +/** @} */ + +/** + * @name xtimer configuration + * @{ + */ +#define XTIMER_DEV (TIMER_PIT_DEV(0)) +#define XTIMER_CHAN (0) +/** @} */ + +/** + * @brief Initialize board specific hardware, including clock, LEDs and std-IO + */ +void board_init(void); + +#ifdef __cplusplus +} +#endif + +#endif /* BOARD_H */ +/** @} */ diff --git a/boards/kea128ledlightrd/include/periph_conf.h b/boards/kea128ledlightrd/include/periph_conf.h new file mode 100644 index 000000000000..9a2ec8637d77 --- /dev/null +++ b/boards/kea128ledlightrd/include/periph_conf.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2014 Freie Universität Berlin + * Copyright (C) 2015 PHYTEC Messtechnik GmbH + * Copyright (C) 2018 HERE Deutschland 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. + */ + +/** + * @ingroup boards_kea128ledlightrd + * @{ + * + * @file + * @name Peripheral MCU configuration for KEA128LEDLIGHTRD + * + * @author Johann Fischer + * @author Anton Gerasimov + */ + +#ifndef PERIPH_CONF_H +#define PERIPH_CONF_H + +#include "periph_cpu.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +#define CLOCK_CORECLOCK (40000000ul) +#define CLOCK_BUSCLOCK (CLOCK_CORECLOCK / 1) +/** @} */ + +/** + * @name Timer configuration + * @{ + */ +#define PIT_NUMOF (2U) +#define LPTMR_NUMOF (0U) +#define PIT_CONFIG { \ + { \ + .prescaler_ch = 0, \ + .count_ch = 1, \ + }, \ + { \ + .prescaler_ch = 2, \ + .count_ch = 3, \ + }, \ +} +#define TIMER_NUMOF ((PIT_NUMOF)) + +#define PIT_BASECLOCK (CLOCK_BUSCLOCK) +#define PIT_ISR_0 isr_pit1 +#define PIT_ISR_1 isr_pit3 +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* PERIPH_CONF_H */ +/** @} */ diff --git a/makefiles/tools/openocd-adapters/arm-jtag-swd.inc.mk b/makefiles/tools/openocd-adapters/arm-jtag-swd.inc.mk new file mode 100644 index 000000000000..0cd8e6f447cb --- /dev/null +++ b/makefiles/tools/openocd-adapters/arm-jtag-swd.inc.mk @@ -0,0 +1,7 @@ +# Olimex ARM-USB-OCD-H with ARM-JTAG-SWD adapter +OPENOCD_ADAPTER_INIT ?= -c 'source [find interface/ftdi/olimex-arm-usb-ocd-h.cfg]' -c 'source [find interface/ftdi/olimex-arm-jtag-swd.cfg]' +# Add serial matching command, only if DEBUG_ADAPTER_ID was specified +ifneq (,$(DEBUG_ADAPTER_ID)) + OPENOCD_ADAPTER_INIT += -c 'ftdi_serial $(DEBUG_ADAPTER_ID)' +endif +export OPENOCD_ADAPTER_INIT diff --git a/makefiles/tools/openocd-adapters/arm-usb-ocd-h.inc.mk b/makefiles/tools/openocd-adapters/arm-usb-ocd-h.inc.mk new file mode 100644 index 000000000000..f72159a7cbdc --- /dev/null +++ b/makefiles/tools/openocd-adapters/arm-usb-ocd-h.inc.mk @@ -0,0 +1,7 @@ +# Olimex ARM-USB-OCD-H debug adapter +OPENOCD_ADAPTER_INIT ?= -c 'source [find interface/ftdi/olimex-arm-usb-ocd-h.cfg]' +# Add serial matching command, only if DEBUG_ADAPTER_ID was specified +ifneq (,$(DEBUG_ADAPTER_ID)) + OPENOCD_ADAPTER_INIT += -c 'ftdi_serial $(DEBUG_ADAPTER_ID)' +endif +export OPENOCD_ADAPTER_INIT