mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-21 21:41:09 +00:00
Merge pull request #1858 from bpaddock/FRDM_K32L24AS
Add support for the NXP FRDM-K32L2A4S eval board.
This commit is contained in:
commit
779149ecce
1
.github/workflows/build_arm.yml
vendored
1
.github/workflows/build_arm.yml
vendored
@ -34,6 +34,7 @@ jobs:
|
|||||||
# Alphabetical order
|
# Alphabetical order
|
||||||
- 'broadcom_32bit'
|
- 'broadcom_32bit'
|
||||||
- 'imxrt'
|
- 'imxrt'
|
||||||
|
- 'kinetis_k32 kinetis_kl'
|
||||||
- 'lpc15 lpc18'
|
- 'lpc15 lpc18'
|
||||||
- 'lpc54 lpc55'
|
- 'lpc54 lpc55'
|
||||||
- 'mm32 msp432e4'
|
- 'mm32 msp432e4'
|
||||||
|
@ -253,6 +253,7 @@ Kinetis
|
|||||||
^^^^^^^
|
^^^^^^^
|
||||||
|
|
||||||
- `Freedom FRDM-KL25Z <https://www.nxp.com/design/development-boards/freedom-development-boards/mcu-boards/freedom-development-platform-for-kinetis-kl14-kl15-kl24-kl25-mcus:FRDM-KL25Z>`__
|
- `Freedom FRDM-KL25Z <https://www.nxp.com/design/development-boards/freedom-development-boards/mcu-boards/freedom-development-platform-for-kinetis-kl14-kl15-kl24-kl25-mcus:FRDM-KL25Z>`__
|
||||||
|
- `Freedom FRDM-K32L2A4S <https://www.nxp.com/design/development-boards/freedom-development-boards/mcu-boards/nxp-freedom-platform-for-k32-l2a-mcus:FRDM-K32L2A4S>`__
|
||||||
- `Freedom FRDM-K32L2B3 <https://www.nxp.com/design/development-boards/freedom-development-boards/mcu-boards/nxp-freedom-development-platform-for-k32-l2b-mcus:FRDM-K32L2B3>`__
|
- `Freedom FRDM-K32L2B3 <https://www.nxp.com/design/development-boards/freedom-development-boards/mcu-boards/nxp-freedom-development-platform-for-k32-l2b-mcus:FRDM-K32L2B3>`__
|
||||||
- `KUIIC <https://github.com/nxf58843/kuiic>`__
|
- `KUIIC <https://github.com/nxf58843/kuiic>`__
|
||||||
|
|
||||||
|
@ -8,3 +8,4 @@ mcu:MKL25ZXX
|
|||||||
family:broadcom_64bit
|
family:broadcom_64bit
|
||||||
family:broadcom_32bit
|
family:broadcom_32bit
|
||||||
board:curiosity_nano
|
board:curiosity_nano
|
||||||
|
board:frdm_kl25z
|
||||||
|
@ -39,15 +39,15 @@
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
|
||||||
// Include order follows OPT_MCU_ number
|
// Include order follows OPT_MCU_ number
|
||||||
#if CFG_TUSB_MCU == OPT_MCU_LPC11UXX || CFG_TUSB_MCU == OPT_MCU_LPC13XX || \
|
#if TU_CHECK_MCU(OPT_MCU_LPC11UXX, OPT_MCU_LPC13XX, OPT_MCU_LPC15XX) || \
|
||||||
CFG_TUSB_MCU == OPT_MCU_LPC15XX || CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || \
|
TU_CHECK_MCU(OPT_MCU_LPC175X_6X, OPT_MCU_LPC177X_8X, OPT_MCU_LPC18XX) || \
|
||||||
CFG_TUSB_MCU == OPT_MCU_LPC177X_8X || CFG_TUSB_MCU == OPT_MCU_LPC18XX || \
|
TU_CHECK_MCU(OPT_MCU_LPC40XX, OPT_MCU_LPC43XX)
|
||||||
CFG_TUSB_MCU == OPT_MCU_LPC40XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX
|
|
||||||
#include "chip.h"
|
#include "chip.h"
|
||||||
|
|
||||||
#elif CFG_TUSB_MCU == OPT_MCU_LPC51UXX || CFG_TUSB_MCU == OPT_MCU_LPC54XXX || \
|
#elif TU_CHECK_MCU(OPT_MCU_LPC51UXX, OPT_MCU_LPC54XXX, OPT_MCU_LPC55XX)
|
||||||
CFG_TUSB_MCU == OPT_MCU_LPC55XX || CFG_TUSB_MCU == OPT_MCU_MKL25ZXX || \
|
#include "fsl_device_registers.h"
|
||||||
CFG_TUSB_MCU == OPT_MCU_K32L2BXX
|
|
||||||
|
#elif TU_CHECK_MCU(OPT_MCU_KINETIS_KL, OPT_MCU_KINETIS_K32)
|
||||||
#include "fsl_device_registers.h"
|
#include "fsl_device_registers.h"
|
||||||
|
|
||||||
#elif CFG_TUSB_MCU == OPT_MCU_NRF5X
|
#elif CFG_TUSB_MCU == OPT_MCU_NRF5X
|
||||||
|
@ -1,51 +0,0 @@
|
|||||||
SDK_DIR = hw/mcu/nxp/mcux-sdk
|
|
||||||
DEPS_SUBMODULES += $(SDK_DIR)
|
|
||||||
|
|
||||||
CFLAGS += \
|
|
||||||
-mthumb \
|
|
||||||
-mabi=aapcs \
|
|
||||||
-mcpu=cortex-m0plus \
|
|
||||||
-DCPU_K32L2B31VLH0A \
|
|
||||||
-DCFG_TUSB_MCU=OPT_MCU_K32L2BXX
|
|
||||||
|
|
||||||
# mcu driver cause following warnings
|
|
||||||
CFLAGS += -Wno-error=unused-parameter -Wno-error=redundant-decls
|
|
||||||
|
|
||||||
MCU_DIR = $(SDK_DIR)/devices/K32L2B31A
|
|
||||||
|
|
||||||
# All source paths should be relative to the top level.
|
|
||||||
LD_FILE = $(MCU_DIR)/gcc/K32L2B31xxxxA_flash.ld
|
|
||||||
|
|
||||||
SRC_C += \
|
|
||||||
src/portable/nxp/khci/dcd_khci.c \
|
|
||||||
$(MCU_DIR)/system_K32L2B31A.c \
|
|
||||||
$(MCU_DIR)/project_template/clock_config.c \
|
|
||||||
$(MCU_DIR)/drivers/fsl_clock.c \
|
|
||||||
$(SDK_DIR)/drivers/gpio/fsl_gpio.c \
|
|
||||||
$(SDK_DIR)/drivers/lpuart/fsl_lpuart.c
|
|
||||||
|
|
||||||
INC += \
|
|
||||||
$(TOP)/hw/bsp/$(BOARD) \
|
|
||||||
$(TOP)/$(SDK_DIR)/CMSIS/Include \
|
|
||||||
$(TOP)/$(SDK_DIR)/drivers/smc \
|
|
||||||
$(TOP)/$(SDK_DIR)/drivers/common \
|
|
||||||
$(TOP)/$(SDK_DIR)/drivers/gpio \
|
|
||||||
$(TOP)/$(SDK_DIR)/drivers/port \
|
|
||||||
$(TOP)/$(SDK_DIR)/drivers/lpuart \
|
|
||||||
$(TOP)/$(MCU_DIR) \
|
|
||||||
$(TOP)/$(MCU_DIR)/drivers \
|
|
||||||
$(TOP)/$(MCU_DIR)/project_template \
|
|
||||||
|
|
||||||
SRC_S += $(MCU_DIR)/gcc/startup_K32L2B31A.S
|
|
||||||
|
|
||||||
# For freeRTOS port source
|
|
||||||
FREERTOS_PORTABLE_SRC = $(FREERTOS_PORTABLE_PATH)/ARM_CM0
|
|
||||||
|
|
||||||
# For flash-jlink target
|
|
||||||
JLINK_DEVICE = MKL25Z128xxx4
|
|
||||||
|
|
||||||
# For flash-pyocd target
|
|
||||||
PYOCD_TARGET = K32L2B
|
|
||||||
|
|
||||||
# flash using pyocd
|
|
||||||
flash: flash-pyocd
|
|
@ -1,52 +0,0 @@
|
|||||||
SDK_DIR = hw/mcu/nxp/nxp_sdk
|
|
||||||
DEPS_SUBMODULES += $(SDK_DIR)
|
|
||||||
|
|
||||||
CFLAGS += \
|
|
||||||
-mthumb \
|
|
||||||
-mabi=aapcs \
|
|
||||||
-mcpu=cortex-m0plus \
|
|
||||||
-DCPU_MKL25Z128VLK4 \
|
|
||||||
-DCFG_TUSB_MCU=OPT_MCU_MKL25ZXX \
|
|
||||||
-DCFG_EXAMPLE_VIDEO_READONLY
|
|
||||||
|
|
||||||
LDFLAGS += \
|
|
||||||
-Wl,--defsym,__stack_size__=0x400 \
|
|
||||||
-Wl,--defsym,__heap_size__=0
|
|
||||||
|
|
||||||
# mcu driver cause following warnings
|
|
||||||
CFLAGS += -Wno-error=unused-parameter -Wno-error=format -Wno-error=redundant-decls
|
|
||||||
|
|
||||||
MCU_DIR = $(SDK_DIR)/devices/MKL25Z4
|
|
||||||
|
|
||||||
# All source paths should be relative to the top level.
|
|
||||||
LD_FILE = $(MCU_DIR)/gcc/MKL25Z128xxx4_flash.ld
|
|
||||||
|
|
||||||
SRC_C += \
|
|
||||||
src/portable/nxp/khci/dcd_khci.c \
|
|
||||||
src/portable/nxp/khci/hcd_khci.c \
|
|
||||||
$(MCU_DIR)/system_MKL25Z4.c \
|
|
||||||
$(MCU_DIR)/project_template/clock_config.c \
|
|
||||||
$(MCU_DIR)/drivers/fsl_clock.c \
|
|
||||||
$(MCU_DIR)/drivers/fsl_gpio.c \
|
|
||||||
$(MCU_DIR)/drivers/fsl_lpsci.c
|
|
||||||
|
|
||||||
INC += \
|
|
||||||
$(TOP)/hw/bsp/$(BOARD) \
|
|
||||||
$(TOP)/$(SDK_DIR)/CMSIS/Include \
|
|
||||||
$(TOP)/$(MCU_DIR) \
|
|
||||||
$(TOP)/$(MCU_DIR)/drivers \
|
|
||||||
$(TOP)/$(MCU_DIR)/project_template \
|
|
||||||
|
|
||||||
SRC_S += $(MCU_DIR)/gcc/startup_MKL25Z4.S
|
|
||||||
|
|
||||||
# For freeRTOS port source
|
|
||||||
FREERTOS_PORTABLE_SRC = $(FREERTOS_PORTABLE_PATH)/ARM_CM0
|
|
||||||
|
|
||||||
# For flash-jlink target
|
|
||||||
JLINK_DEVICE = MKL25Z128xxx4
|
|
||||||
|
|
||||||
# For flash-pyocd target
|
|
||||||
PYOCD_TARGET = mkl25zl128
|
|
||||||
|
|
||||||
# flash using pyocd
|
|
||||||
flash: flash-pyocd
|
|
58
hw/bsp/kinetis_k32/boards/frdm_k32l2a4s/board.h
Normal file
58
hw/bsp/kinetis_k32/boards/frdm_k32l2a4s/board.h
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019, Ha Thach (tinyusb.org)
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* This file is part of the TinyUSB stack.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef BOARD_H_
|
||||||
|
#define BOARD_H_
|
||||||
|
|
||||||
|
#include "fsl_device_registers.h"
|
||||||
|
|
||||||
|
// LED
|
||||||
|
// The Red LED is on PTE29.
|
||||||
|
// The Green LED is on PTC4.
|
||||||
|
// The Blue LED is on PTE31.
|
||||||
|
#define LED_PIN_CLOCK kCLOCK_PortC
|
||||||
|
#define LED_GPIO GPIOC
|
||||||
|
#define LED_PORT PORTC
|
||||||
|
#define LED_PIN 4
|
||||||
|
#define LED_STATE_ON 0
|
||||||
|
|
||||||
|
// SW3 button1
|
||||||
|
#define BUTTON_PIN_CLOCK kCLOCK_PortE
|
||||||
|
#define BUTTON_GPIO GPIOE
|
||||||
|
#define BUTTON_PORT PORTE
|
||||||
|
#define BUTTON_PIN 4
|
||||||
|
#define BUTTON_STATE_ACTIVE 0
|
||||||
|
|
||||||
|
// UART
|
||||||
|
#define UART_PORT LPUART0
|
||||||
|
#define UART_PIN_CLOCK kCLOCK_PortB
|
||||||
|
#define UART_PIN_GPIO GPIOB
|
||||||
|
#define UART_PIN_PORT PORTB
|
||||||
|
#define UART_PIN_RX 16u
|
||||||
|
#define UART_PIN_TX 17u
|
||||||
|
|
||||||
|
#endif /* BOARD_H_ */
|
26
hw/bsp/kinetis_k32/boards/frdm_k32l2a4s/board.mk
Normal file
26
hw/bsp/kinetis_k32/boards/frdm_k32l2a4s/board.mk
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
MCU = K32L2A41A
|
||||||
|
|
||||||
|
CFLAGS += \
|
||||||
|
-mcpu=cortex-m0plus \
|
||||||
|
-DCPU_K32L2A41VLH1A \
|
||||||
|
|
||||||
|
# mcu driver cause following warnings
|
||||||
|
CFLAGS += -Wno-error=unused-parameter -Wno-error=redundant-decls -Wno-error=cast-qual
|
||||||
|
|
||||||
|
# All source paths should be relative to the top level.
|
||||||
|
LD_FILE = $(MCU_DIR)/gcc/K32L2A41xxxxA_flash.ld
|
||||||
|
|
||||||
|
SRC_C += \
|
||||||
|
$(MCU_DIR)/project_template/clock_config.c \
|
||||||
|
|
||||||
|
# For freeRTOS port source
|
||||||
|
FREERTOS_PORTABLE_SRC = $(FREERTOS_PORTABLE_PATH)/ARM_CM0
|
||||||
|
|
||||||
|
# For flash-jlink target
|
||||||
|
JLINK_DEVICE = K32L2A41xxxxA
|
||||||
|
|
||||||
|
# For flash-pyocd target
|
||||||
|
PYOCD_TARGET = K32L2A
|
||||||
|
|
||||||
|
# flash using pyocd
|
||||||
|
flash: flash-pyocd
|
171
hw/bsp/kinetis_k32/boards/frdm_k32l2a4s/frdm_k32l2a4s.c
Normal file
171
hw/bsp/kinetis_k32/boards/frdm_k32l2a4s/frdm_k32l2a4s.c
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
/*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018, hathach (tinyusb.org)
|
||||||
|
* Copyright (c) 2020, Koji Kitayama
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*
|
||||||
|
* This file is part of the TinyUSB stack.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "bsp/board.h"
|
||||||
|
#include "board.h"
|
||||||
|
#include "fsl_gpio.h"
|
||||||
|
#include "fsl_port.h"
|
||||||
|
#include "fsl_clock.h"
|
||||||
|
#include "fsl_lpuart.h"
|
||||||
|
|
||||||
|
#include "clock_config.h"
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// Forward USB interrupt events to TinyUSB IRQ Handler
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
void USB0_IRQHandler(void)
|
||||||
|
{
|
||||||
|
tud_int_handler(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void board_init(void)
|
||||||
|
{
|
||||||
|
/* Enable port clocks for UART/LED/Button pins */
|
||||||
|
CLOCK_EnableClock(UART_PIN_CLOCK);
|
||||||
|
CLOCK_EnableClock(LED_PIN_CLOCK);
|
||||||
|
CLOCK_EnableClock(BUTTON_PIN_CLOCK);
|
||||||
|
|
||||||
|
gpio_pin_config_t led_config = { kGPIO_DigitalOutput, 0 };
|
||||||
|
GPIO_PinInit(LED_GPIO, LED_PIN, &led_config);
|
||||||
|
PORT_SetPinMux(LED_PORT, LED_PIN, kPORT_MuxAsGpio);
|
||||||
|
|
||||||
|
gpio_pin_config_t button_config = { kGPIO_DigitalInput, 0 };
|
||||||
|
GPIO_PinInit(BUTTON_GPIO, BUTTON_PIN, &button_config);
|
||||||
|
const port_pin_config_t BUTTON_CFG = {
|
||||||
|
kPORT_PullUp,
|
||||||
|
kPORT_FastSlewRate,
|
||||||
|
kPORT_PassiveFilterDisable,
|
||||||
|
kPORT_OpenDrainDisable,
|
||||||
|
kPORT_LowDriveStrength,
|
||||||
|
kPORT_MuxAsGpio,
|
||||||
|
kPORT_UnlockRegister
|
||||||
|
};
|
||||||
|
PORT_SetPinConfig(BUTTON_PORT, BUTTON_PIN, &BUTTON_CFG);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Enable LPUART0 clock and configure port pins.
|
||||||
|
FIR clock is being used so the USB examples work.
|
||||||
|
*/
|
||||||
|
PCC_LPUART0 = 0U; /* Clock must be off to set PCS */
|
||||||
|
PCC_LPUART0 = PCC_CLKCFG_PCS( 3U ); /* Select the clock. 1:OSCCLK/Bus Clock, 2:Slow IRC, 3: Fast IRC, 6: System PLL */
|
||||||
|
PCC_LPUART0 |= PCC_CLKCFG_CGC( 1U ); /* Enable LPUART */
|
||||||
|
|
||||||
|
/* PORTB16 (pin 62) is configured as LPUART0_RX */
|
||||||
|
gpio_pin_config_t const lpuart_config_rx = { kGPIO_DigitalInput, 0 };
|
||||||
|
GPIO_PinInit(UART_PIN_GPIO, UART_PIN_RX, &lpuart_config_rx);
|
||||||
|
const port_pin_config_t UART_CFG = {
|
||||||
|
kPORT_PullUp,
|
||||||
|
kPORT_FastSlewRate,
|
||||||
|
kPORT_PassiveFilterDisable,
|
||||||
|
kPORT_OpenDrainDisable,
|
||||||
|
kPORT_LowDriveStrength,
|
||||||
|
kPORT_MuxAsGpio,
|
||||||
|
kPORT_UnlockRegister
|
||||||
|
};
|
||||||
|
PORT_SetPinConfig(UART_PIN_PORT, UART_PIN_RX, &UART_CFG);
|
||||||
|
PORT_SetPinMux( UART_PIN_PORT, UART_PIN_RX, kPORT_MuxAlt3);
|
||||||
|
|
||||||
|
/* PORTB17 (pin 63) is configured as LPUART0_TX */
|
||||||
|
gpio_pin_config_t const lpuart_config_tx = { kGPIO_DigitalOutput, 0 };
|
||||||
|
GPIO_PinInit( UART_PIN_GPIO, UART_PIN_TX, &lpuart_config_tx);
|
||||||
|
PORT_SetPinMux( UART_PIN_PORT, UART_PIN_TX, kPORT_MuxAlt3);
|
||||||
|
|
||||||
|
BOARD_BootClockRUN();
|
||||||
|
SystemCoreClockUpdate();
|
||||||
|
|
||||||
|
#if CFG_TUSB_OS == OPT_OS_NONE
|
||||||
|
// 1ms tick timer
|
||||||
|
SysTick_Config(SystemCoreClock / 1000);
|
||||||
|
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
|
||||||
|
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
|
||||||
|
NVIC_SetPriority(USB0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
lpuart_config_t uart_config;
|
||||||
|
LPUART_GetDefaultConfig(&uart_config);
|
||||||
|
uart_config.baudRate_Bps = CFG_BOARD_UART_BAUDRATE;
|
||||||
|
uart_config.enableTx = true;
|
||||||
|
uart_config.enableRx = true;
|
||||||
|
LPUART_Init(UART_PORT, &uart_config, CLOCK_GetFreq(kCLOCK_ScgFircClk));
|
||||||
|
|
||||||
|
// USB
|
||||||
|
CLOCK_EnableUsbfs0Clock(kCLOCK_IpSrcFircAsync, 48000000U);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// Board porting API
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
|
||||||
|
void board_led_write(bool state)
|
||||||
|
{
|
||||||
|
GPIO_PinWrite(LED_GPIO, LED_PIN, state ? LED_STATE_ON : (1-LED_STATE_ON));
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t board_button_read(void)
|
||||||
|
{
|
||||||
|
return BUTTON_STATE_ACTIVE == GPIO_PinRead(BUTTON_GPIO, BUTTON_PIN);
|
||||||
|
}
|
||||||
|
|
||||||
|
int board_uart_read(uint8_t* buf, int len)
|
||||||
|
{
|
||||||
|
#if 0 /*
|
||||||
|
Use this version if want the LED to blink during BOARD=board_test,
|
||||||
|
without having to hit a key.
|
||||||
|
*/
|
||||||
|
if( 0U != (kLPUART_RxDataRegFullFlag & LPUART_GetStatusFlags( UART_PORT )) )
|
||||||
|
{
|
||||||
|
LPUART_ReadBlocking(UART_PORT, buf, len);
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
return( 0 );
|
||||||
|
#else /* Wait for 'len' characters to come in */
|
||||||
|
|
||||||
|
LPUART_ReadBlocking(UART_PORT, buf, len);
|
||||||
|
return len;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
int board_uart_write(void const * buf, int len)
|
||||||
|
{
|
||||||
|
LPUART_WriteBlocking(UART_PORT, (uint8_t const*) buf, len);
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if CFG_TUSB_OS == OPT_OS_NONE
|
||||||
|
volatile uint32_t system_ticks = 0;
|
||||||
|
void SysTick_Handler(void)
|
||||||
|
{
|
||||||
|
system_ticks++;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t board_millis(void)
|
||||||
|
{
|
||||||
|
return system_ticks;
|
||||||
|
}
|
||||||
|
#endif
|
26
hw/bsp/kinetis_k32/boards/frdm_k32l2b/board.mk
Normal file
26
hw/bsp/kinetis_k32/boards/frdm_k32l2b/board.mk
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
MCU = K32L2B31A
|
||||||
|
|
||||||
|
CFLAGS += \
|
||||||
|
-mcpu=cortex-m0plus \
|
||||||
|
-DCPU_K32L2B31VLH0A \
|
||||||
|
|
||||||
|
# mcu driver cause following warnings
|
||||||
|
CFLAGS += -Wno-error=unused-parameter -Wno-error=redundant-decls
|
||||||
|
|
||||||
|
# All source paths should be relative to the top level.
|
||||||
|
LD_FILE = $(MCU_DIR)/gcc/K32L2B31xxxxA_flash.ld
|
||||||
|
|
||||||
|
SRC_C += \
|
||||||
|
$(MCU_DIR)/project_template/clock_config.c \
|
||||||
|
|
||||||
|
# For freeRTOS port source
|
||||||
|
FREERTOS_PORTABLE_SRC = $(FREERTOS_PORTABLE_PATH)/ARM_CM0
|
||||||
|
|
||||||
|
# For flash-jlink target
|
||||||
|
JLINK_DEVICE = K32L2B31xxxxA
|
||||||
|
|
||||||
|
# For flash-pyocd target
|
||||||
|
PYOCD_TARGET = K32L2B
|
||||||
|
|
||||||
|
# flash using pyocd
|
||||||
|
flash: flash-pyocd
|
@ -25,7 +25,7 @@
|
|||||||
* This file is part of the TinyUSB stack.
|
* This file is part of the TinyUSB stack.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../board.h"
|
#include "bsp/board.h"
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "fsl_gpio.h"
|
#include "fsl_gpio.h"
|
||||||
#include "fsl_port.h"
|
#include "fsl_port.h"
|
26
hw/bsp/kinetis_k32/boards/kuiic/board.mk
Normal file
26
hw/bsp/kinetis_k32/boards/kuiic/board.mk
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
MCU = K32L2B31A
|
||||||
|
|
||||||
|
# This board uses TinyUF2 for updates
|
||||||
|
UF2_FAMILY_ID = 0x7f83e793
|
||||||
|
|
||||||
|
CFLAGS += \
|
||||||
|
-mcpu=cortex-m0plus \
|
||||||
|
-DCPU_K32L2B31VLH0A \
|
||||||
|
|
||||||
|
# mcu driver cause following warnings
|
||||||
|
CFLAGS += -Wno-error=unused-parameter -Wno-error=redundant-decls
|
||||||
|
|
||||||
|
# All source paths should be relative to the top level.
|
||||||
|
LD_FILE = $(BOARD_PATH)/K32L2B31xxxxA_flash.ld
|
||||||
|
|
||||||
|
# For freeRTOS port source
|
||||||
|
FREERTOS_PORTABLE_SRC = $(FREERTOS_PORTABLE_PATH)/ARM_CM0
|
||||||
|
|
||||||
|
# For flash-jlink target
|
||||||
|
JLINK_DEVICE = K32L2B31xxxxA
|
||||||
|
|
||||||
|
# For flash-pyocd target
|
||||||
|
PYOCD_TARGET = K32L2B
|
||||||
|
|
||||||
|
# flash using pyocd
|
||||||
|
flash: flash-pyocd
|
@ -25,7 +25,7 @@
|
|||||||
* This file is part of the TinyUSB stack.
|
* This file is part of the TinyUSB stack.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../board.h"
|
#include "bsp/board.h"
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "fsl_smc.h"
|
#include "fsl_smc.h"
|
||||||
#include "fsl_gpio.h"
|
#include "fsl_gpio.h"
|
32
hw/bsp/kinetis_k32/family.mk
Normal file
32
hw/bsp/kinetis_k32/family.mk
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
SDK_DIR = hw/mcu/nxp/mcux-sdk
|
||||||
|
DEPS_SUBMODULES += $(SDK_DIR)
|
||||||
|
|
||||||
|
MCU_DIR = $(SDK_DIR)/devices/$(MCU)
|
||||||
|
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||||
|
|
||||||
|
CFLAGS += \
|
||||||
|
-mthumb \
|
||||||
|
-mabi=aapcs \
|
||||||
|
-DCFG_TUSB_MCU=OPT_MCU_KINETIS_K32
|
||||||
|
|
||||||
|
SRC_C += \
|
||||||
|
src/portable/nxp/khci/dcd_khci.c \
|
||||||
|
src/portable/nxp/khci/hcd_khci.c \
|
||||||
|
$(MCU_DIR)/system_$(MCU).c \
|
||||||
|
$(MCU_DIR)/drivers/fsl_clock.c \
|
||||||
|
$(SDK_DIR)/drivers/gpio/fsl_gpio.c \
|
||||||
|
$(SDK_DIR)/drivers/lpuart/fsl_lpuart.c
|
||||||
|
|
||||||
|
INC += \
|
||||||
|
$(TOP)/$(BOARD_PATH) \
|
||||||
|
$(TOP)/$(SDK_DIR)/CMSIS/Include \
|
||||||
|
$(TOP)/$(MCU_DIR) \
|
||||||
|
$(TOP)/$(MCU_DIR)/project_template \
|
||||||
|
$(TOP)/$(MCU_DIR)/drivers \
|
||||||
|
$(TOP)/$(SDK_DIR)/drivers/smc \
|
||||||
|
$(TOP)/$(SDK_DIR)/drivers/common \
|
||||||
|
$(TOP)/$(SDK_DIR)/drivers/gpio \
|
||||||
|
$(TOP)/$(SDK_DIR)/drivers/port \
|
||||||
|
$(TOP)/$(SDK_DIR)/drivers/lpuart \
|
||||||
|
|
||||||
|
SRC_S += $(MCU_DIR)/gcc/startup_$(MCU).S
|
21
hw/bsp/kinetis_kl/boards/frdm_kl25z/board.mk
Normal file
21
hw/bsp/kinetis_kl/boards/frdm_kl25z/board.mk
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MCU = MKL25Z4
|
||||||
|
|
||||||
|
CFLAGS += \
|
||||||
|
-DCPU_MKL25Z128VLK4 \
|
||||||
|
-DCFG_EXAMPLE_VIDEO_READONLY \
|
||||||
|
-DCFG_EXAMPLE_MSC_READONLY
|
||||||
|
|
||||||
|
# mcu driver cause following warnings
|
||||||
|
CFLAGS += -Wno-error=unused-parameter -Wno-error=format -Wno-error=redundant-decls
|
||||||
|
|
||||||
|
# All source paths should be relative to the top level.
|
||||||
|
LD_FILE = $(MCU_DIR)/gcc/MKL25Z128xxx4_flash.ld
|
||||||
|
|
||||||
|
# For flash-jlink target
|
||||||
|
JLINK_DEVICE = MKL25Z128xxx4
|
||||||
|
|
||||||
|
# For flash-pyocd target
|
||||||
|
PYOCD_TARGET = mkl25zl128
|
||||||
|
|
||||||
|
# flash using pyocd
|
||||||
|
flash: flash-jlink
|
37
hw/bsp/kinetis_kl/family.mk
Normal file
37
hw/bsp/kinetis_kl/family.mk
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
SDK_DIR = hw/mcu/nxp/nxp_sdk
|
||||||
|
DEPS_SUBMODULES += $(SDK_DIR)
|
||||||
|
|
||||||
|
MCU_DIR = $(SDK_DIR)/devices/$(MCU)
|
||||||
|
include $(TOP)/$(BOARD_PATH)/board.mk
|
||||||
|
|
||||||
|
CFLAGS += \
|
||||||
|
-mthumb \
|
||||||
|
-mabi=aapcs \
|
||||||
|
-mcpu=cortex-m0plus \
|
||||||
|
-DCFG_TUSB_MCU=OPT_MCU_KINETIS_KL \
|
||||||
|
|
||||||
|
LDFLAGS += \
|
||||||
|
-Wl,--defsym,__stack_size__=0x400 \
|
||||||
|
-Wl,--defsym,__heap_size__=0
|
||||||
|
|
||||||
|
SRC_C += \
|
||||||
|
src/portable/nxp/khci/dcd_khci.c \
|
||||||
|
src/portable/nxp/khci/hcd_khci.c \
|
||||||
|
$(MCU_DIR)/system_$(MCU).c \
|
||||||
|
$(MCU_DIR)/project_template/clock_config.c \
|
||||||
|
$(MCU_DIR)/drivers/fsl_clock.c \
|
||||||
|
$(MCU_DIR)/drivers/fsl_gpio.c \
|
||||||
|
$(MCU_DIR)/drivers/fsl_lpsci.c \
|
||||||
|
$(MCU_DIR)/drivers/fsl_uart.c
|
||||||
|
|
||||||
|
INC += \
|
||||||
|
$(TOP)/$(BOARD_PATH) \
|
||||||
|
$(TOP)/$(SDK_DIR)/CMSIS/Include \
|
||||||
|
$(TOP)/$(MCU_DIR) \
|
||||||
|
$(TOP)/$(MCU_DIR)/project_template \
|
||||||
|
$(TOP)/$(MCU_DIR)/drivers
|
||||||
|
|
||||||
|
SRC_S += $(MCU_DIR)/gcc/startup_$(MCU).S
|
||||||
|
|
||||||
|
# For freeRTOS port source
|
||||||
|
FREERTOS_PORTABLE_SRC = $(FREERTOS_PORTABLE_PATH)/ARM_CM0
|
@ -1,52 +0,0 @@
|
|||||||
SDK_DIR = hw/mcu/nxp/mcux-sdk
|
|
||||||
DEPS_SUBMODULES += $(SDK_DIR) tools/uf2
|
|
||||||
|
|
||||||
# This board uses TinyUF2 for updates
|
|
||||||
UF2_FAMILY_ID = 0x7f83e793
|
|
||||||
|
|
||||||
CFLAGS += \
|
|
||||||
-mthumb \
|
|
||||||
-mabi=aapcs \
|
|
||||||
-mcpu=cortex-m0plus \
|
|
||||||
-DCPU_K32L2B31VLH0A \
|
|
||||||
-DCFG_TUSB_MCU=OPT_MCU_K32L2BXX
|
|
||||||
|
|
||||||
# mcu driver cause following warnings
|
|
||||||
CFLAGS += -Wno-error=unused-parameter
|
|
||||||
|
|
||||||
MCU_DIR = $(SDK_DIR)/devices/K32L2B31A
|
|
||||||
|
|
||||||
# All source paths should be relative to the top level.
|
|
||||||
LD_FILE = /hw/bsp/$(BOARD)/K32L2B31xxxxA_flash.ld
|
|
||||||
|
|
||||||
SRC_C += \
|
|
||||||
src/portable/nxp/khci/dcd_khci.c \
|
|
||||||
$(MCU_DIR)/system_K32L2B31A.c \
|
|
||||||
$(MCU_DIR)/drivers/fsl_clock.c \
|
|
||||||
$(SDK_DIR)/drivers/gpio/fsl_gpio.c \
|
|
||||||
$(SDK_DIR)/drivers/lpuart/fsl_lpuart.c
|
|
||||||
|
|
||||||
INC += \
|
|
||||||
$(TOP)/hw/bsp/$(BOARD) \
|
|
||||||
$(TOP)/$(SDK_DIR)/CMSIS/Include \
|
|
||||||
$(TOP)/$(SDK_DIR)/drivers/smc \
|
|
||||||
$(TOP)/$(SDK_DIR)/drivers/common \
|
|
||||||
$(TOP)/$(SDK_DIR)/drivers/gpio \
|
|
||||||
$(TOP)/$(SDK_DIR)/drivers/port \
|
|
||||||
$(TOP)/$(SDK_DIR)/drivers/lpuart \
|
|
||||||
$(TOP)/$(MCU_DIR) \
|
|
||||||
$(TOP)/$(MCU_DIR)/drivers
|
|
||||||
|
|
||||||
SRC_S += $(MCU_DIR)/gcc/startup_K32L2B31A.S
|
|
||||||
|
|
||||||
# For freeRTOS port source
|
|
||||||
FREERTOS_PORTABLE_SRC = $(FREERTOS_PORTABLE_PATH)/ARM_CM0
|
|
||||||
|
|
||||||
# For flash-jlink target
|
|
||||||
JLINK_DEVICE = MKL25Z128xxx4
|
|
||||||
|
|
||||||
# For flash-pyocd target
|
|
||||||
PYOCD_TARGET = K32L2B
|
|
||||||
|
|
||||||
# flash using pyocd
|
|
||||||
flash: flash-pyocd
|
|
@ -85,7 +85,9 @@
|
|||||||
#define TUP_DCD_ENDPOINT_MAX 8
|
#define TUP_DCD_ENDPOINT_MAX 8
|
||||||
#define TUP_RHPORT_HIGHSPEED 1 // Port0 HS, Port1 HS
|
#define TUP_RHPORT_HIGHSPEED 1 // Port0 HS, Port1 HS
|
||||||
|
|
||||||
#elif TU_CHECK_MCU(OPT_MCU_MKL25ZXX, OPT_MCU_K32L2BXX)
|
#elif TU_CHECK_MCU(OPT_MCU_KINETIS_KL, OPT_MCU_KINETIS_K32)
|
||||||
|
#define TUP_USBIP_CHIPIDEA_FS
|
||||||
|
#define TUP_USBIP_CHIPIDEA_FS_KINETIS
|
||||||
#define TUP_DCD_ENDPOINT_MAX 16
|
#define TUP_DCD_ENDPOINT_MAX 16
|
||||||
|
|
||||||
#elif TU_CHECK_MCU(OPT_MCU_MM32F327X)
|
#elif TU_CHECK_MCU(OPT_MCU_MM32F327X)
|
||||||
|
@ -26,12 +26,14 @@
|
|||||||
|
|
||||||
#include "tusb_option.h"
|
#include "tusb_option.h"
|
||||||
|
|
||||||
#if CFG_TUD_ENABLED && ( \
|
#if CFG_TUD_ENABLED && defined(TUP_USBIP_CHIPIDEA_FS)
|
||||||
( CFG_TUSB_MCU == OPT_MCU_MKL25ZXX ) || ( CFG_TUSB_MCU == OPT_MCU_K32L2BXX ) \
|
|
||||||
)
|
|
||||||
|
|
||||||
#include "fsl_device_registers.h"
|
#ifdef TUP_USBIP_CHIPIDEA_FS_KINETIS
|
||||||
#define KHCI USB0
|
#include "fsl_device_registers.h"
|
||||||
|
#define KHCI USB0
|
||||||
|
#else
|
||||||
|
#error "MCU is not supported"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "device/dcd.h"
|
#include "device/dcd.h"
|
||||||
|
|
||||||
|
@ -26,12 +26,14 @@
|
|||||||
|
|
||||||
#include "tusb_option.h"
|
#include "tusb_option.h"
|
||||||
|
|
||||||
#if CFG_TUH_ENABLED && ( \
|
#if CFG_TUH_ENABLED && defined(TUP_USBIP_CHIPIDEA_FS)
|
||||||
( CFG_TUSB_MCU == OPT_MCU_MKL25ZXX ) || ( CFG_TUSB_MCU == OPT_MCU_K32L2BXX ) \
|
|
||||||
)
|
|
||||||
|
|
||||||
#include "fsl_device_registers.h"
|
#ifdef TUP_USBIP_CHIPIDEA_FS_KINETIS
|
||||||
#define KHCI USB0
|
#include "fsl_device_registers.h"
|
||||||
|
#define KHCI USB0
|
||||||
|
#else
|
||||||
|
#error "MCU is not supported"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "host/hcd.h"
|
#include "host/hcd.h"
|
||||||
|
|
||||||
|
@ -117,8 +117,11 @@
|
|||||||
#define OPT_MCU_RP2040 1100 ///< Raspberry Pi RP2040
|
#define OPT_MCU_RP2040 1100 ///< Raspberry Pi RP2040
|
||||||
|
|
||||||
// NXP Kinetis
|
// NXP Kinetis
|
||||||
#define OPT_MCU_MKL25ZXX 1200 ///< NXP MKL25Zxx
|
#define OPT_MCU_KINETIS_KL 1200 ///< NXP KL series
|
||||||
#define OPT_MCU_K32L2BXX 1201 ///< NXP K32L2Bxx
|
#define OPT_MCU_KINETIS_K32 1201 ///< NXP K32 series
|
||||||
|
|
||||||
|
#define OPT_MCU_MKL25ZXX 1200 ///< Alias to KL (obsolete)
|
||||||
|
#define OPT_MCU_K32L2BXX 1201 ///< Alias to K32 (obsolete)
|
||||||
|
|
||||||
// Silabs
|
// Silabs
|
||||||
#define OPT_MCU_EFM32GG 1300 ///< Silabs EFM32GG
|
#define OPT_MCU_EFM32GG 1300 ///< Silabs EFM32GG
|
||||||
|
Loading…
x
Reference in New Issue
Block a user