port demo to Teensy 3.6

Getting the mcuconf and Makefile changes right is non-trivial for a beginner, so
this will be helpful for others who want to get started with ChibiOS on a Teensy 3.6.
This commit is contained in:
Michael Stapelberg 2020-06-03 19:37:13 +02:00
parent d6531f0b74
commit 4ee0b8fa26
4 changed files with 25 additions and 8 deletions

View File

@ -91,11 +91,11 @@ CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib
# Licensing files.
include $(CHIBIOS)/os/license/license.mk
# Startup files.
include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_k20x7.mk
include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_MK66F18.mk
# HAL-OSAL files (optional).
include $(CHIBIOS_CONTRIB)/os/hal/hal.mk
include $(CHIBIOS_CONTRIB)/os/hal/ports/KINETIS/K20x/platform.mk
include $(CHIBIOS_CONTRIB)/os/hal/boards/PJRC_TEENSY_3_1/board.mk
include $(CHIBIOS_CONTRIB)/os/hal/ports/KINETIS/MK66F18/platform.mk
include $(CHIBIOS_CONTRIB)/os/hal/boards/PJRC_TEENSY_3_6/board.mk
include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
@ -106,7 +106,7 @@ include $(CHIBIOS)/test/rt/rt_test.mk
include $(CHIBIOS)/test/oslib/oslib_test.mk
# Define linker script file here
LDSCRIPT= $(STARTUPLD_CONTRIB)/MK20DX256.ld
LDSCRIPT= $(STARTUPLD_CONTRIB)/MK66FX1M0.ld
# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.

View File

@ -80,7 +80,11 @@
* this value.
*/
#if !defined(CH_CFG_ST_TIMEDELTA)
#define CH_CFG_ST_TIMEDELTA 2
// TODO: tickless mode is currently broken: e.g. chVTGetSystemTimeX() will
// always return 0, making all timers hang.
#define CH_CFG_ST_TIMEDELTA 0
#endif
/** @} */

View File

@ -17,7 +17,7 @@
#ifndef _MCUCONF_H_
#define _MCUCONF_H_
#define K20x_MCUCONF
#define MK66FX1M0_MCUCONF
/*
* HAL driver system settings.
@ -25,8 +25,21 @@
/* Select the MCU clocking mode below by enabling the appropriate block. */
/* PEE mode - 48MHz system clock driven by external crystal. */
/* PEE mode - 180 MHz system clock driving by 16 MHz xtal */
#if 1
#define KINETIS_MCG_MODE KINETIS_MCG_MODE_PEE
#define KINETIS_PLLCLK_FREQUENCY 180000000UL
#define KINETIS_SYSCLK_FREQUENCY KINETIS_PLLCLK_FREQUENCY
#define KINETIS_BUSCLK_FREQUENCY 60000000UL
#define KINETIS_FLASHCLK_FREQUENCY 28000000UL
#define KINETIS_CLKDIV1_OUTDIV1 1 // -> 0
#define KINETIS_CLKDIV1_OUTDIV2 3 // -> 2
#define KINETIS_CLKDIV1_OUTDIV4 7 // -> 6
#endif
/* PEE mode - 48MHz system clock driven by external crystal. */
#if 0
#define KINETIS_MCG_MODE KINETIS_MCG_MODE_PEE
#define KINETIS_PLLCLK_FREQUENCY 96000000UL
#define KINETIS_SYSCLK_FREQUENCY 48000000UL

View File

@ -31,7 +31,7 @@
#define KINETIS_XTAL_FREQUENCY 16000000UL
/* Use internal capacitors for the crystal */
#define KINETIS_BOARD_OSCILLATOR_SETTING OSC_CR_SC8P|OSC_CR_SC2P
#define KINETIS_BOARD_OSCILLATOR_SETTING OSC0_CR_SC8P_SET(1) | OSC0_CR_SC2P_SET(1) | OSC0_CR_ERCLKEN_SET(1)
/*
* MCU type