Skip to content

Commit

Permalink
mcux: kw45 Soc and Board Support
Browse files Browse the repository at this point in the history
Support for KW45 SoC Family and KW45B41Z-EVK Board.

Co-authored-by: Mayank Mahajan <[email protected]>
Signed-off-by: Sumit Batra <[email protected]>
  • Loading branch information
sumitbatra-nxp and mayankmahajan-nxp committed Nov 26, 2024
1 parent c42d70d commit ab2e66a
Show file tree
Hide file tree
Showing 21 changed files with 327,755 additions and 421 deletions.
429 changes: 214 additions & 215 deletions dts/nxp/mcx/MCXW716CMFTA-pinctrl.h

Large diffs are not rendered by default.

14 changes: 12 additions & 2 deletions mcux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ else()
endif()

zephyr_include_directories(mcux-sdk/devices/${MCUX_DEVICE_PATH})
zephyr_include_directories(mcux-sdk/devices/${MCUX_DEVICE_PATH}/drivers)

if("${CONFIG_SOC_SERIES}" STREQUAL "kw45")
zephyr_include_directories(mcux-sdk/devices/MCXW716C/drivers)
else()
zephyr_include_directories(mcux-sdk/devices/${MCUX_DEVICE_PATH}/drivers)
endif()

#include device specific drivers
if (${MCUX_DEVICE} MATCHES "MIMXRT1[0-9][0-9][0-9]")
Expand All @@ -46,7 +51,12 @@ zephyr_compile_definitions(${MCUX_CPU})
# Build mcux device-specific objects. Although it is not normal
# practice, drilling down like this avoids the need for repetitive
# build scripts for every mcux device.
zephyr_library_sources(mcux-sdk/devices/${MCUX_DEVICE_PATH}/drivers/fsl_clock.c)
if("${CONFIG_SOC_SERIES}" STREQUAL "kw45")
zephyr_library_sources(mcux-sdk/devices/MCXW716C/drivers/fsl_clock.c)
else()
zephyr_library_sources(mcux-sdk/devices/${MCUX_DEVICE_PATH}/drivers/fsl_clock.c)
endif()

if (${MCUX_DEVICE} MATCHES "LPC|MIMXRT6|MIMXRT5|RW6|MCXN.4.")
zephyr_library_sources(mcux-sdk/devices/${MCUX_DEVICE_PATH}/drivers/fsl_power.c)
zephyr_library_sources(mcux-sdk/devices/${MCUX_DEVICE_PATH}/drivers/fsl_reset.c)
Expand Down
16 changes: 13 additions & 3 deletions mcux/hal_nxp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ list(APPEND CMAKE_MODULE_PATH
${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/lists
)

if("${CONFIG_SOC_SERIES}" STREQUAL "kw45")
list(APPEND CMAKE_MODULE_PATH
${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/devices/MCXW716C/drivers)
endif()

if(CONFIG_CPU_CORTEX_A)
list(APPEND CMAKE_MODULE_PATH
${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/CMSIS/Core_AArch64/Include
Expand Down Expand Up @@ -267,6 +272,7 @@ include_driver_ifdef(CONFIG_S3MU_MCUX_S3MU s3mu driver_s
include_driver_ifdef(CONFIG_PINCTRL_NXP_PORT port driver_port)
if(CONFIG_BT_NXP)
include_driver_ifdef(CONFIG_SOC_SERIES_MCXW spc driver_spc)
include_driver_ifdef(CONFIG_SOC_SERIES_KINETIS_KW45 spc driver_spc)
endif()

if (${MCUX_DEVICE} MATCHES "MIMXRT1189")
Expand Down Expand Up @@ -315,7 +321,11 @@ endif()

if("${CONFIG_SOC_FAMILY}" STREQUAL "nxp_kinetis")

include_driver_ifdef(CONFIG_SOC_FLASH_MCUX flash driver_flash)
if("${CONFIG_SOC_SERIES}" STREQUAL "kw45")
include_driver_ifdef(CONFIG_SOC_FLASH_MCUX flash_k4 driver_flash_k4)
else()
include_driver_ifdef(CONFIG_SOC_FLASH_MCUX flash driver_flash)
endif()

include(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/port/driver_port.cmake)
zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/port)
Expand Down Expand Up @@ -473,15 +483,15 @@ if(CONFIG_NXP_RF_IMU)
${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/gdma
)
include(component_wireless_imu_adapter)
elseif(CONFIG_SOC_SERIES_MCXW)
elseif(CONFIG_SOC_SERIES_MCXW OR CONFIG_SOC_SERIES_KINETIS_KW45)
zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/rpmsg)
zephyr_library_sources(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/rpmsg/fsl_adapter_rpmsg.c)
include(component_lists)
zephyr_compile_definitions(HAL_RPMSG_SELECT_ROLE=0U)
endif()
endif()

if(${MCUX_DEVICE} MATCHES "MCXW")
if(${MCUX_DEVICE} MATCHES "MCXW" OR ${MCUX_DEVICE} MATCHES "KW45")
list(APPEND CMAKE_MODULE_PATH
${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/ccm32k
)
Expand Down
12 changes: 6 additions & 6 deletions mcux/mcux-sdk/boards/kw45b41zevk/board.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: BSD-3-Clause
/*
* Copyright 2021 NXP
* Copyright 2024 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/

#include <stdint.h>
Expand All @@ -20,9 +19,10 @@
/* Initialize debug console. */
void BOARD_InitDebugConsole(void)
{
uint32_t uartClkSrcFreq = BOARD_DEBUG_UART_CLK_FREQ;
uint32_t uartClkSrcFreq = BOARD_DEBUG_UART_CLK_FREQ;

CLOCK_SetIpSrc(kCLOCK_Lpuart1, kCLOCK_IpSrcFro6M);
CLOCK_SetIpSrc(kCLOCK_Lpuart1, kCLOCK_IpSrcFro6M);

DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE, BOARD_DEBUG_UART_BAUDRATE, BOARD_DEBUG_UART_TYPE, uartClkSrcFreq);
DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE, BOARD_DEBUG_UART_BAUDRATE, BOARD_DEBUG_UART_TYPE,
uartClkSrcFreq);
}
60 changes: 35 additions & 25 deletions mcux/mcux-sdk/boards/kw45b41zevk/board.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/*
* Copyright 2021-2022 NXP
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright 2024 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/

#ifndef _BOARD_H_
Expand All @@ -20,7 +18,7 @@
/* The UART to use for debug messages. */
#define BOARD_USE_LPUART
#define BOARD_DEBUG_UART_TYPE kSerialPort_Uart
#define BOARD_DEBUG_UART_BASEADDR (uint32_t) LPUART1
#define BOARD_DEBUG_UART_BASEADDR ((uint32_t) LPUART1)
#define BOARD_DEBUG_UART_INSTANCE 1U
#define BOARD_DEBUG_UART_CLK_FREQ (CLOCK_GetFreq(kCLOCK_ScgSircClk))

Expand Down Expand Up @@ -65,26 +63,38 @@
#define BOARD_LED3_GPIO_PIN 21U
#endif

#define LED1_INIT(output) \
GPIO_PinWrite(BOARD_LED1_GPIO, BOARD_LED1_GPIO_PIN, output); \
BOARD_LED1_GPIO->PDDR |= (1U << BOARD_LED1_GPIO_PIN) /*!< Enable target LED1 */
#define LED1_ON() GPIO_PortSet(BOARD_LED1_GPIO, 1U << BOARD_LED1_GPIO_PIN) /*!< Turn on target LED1 */
#define LED1_OFF() GPIO_PortClear(BOARD_LED1_GPIO, 1U << BOARD_LED1_GPIO_PIN) /*!< Turn off target LED1 */
#define LED1_TOGGLE() GPIO_PortToggle(BOARD_LED1_GPIO, 1U << BOARD_LED1_GPIO_PIN) /*!< Toggle on target LED1 */

#define LED2_INIT(output) \
GPIO_PinWrite(BOARD_LED2_GPIO, BOARD_LED2_GPIO_PIN, output); \
BOARD_LED2_GPIO->PDDR |= (1U << BOARD_LED2_GPIO_PIN) /*!< Enable target LED2 */
#define LED2_ON() GPIO_PortSet(BOARD_LED2_GPIO, 1U << BOARD_LED2_GPIO_PIN) /*!< Turn on target LED2 */
#define LED2_OFF() GPIO_PortClear(BOARD_LED2_GPIO, 1U << BOARD_LED2_GPIO_PIN) /*!< Turn off target LED2 */
#define LED2_TOGGLE() GPIO_PortToggle(BOARD_LED2_GPIO, 1U << BOARD_LED2_GPIO_PIN) /*!< Toggle on target LED2 */

#define LED3_INIT(output) \
GPIO_PinWrite(BOARD_LED3_GPIO, BOARD_LED3_GPIO_PIN, output); \
BOARD_LED3_GPIO->PDDR |= (1U << BOARD_LED3_GPIO_PIN) /*!< Enable target LED3 */
#define LED3_ON() GPIO_PortSet(BOARD_LED3_GPIO, 1U << BOARD_LED3_GPIO_PIN) /*!< Turn on target LED3 */
#define LED3_OFF() GPIO_PortClear(BOARD_LED3_GPIO, 1U << BOARD_LED3_GPIO_PIN) /*!< Turn off target LED3 */
#define LED3_TOGGLE() GPIO_PortToggle(BOARD_LED3_GPIO, 1U << BOARD_LED3_GPIO_PIN) /*!< Toggle on target LED3 */
#define LED1_INIT(output) do { \
GPIO_PinWrite(BOARD_LED1_GPIO, BOARD_LED1_GPIO_PIN, output); \
BOARD_LED1_GPIO->PDDR |= (1U << BOARD_LED1_GPIO_PIN); \
} while (0) /*!< Enable target LED1 */
#define LED1_ON() GPIO_PortSet(BOARD_LED1_GPIO, 1U << BOARD_LED1_GPIO_PIN)
/*!< Turn on target LED1 */
#define LED1_OFF() GPIO_PortClear(BOARD_LED1_GPIO, 1U << BOARD_LED1_GPIO_PIN)
/*!< Turn off target LED1 */
#define LED1_TOGGLE() GPIO_PortToggle(BOARD_LED1_GPIO, 1U << BOARD_LED1_GPIO_PIN)
/*!< Toggle on target LED1 */

#define LED2_INIT(output) do { \
GPIO_PinWrite(BOARD_LED2_GPIO, BOARD_LED2_GPIO_PIN, output); \
BOARD_LED2_GPIO->PDDR |= (1U << BOARD_LED2_GPIO_PIN); \
} while (0) /*!< Enable target LED2 */
#define LED2_ON() GPIO_PortSet(BOARD_LED2_GPIO, 1U << BOARD_LED2_GPIO_PIN)
/*!< Turn on target LED2 */
#define LED2_OFF() GPIO_PortClear(BOARD_LED2_GPIO, 1U << BOARD_LED2_GPIO_PIN)
/*!< Turn off target LED2 */
#define LED2_TOGGLE() GPIO_PortToggle(BOARD_LED2_GPIO, 1U << BOARD_LED2_GPIO_PIN)
/*!< Toggle on target LED2 */

#define LED3_INIT(output) do { \
GPIO_PinWrite(BOARD_LED3_GPIO, BOARD_LED3_GPIO_PIN, output); \
BOARD_LED3_GPIO->PDDR |= (1U << BOARD_LED3_GPIO_PIN); \
} while (0) /*!< Enable target LED3 */
#define LED3_ON() GPIO_PortSet(BOARD_LED3_GPIO, 1U << BOARD_LED3_GPIO_PIN)
/*!< Turn on target LED3 */
#define LED3_OFF() GPIO_PortClear(BOARD_LED3_GPIO, 1U << BOARD_LED3_GPIO_PIN)
/*!< Turn off target LED3 */
#define LED3_TOGGLE() GPIO_PortToggle(BOARD_LED3_GPIO, 1U << BOARD_LED3_GPIO_PIN)
/*!< Toggle on target LED3 */

#define BOARD_SW2_NAME "SW2"
#define BOARD_SW2_GPIO GPIOD
Expand Down
Loading

0 comments on commit ab2e66a

Please sign in to comment.