From 23099c53268b1d078e516e1f21f4ab3bdc6efd6f Mon Sep 17 00:00:00 2001 From: wgz-code <820906721@qq.com> Date: Mon, 7 Mar 2022 18:24:10 +0800 Subject: [PATCH 01/18] support M7 imxrt-ok1052 board --- .../Nuttx/aiit_board/imxrt1052-ok/Kconfig | 27 + .../imxrt1052-ok/configs/knsh/Make.defs | 74 + .../imxrt1052-ok/configs/knsh/defconfig | 43 + .../imxrt1052-ok/configs/libcxxtest/Make.defs | 85 ++ .../imxrt1052-ok/configs/libcxxtest/defconfig | 40 + .../imxrt1052-ok/configs/netnsh/defconfig | 62 + .../imxrt1052-ok/configs/nsh/defconfig | 37 + .../aiit_board/imxrt1052-ok/include/board.h | 338 +++++ .../aiit_board/imxrt1052-ok/kernel/Makefile | 103 ++ .../imxrt1052-ok/kernel/imxrt_userspace.c | 113 ++ .../aiit_board/imxrt1052-ok/scripts/Make.defs | 75 + .../imxrt1052-ok/scripts/flash-ocram.ld | 140 ++ .../imxrt1052-ok/scripts/kernel-space.ld | 104 ++ .../aiit_board/imxrt1052-ok/scripts/memory.ld | 67 + .../imxrt1052-ok/scripts/user-space.ld | 118 ++ .../aiit_board/imxrt1052-ok/src/Makefile | 69 + .../imxrt1052-ok/src/imxrt1052-ok.h | 193 +++ .../imxrt1052-ok/src/imxrt_appinit.c | 75 + .../imxrt1052-ok/src/imxrt_autoleds.c | 166 +++ .../aiit_board/imxrt1052-ok/src/imxrt_boot.c | 77 + .../imxrt1052-ok/src/imxrt_bringup.c | 190 +++ .../imxrt1052-ok/src/imxrt_buttons.c | 129 ++ .../imxrt1052-ok/src/imxrt_ethernet.c | 284 ++++ .../imxrt1052-ok/src/imxrt_flexspi_nor_boot.c | 55 + .../imxrt1052-ok/src/imxrt_flexspi_nor_boot.h | 142 ++ .../src/imxrt_flexspi_nor_flash.c | 206 +++ .../src/imxrt_flexspi_nor_flash.h | 350 +++++ .../aiit_board/imxrt1052-ok/src/imxrt_gpio.c | 215 +++ .../aiit_board/imxrt1052-ok/src/imxrt_lcd.c | 68 + .../imxrt1052-ok/src/imxrt_mmcsd_spi.c | 122 ++ .../imxrt1052-ok/src/imxrt_sdram_ini_dcd.c | 1257 +++++++++++++++++ .../aiit_board/imxrt1052-ok/src/imxrt_spi.c | 211 +++ .../imxrt1052-ok/src/imxrt_userleds.c | 85 ++ Ubiquitous/Nuttx/app_match_nuttx/build.sh | 1 + .../app_match_nuttx/nuttx/boards/Kconfig | 14 + 35 files changed, 5335 insertions(+) create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/Kconfig create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/Make.defs create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/Make.defs create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/include/board.h create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/kernel/Makefile create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/kernel/imxrt_userspace.c create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/Make.defs create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/flash-ocram.ld create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/kernel-space.ld create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/memory.ld create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/user-space.ld create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/Makefile create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt1052-ok.h create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_appinit.c create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_autoleds.c create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_boot.c create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_bringup.c create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_buttons.c create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_ethernet.c create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_boot.c create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_boot.h create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_flash.c create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_flash.h create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_gpio.c create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_lcd.c create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_mmcsd_spi.c create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_sdram_ini_dcd.c create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_spi.c create mode 100644 Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_userleds.c diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/Kconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/Kconfig new file mode 100644 index 000000000..c4fde44a1 --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/Kconfig @@ -0,0 +1,27 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# + +if ARCH_BOARD_IMXRT1052_OK + +choice + prompt "Boot Flash" + default IMXRT1052_OK_HYPER_FLASH + +config IMXRT1052_OK_HYPER_FLASH + bool "HYPER Flash" + +config IMXRT1052_OK_QSPI_FLASH + bool "QSPI Flash" + +endchoice # Boot Flash + +config IMXRT1052_OK_SDRAM + bool "Enable SDRAM" + default n + select IMXRT_SEMC_INIT_DONE + ---help--- + Activate DCD configuration of SDRAM + +endif diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/Make.defs b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/Make.defs new file mode 100644 index 000000000..9f16dfe9d --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/Make.defs @@ -0,0 +1,74 @@ +############################################################################ +# boards/arm/imxrt/imxrt1052-ok/configs/knsh/Make.defs +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +############################################################################ + +include $(TOPDIR)/.config +include $(TOPDIR)/tools/Config.mk +include $(TOPDIR)/arch/arm/src/armv7-m/Toolchain.defs + +LDSCRIPT1 = memory.ld +LDSCRIPT2 = kernel-space.ld + +ifeq ($(CONFIG_CYGWIN_WINTOOL),y) + ARCHSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT1)}" + ARCHSCRIPT += -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT2)}" +else + ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT1) + ARCHSCRIPT += -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT2) +endif + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + ARCHOPTIMIZATION = -g +endif + +ifneq ($(CONFIG_DEBUG_NOOPT),y) + ARCHOPTIMIZATION += $(MAXOPTIMIZATION) +endif + +ARCHCFLAGS = -fno-builtin +ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new -fno-rtti +ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -fno-strict-aliasing +ARCHWARNINGSXX = -Wall -Wshadow -Wundef +ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10 + +CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe +CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) +CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe +CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS) +CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) +AFLAGS := $(CFLAGS) -D__ASSEMBLY__ + +NXFLATLDFLAGS1 = -r -d -warn-common +NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections +LDNXFLATFLAGS = -e main -s 2048 + +# Loadable module definitions + +CMODULEFLAGS = $(CFLAGS) -mlong-calls # --target1-abs + +LDMODULEFLAGS = -r -e module_initialize +ifeq ($(CONFIG_CYGWIN_WINTOOL),y) + LDMODULEFLAGS += -T "${shell cygpath -w $(TOPDIR)/libs/libc/modlib/gnu-elf.ld}" +else + LDMODULEFLAGS += -T $(TOPDIR)/libs/libc/modlib/gnu-elf.ld +endif + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + LDFLAGS += -g +endif diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig new file mode 100644 index 000000000..1ef5015a7 --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig @@ -0,0 +1,43 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_ARCH_RAMFUNCS is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="imxrt1052-ok" +CONFIG_ARCH_BOARD_IMXRT1052_OK=y +CONFIG_ARCH_CHIP="imxrt" +CONFIG_ARCH_CHIP_IMXRT=y +CONFIG_ARCH_CHIP_MIMXRT1052DVL6A=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARMV7M_DCACHE=y +CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y +CONFIG_ARMV7M_ICACHE=y +CONFIG_ARMV7M_LAZYFPU=y +CONFIG_ARMV7M_USEBASEPRI=y +CONFIG_ARM_MPU=y +CONFIG_BOARD_LOOPSPERMSEC=104926 +CONFIG_BUILD_PROTECTED=y +CONFIG_FS_PROCFS=y +CONFIG_IDLETHREAD_STACKSIZE=2048 +CONFIG_IMXRT_LPUART1=y +CONFIG_INTELHEX_BINARY=y +CONFIG_LPUART1_SERIAL_CONSOLE=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_DISABLE_MKRD=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_LINELEN=64 +CONFIG_NSH_READLINE=y +CONFIG_NUTTX_USERSPACE=0x60200000 +CONFIG_PASS1_BUILDIR="boards/arm/imxrt/imxrt1052-ok/kernel" +CONFIG_RAM_SIZE=524288 +CONFIG_RAM_START=0x20200000 +CONFIG_SCHED_WAITPID=y +CONFIG_START_DAY=8 +CONFIG_START_MONTH=6 +CONFIG_SYSTEM_NSH=y +CONFIG_SYS_RESERVED=9 +CONFIG_USER_ENTRYPOINT="nsh_main" diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/Make.defs b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/Make.defs new file mode 100644 index 000000000..6e1d1be1c --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/Make.defs @@ -0,0 +1,85 @@ +############################################################################ +# boards/arm/imxrt/imxrt1052-ok/configs/libcxxtest/Make.defs +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +############################################################################ + +include $(TOPDIR)/.config +include $(TOPDIR)/tools/Config.mk +include $(TOPDIR)/arch/arm/src/armv7-m/Toolchain.defs + +ifeq ($(CONFIG_ARMV7M_DTCM),y) + LDSCRIPT = flash-dtcm.ld +else + LDSCRIPT = flash-ocram.ld +endif + +ifeq ($(CONFIG_CYGWIN_WINTOOL),y) + ARCHSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)}" +else + ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT) +endif + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + ARCHOPTIMIZATION = -g +endif + +ifneq ($(CONFIG_DEBUG_NOOPT),y) + ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing \ + -fno-strength-reduce -fomit-frame-pointer +endif + +ARCHCFLAGS = -fno-builtin +ifeq ($(CONFIG_CXX_EXCEPTION),y) + ARCHCPUFLAGSXX = -fno-builtin +else + ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fcheck-new +endif +ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef #-fno-strict-aliasing +ARCHWARNINGSXX = -Wall -Wshadow -Wundef +ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10 + + +CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe +CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) +CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \ + $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) +CXXFLAGS += $(ARCHDEFINES) $(EXTRAFLAGS) -pipe -std=c++11 +CXXFLAGS += -fno-builtin -fno-exceptions -fcheck-new -fno-rtti +CXXFLAGS += -pedantic -D_DEBUG -D_LIBCPP_BUILD_STATIC -D_LIBCPP_NO_EXCEPTIONS +CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS) +CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) +AFLAGS := $(CFLAGS) -D__ASSEMBLY__ + +NXFLATLDFLAGS1 = -r -d -warn-common +NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections +LDNXFLATFLAGS = -e main -s 2048 + +# Loadable module definitions + +CMODULEFLAGS = $(CFLAGS) -mlong-calls # --target1-abs + +LDMODULEFLAGS = -r -e module_initialize +ifeq ($(CONFIG_CYGWIN_WINTOOL),y) + LDMODULEFLAGS += -T "${shell cygpath -w $(TOPDIR)/libs/libc/modlib/gnu-elf.ld}" +else + LDMODULEFLAGS += -T $(TOPDIR)/libs/libc/modlib/gnu-elf.ld +endif + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + LDFLAGS += -g +endif diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig new file mode 100644 index 000000000..568c20516 --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig @@ -0,0 +1,40 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="imxrt1052-ok" +CONFIG_ARCH_BOARD_IMXRT1052_OK=y +CONFIG_ARCH_CHIP="imxrt" +CONFIG_ARCH_CHIP_IMXRT=y +CONFIG_ARCH_CHIP_MIMXRT1052DVL6A=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_BOARD_LATE_INITIALIZE=y +CONFIG_BOARD_LOOPSPERMSEC=20000 +CONFIG_BUILTIN=y +CONFIG_C99_BOOL8=y +CONFIG_FS_PROCFS=y +CONFIG_HAVE_CXX=y +CONFIG_IDLETHREAD_STACKSIZE=2048 +CONFIG_IMXRT_LPUART1=y +CONFIG_INTELHEX_BINARY=y +CONFIG_LIBCXX=y +CONFIG_LIBCXXABI=y +CONFIG_LIBC_FLOATINGPOINT=y +CONFIG_LIBC_LOCALTIME=y +CONFIG_LIBM=y +CONFIG_LPUART1_SERIAL_CONSOLE=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_LINELEN=64 +CONFIG_NSH_READLINE=y +CONFIG_RAM_SIZE=536870912 +CONFIG_RAM_START=0x20200000 +CONFIG_SCHED_CPULOAD=y +CONFIG_START_DAY=14 +CONFIG_START_MONTH=3 +CONFIG_SYSTEM_NSH=y +CONFIG_USER_ENTRYPOINT="nsh_main" diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig new file mode 100644 index 000000000..bbc23cc75 --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig @@ -0,0 +1,62 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_ARCH_LEDS is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="imxrt1052-ok" +CONFIG_ARCH_BOARD_IMXRT1052_OK=y +CONFIG_ARCH_CHIP="imxrt" +CONFIG_ARCH_CHIP_IMXRT=y +CONFIG_ARCH_CHIP_MIMXRT1052DVL6A=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARMV7M_DCACHE=y +CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y +CONFIG_ARMV7M_ICACHE=y +CONFIG_ARMV7M_USEBASEPRI=y +CONFIG_BOARD_LOOPSPERMSEC=104926 +CONFIG_BUILTIN=y +CONFIG_ETH0_PHY_KSZ8081=y +CONFIG_FS_PROCFS=y +CONFIG_IDLETHREAD_STACKSIZE=2048 +CONFIG_IMXRT_ENET=y +CONFIG_IMXRT_LPUART1=y +CONFIG_INTELHEX_BINARY=y +CONFIG_LIBC_HOSTNAME="i.MXRT1050 EVK" +CONFIG_LPUART1_SERIAL_CONSOLE=y +CONFIG_NET=y +CONFIG_NETDEV_STATISTICS=y +CONFIG_NETINIT_NOMAC=y +CONFIG_NETUTILS_TELNETD=y +CONFIG_NET_ARP_SEND=y +CONFIG_NET_BROADCAST=y +CONFIG_NET_ICMP=y +CONFIG_NET_ICMP_SOCKET=y +CONFIG_NET_ICMPv6=y +CONFIG_NET_ICMPv6_NEIGHBOR=y +CONFIG_NET_ICMPv6_SOCKET=y +CONFIG_NET_IPv6=y +CONFIG_NET_SOCKOPTS=y +CONFIG_NET_STATISTICS=y +CONFIG_NET_TCP=y +CONFIG_NET_TCPBACKLOG=y +CONFIG_NET_TCP_WRITE_BUFFERS=y +CONFIG_NET_UDP=y +CONFIG_NET_UDP_WRITE_BUFFERS=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_LINELEN=64 +CONFIG_NSH_READLINE=y +CONFIG_RAM_SIZE=524288 +CONFIG_RAM_START=0x20200000 +CONFIG_SCHED_LPWORK=y +CONFIG_START_DAY=14 +CONFIG_START_MONTH=3 +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_PING6=y +CONFIG_SYSTEM_PING=y +CONFIG_USER_ENTRYPOINT="nsh_main" diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig new file mode 100644 index 000000000..d69e7aecd --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig @@ -0,0 +1,37 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="imxrt1052-ok" +CONFIG_ARCH_BOARD_IMXRT1052_OK=y +CONFIG_ARCH_CHIP="imxrt" +CONFIG_ARCH_CHIP_IMXRT=y +CONFIG_ARCH_CHIP_MIMXRT1052DVL6A=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARMV7M_DCACHE=y +CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y +CONFIG_ARMV7M_ICACHE=y +CONFIG_ARMV7M_USEBASEPRI=y +CONFIG_BOARD_LOOPSPERMSEC=104926 +CONFIG_BUILTIN=y +CONFIG_FS_PROCFS=y +CONFIG_IDLETHREAD_STACKSIZE=2048 +CONFIG_IMXRT_LPUART1=y +CONFIG_INTELHEX_BINARY=y +CONFIG_LPUART1_SERIAL_CONSOLE=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_DISABLE_IFUPDOWN=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_LINELEN=64 +CONFIG_NSH_READLINE=y +CONFIG_RAM_SIZE=524288 +CONFIG_RAM_START=0x20200000 +CONFIG_START_DAY=14 +CONFIG_START_MONTH=3 +CONFIG_SYSTEM_NSH=y +CONFIG_USER_ENTRYPOINT="nsh_main" diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/include/board.h b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/include/board.h new file mode 100644 index 000000000..f7a7e1be1 --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/include/board.h @@ -0,0 +1,338 @@ +/**************************************************************************** + * boards/arm/imxrt/imxrt1052-ok/include/board.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __BOARDS_ARM_IMXRT_IMXRT1052_OK_INCLUDE_BOARD_H +#define __BOARDS_ARM_IMXRT_IMXRT1052_OK_INCLUDE_BOARD_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/* Do not include i.MXRT header files here */ + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Clocking *****************************************************************/ + +/* Set VDD_SOC to 1.25V */ + +#define IMXRT_VDD_SOC (0x12) + +/* Set Arm PLL (PLL1) to fOut = (24Mhz * ARM_PLL_DIV_SELECT/2) / + * ARM_PODF_DIVISOR + * 600Mhz = (24Mhz * ARM_PLL_DIV_SELECT/2) / + * ARM_PODF_DIVISOR + * ARM_PLL_DIV_SELECT = 100 + * ARM_PODF_DIVISOR = 2 + * 600Mhz = (24Mhz * 100/2) / 2 + * + * AHB_CLOCK_ROOT = PLL1fOut / IMXRT_AHB_PODF_DIVIDER + * 1Hz to 600 MHz = 600Mhz / IMXRT_ARM_CLOCK_DIVIDER + * IMXRT_ARM_CLOCK_DIVIDER = 1 + * 600Mhz = 600Mhz / 1 + * + * PRE_PERIPH_CLK_SEL = PRE_PERIPH_CLK_SEL_PLL1 + * PERIPH_CLK_SEL = 1 (0 select PERIPH_CLK2_PODF, + * 1 select PRE_PERIPH_CLK_SEL_PLL1) + * PERIPH_CLK = 600Mhz + * + * IPG_CLOCK_ROOT = AHB_CLOCK_ROOT / IMXRT_IPG_PODF_DIVIDER + * IMXRT_IPG_PODF_DIVIDER = 4 + * 150Mhz = 600Mhz / 4 + * + * PERCLK_CLOCK_ROOT = IPG_CLOCK_ROOT / + * IMXRT_PERCLK_PODF_DIVIDER + * IMXRT_PERCLK_PODF_DIVIDER = 9 + * 16.6Mhz = 150Mhz / 9 + * + * SEMC_CLK_ROOT = 600Mhz / IMXRT_SEMC_PODF_DIVIDER + * (labeled AIX_PODF in 18.2) + * IMXRT_SEMC_PODF_DIVIDER = 8 + * 75Mhz = 600Mhz / 8 + * + * Set Sys PLL (PLL2) to fOut = (24Mhz * (20+(2*(DIV_SELECT))) + * 528Mhz = (24Mhz * (20+(2*(1))) + * + * Set USB1 PLL (PLL3) to fOut = (24Mhz * 20) + * 480Mhz = (24Mhz * 20) + * + * Set LPSPI PLL3 PFD0 to fOut = (480Mhz / 12 * 18) + * 720Mhz = (480Mhz / 12 * 18) + * 90Mhz = (720Mhz / LSPI_PODF_DIVIDER) + * + * Set LPI2C PLL3 / 8 to fOut = (480Mhz / 8) + * 60Mhz = (480Mhz / 8) + * 12Mhz = (60Mhz / LSPI_PODF_DIVIDER) + * + * These clock frequencies can be verified via the CCM_CLKO1 pin and sending + * the appropriate clock to it with something like; + * + * putreg32( | CCM_CCOSR_CLKO1_EN , IMXRT_CCM_CCOSR); + * imxrt_config_gpio(GPIO_CCM_CLKO1); + */ + +#define BOARD_XTAL_FREQUENCY 24000000 +#define IMXRT_PRE_PERIPH_CLK_SEL CCM_CBCMR_PRE_PERIPH_CLK_SEL_PLL1 +#define IMXRT_PERIPH_CLK_SEL CCM_CBCDR_PERIPH_CLK_SEL_PRE_PERIPH +#define IMXRT_ARM_PLL_DIV_SELECT 100 +#define IMXRT_ARM_PODF_DIVIDER 2 +#define IMXRT_AHB_PODF_DIVIDER 1 +#define IMXRT_IPG_PODF_DIVIDER 4 +#define IMXRT_PERCLK_CLK_SEL CCM_CSCMR1_PERCLK_CLK_SEL_IPG_CLK_ROOT +#define IMXRT_PERCLK_PODF_DIVIDER 9 +#define IMXRT_SEMC_PODF_DIVIDER 8 +#define IMXRT_LPSPI_CLK_SELECT CCM_CBCMR_LPSPI_CLK_SEL_PLL3_PFD0 +#define IMXRT_LSPI_PODF_DIVIDER 8 + +#define IMXRT_LPSPI_CLK_SELECT CCM_CBCMR_LPSPI_CLK_SEL_PLL3_PFD0 +#define IMXRT_LSPI_PODF_DIVIDER 8 + +#define IMXRT_LPI2C_CLK_SELECT CCM_CSCDR2_LPI2C_CLK_SEL_PLL3_60M +#define IMXRT_LSI2C_PODF_DIVIDER 5 + +#define IMXRT_USDHC1_CLK_SELECT CCM_CSCMR1_USDHC1_CLK_SEL_PLL2_PFD0 +#define IMXRT_USDHC1_PODF_DIVIDER 2 + +#define IMXRT_SYS_PLL_SELECT CCM_ANALOG_PLL_SYS_DIV_SELECT_22 + +#define IMXRT_USB1_PLL_DIV_SELECT CCM_ANALOG_PLL_USB1_DIV_SELECT_20 + +#define BOARD_CPU_FREQUENCY \ + (BOARD_XTAL_FREQUENCY * (IMXRT_ARM_PLL_DIV_SELECT / 2)) / IMXRT_ARM_PODF_DIVIDER + +/* Define this to enable tracing */ + +#if 0 +# define IMXRT_TRACE_PODF_DIVIDER 1 +# define IMXRT_TRACE_CLK_SELECT CCM_CBCMR_TRACE_CLK_SEL_PLL2_PFD0 +#endif + +/* LED definitions **********************************************************/ + +/* There are four LED status indicators located on the EVK Board. + * The functions of these LEDs include: + * + * - Main Power Supply(D3) + * Green: DC 5V main supply is normal. + * Red: J2 input voltage is over 5.6V. + * Off: The board is not powered. + * - Reset RED LED(D15) + * - OpenSDA LED(D16) + * - USER LED(D18) + * + * Only a single LED, D18, is under software control. + */ + +/* LED index values for use with board_userled() */ + +#define BOARD_USERLED 0 +#define BOARD_NLEDS 1 + +/* LED bits for use with board_userled_all() */ + +#define BOARD_USERLED_BIT (1 << BOARD_USERLED) + +/* This LED is not used by the board port unless CONFIG_ARCH_LEDS is + * defined. In that case, the usage by the board port is defined in + * include/board.h and src/imxrt_autoleds.c. The LED is used to encode + * OS-related events as follows: + * + * -------------------- ----------------------------- ------ + * SYMBOL Meaning LED + * -------------------- ----------------------------- ------ + */ + +#define LED_STARTED 0 /* NuttX has been started OFF */ +#define LED_HEAPALLOCATE 0 /* Heap has been allocated OFF */ +#define LED_IRQSENABLED 0 /* Interrupts enabled OFF */ +#define LED_STACKCREATED 1 /* Idle stack created ON */ +#define LED_INIRQ 2 /* In an interrupt N/C */ +#define LED_SIGNAL 2 /* In a signal handler N/C */ +#define LED_ASSERTION 2 /* An assertion failed N/C */ +#define LED_PANIC 3 /* The system has crashed FLASH */ +#undef LED_IDLE /* Not used */ + +/* Thus if the LED is statically on, NuttX has successfully booted and is, + * apparently, running normally. If the LED is flashing at approximately + * 2Hz, then a fatal error has been detected and the system has halted. + */ + +/* Button definitions *******************************************************/ + +/* The IMXRT board has one external user button + * + * 1. SW8 (IRQ88) GPIO5-00 + */ + +#define BUTTON_SW8 0 + +#define BUTTON_SW8_BIT (1 << BUTTON_SW8) + +/* SDIO *********************************************************************/ + +/* Pin drive characteristics - drive strength in particular may need tuning + * for specific boards, but has been checked by scope on the EVKB to make + * sure shapes are square with minimal ringing. + */ + +#define PIN_USDHC1_D0 (GPIO_USDHC1_DATA0 | IOMUX_USDHC1_DATAX_DEFAULT) +#define PIN_USDHC1_D1 (GPIO_USDHC1_DATA1 | IOMUX_USDHC1_DATAX_DEFAULT) +#define PIN_USDHC1_D2 (GPIO_USDHC1_DATA2 | IOMUX_USDHC1_DATAX_DEFAULT) +#define PIN_USDHC1_D3 (GPIO_USDHC1_DATA3 | IOMUX_USDHC1_DATAX_DEFAULT) +#define PIN_USDHC1_DCLK (GPIO_USDHC1_CLK | IOMUX_USDHC1_CLK_DEFAULT) +#define PIN_USDHC1_CMD (GPIO_USDHC1_CMD | IOMUX_USDHC1_CMD_DEFAULT) +#define PIN_USDHC1_CD (GPIO_USDHC1_CD_2 | IOMUX_USDHC1_CLK_DEFAULT) + +/* 386 KHz for initial inquiry stuff */ + +#define BOARD_USDHC_IDMODE_PRESCALER USDHC_SYSCTL_SDCLKFS_DIV256 +#define BOARD_USDHC_IDMODE_DIVISOR USDHC_SYSCTL_DVS_DIV(2) + +/* 24.8MHz for other modes */ + +#define BOARD_USDHC_MMCMODE_PRESCALER USDHC_SYSCTL_SDCLKFS_DIV8 +#define BOARD_USDHC_MMCMODE_DIVISOR USDHC_SYSCTL_DVS_DIV(1) + +#define BOARD_USDHC_SD1MODE_PRESCALER USDHC_SYSCTL_SDCLKFS_DIV8 +#define BOARD_USDHC_SD1MODE_DIVISOR USDHC_SYSCTL_DVS_DIV(1) + +#define BOARD_USDHC_SD4MODE_PRESCALER USDHC_SYSCTL_SDCLKFS_DIV8 +#define BOARD_USDHC_SD4MODE_DIVISOR USDHC_SYSCTL_DVS_DIV(1) + +/* LCD **********************************************************************/ + +#ifdef CONFIG_IMXRT_LCD +/* LCD controller */ + +# define GPIO_LCD_DATA23 (GPIO_LCD_DATA23_1 | IOMUX_LCD_DEFAULT) +# define GPIO_LCD_DATA22 (GPIO_LCD_DATA22_1 | IOMUX_LCD_DEFAULT) +# define GPIO_LCD_DATA21 (GPIO_LCD_DATA21_1 | IOMUX_LCD_DEFAULT) +# define GPIO_LCD_DATA20 (GPIO_LCD_DATA20_1 | IOMUX_LCD_DEFAULT) +# define GPIO_LCD_DATA19 (GPIO_LCD_DATA19_1 | IOMUX_LCD_DEFAULT) +# define GPIO_LCD_DATA18 (GPIO_LCD_DATA18_1 | IOMUX_LCD_DEFAULT) +# define GPIO_LCD_DATA17 (GPIO_LCD_DATA17_1 | IOMUX_LCD_DEFAULT) +# define GPIO_LCD_DATA16 (GPIO_LCD_DATA16_1 | IOMUX_LCD_DEFAULT) +# define GPIO_LCD_DATA15 (GPIO_LCD_DATA15_1 | IOMUX_LCD_DEFAULT) +# define GPIO_LCD_DATA14 (GPIO_LCD_DATA14_1 | IOMUX_LCD_DEFAULT) +# define GPIO_LCD_DATA13 (GPIO_LCD_DATA13_1 | IOMUX_LCD_DEFAULT) +# define GPIO_LCD_DATA12 (GPIO_LCD_DATA12_1 | IOMUX_LCD_DEFAULT) +# define GPIO_LCD_DATA11 (GPIO_LCD_DATA11_1 | IOMUX_LCD_DEFAULT) +# define GPIO_LCD_DATA10 (GPIO_LCD_DATA10_1 | IOMUX_LCD_DEFAULT) +# define GPIO_LCD_DATA09 (GPIO_LCD_DATA09_1 | IOMUX_LCD_DEFAULT) +# define GPIO_LCD_DATA08 (GPIO_LCD_DATA08_1 | IOMUX_LCD_DEFAULT) +# define GPIO_LCD_DATA07 (GPIO_LCD_DATA07_1 | IOMUX_LCD_DEFAULT) +# define GPIO_LCD_DATA06 (GPIO_LCD_DATA06_1 | IOMUX_LCD_DEFAULT) +# define GPIO_LCD_DATA05 (GPIO_LCD_DATA05_1 | IOMUX_LCD_DEFAULT) +# define GPIO_LCD_DATA04 (GPIO_LCD_DATA04_1 | IOMUX_LCD_DEFAULT) +# define GPIO_LCD_DATA03 (GPIO_LCD_DATA03_1 | IOMUX_LCD_DEFAULT) +# define GPIO_LCD_DATA02 (GPIO_LCD_DATA02_1 | IOMUX_LCD_DEFAULT) +# define GPIO_LCD_DATA01 (GPIO_LCD_DATA01_1 | IOMUX_LCD_DEFAULT) +# define GPIO_LCD_DATA00 (GPIO_LCD_DATA00_1 | IOMUX_LCD_DEFAULT) +# define GPIO_LCD_ENABLE (GPIO_LCD_ENABLE_1 | IOMUX_LCD_DEFAULT) +# define GPIO_LCD_HSYNC (GPIO_LCD_HSYNC_1 | IOMUX_LCD_DEFAULT) +# define GPIO_LCD_VSYNC (GPIO_LCD_VSYNC_1 | IOMUX_LCD_DEFAULT) +# define GPIO_LCD_CLK (GPIO_LCD_CLK_1 | IOMUX_LCD_DEFAULT) +#endif + +/* ETH Disambiguation *******************************************************/ + +#define GPIO_ENET_TX_DATA00 (GPIO_ENET_TX_DATA00_1| \ + IOMUX_ENET_DATA_DEFAULT) /* GPIO_B1_07 */ +#define GPIO_ENET_TX_DATA01 (GPIO_ENET_TX_DATA01_1| \ + IOMUX_ENET_DATA_DEFAULT) /* GPIO_B1_08 */ +#define GPIO_ENET_RX_DATA00 (GPIO_ENET_RX_DATA00_1| \ + IOMUX_ENET_DATA_DEFAULT) /* GPIO_B1_04 */ +#define GPIO_ENET_RX_DATA01 (GPIO_ENET_RX_DATA01_1| \ + IOMUX_ENET_DATA_DEFAULT) /* GPIO_B1_05 */ +#define GPIO_ENET_MDIO (GPIO_ENET_MDIO_3|IOMUX_ENET_MDIO_DEFAULT) /* GPIO_EMC_41 */ +#define GPIO_ENET_MDC (GPIO_ENET_MDC_3|IOMUX_ENET_MDC_DEFAULT) /* GPIO_EMC_40 */ +#define GPIO_ENET_RX_EN (GPIO_ENET_RX_EN_1|IOMUX_ENET_EN_DEFAULT) /* GPIO_B1_06 */ +#define GPIO_ENET_RX_ER (GPIO_ENET_RX_ER_1|IOMUX_ENET_RXERR_DEFAULT) /* GPIO_B1_11 */ +#define GPIO_ENET_TX_CLK (GPIO_ENET_REF_CLK_2|\ + IOMUX_ENET_TX_CLK_DEFAULT) /* GPIO_B1_10 */ +#define GPIO_ENET_TX_EN (GPIO_ENET_TX_EN_1|IOMUX_ENET_EN_DEFAULT) /* GPIO_B1_09 */ + +/* PIO Disambiguation *******************************************************/ + +/* LPUARTs + * + * Virtual console port provided by OpenSDA on UART1 and + * Arduino RS-232 Shield on UART3. + * + */ + +#define GPIO_LPUART1_RX (GPIO_LPUART1_RX_1|IOMUX_UART_DEFAULT) /* GPIO_AD_B0_13 */ +#define GPIO_LPUART1_TX (GPIO_LPUART1_TX_1|IOMUX_UART_DEFAULT) /* GPIO_AD_B0_12 */ +#define GPIO_LPUART3_RX (GPIO_LPUART3_RX_1|IOMUX_UART_DEFAULT) /* GPIO_AD_B1_07 */ +#define GPIO_LPUART3_TX (GPIO_LPUART3_TX_1|IOMUX_UART_DEFAULT) /* GPIO_AD_B1_06 */ + +/* LPI2Cs + * + * Arduino Connector LPI2C1 and audio/gyro IO on LPI2C3. + */ + +#define GPIO_LPI2C1_SDA (GPIO_LPI2C1_SDA_2|IOMUX_LPI2C_DEFAULT) /* GPIO_AD_B1_01 */ +#define GPIO_LPI2C1_SCL (GPIO_LPI2C1_SCL_2|IOMUX_LPI2C_DEFAULT) /* GPIO_AD_B1_00 */ +#define GPIO_LPI2C3_SDA (GPIO_LPI2C3_SDA_2|IOMUX_LPI2C_DEFAULT) /* GPIO_AD_B1_01 */ +#define GPIO_LPI2C3_SCL (GPIO_LPI2C3_SCL_2|IOMUX_LPI2C_DEFAULT) /* GPIO_AD_B1_00 */ + +/* LPSPI + * + * Arduino Connector + * + * J24 D09 GPIO_AD_B0_02 LPSPI3_SDI + * J24 D14 GPIO_AD_B0_01 LPSPI3_SDO + * J24 D15 GPIO_AD_B0_00 LPSPI3_SCK + */ + +#define GPIO_LPSPI3_SCK (GPIO_LPSPI3_SCK_2|IOMUX_LPSPI_DEFAULT) /* GPIO_AD_B0_00 */ +#define GPIO_LPSPI3_MISO (GPIO_LPSPI3_SDI_2|IOMUX_LPSPI_DEFAULT) /* GPIO_AD_B0_02 */ +#define GPIO_LPSPI3_MOSI (GPIO_LPSPI3_SDO_2|IOMUX_LPSPI_DEFAULT) /* GPIO_AD_B0_01 */ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_ARM_IMXRT_IMXRT1052_OK_INCLUDE_BOARD_H */ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/kernel/Makefile b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/kernel/Makefile new file mode 100644 index 000000000..8315d342c --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/kernel/Makefile @@ -0,0 +1,103 @@ +############################################################################ +# boards/arm/imxrt/imxrt1052-ok/kernel/Makefile +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +############################################################################ + +include $(TOPDIR)/Make.defs + +# The entry point name (if none is provided in the .config file) + +CONFIG_USER_ENTRYPOINT ?= user_start +ENTRYPT = $(patsubst "%",%,$(CONFIG_USER_ENTRYPOINT)) + +# Get the paths to the libraries and the links script path in format that +# is appropriate for the host OS + +ifeq ($(CONFIG_CYGWIN_WINTOOL),y) + # Windows-native toolchains + USER_LIBPATHS = ${shell for path in $(USERLIBS); do dir=`dirname $(TOPDIR)$(DELIM)$$path`;echo "-L\"`cygpath -w $$dir`\"";done} + USER_LDSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)memory.ld}" + USER_LDSCRIPT += -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)user-space.ld}" + USER_HEXFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.hex}" + USER_SRECFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.srec}" + USER_BINFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.bin}" +else + # Linux/Cygwin-native toolchain + USER_LIBPATHS = $(addprefix -L$(TOPDIR)$(DELIM),$(dir $(USERLIBS))) + USER_LDSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)memory.ld + USER_LDSCRIPT += -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)user-space.ld + USER_HEXFILE += "$(TOPDIR)$(DELIM)nuttx_user.hex" + USER_SRECFILE += "$(TOPDIR)$(DELIM)nuttx_user.srec" + USER_BINFILE += "$(TOPDIR)$(DELIM)nuttx_user.bin" +endif + +USER_LDFLAGS = --undefined=$(ENTRYPT) --entry=$(ENTRYPT) $(USER_LDSCRIPT) +USER_LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(USERLIBS)))) +USER_LIBGCC = "${shell "$(CC)" $(ARCHCPUFLAGS) -print-libgcc-file-name}" + +# Source files + +CSRCS = imxrt_userspace.c +COBJS = $(CSRCS:.c=$(OBJEXT)) +OBJS = $(COBJS) + +# Targets: + +all: $(TOPDIR)$(DELIM)nuttx_user.elf $(TOPDIR)$(DELIM)User.map +.PHONY: nuttx_user.elf depend clean distclean + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +# Create the nuttx_user.elf file containing all of the user-mode code + +nuttx_user.elf: $(OBJS) + $(Q) $(LD) -o $@ $(USER_LDFLAGS) $(USER_LIBPATHS) $(OBJS) --start-group $(USER_LDLIBS) --end-group $(USER_LIBGCC) + +$(TOPDIR)$(DELIM)nuttx_user.elf: nuttx_user.elf + @echo "LD: nuttx_user.elf" + $(Q) cp -a nuttx_user.elf $(TOPDIR)$(DELIM)nuttx_user.elf +ifeq ($(CONFIG_INTELHEX_BINARY),y) + @echo "CP: nuttx_user.hex" + $(Q) $(OBJCOPY) $(OBJCOPYARGS) -O ihex nuttx_user.elf $(USER_HEXFILE) +endif +ifeq ($(CONFIG_MOTOROLA_SREC),y) + @echo "CP: nuttx_user.srec" + $(Q) $(OBJCOPY) $(OBJCOPYARGS) -O srec nuttx_user.elf $(USER_SRECFILE) +endif +ifeq ($(CONFIG_RAW_BINARY),y) + @echo "CP: nuttx_user.bin" + $(Q) $(OBJCOPY) $(OBJCOPYARGS) -O binary nuttx_user.elf $(USER_BINFILE) +endif + +$(TOPDIR)$(DELIM)User.map: nuttx_user.elf + @echo "MK: User.map" + $(Q) $(NM) nuttx_user.elf >$(TOPDIR)$(DELIM)User.map + $(Q) $(CROSSDEV)size nuttx_user.elf + +.depend: + +depend: .depend + +clean: + $(call DELFILE, nuttx_user.elf) + $(call DELFILE, "$(TOPDIR)$(DELIM)nuttx_user.*") + $(call DELFILE, "$(TOPDIR)$(DELIM)User.map") + $(call CLEAN) + +distclean: clean diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/kernel/imxrt_userspace.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/kernel/imxrt_userspace.c new file mode 100644 index 000000000..a30557c6a --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/kernel/imxrt_userspace.c @@ -0,0 +1,113 @@ +/**************************************************************************** + * boards/arm/imxrt/imxrt1052-ok/kernel/imxrt_userspace.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include +#include +#include + +#if defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__) + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Configuration ************************************************************/ + +#ifndef CONFIG_NUTTX_USERSPACE +# error "CONFIG_NUTTX_USERSPACE not defined" +#endif + +#if CONFIG_NUTTX_USERSPACE != 0x60200000 +# error "CONFIG_NUTTX_USERSPACE must be 0x60200000 to match user-space.ld" +#endif + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/* These 'addresses' of these values are setup by the linker script. + * They are not actual uint32_t storage locations! + * They are only used meaningfully in the following way: + * + * - The linker script defines, for example, the symbol_sdata. + * - The declareion extern uint32_t _sdata; makes C happy. C will believe + * that the value _sdata is the address of a uint32_t variable _data (it + * is not!). + * - We can recoved the linker value then by simply taking the address of + * of _data. like: uint32_t *pdata = &_sdata; + */ + +extern uint32_t _stext; /* Start of .text */ +extern uint32_t _etext; /* End_1 of .text + .rodata */ +extern const uint32_t _eronly; /* End+1 of read only section (.text + .rodata) */ +extern uint32_t _sdata; /* Start of .data */ +extern uint32_t _edata; /* End+1 of .data */ +extern uint32_t _sbss; /* Start of .bss */ +extern uint32_t _ebss; /* End+1 of .bss */ + +/* This is the user space entry point */ + +int CONFIG_USER_ENTRYPOINT(int argc, char *argv[]); + +const struct userspace_s userspace locate_data(".userspace") = +{ + /* General memory map */ + + .us_entrypoint = (main_t)CONFIG_USER_ENTRYPOINT, + .us_textstart = (uintptr_t)&_stext, + .us_textend = (uintptr_t)&_etext, + .us_datasource = (uintptr_t)&_eronly, + .us_datastart = (uintptr_t)&_sdata, + .us_dataend = (uintptr_t)&_edata, + .us_bssstart = (uintptr_t)&_sbss, + .us_bssend = (uintptr_t)&_ebss, + + /* Memory manager heap structure */ + + .us_heap = &g_mmheap, + + /* Task/thread startup routines */ + + .task_startup = nxtask_startup, + + /* Signal handler trampoline */ + + .signal_handler = up_signal_handler, + + /* User-space work queue support (declared in include/nuttx/wqueue.h) */ + +#ifdef CONFIG_LIBC_USRWORK + .work_usrstart = work_usrstart, +#endif +}; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +#endif /* CONFIG_BUILD_PROTECTED && !__KERNEL__ */ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/Make.defs b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/Make.defs new file mode 100644 index 000000000..431e865cd --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/Make.defs @@ -0,0 +1,75 @@ +############################################################################ +# boards/arm/imxrt/imxrt1052-ok/scripts/Make.defs +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +############################################################################ + +include $(TOPDIR)/.config +include $(TOPDIR)/tools/Config.mk +include $(TOPDIR)/arch/arm/src/armv7-m/Toolchain.defs + +ifeq ($(CONFIG_ARMV7M_DTCM),y) + LDSCRIPT = flash-dtcm.ld +else + LDSCRIPT = flash-ocram.ld +endif + +ifeq ($(CONFIG_CYGWIN_WINTOOL),y) + ARCHSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)}" +else + ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT) +endif + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + ARCHOPTIMIZATION = -g +endif + +ifneq ($(CONFIG_DEBUG_NOOPT),y) + ARCHOPTIMIZATION += $(MAXOPTIMIZATION) +endif + +ARCHCFLAGS = -fno-builtin +ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new -fno-rtti +ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -fno-strict-aliasing +ARCHWARNINGSXX = -Wall -Wshadow -Wundef +ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10 + +CFLAGS := $(APPPATHS) $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe +CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) +CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe +CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS) +CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) +AFLAGS := $(CFLAGS) -D__ASSEMBLY__ + +NXFLATLDFLAGS1 = -r -d -warn-common +NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections +LDNXFLATFLAGS = -e main -s 2048 + +# Loadable module definitions + +CMODULEFLAGS = $(CFLAGS) -mlong-calls # --target1-abs + +LDMODULEFLAGS = -r -e module_initialize +ifeq ($(CONFIG_CYGWIN_WINTOOL),y) + LDMODULEFLAGS += -T "${shell cygpath -w $(TOPDIR)/libs/libc/modlib/gnu-elf.ld}" +else + LDMODULEFLAGS += -T $(TOPDIR)/libs/libc/modlib/gnu-elf.ld +endif + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + LDFLAGS += -g +endif diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/flash-ocram.ld b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/flash-ocram.ld new file mode 100644 index 000000000..4cd8da676 --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/flash-ocram.ld @@ -0,0 +1,140 @@ +/**************************************************************************** + * boards/arm/imxrt/imxrt1052-ok/scripts/flash-ocram.ld + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/* Specify the memory areas */ + +MEMORY +{ + flash (rx) : ORIGIN = 0x60000000, LENGTH = 0x04000000 + sram (rwx) : ORIGIN = 0x20200000, LENGTH = 0x00080000 + itcm (rwx) : ORIGIN = 0x00000000, LENGTH = 0x00020000 + dtcm (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00020000 +} + +OUTPUT_ARCH(arm) +EXTERN(_vectors) +EXTERN(g_flash_config) +EXTERN(g_image_vector_table) +EXTERN(g_boot_data) +EXTERN(g_dcd_data) + +ENTRY(_stext) + +SECTIONS +{ + /* Image Vector Table and Boot Data for booting from external flash */ + + .boot_hdr : ALIGN(4) + { + FILL(0xff) + __boot_hdr_start__ = ABSOLUTE(.) ; + KEEP(*(.boot_hdr.conf)) + . = 0x1000 ; + KEEP(*(.boot_hdr.ivt)) + . = 0x1020 ; + KEEP(*(.boot_hdr.boot_data)) + . = 0x1030 ; + KEEP(*(.boot_hdr.dcd_data)) + __boot_hdr_end__ = ABSOLUTE(.) ; + . = 0x2000 ; + } >flash + + .text : + { + _stext = ABSOLUTE(.); + *(.vectors) + *(.text .text.*) + *(.fixup) + *(.gnu.warning) + *(.rodata .rodata.*) + *(.gnu.linkonce.t.*) + *(.glue_7) + *(.glue_7t) + *(.got) + *(.gcc_except_table) + *(.gnu.linkonce.r.*) + _etext = ABSOLUTE(.); + } > flash + + .init_section : + { + _sinit = ABSOLUTE(.); + *(.init_array .init_array.*) + _einit = ABSOLUTE(.); + } > flash + + .ARM.extab : + { + *(.ARM.extab*) + } > flash + + .ARM.exidx : + { + __exidx_start = ABSOLUTE(.); + *(.ARM.exidx*) + __exidx_end = ABSOLUTE(.); + } > flash + + _eronly = ABSOLUTE(.); + + .data : + { + _sdata = ABSOLUTE(.); + *(.data .data.*) + *(.gnu.linkonce.d.*) + CONSTRUCTORS + . = ALIGN(4); + _edata = ABSOLUTE(.); + } > sram AT > flash + + .ramfunc ALIGN(4): + { + _sramfuncs = ABSOLUTE(.); + *(.ramfunc .ramfunc.*) + _eramfuncs = ABSOLUTE(.); + } > sram AT > flash + + _framfuncs = LOADADDR(.ramfunc); + + .bss : + { + _sbss = ABSOLUTE(.); + *(.bss .bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + . = ALIGN(4); + _ebss = ABSOLUTE(.); + } > sram + + /* Stabs debugging sections. */ + + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_info 0 : { *(.debug_info) } + .debug_line 0 : { *(.debug_line) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_aranges 0 : { *(.debug_aranges) } +} diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/kernel-space.ld b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/kernel-space.ld new file mode 100644 index 000000000..b50660936 --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/kernel-space.ld @@ -0,0 +1,104 @@ +/**************************************************************************** + * boards/arm/imxrt/imxrt1052-ok/scripts/kernel-space.ld + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/* NOTE: This depends on the memory.ld script having been included prior to + * this script. + */ + +OUTPUT_ARCH(arm) +EXTERN(_vectors) +ENTRY(_stext) + +SECTIONS +{ + .text : + { + _stext = ABSOLUTE(.); + *(.vectors) + *(.text .text.*) + *(.fixup) + *(.gnu.warning) + *(.rodata .rodata.*) + *(.gnu.linkonce.t.*) + *(.glue_7) + *(.glue_7t) + *(.got) + *(.gcc_except_table) + *(.gnu.linkonce.r.*) + _etext = ABSOLUTE(.); + } > kflash + + .init_section : + { + _sinit = ABSOLUTE(.); + KEEP(*(.init_array .init_array.*)) + _einit = ABSOLUTE(.); + } > kflash + + .ARM.extab : + { + *(.ARM.extab*) + } > kflash + + __exidx_start = ABSOLUTE(.); + .ARM.exidx : + { + *(.ARM.exidx*) + } > kflash + + __exidx_end = ABSOLUTE(.); + + _eronly = ABSOLUTE(.); + + .data : + { + _sdata = ABSOLUTE(.); + *(.data .data.*) + *(.gnu.linkonce.d.*) + CONSTRUCTORS + . = ALIGN(4); + _edata = ABSOLUTE(.); + } > kocram AT > kflash + + .bss : + { + _sbss = ABSOLUTE(.); + *(.bss .bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + . = ALIGN(4); + _ebss = ABSOLUTE(.); + } > kocram + + /* Stabs debugging sections */ + + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_info 0 : { *(.debug_info) } + .debug_line 0 : { *(.debug_line) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_aranges 0 : { *(.debug_aranges) } +} diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/memory.ld b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/memory.ld new file mode 100644 index 000000000..6486acda5 --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/memory.ld @@ -0,0 +1,67 @@ +/**************************************************************************** + * boards/arm/imxrt/imxrt1052-ok/scripts/memory.ld + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/* The i.MXRT1050-EVK has 64Mb of Hyper FLASH beginning at address, + * 0x0060:0000, 512Kb of DTCM RAM beginning at 0x2000:0000, and 512Kb OCRAM + * beginning at 0x2020:0000. Neither DTCM or SDRAM are used in this + * configuration. + * + * The user and kernel space partitions will be spanned with a single + * region of size 2**n bytes. As a consequence, as the partitions increase + * in size, the alignment requirement also increases. The sizes below give + * the largest possible user address spaces (but leave far too much for the + * OS). + * + * The solution to this wasted memory is to (1) use more than one region to + * span the user spaces, or (2) poke holes in a larger region (via sub- + * regions) to trim it to fit better. + * + * A detailed memory map for the 512KB SRAM region is as follows: + * + * 0x2020 0000: Kernel .data region. Typical size: 0.1KB + * ------ ---- Kernel .bss region. Typical size: 1.8KB + * 0x2020 0800: Kernel IDLE thread stack (approximate). Size is + * determined by CONFIG_IDLETHREAD_STACKSIZE and + * adjustments for alignment. Typical is 1KB. + * ------ ---- Padded to 4KB + * 0x2040 0000: User .data region. Size is variable. + * ------- ---- User .bss region Size is variable. + * 0x2042 0000: Beginning of kernel heap. Size determined by + * CONFIG_MM_KERNEL_HEAPSIZE. + * ------ ---- Beginning of user heap. Can vary with other settings. + * 0x2080 0000: End+1 of mappable OCRAM + */ + +/* Specify the memory areas */ + +MEMORY +{ + /* 64Mb of HyperFLASH */ + + kflash (rx) : ORIGIN = 0x60000000, LENGTH = 1M + uflash (rx) : ORIGIN = 0x60200000, LENGTH = 1M + flash (rx) : ORIGIN = 0x60400000, LENGTH = 62M + + /* 512Kb of OCRAM */ + + dtcm (rwx) : ORIGIN = 0x20000000, LENGTH = 512K + kocram (rwx) : ORIGIN = 0x20200000, LENGTH = 256K + uocram (rwx) : ORIGIN = 0x20240000, LENGTH = 256K +} diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/user-space.ld b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/user-space.ld new file mode 100644 index 000000000..5eb3f32dd --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/user-space.ld @@ -0,0 +1,118 @@ +/**************************************************************************** + * boards/arm/imxrt/imxrt1052-ok/scripts/user-space.ld + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/* NOTE: This depends on the memory.ld script having been included prior to + * this script. + */ + +/* Make sure that the critical memory management functions are in user-space. + * the user heap memory manager will reside in user-space but be usable both + * by kernel- and user-space code + */ + +EXTERN(umm_initialize) +EXTERN(umm_addregion) + +EXTERN(malloc) +EXTERN(realloc) +EXTERN(zalloc) +EXTERN(free) + +OUTPUT_ARCH(arm) +SECTIONS +{ + .userspace : + { + *(.userspace) + } > uflash + + .text : + { + _stext = ABSOLUTE(.); + *(.text .text.*) + *(.fixup) + *(.gnu.warning) + *(.rodata .rodata.*) + *(.gnu.linkonce.t.*) + *(.glue_7) + *(.glue_7t) + *(.got) + *(.gcc_except_table) + *(.gnu.linkonce.r.*) + _etext = ABSOLUTE(.); + } > uflash + + .init_section : + { + _sinit = ABSOLUTE(.); + KEEP(*(.init_array .init_array.*)) + _einit = ABSOLUTE(.); + } > uflash + + .ARM.extab : + { + *(.ARM.extab*) + } > uflash + + __exidx_start = ABSOLUTE(.); + .ARM.exidx : + { + *(.ARM.exidx*) + } > uflash + + __exidx_end = ABSOLUTE(.); + + _eronly = ABSOLUTE(.); + + .data : + { + _sdata = ABSOLUTE(.); + *(.data .data.*) + *(.gnu.linkonce.d.*) + CONSTRUCTORS + . = ALIGN(4); + _edata = ABSOLUTE(.); + } > uocram AT > uflash + + .bss : + { + _sbss = ABSOLUTE(.); + *(.bss .bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + . = ALIGN(4); + _ebss = ABSOLUTE(.); + } > uocram + + /* Stabs debugging sections */ + + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_info 0 : { *(.debug_info) } + .debug_line 0 : { *(.debug_line) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_aranges 0 : { *(.debug_aranges) } +} diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/Makefile b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/Makefile new file mode 100644 index 000000000..b3d3dcf44 --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/Makefile @@ -0,0 +1,69 @@ +############################################################################ +# boards/arm/imxrt/imxrt1052-ok/src/Makefile +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +############################################################################ + +include $(TOPDIR)/Make.defs + +CSRCS = imxrt_boot.c imxrt_flexspi_nor_boot.c imxrt_flexspi_nor_flash.c + +ifeq ($(CONFIG_IMXRT_SDRAMC),y) +CSRCS += imxrt_sdram.c +endif + +ifeq ($(CONFIG_BOARDCTL),y) +CSRCS += imxrt_appinit.c imxrt_bringup.c +else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y) +CSRCS += imxrt_bringup.c +endif + +ifeq ($(CONFIG_ARCH_LEDS),y) +CSRCS += imxrt_autoleds.c +else +CSRCS += imxrt_userleds.c +endif + +ifeq ($(CONFIG_ARCH_BUTTONS),y) +CSRCS += imxrt_buttons.c +endif + +ifeq ($(CONFIG_IMXRT_ENET),y) +CSRCS += imxrt_ethernet.c +endif + +ifeq ($(CONFIG_IMXRT_LPSPI),y) +CSRCS += imxrt_spi.c +endif + +ifeq ($(CONFIG_IMXRT_LCD),y) +CSRCS += imxrt_lcd.c +endif + +ifeq ($(CONFIG_MMCSD_SPI),y) +CSRCS += imxrt_mmcsd_spi.c +endif + +ifeq ($(CONFIG_DEV_GPIO),y) +CSRCS += imxrt_gpio.c +endif + +ifeq ($(CONFIG_IMXRT1052_OK_SDRAM),y) +CSRCS += imxrt_sdram_ini_dcd.c +endif + +include $(TOPDIR)/boards/Board.mk diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt1052-ok.h b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt1052-ok.h new file mode 100644 index 000000000..8407404e2 --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt1052-ok.h @@ -0,0 +1,193 @@ +/**************************************************************************** + * boards/arm/imxrt/imxrt1052-ok/src/imxrt1052-ok.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __BOARDS_ARM_IMXRT_IMXRT1052_OK_SRC_IMXRT1052_OK_H +#define __BOARDS_ARM_IMXRT_IMXRT1052_OK_SRC_IMXRT1052_OK_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include +#include + +#include "imxrt_gpio.h" +#include "imxrt_iomuxc.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* LEDs */ + +#define GPIO_LED (GPIO_OUTPUT | IOMUX_LED_DEFAULT | \ + GPIO_OUTPUT_ZERO | GPIO_PORT1 | GPIO_PIN9) /* AD_BO_09 */ + +/* Buttons ******************************************************************/ + +#define GPIO_SW8 (GPIO_INTERRUPT | GPIO_INT_FALLINGEDGE | \ + IOMUX_SW_DEFAULT | \ + GPIO_PORT5 | GPIO_PIN0 | ) /* WAKEUP */ + +/* Test Pins ****************************************************************/ + +#define BOARD_NGPIOIN 0 /* Amount of GPIO Input pins */ +#define BOARD_NGPIOOUT 4 /* Amount of GPIO Output pins */ +#define BOARD_NGPIOINT 0 /* Amount of GPIO Input w/ Interruption pins */ + +#define GPIO_GOUT1 (GPIO_OUTPUT | GPIO_OUTPUT_ZERO | IOMUX_GOUT_DEFAULT | \ + GPIO_PORT1 | GPIO_PIN19) + +#define GPIO_GOUT2 (GPIO_OUTPUT | GPIO_OUTPUT_ZERO | IOMUX_GOUT_DEFAULT | \ + GPIO_PIN18 | GPIO_PORT1) + +#define GPIO_GOUT3 (GPIO_OUTPUT | GPIO_OUTPUT_ZERO | IOMUX_GOUT_DEFAULT | \ + GPIO_PIN10 | GPIO_PORT1) + +#define GPIO_GOUT4 (GPIO_OUTPUT | GPIO_OUTPUT_ZERO | IOMUX_GOUT_DEFAULT | \ + GPIO_PIN9 | GPIO_PORT1) + +/* Backlight */ + +#define GPIO_LCD_BL (GPIO_OUTPUT | GPIO_OUTPUT_ZERO | GPIO_PORT2 | \ + GPIO_PIN31 | IOMUX_LCD_BL_DEFAULT) + +/* Ethernet */ + +#define GPIO_ENET_INT (IOMUX_ENET_INT_DEFAULT | \ + GPIO_PORT1 | GPIO_PIN10) /* AD_B0_10 */ +#define GPIO_ENET_IRQ IMXRT_IRQ_GPIO1_10 +#define GPIO_ENET_RST (GPIO_OUTPUT | GPIO_OUTPUT_ZERO | \ + GPIO_PORT1 | GPIO_PIN9 | IOMUX_ENET_RST_DEFAULT) + +#ifdef CONFIG_ETH0_PHY_KSZ8081 +#ifdef GPIO_LED +#warning LED interferes with ETH reset unless R323 is removed. +#endif +#endif + +/* LPSPI CS: */ + +#define IOMUX_LPSPI3_CS (IOMUX_SLEW_FAST | IOMUX_DRIVE_50OHM | \ + IOMUX_SPEED_MEDIUM | IOMUX_PULL_UP_100K | \ + _IOMUX_PULL_ENABLE) +#define GPIO_LPSPI3_CS (GPIO_OUTPUT | GPIO_OUTPUT_ONE | \ + GPIO_PORT1 | GPIO_PIN3 | IOMUX_LPSPI3_CS) /* GPIO_AD_B0_03 */ + +/* LPSPI1 CS: GPIO_SD_B0_01 */ + +#define IOMUX_LPSPI1_CS (IOMUX_SLEW_FAST | IOMUX_DRIVE_50OHM | \ + IOMUX_SPEED_MEDIUM | IOMUX_PULL_UP_100K | \ + _IOMUX_PULL_ENABLE) +#define GPIO_LPSPI1_CS (GPIO_OUTPUT | GPIO_OUTPUT_ONE | \ + GPIO_PORT3 | GPIO_PIN13 | IOMUX_LPSPI1_CS) + +#define IOMUX_MMCSD_EN (IOMUX_SLEW_FAST | IOMUX_DRIVE_50OHM | \ + IOMUX_SPEED_MEDIUM | IOMUX_PULL_UP_100K | \ + _IOMUX_PULL_ENABLE) +#define GPIO_MMCSD_EN (GPIO_OUTPUT | GPIO_OUTPUT_ZERO | \ + GPIO_PORT3 | GPIO_PIN2 | IOMUX_MMCSD_EN) + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +/**************************************************************************** + * Public Functions Definitions + ****************************************************************************/ + +/**************************************************************************** + * Name: imxrt_bringup + * + * Description: + * Bring up board features + * + ****************************************************************************/ + +#if defined(CONFIG_BOARDCTL) || defined(CONFIG_BOARD_LATE_INITIALIZE) +int imxrt_bringup(void); +#endif + +/**************************************************************************** + * Name: imxrt_spidev_initialize + * + * Description: + * Called to configure SPI chip select GPIO pins for the i.MXRT1050 EVK. + * + ****************************************************************************/ + +void imxrt_spidev_initialize(void); + +/**************************************************************************** + * Name: imxrt_mmcsd_spi_initialize + * + * Description: + * Initialize SPI-based SD card and card detect thread. + * + ****************************************************************************/ + +#ifdef CONFIG_MMCSD_SPI +int imxrt_mmcsd_spi_initialize(int minor); +#endif + +/**************************************************************************** + * Name: imxrt_autoled_initialize + * + * Description: + * Initialize NuttX-controlled LED logic + * + * Input Parameters: + * None + * + * Returned Value: + * None + * + ****************************************************************************/ + +#ifdef CONFIG_ARCH_LEDS +void imxrt_autoled_initialize(void); +#endif + +#ifdef CONFIG_DEV_GPIO + +/**************************************************************************** + * Name: imxrt_gpio_initialize + * + * Description: + * Initialize GPIO drivers for use with /apps/examples/gpio + * + ****************************************************************************/ + +int imxrt_gpio_initialize(void); +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_ARM_IMXRT_IMXRT1052_OK_SRC_IMXRT1052_OK_H */ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_appinit.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_appinit.c new file mode 100644 index 000000000..bdd387ae4 --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_appinit.c @@ -0,0 +1,75 @@ +/**************************************************************************** + * boards/arm/imxrt/imxrt1052-ok/src/imxrt_appinit.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include + +#include "imxrt1052-ok.h" + +#ifdef CONFIG_BOARDCTL + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_app_initialize + * + * Description: + * Perform application specific initialization. This function is never + * called directly from application code, but only indirectly via the + * (non-standard) boardctl() interface using the command BOARDIOC_INIT. + * + * Input Parameters: + * arg - The boardctl() argument is passed to the board_app_initialize() + * implementation without modification. The argument has no + * meaning to NuttX; the meaning of the argument is a contract + * between the board-specific initialization logic and the + * matching application logic. The value could be such things as a + * mode enumeration value, a set of DIP switch switch settings, a + * pointer to configuration data read from a file or serial FLASH, + * or whatever you would like to do with it. Every implementation + * should accept zero/NULL as a default configuration. + * + * Returned Value: + * Zero (OK) is returned on success; a negated errno value is returned on + * any failure to indicate the nature of the failure. + * + ****************************************************************************/ + +int board_app_initialize(uintptr_t arg) +{ +#ifndef CONFIG_BOARD_LATE_INITIALIZE + /* Perform board initialization */ + + return imxrt_bringup(); +#else + return OK; +#endif +} + +#endif /* CONFIG_BOARDCTL */ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_autoleds.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_autoleds.c new file mode 100644 index 000000000..0b18c711f --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_autoleds.c @@ -0,0 +1,166 @@ +/**************************************************************************** + * boards/arm/imxrt/imxrt1052-ok/src/imxrt_autoleds.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/* There are four LED status indicators located on the EVK Board. The + * functions of these LEDs include: + * + * - Main Power Supply(D3) + * Green: DC 5V main supply is normal. + * Red: J2 input voltage is over 5.6V. + * Off: The board is not powered. + * - Reset RED LED(D15) + * - OpenSDA LED(D16) + * - USER LED(D18) + * + * Only a single LED, D18, is under software control. + * + * This LED is not used by the board port unless CONFIG_ARCH_LEDS is + * defined. In that case, the usage by the board port is defined in + * include/board.h and src/imxrt_autoleds.c. The LED is used to encode + * OS-related events as follows: + * + * -------------------- ----------------------- ------ + * SYMBOL Meaning LED + * -------------------- ----------------------- ------ + * + * LED_STARTED 0 NuttX has been started OFF + * LED_HEAPALLOCATE 0 Heap has been allocated OFF + * LED_IRQSENABLED 0 Interrupts enabled OFF + * LED_STACKCREATED 1 Idle stack created ON + * LED_INIRQ 2 In an interrupt N/C + * LED_SIGNAL 2 In a signal handler N/C + * LED_ASSERTION 2 An assertion failed N/C + * LED_PANIC 3 The system has crashed FLASH + * LED_IDLE Not used + * + * Thus if the LED is statically on, NuttX has successfully booted and is, + * apparently, running normally. If the LED is flashing at approximately + * 2Hz, then a fatal error has been detected and the system has halted. + */ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include "imxrt_gpio.h" +#include "imxrt_iomuxc.h" +#include "imxrt1052-ok.h" + +#include + +#ifdef CONFIG_ARCH_LEDS + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: imxrt_autoled_initialize + * + * Description: + * Initialize NuttX-controlled LED logic + * + * Input Parameters: + * None + * + * Returned Value: + * None + * + ****************************************************************************/ + +void imxrt_autoled_initialize(void) +{ + /* Configure LED GPIO for output */ + + imxrt_config_gpio(GPIO_LED); +} + +/**************************************************************************** + * Name: board_autoled_on + * + * Description: + * Turn on the "logical" LED state + * + * Input Parameters: + * led - Identifies the "logical" LED state (see definitions in + * include/board.h) + * + * Returned Value: + * None + * + ****************************************************************************/ + +void board_autoled_on(int led) +{ + bool ledoff = false; + + switch (led) + { + case 0: /* LED Off */ + ledoff = true; + break; + + case 2: /* LED No change */ + return; + + case 1: /* LED On */ + case 3: /* LED On */ + break; + } + + imxrt_gpio_write(GPIO_LED, ledoff); /* Low illuminates */ +} + +/**************************************************************************** + * Name: board_autoled_off + * + * Description: + * Turn off the "logical" LED state + * + * Input Parameters: + * led - Identifies the "logical" LED state (see definitions in + * include/board.h) + * + * Returned Value: + * None + * + ****************************************************************************/ + +void board_autoled_off(int led) +{ + switch (led) + { + case 0: /* LED Off */ + case 1: /* LED Off */ + case 3: /* LED Off */ + break; + + case 2: /* LED No change */ + return; + } + + imxrt_gpio_write(GPIO_LED, true); /* Low illuminates */ +} + +#endif /* CONFIG_ARCH_LEDS */ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_boot.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_boot.c new file mode 100644 index 000000000..813931cdf --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_boot.c @@ -0,0 +1,77 @@ +/**************************************************************************** + * boards/arm/imxrt/imxrt1052-ok/src/imxrt_boot.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include "imxrt_start.h" +#include "imxrt1052-ok.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: imxrt_boardinitialize + * + * Description: + * All i.MX RT architectures must provide the following entry point. This + * entry point is called early in the initialization -- after clocking and + * memory have been configured but before caches have been enabled and + * before any devices have been initialized. + * + ****************************************************************************/ + +void imxrt_boardinitialize(void) +{ + /* Configure on-board LEDs if LED support has been selected. */ + +#ifdef CONFIG_ARCH_LEDS + imxrt_autoled_initialize(); +#endif +} + +/**************************************************************************** + * Name: board_late_initialize + * + * Description: + * If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional + * initialization call will be performed in the boot-up sequence to a + * function called board_late_initialize(). board_late_initialize() will be + * called immediately after up_intitialize() is called and just before the + * initial application is started. This additional initialization phase + * may be used, for example, to initialize board-specific device drivers. + * + ****************************************************************************/ + +#ifdef CONFIG_BOARD_LATE_INITIALIZE +void board_late_initialize(void) +{ + /* Perform board initialization */ + + imxrt_bringup(); +} +#endif /* CONFIG_BOARD_LATE_INITIALIZE */ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_bringup.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_bringup.c new file mode 100644 index 000000000..85f05794d --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_bringup.c @@ -0,0 +1,190 @@ +/**************************************************************************** + * boards/arm/imxrt/imxrt1052-ok/src/imxrt_bringup.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#ifdef CONFIG_IMXRT_USDHC +# include "imxrt_usdhc.h" +#endif + +#include "imxrt1052-ok.h" + +#include /* Must always be included last */ + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Checking needed by MMC/SDCard */ + +#ifdef CONFIG_NSH_MMCSDMINOR +# define MMCSD_MINOR CONFIG_NSH_MMCSDMINOR +#else +# define MMCSD_MINOR 0 +#endif + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +#if defined(CONFIG_I2C_DRIVER) && defined(CONFIG_IMXRT_LPI2C) +static void imxrt_i2c_register(int bus) +{ + FAR struct i2c_master_s *i2c; + int ret; + + i2c = imxrt_i2cbus_initialize(bus); + if (i2c == NULL) + { + serr("ERROR: Failed to get I2C%d interface\n", bus); + } + else + { + ret = i2c_register(i2c, bus); + if (ret < 0) + { + serr("ERROR: Failed to register I2C%d driver: %d\n", bus, ret); + imxrt_i2cbus_uninitialize(i2c); + } + } +} +#endif + +#ifdef CONFIG_IMXRT_USDHC +static int nsh_sdmmc_initialize(void) +{ + struct sdio_dev_s *sdmmc; + int ret = 0; + + /* Get an instance of the SDIO interface */ + + sdmmc = imxrt_usdhc_initialize(0); + if (!sdmmc) + { + syslog(LOG_ERR, "ERROR: Failed to initialize SD/MMC\n"); + } + else + { + /* Bind the SDIO interface to the MMC/SD driver */ + + ret = mmcsd_slotinitialize(0, sdmmc); + if (ret != OK) + { + syslog(LOG_ERR, + "ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", + ret); + } + } + + return OK; +} +#else +# define nsh_sdmmc_initialize() (OK) +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: imxrt_bringup + * + * Description: + * Bring up board features + * + ****************************************************************************/ + +int imxrt_bringup(void) +{ + int ret; + + /* If we got here then perhaps not all initialization was successful, but + * at least enough succeeded to bring-up NSH with perhaps reduced + * capabilities. + */ + +#ifdef CONFIG_FS_PROCFS + /* Mount the procfs file system */ + + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); + } +#endif + +#if defined(CONFIG_I2C_DRIVER) && defined(CONFIG_IMXRT_LPI2C1) + imxrt_i2c_register(1); +#endif + +#ifdef CONFIG_IMXRT_USDHC + /* Initialize SDHC-base MMC/SD card support */ + + nsh_sdmmc_initialize(); +#endif + +#ifdef CONFIG_MMCSD_SPI + /* Initialize SPI-based MMC/SD card support */ + + imxrt_spidev_initialize(); + + ret = imxrt_mmcsd_spi_initialize(MMCSD_MINOR); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to initialize SD slot %d: %d\n", ret); + } +#endif + +#ifdef CONFIG_DEV_GPIO + ret = imxrt_gpio_initialize(); + if (ret < 0) + { + syslog(LOG_ERR, "Failed to initialize GPIO Driver: %d\n", ret); + return ret; + } +#endif + +#ifdef CONFIG_VIDEO_FB + /* Initialize and register the framebuffer driver */ + + ret = fb_register(0, 0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: fb_register() failed: %d\n", ret); + } +#endif + + UNUSED(ret); + return OK; +} diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_buttons.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_buttons.c new file mode 100644 index 000000000..f6c3b2b30 --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_buttons.c @@ -0,0 +1,129 @@ +/**************************************************************************** + * boards/arm/imxrt/imxrt1052-ok/src/imxrt_buttons.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include +#include +#include + +#include "arm_arch.h" + +#include "imxrt_config.h" +#include "imxrt_irq.h" +#include "imxrt_gpio.h" +#include "imxrt1052-ok.h" + +#ifdef CONFIG_ARCH_BUTTONS + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* The IMXRT has 1 user button (SW8)): + * + * 1. SW8 (IRQ88) GPIO5-00 + */ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_button_initialize + * + * Description: + * board_button_initialize() must be called to initialize button resources. + * After that, board_buttons() may be called to collect the current state + * of all buttons or board_button_irq() may be called to register button + * interrupt handlers. + * + ****************************************************************************/ + +uint32_t board_button_initialize(void) +{ + /* Configure the button as input */ + + imxrt_config_gpio(GPIO_SW8); + return 1; +} + +/**************************************************************************** + * Name: board_buttons + * + * Description: + * After board_button_initialize() has been called, board_buttons() may be + * called to collect the state of all buttons. board_buttons() returns an + * 8-bit bit set with each bit associated with a button. See the + * BUTTON_*_BIT definitions in board.h for the meaning of each bit. + * + ****************************************************************************/ + +uint8_t board_buttons(void) +{ + uint8_t ret = 0; + + if (!imxrt_gpio_read(GPIO_SW8)) + { + ret |= BUTTON_SW8_BIT; + } + + return ret; +} + +/**************************************************************************** + * Name: board_button_irq + * + * Description: + * board_button_irq() may be called to register an interrupt handler that + * will be called when a button is depressed or released. The ID value is + * a button enumeration value that uniquely identifies a button resource. + * See the BUTTON_* definitions in board.h for the meaning of enumeration + * value. + * + ****************************************************************************/ + +#ifdef CONFIG_ARCH_IRQBUTTONS +int board_button_irq(int id, xcpt_t irqhandler) +{ + int ret = -EINVAL; + + /* The button has already been configured as an interrupting input (by + * board_button_initialize() above). + * + * Attach the new button handler. + */ + + ret = irq_attach(id, irqhandler, NULL); + + /* Then make sure that interrupts are enabled on the pin */ + + up_enable_irq(id); + return ret; +} +#endif +#endif /* CONFIG_ARCH_BUTTONS */ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_ethernet.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_ethernet.c new file mode 100644 index 000000000..958aa2414 --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_ethernet.c @@ -0,0 +1,284 @@ +/**************************************************************************** + * boards/arm/imxrt/imxrt1052-ok/src/imxrt_ethernet.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/* Force verbose debug on in this file only to support unit-level testing. */ + +#ifdef CONFIG_NETDEV_PHY_DEBUG +# undef CONFIG_DEBUG_INFO +# define CONFIG_DEBUG_INFO 1 +# undef CONFIG_DEBUG_NET +# define CONFIG_DEBUG_NET 1 +#endif + +#include +#include +#include +#include + +#include +#include +#include + +#include "imxrt_gpio.h" +#include "imxrt_enet.h" + +#include "imxrt1052-ok.h" + +#include + +#ifdef CONFIG_IMXRT_ENET + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define IMXRT_ENET_DEVNAME "eth0" + +/* Debug ********************************************************************/ + +/* Extra, in-depth debug output that is only available if + * CONFIG_NETDEV_PHY_DEBUG us defined. + */ + +#ifdef CONFIG_NETDEV_PHY_DEBUG +# define phyerr _err +# define phywarn _warn +# define phyinfo _info +#else +# define phyerr(x...) +# define phywarn(x...) +# define phyinfo(x...) +#endif + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: imxrt_enet_phy_enable + ****************************************************************************/ + +#ifdef CONFIG_IMXRT_GPIO1_0_15_IRQ +static void imxrt_enet_phy_enable(bool enable) +{ + phyinfo("IRQ%d: enable=%d\n", GPIO_ENET_INT, enable); + + if (enable) + { + up_enable_irq(GPIO_ENET_IRQ); + } + else + { + up_disable_irq(GPIO_ENET_IRQ); + } +} +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Function: imxrt_phy_boardinitialize + * + * Description: + * Some boards require specialized initialization of the PHY before it can + * be used. + * This may include such things as configuring GPIOs, resetting the PHY, + * etc. + * If CONFIG_IMXRT_ENET_PHYINIT is defined in the configuration then the + * board specific logic must provide imxrt_phyinitialize(); + * The i.MX RT Ethernet driver will call this function one time before it + * first uses the PHY. + * + * Input Parameters: + * intf - Always zero for now. + * + * Returned Value: + * OK on success; Negated errno on failure. + * + ****************************************************************************/ + +int imxrt_phy_boardinitialize(int intf) +{ +#ifdef CONFIG_IMXRT_GPIO1_0_15_IRQ + /* Configure the PHY interrupt pin */ + + phyinfo("Configuring interrupt: %08x\n", GPIO_ENET_INT); + imxrt_config_gpio(GPIO_ENET_INT); +#endif + + /* Configure the PHY reset pin. + * + * The #RST uses inverted logic. The initial value of zero will put the + * PHY into the reset state. + */ +#ifdef GPIO_ENET_RST + /* On the EVK the RST pin is combined with LED, so sometimes can't be + * accessed. Only stress about it if we've got a definition. + */ + + phyinfo("Configuring reset: %08x\n", GPIO_ENET_RST); + imxrt_config_gpio(GPIO_ENET_RST); + + /* Take the PHY out of reset. */ + + imxrt_gpio_write(GPIO_ENET_RST, true); +#endif + return OK; +} + +/**************************************************************************** + * Name: arch_phy_irq + * + * Description: + * This function may be called to register an interrupt handler that will + * be called when a PHY interrupt occurs. This function both attaches + * the interrupt handler and enables the interrupt if 'handler' is non- + * NULL. If handler is NULL, then the interrupt is detached and disabled + * instead. + * + * The PHY interrupt is always disabled upon return. The caller must + * call back through the enable function point to control the state of + * the interrupt. + * + * This interrupt may or may not be available on a given platform depending + * on how the network hardware architecture is implemented. In a typical + * case, the PHY interrupt is provided to board-level logic as a GPIO + * interrupt (in which case this is a board-specific interface and really + * should be called board_phy_irq()); In other cases, the PHY interrupt + * may be cause by the chip's MAC logic (in which case arch_phy_irq()) is + * an appropriate name. Other other boards, there may be no PHY interrupts + * available at all. If client attachable PHY interrupts are available + * from the board or from the chip, then CONFIG_ARCH_PHY_INTERRUPT should + * be defined to indicate that fact. + * + * Typical usage: + * a. OS service logic (not application logic*) attaches to the PHY + * PHY interrupt and enables the PHY interrupt. + * b. When the PHY interrupt occurs: (1) the interrupt should be + * disabled and () work should be scheduled on the worker thread (or + * perhaps a dedicated application thread). + * c. That worker thread should use the SIOCGMIIPHY, SIOCGMIIREG, + * and SIOCSMIIREG ioctl calls** to communicate with the PHY, + * determine what network event took place (Link Up/Down?), and + * take the appropriate actions. + * d. It should then interact the PHY to clear any pending + * interrupts, then re-enable the PHY interrupt. + * + * * This is an OS internal interface and should not be used from + * application space. Rather applications should use the SIOCMIISIG + * ioctl to receive a signal when a PHY event occurs. + * ** This interrupt is really of no use if the Ethernet MAC driver + * does not support these ioctl calls. + * + * Input Parameters: + * intf - Identifies the network interface. For example "eth0". Only + * useful on platforms that support multiple Ethernet interfaces + * and, hence, multiple PHYs and PHY interrupts. + * handler - The client interrupt handler to be invoked when the PHY + * asserts an interrupt. Must reside in OS space, but can + * signal tasks in user space. A value of NULL can be passed + * in order to detach and disable the PHY interrupt. + * arg - The argument that will accompany the interrupt + * enable - A function pointer that be unused to enable or disable the + * PHY interrupt. + * + * Returned Value: + * Zero (OK) returned on success; a negated errno value is returned on + * failure. + * + ****************************************************************************/ + +#ifdef CONFIG_IMXRT_GPIO1_0_15_IRQ +int arch_phy_irq(FAR const char *intf, xcpt_t handler, void *arg, + phy_enable_t *enable) +{ + irqstate_t flags; + phy_enable_t enabler; + int irq; + + DEBUGASSERT(intf); + + ninfo("%s: handler=%p\n", intf, handler); + phyinfo("EMAC: devname=%s\n", IMXRT_ENET_DEVNAME); + + if (strcmp(intf, IMXRT_ENET_DEVNAME) == 0) + { + irq = GPIO_ENET_IRQ; + enabler = imxrt_enet_phy_enable; + } + else + { + nerr("ERROR: Unsupported interface: %s\n", intf); + return -EINVAL; + } + + /* Disable interrupts until we are done. This guarantees that the + * following operations are atomic. + */ + + flags = spin_lock_irqsave(NULL); + + /* Configure the interrupt */ + + if (handler) + { + /* The interrupt pin has already been configured as an interrupting + * input (by imxrt_phy_boardinitialize() above). + * + * Attach the new button handler. + */ + + phyinfo("Attach IRQ%d\n", irq); + irq_attach(irq, handler, arg); + } + else + { + phyinfo("Detach IRQ%d\n", irq); + irq_detach(irq); + enabler = NULL; + } + + /* Return with the interrupt disabled in either case */ + + up_disable_irq(GPIO_ENET_IRQ); + + /* Return the enabling function pointer */ + + if (enable) + { + *enable = enabler; + } + + /* Return the old handler (so that it can be restored) */ + + spin_unlock_irqrestore(NULL, flags); + return OK; +} +#endif /* CONFIG_IMXRT_GPIO1_0_15_IRQ */ + +#endif /* CONFIG_IMXRT_ENET */ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_boot.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_boot.c new file mode 100644 index 000000000..b727cf579 --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_boot.c @@ -0,0 +1,55 @@ +/**************************************************************************** + * boards/arm/imxrt/imxrt1052-ok/src/imxrt_flexspi_nor_boot.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include "imxrt_flexspi_nor_boot.h" + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +locate_data(".boot_hdr.ivt") +const struct ivt_s g_image_vector_table = +{ + IVT_HEADER, /* IVT Header */ + 0x60002000, /* Image Entry Function */ + IVT_RSVD, /* Reserved = 0 */ + (uint32_t)DCD_ADDRESS, /* Address where DCD information is stored */ + (uint32_t)BOOT_DATA_ADDRESS, /* Address where BOOT Data Structure is stored */ + (uint32_t)&g_image_vector_table, /* Pointer to IVT Self (absolute address */ + (uint32_t)CSF_ADDRESS, /* Address where CSF file is stored */ + IVT_RSVD /* Reserved = 0 */ +}; + +locate_data(".boot_hdr.boot_data") +const struct boot_data_s g_boot_data = +{ + FLASH_BASE, /* boot start location */ + (FLASH_END - FLASH_BASE), /* size */ + PLUGIN_FLAG, /* Plugin flag */ + 0xffffffff /* empty - extra data word */ +}; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_boot.h b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_boot.h new file mode 100644 index 000000000..807ab9b82 --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_boot.h @@ -0,0 +1,142 @@ +/**************************************************************************** + * boards/arm/imxrt/imxrt1052-ok/src/imxrt_flexspi_nor_boot.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __BOARDS_ARM_IMXRT_IMXRT1052_OK_SRC_IMXRT_FLEXSPI_NOR_BOOT_H +#define __BOARDS_ARM_IMXRT_IMXRT1052_OK_SRC_IMXRT_FLEXSPI_NOR_BOOT_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* IVT Data */ + +#define IVT_MAJOR_VERSION 0x4 +#define IVT_MAJOR_VERSION_SHIFT 0x4 +#define IVT_MAJOR_VERSION_MASK 0xf +#define IVT_MINOR_VERSION 0x1 +#define IVT_MINOR_VERSION_SHIFT 0x0 +#define IVT_MINOR_VERSION_MASK 0xf + +#define IVT_VERSION(major, minor) \ + ((((major) & IVT_MAJOR_VERSION_MASK) << IVT_MAJOR_VERSION_SHIFT) | \ + (((minor) & IVT_MINOR_VERSION_MASK) << IVT_MINOR_VERSION_SHIFT)) + +#define IVT_TAG_HEADER (0xd1) /* Image Vector Table */ +#define IVT_SIZE 0x2000 +#define IVT_PAR IVT_VERSION(IVT_MAJOR_VERSION, IVT_MINOR_VERSION) + +#define IVT_HEADER (IVT_TAG_HEADER | (IVT_SIZE << 8) | (IVT_PAR << 24)) +#define IVT_RSVD (uint32_t)(0x00000000) + +/* DCD Data */ + +#define DCD_TAG_HEADER (0xd2) +#define DCD_TAG_HEADER_SHIFT (24) +#define DCD_VERSION (0x40) +#define DCD_ARRAY_SIZE 1 + +#define FLASH_BASE 0x60000000 +#define FLASH_END 0x7f7fffff +#define SCLK 1 + +#ifdef CONFIG_IMXRT1052_OK_SDRAM +# define DCD_ADDRESS &g_dcd_data +#else +# define DCD_ADDRESS 0 +#endif + +#define BOOT_DATA_ADDRESS &g_boot_data +#define CSF_ADDRESS 0 +#define PLUGIN_FLAG (uint32_t)0 + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/* IVT Data */ + +struct ivt_s +{ + /* Header with tag #HAB_TAG_IVT, length and HAB version fields + * (see data) + */ + + uint32_t hdr; + + /* Absolute address of the first instruction to execute from the + * image + */ + + uint32_t entry; + + /* Reserved in this version of HAB: should be NULL. */ + + uint32_t reserved1; + + /* Absolute address of the image DCD: may be NULL. */ + + uint32_t dcd; + + /* Absolute address of the Boot Data: may be NULL, but not interpreted + * any further by HAB + */ + + uint32_t boot_data; + + /* Absolute address of the IVT. */ + + uint32_t self; + + /* Absolute address of the image CSF. */ + + uint32_t csf; + + /* Reserved in this version of HAB: should be zero. */ + + uint32_t reserved2; +}; + +/* Boot Data */ + +struct boot_data_s +{ + uint32_t start; /* boot start location */ + uint32_t size; /* size */ + uint32_t plugin; /* plugin flag - 1 if downloaded application is plugin */ + uint32_t placeholder; /* placeholder to make even 0x10 size */ +}; + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +extern const struct boot_data_s g_boot_data; + +#ifdef CONFIG_IMXRT1052_OK_SDRAM +extern const uint8_t g_dcd_data[]; +#endif + +#endif /* __BOARDS_ARM_IMXRT_IMXRT1052_OK_SRC_IMXRT_FLEXSPI_NOR_BOOT_H */ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_flash.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_flash.c new file mode 100644 index 000000000..0343860ab --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_flash.c @@ -0,0 +1,206 @@ +/**************************************************************************** + * boards/arm/imxrt/imxrt1052-ok/src/imxrt_flexspi_nor_flash.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include "imxrt_flexspi_nor_flash.h" + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#if defined (CONFIG_IMXRT1052_OK_HYPER_FLASH) +locate_data(".boot_hdr.conf") +const struct flexspi_nor_config_s g_flash_config = +{ + .mem_config = + { + .tag = FLEXSPI_CFG_BLK_TAG, + .version = FLEXSPI_CFG_BLK_VERSION, + .read_sample_clksrc = FLASH_READ_SAMPLE_CLK_EXT_INPUT_FROM_DQSPAD, + .cs_hold_time = 3u, + .cs_setup_time = 3u, + .column_address_width = 3u, + + /* Enable DDR mode, Word addassable, + * Safe configuration, Differential clock + */ + + .controller_misc_option = + (1u << FLEXSPIMISC_OFFSET_DDR_MODE_EN) | + (1u << FLEXSPIMISC_OFFSET_WORD_ADDRESSABLE_EN) | + (1u << FLEXSPIMISC_OFFSET_SAFECONFIG_FREQ_EN) | + (1u << FLEXSPIMISC_OFFSET_DIFFCLKEN), + .sflash_pad_type = SERIAL_FLASH_8PADS, + .serial_clk_freq = FLEXSPI_SERIAL_CLKFREQ_133MHz, + .sflash_a1size = 64u * 1024u * 1024u, + .data_valid_time = + { + 16u, 16u + }, + .lookup_table = + { + /* Read LUTs */ + + FLEXSPI_LUT_SEQ(CMD_DDR, + FLEXSPI_8PAD, 0xa0, RADDR_DDR, FLEXSPI_8PAD, 0x18), + FLEXSPI_LUT_SEQ(CADDR_DDR, + FLEXSPI_8PAD, 0x10, DUMMY_DDR, FLEXSPI_8PAD, 0x06), + FLEXSPI_LUT_SEQ(READ_DDR, + FLEXSPI_8PAD, 0x04, STOP, FLEXSPI_1PAD, 0x0), + }, + }, + .page_size = 512u, + .sector_size = 256u * 1024u, + .blocksize = 256u * 1024u, + .is_uniform_blocksize = 1, +}; + +#elif defined (CONFIG_IMXRT1052_OK_QSPI_FLASH) +locate_data(".boot_hdr.conf") +const struct flexspi_nor_config_s g_flash_config = +{ + .mem_config = + { + .tag = FLEXSPI_CFG_BLK_TAG, + .version = FLEXSPI_CFG_BLK_VERSION, + .read_sample_clksrc = FLASH_READ_SAMPLE_CLK_LOOPBACK_FROM_SCKPAD, + .cs_hold_time = 3u, + .cs_setup_time = 3u, + .column_address_width = 0u, + .device_type = FLEXSPI_DEVICE_TYPE_SERIAL_NOR, + .sflash_pad_type = SERIAL_FLASH_4PADS, + .serial_clk_freq = FLEXSPI_SERIAL_CLKFREQ_60MHz, + .sflash_a1size = 8u * 1024u * 1024u, + .data_valid_time = + { + 16u, 16u + }, + .lookup_table = + { + /* LUTs */ + + /* 0 Fast read Quad IO DTR Mode Operation in SPI Mode (normal read) */ + + FLEXSPI_LUT_SEQ(CMD_SDR, + FLEXSPI_1PAD, 0xed, RADDR_DDR, FLEXSPI_4PAD, 0x18), + FLEXSPI_LUT_SEQ(DUMMY_DDR, + FLEXSPI_4PAD, 0x0c, READ_DDR, FLEXSPI_4PAD, 0x08), + FLEXSPI_LUT_SEQ(STOP, + FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0), + FLEXSPI_LUT_SEQ(STOP, + FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0), + + /* 1 Read Status */ + + FLEXSPI_LUT_SEQ(CMD_SDR, + FLEXSPI_1PAD, 0x05, READ_SDR, FLEXSPI_1PAD, 0x1), + FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0), + FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0), + FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0), + + /* 2 */ + + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + /* 3 */ + + FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06, STOP, FLEXSPI_1PAD, 0x0), + FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0), + FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0), + FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0), + + /* 4 */ + + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + /* 5 Erase Sector */ + + FLEXSPI_LUT_SEQ(CMD_SDR, + FLEXSPI_1PAD, 0xd7, RADDR_SDR, FLEXSPI_1PAD, 0x18), + FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0), + FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0), + FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0), + + /* 6 */ + + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + /* 7 */ + + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + /* 8 */ + + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + /* 9 Page Program */ + + FLEXSPI_LUT_SEQ(CMD_SDR, + FLEXSPI_1PAD, 0x02, RADDR_SDR, FLEXSPI_1PAD, 0x18), + FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x8, STOP, FLEXSPI_1PAD, 0x0), + FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0), + FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0), + + /* 10 */ + + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + + /* 11 Chip Erase */ + + FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xc7, STOP, FLEXSPI_1PAD, 0x0), + FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0), + FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0), + FLEXSPI_LUT_SEQ(STOP, FLEXSPI_1PAD, 0x0, STOP, FLEXSPI_1PAD, 0x0), + }, + }, + + .page_size = 256u, + .sector_size = 4u * 1024u, + .blocksize = 32u * 1024u, + .is_uniform_blocksize = false, +}; +#else +# error Boot Flash type not chosen! +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_flash.h b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_flash.h new file mode 100644 index 000000000..087a7e3ca --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_flash.h @@ -0,0 +1,350 @@ +/**************************************************************************** + * boards/arm/imxrt/imxrt1052-ok/src/imxrt_flexspi_nor_flash.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __BOARDS_ARM_IMXRT_IMXRT1052_OK_SRC_IMXRT_FLEXSPI_NOR_FLASH_H +#define __BOARDS_ARM_IMXRT_IMXRT1052_OK_SRC_IMXRT_FLEXSPI_NOR_FLASH_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* FLEXSPI memory config block related definitions */ + +#define FLEXSPI_CFG_BLK_TAG (0x42464346ul) +#define FLEXSPI_CFG_BLK_VERSION (0x56010400ul) +#define FLEXSPI_CFG_BLK_SIZE (512) + +/* FLEXSPI Feature related definitions */ + +#define FLEXSPI_FEATURE_HAS_PARALLEL_MODE 1 + +/* Lookup table related definitions */ + +#define CMD_INDEX_READ 0 +#define CMD_INDEX_READSTATUS 1 +#define CMD_INDEX_WRITEENABLE 2 +#define CMD_INDEX_WRITE 4 + +#define CMD_LUT_SEQ_IDX_READ 0 +#define CMD_LUT_SEQ_IDX_READSTATUS 1 +#define CMD_LUT_SEQ_IDX_WRITEENABLE 3 +#define CMD_LUT_SEQ_IDX_WRITE 9 + +#define CMD_SDR 0x01 +#define CMD_DDR 0x21 +#define RADDR_SDR 0x02 +#define RADDR_DDR 0x22 +#define CADDR_SDR 0x03 +#define CADDR_DDR 0x23 +#define MODE1_SDR 0x04 +#define MODE1_DDR 0x24 +#define MODE2_SDR 0x05 +#define MODE2_DDR 0x25 +#define MODE4_SDR 0x06 +#define MODE4_DDR 0x26 +#define MODE8_SDR 0x07 +#define MODE8_DDR 0x27 +#define WRITE_SDR 0x08 +#define WRITE_DDR 0x28 +#define READ_SDR 0x09 +#define READ_DDR 0x29 +#define LEARN_SDR 0x0a +#define LEARN_DDR 0x2a +#define DATSZ_SDR 0x0b +#define DATSZ_DDR 0x2b +#define DUMMY_SDR 0x0c +#define DUMMY_DDR 0x2c +#define DUMMY_RWDS_SDR 0x0d +#define DUMMY_RWDS_DDR 0x2d +#define JMP_ON_CS 0x1f +#define STOP 0 + +#define FLEXSPI_1PAD 0 +#define FLEXSPI_2PAD 1 +#define FLEXSPI_4PAD 2 +#define FLEXSPI_8PAD 3 + +#define FLEXSPI_LUT_OPERAND0_MASK (0xffu) +#define FLEXSPI_LUT_OPERAND0_SHIFT (0U) +#define FLEXSPI_LUT_OPERAND0(x) (((uint32_t) \ + (((uint32_t)(x)) << FLEXSPI_LUT_OPERAND0_SHIFT)) & \ + FLEXSPI_LUT_OPERAND0_MASK) +#define FLEXSPI_LUT_NUM_PADS0_MASK (0x300u) +#define FLEXSPI_LUT_NUM_PADS0_SHIFT (8u) +#define FLEXSPI_LUT_NUM_PADS0(x) (((uint32_t) \ + (((uint32_t)(x)) << FLEXSPI_LUT_NUM_PADS0_SHIFT)) & \ + FLEXSPI_LUT_NUM_PADS0_MASK) +#define FLEXSPI_LUT_OPCODE0_MASK (0xfc00u) +#define FLEXSPI_LUT_OPCODE0_SHIFT (10u) +#define FLEXSPI_LUT_OPCODE0(x) (((uint32_t) \ + (((uint32_t)(x)) << FLEXSPI_LUT_OPCODE0_SHIFT)) & \ + FLEXSPI_LUT_OPCODE0_MASK) +#define FLEXSPI_LUT_OPERAND1_MASK (0xff0000u) +#define FLEXSPI_LUT_OPERAND1_SHIFT (16U) +#define FLEXSPI_LUT_OPERAND1(x) (((uint32_t) \ + (((uint32_t)(x)) << FLEXSPI_LUT_OPERAND1_SHIFT)) & \ + FLEXSPI_LUT_OPERAND1_MASK) +#define FLEXSPI_LUT_NUM_PADS1_MASK (0x3000000u) +#define FLEXSPI_LUT_NUM_PADS1_SHIFT (24u) +#define FLEXSPI_LUT_NUM_PADS1(x) (((uint32_t) \ + (((uint32_t)(x)) << FLEXSPI_LUT_NUM_PADS1_SHIFT)) & \ + FLEXSPI_LUT_NUM_PADS1_MASK) +#define FLEXSPI_LUT_OPCODE1_MASK (0xfc000000u) +#define FLEXSPI_LUT_OPCODE1_SHIFT (26u) +#define FLEXSPI_LUT_OPCODE1(x) (((uint32_t)(((uint32_t)(x)) << FLEXSPI_LUT_OPCODE1_SHIFT)) & \ + FLEXSPI_LUT_OPCODE1_MASK) + +#define FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1) \ + (FLEXSPI_LUT_OPERAND0(op0) | FLEXSPI_LUT_NUM_PADS0(pad0) | \ + FLEXSPI_LUT_OPCODE0(cmd0) | FLEXSPI_LUT_OPERAND1(op1) | \ + FLEXSPI_LUT_NUM_PADS1(pad1) | FLEXSPI_LUT_OPCODE1(cmd1)) + +#define NOR_CMD_INDEX_READ CMD_INDEX_READ +#define NOR_CMD_INDEX_READSTATUS CMD_INDEX_READSTATUS +#define NOR_CMD_INDEX_WRITEENABLE CMD_INDEX_WRITEENABLE +#define NOR_CMD_INDEX_ERASESECTOR 3 +#define NOR_CMD_INDEX_PAGEPROGRAM CMD_INDEX_WRITE +#define NOR_CMD_INDEX_CHIPERASE 5 +#define NOR_CMD_INDEX_DUMMY 6 +#define NOR_CMD_INDEX_ERASEBLOCK 7 + +/* READ LUT sequence id in lookupTable stored in config block */ + +#define NOR_CMD_LUT_SEQ_IDX_READ CMD_LUT_SEQ_IDX_READ + +/* Read Status LUT sequence id in lookupTable stored in config block */ + +#define NOR_CMD_LUT_SEQ_IDX_READSTATUS CMD_LUT_SEQ_IDX_READSTATUS + +/* 2 Read status DPI/QPI/OPI sequence id in lookupTable stored in config + * block + */ + +#define NOR_CMD_LUT_SEQ_IDX_READSTATUS_XPI 2 + +/* 3 Write Enable sequence id in lookupTable stored in config block */ + +#define NOR_CMD_LUT_SEQ_IDX_WRITEENABLE CMD_LUT_SEQ_IDX_WRITEENABLE + +/* 4 Write Enable DPI/QPI/OPI sequence id in lookupTable stored in config + * block + */ + +#define NOR_CMD_LUT_SEQ_IDX_WRITEENABLE_XPI 4 + +/* 5 Erase Sector sequence id in lookupTable stored in config block */ + +#define NOR_CMD_LUT_SEQ_IDX_ERASESECTOR 5 + +/* 8 Erase Block sequence id in lookupTable stored in config block */ + +#define NOR_CMD_LUT_SEQ_IDX_ERASEBLOCK 8 + +/* 9 Program sequence id in lookupTable stored in config block */ + +#define NOR_CMD_LUT_SEQ_IDX_PAGEPROGRAM CMD_LUT_SEQ_IDX_WRITE + +/* 11 Chip Erase sequence in lookupTable id stored in config block */ + +#define NOR_CMD_LUT_SEQ_IDX_CHIPERASE 11 + +/* 13 Read SFDP sequence in lookupTable id stored in config block */ + +#define NOR_CMD_LUT_SEQ_IDX_READ_SFDP 13 + +/* 14 Restore 0-4-4/0-8-8 mode sequence id in lookupTable stored in config + * block + */ + +#define NOR_CMD_LUT_SEQ_IDX_RESTORE_NOCMD 14 + +/* 15 Exit 0-4-4/0-8-8 mode sequence id in lookupTable stored in config + * blobk + */ + +#define NOR_CMD_LUT_SEQ_IDX_EXIT_NOCMD 15 + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/* Definitions for FlexSPI Serial Clock Frequency */ + +enum flexspi_serial_clkfreq_e +{ + FLEXSPI_SERIAL_CLKFREQ_30MHz = 1, + FLEXSPI_SERIAL_CLKFREQ_50MHz = 2, + FLEXSPI_SERIAL_CLKFREQ_60MHz = 3, + FLEXSPI_SERIAL_CLKFREQ_75MHz = 4, + FLEXSPI_SERIAL_CLKFREQ_80MHz = 5, + FLEXSPI_SERIAL_CLKFREQ_100MHz = 6, + FLEXSPI_SERIAL_CLKFREQ_133MHz = 7, + FLEXSPI_SERIAL_CLKFREQ_166MHz = 8, + FLEXSPI_SERIAL_CLKFREQ_200MHz = 9, +}; + +/* FlexSPI clock configuration type */ + +enum flexspi_serial_clockmode_e +{ + FLEXSPI_CLKMODE_SDR, + FLEXSPI_CLKMODE_DDR, +}; + +/* FlexSPI Read Sample Clock Source definition */ + +enum flash_read_sample_clk_e +{ + FLASH_READ_SAMPLE_CLK_LOOPBACK_INTERNELLY = 0, + FLASH_READ_SAMPLE_CLK_LOOPBACK_FROM_DQSPAD = 1, + FLASH_READ_SAMPLE_CLK_LOOPBACK_FROM_SCKPAD = 2, + FLASH_READ_SAMPLE_CLK_EXT_INPUT_FROM_DQSPAD = 3, +}; + +/* Misc feature bit definitions */ + +enum flash_misc_feature_e +{ + FLEXSPIMISC_OFFSET_DIFFCLKEN = 0, /* Bit for Differential clock enable */ + FLEXSPIMISC_OFFSET_CK2EN = 1, /* Bit for CK2 enable */ + FLEXSPIMISC_OFFSET_PARALLELEN = 2, /* Bit for Parallel mode enable */ + FLEXSPIMISC_OFFSET_WORD_ADDRESSABLE_EN = 3, /* Bit for Word Addressable enable */ + FLEXSPIMISC_OFFSET_SAFECONFIG_FREQ_EN = 4, /* Bit for Safe Configuration Frequency enable */ + FLEXSPIMISC_OFFSET_PAD_SETTING_OVERRIDE_EN = 5, /* Bit for Pad setting override enable */ + FLEXSPIMISC_OFFSET_DDR_MODE_EN = 6, /* Bit for DDR clock confiuration indication. */ +}; + +/* Flash Type Definition */ + +enum flash_flash_type_e +{ + FLEXSPI_DEVICE_TYPE_SERIAL_NOR = 1, /* Flash devices are Serial NOR */ + FLEXSPI_DEVICE_TYPE_SERIAL_NAND = 2, /* Flash devices are Serial NAND */ + FLEXSPI_DEVICE_TYPE_SERIAL_RAM = 3, /* Flash devices are Serial RAM/HyperFLASH */ + FLEXSPI_DEVICE_TYPE_MCP_NOR_NAND = 0x12, /* Flash device is MCP device, A1 is Serial NOR, A2 is Serial NAND */ + FLEXSPI_DEVICE_TYPE_MCP_NOR_RAM = 0x13, /* Flash device is MCP device, A1 is Serial NOR, A2 is Serial RAMs */ +}; + +/* Flash Pad Definitions */ + +enum flash_flash_pad_e +{ + SERIAL_FLASH_1PAD = 1, + SERIAL_FLASH_2PADS = 2, + SERIAL_FLASH_4PADS = 4, + SERIAL_FLASH_8PADS = 8, +}; + +/* Flash Configuration Command Type */ + +enum flash_config_cmd_e +{ + DEVICE_CONFIG_CMD_TYPE_GENERIC, /* Generic command, for example: configure dummy cycles, drive strength, etc */ + DEVICE_CONFIG_CMD_TYPE_QUADENABLE, /* Quad Enable command */ + DEVICE_CONFIG_CMD_TYPE_SPI2XPI, /* Switch from SPI to DPI/QPI/OPI mode */ + DEVICE_CONFIG_CMD_TYPE_XPI2SPI, /* Switch from DPI/QPI/OPI to SPI mode */ + DEVICE_CONFIG_CMD_TYPE_SPI2NO_CMD, /* Switch to 0-4-4/0-8-8 mode */ + DEVICE_CONFIG_CMD_TYPE_RESET, /* Reset device command */ +}; + +/* FlexSPI LUT Sequence structure */ + +struct flexspi_lut_seq_s +{ + uint8_t seq_num; /* Sequence Number, valid number: 1-16 */ + uint8_t seq_id; /* Sequence Index, valid number: 0-15 */ + uint16_t reserved; +}; + +/* FlexSPI Memory Configuration Block */ + +struct flexspi_mem_config_s +{ + uint32_t tag; + uint32_t version; + uint32_t reserved0; + uint8_t read_sample_clksrc; + uint8_t cs_hold_time; + uint8_t cs_setup_time; + uint8_t column_address_width; /* [0x00f-0x00f] Column Address with, for + * HyperBus protocol, it is fixed to 3, For + * Serial NAND, need to refer to datasheet + */ + uint8_t device_mode_cfg_enable; + uint8_t device_mode_type; + uint16_t wait_time_cfg_commands; + struct flexspi_lut_seq_s device_mode_seq; + uint32_t device_mode_arg; + uint8_t config_cmd_enable; + uint8_t config_mode_type[3]; + struct flexspi_lut_seq_s config_cmd_seqs[3]; + uint32_t reserved1; + uint32_t config_cmd_args[3]; + uint32_t reserved2; + uint32_t controller_misc_option; + uint8_t device_type; + uint8_t sflash_pad_type; + uint8_t serial_clk_freq; + uint8_t lut_custom_seq_enable; + uint32_t reserved3[2]; + uint32_t sflash_a1size; + uint32_t sflash_a2size; + uint32_t sflash_b1size; + uint32_t sflash_b2size; + uint32_t cspad_setting_override; + uint32_t sclkpad_setting_override; + uint32_t datapad_setting_override; + uint32_t dqspad_setting_override; + uint32_t timeout_in_ms; + uint32_t command_interval; + uint16_t data_valid_time[2]; + uint16_t busy_offset; + uint16_t busybit_polarity; + uint32_t lookup_table[64]; + struct flexspi_lut_seq_s lut_customseq[12]; + uint32_t reserved4[4]; +}; + +/* Serial NOR configuration block */ + +struct flexspi_nor_config_s +{ + struct flexspi_mem_config_s mem_config; /* Common memory configuration info via FlexSPI */ + uint32_t page_size; /* Page size of Serial NOR */ + uint32_t sector_size; /* Sector size of Serial NOR */ + uint8_t ipcmd_serial_clkfreq; /* Clock frequency for IP command */ + uint8_t is_uniform_blocksize; /* Sector/Block size is the same */ + uint8_t reserved0[2]; /* Reserved for future use */ + uint8_t serial_nor_type; /* Serial NOR Flash type: 0/1/2/3 */ + uint8_t need_exit_nocmdmode; /* Need to exit NoCmd mode before other IP command */ + uint8_t halfclk_for_nonreadcmd; /* Half the Serial Clock for non-read command: true/false */ + uint8_t need_restore_nocmdmode; /* Need to Restore NoCmd mode after IP command execution */ + uint32_t blocksize; /* Block size */ + uint32_t reserve2[11]; /* Reserved for future use */ +}; + +#endif /* __BOARDS_ARM_IMXRT_IMXRT1052_OK_SRC_IMXRT_FLEXSPI_NOR_FLASH_H */ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_gpio.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_gpio.c new file mode 100644 index 000000000..c904cd5aa --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_gpio.c @@ -0,0 +1,215 @@ +/**************************************************************************** + * boards/arm/imxrt/imxrt1052-ok/src/imxrt_gpio.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#include "chip.h" + +#include +#include "imxrt1052-ok.h" + +#if defined(CONFIG_DEV_GPIO) && !defined(CONFIG_GPIO_LOWER_HALF) + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +struct imxrtgpio_dev_s +{ + struct gpio_dev_s gpio; + uint8_t id; +}; + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +#if BOARD_NGPIOIN > 0 +static int gpin_read(FAR struct gpio_dev_s *dev, FAR bool *value); +#endif + +#if BOARD_NGPIOOUT > 0 +static int gpout_read(FAR struct gpio_dev_s *dev, FAR bool *value); +static int gpout_write(FAR struct gpio_dev_s *dev, bool value); +#endif + +/**************************************************************************** + * Private Data + ****************************************************************************/ + + #if BOARD_NGPIOIN > 0 +static const struct gpio_operations_s gpin_ops = +{ + .go_read = gpin_read, + .go_write = NULL, + .go_attach = NULL, + .go_enable = NULL, +}; + +/* This array maps the GPIO pins used as INPUT */ + +static const uint32_t g_gpioinputs[BOARD_NGPIOIN] = +{ + GPIO_IN1, +}; + +static struct imxrtgpio_dev_s g_gpin[BOARD_NGPIOIN]; +#endif + +#if BOARD_NGPIOOUT > 0 + +static const struct gpio_operations_s gpout_ops = +{ + .go_read = gpout_read, + .go_write = gpout_write, + .go_attach = NULL, + .go_enable = NULL, +}; + +/* This array maps the GPIO pins used as OUTPUT */ + +static const uint32_t g_gpiooutputs[BOARD_NGPIOOUT] = +{ + GPIO_GOUT1, + GPIO_GOUT2, + GPIO_GOUT3, + GPIO_GOUT4, +}; + +static struct imxrtgpio_dev_s g_gpout[BOARD_NGPIOOUT]; +#endif + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +#if BOARD_NGPIOIN > 0 +static int gpin_read(FAR struct gpio_dev_s *dev, FAR bool *value) +{ + FAR struct imxrtgpio_dev_s *imxrtgpio = (FAR struct imxrtgpio_dev_s *)dev; + + DEBUGASSERT(imxrtgpio != NULL && value != NULL); + DEBUGASSERT(imxrtgpio->id < BOARD_NGPIOIN); + gpioinfo("Reading...\n"); + + *value = imxrt_gpio_read(g_gpioinputs[imxrtgpio->id]); + return OK; +} +#endif + +#if BOARD_NGPIOOUT > 0 +static int gpout_read(FAR struct gpio_dev_s *dev, FAR bool *value) +{ + FAR struct imxrtgpio_dev_s *imxrtgpio = (FAR struct imxrtgpio_dev_s *)dev; + + DEBUGASSERT(imxrtgpio != NULL && value != NULL); + DEBUGASSERT(imxrtgpio->id < BOARD_NGPIOOUT); + gpioinfo("Reading...\n"); + + *value = imxrt_gpio_read(g_gpiooutputs[imxrtgpio->id]); + return OK; +} + +static int gpout_write(FAR struct gpio_dev_s *dev, bool value) +{ + FAR struct imxrtgpio_dev_s *imxrtgpio = (FAR struct imxrtgpio_dev_s *)dev; + + DEBUGASSERT(imxrtgpio != NULL); + DEBUGASSERT(imxrtgpio->id < BOARD_NGPIOOUT); + gpioinfo("Writing %d\n", (int)value); + + imxrt_gpio_write(g_gpiooutputs[imxrtgpio->id], value); + return OK; +} +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: imxrt_gpio_initialize + * + * Description: + * Initialize GPIO drivers for use with /apps/examples/gpio + * + ****************************************************************************/ + +int imxrt_gpio_initialize(void) +{ + int pincount = 0; + int i; + +#if BOARD_NGPIOIN > 0 + for (i = 0; i < BOARD_NGPIOIN; i++) + { + /* Setup and register the GPIO pin */ + + g_gpin[i].gpio.gp_pintype = GPIO_INPUT_PIN; + g_gpin[i].gpio.gp_ops = &gpin_ops; + g_gpin[i].id = i; + + gpio_pin_register(&g_gpin[i].gpio, pincount); + + /* Configure the pin that will be used as input */ + + imxrt_config_gpio(g_gpioinputs[i]); + + pincount++; + } +#endif + +#if BOARD_NGPIOOUT > 0 + for (i = 0; i < BOARD_NGPIOOUT; i++) + { + /* Setup and register the GPIO pin */ + + g_gpout[i].gpio.gp_pintype = GPIO_OUTPUT_PIN; + g_gpout[i].gpio.gp_ops = &gpout_ops; + g_gpout[i].id = i; + + gpio_pin_register(&g_gpout[i].gpio, pincount); + + /* Configure the pin that will be used as output */ + + imxrt_gpio_write(g_gpiooutputs[i], 0); + imxrt_config_gpio(g_gpiooutputs[i]); + + pincount++; + } +#endif + + return 0; +} +#endif /* CONFIG_DEV_GPIO && !CONFIG_GPIO_LOWER_HALF */ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_lcd.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_lcd.c new file mode 100644 index 000000000..bec6d715c --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_lcd.c @@ -0,0 +1,68 @@ +/**************************************************************************** + * boards/arm/imxrt/imxrt1052-ok/src/imxrt_lcd.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include "imxrt_lcd.h" +#include "imxrt_gpio.h" + +#include "imxrt1052-ok.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: imxrt_lcd_initialize + * + * Description: + * Initialize the LCD. Setup backlight (initially off) + * + ****************************************************************************/ + +void imxrt_lcd_initialize(void) +{ + /* Configure the LCD backlight (and turn the backlight off) */ + + imxrt_config_gpio(GPIO_LCD_BL); +} + +/**************************************************************************** + * Name: imxrt_backlight + * + * Description: + * If CONFIG_IMXRT_LCD_BACKLIGHT is defined, then the board-specific + * logic must provide this interface to turn the backlight on and off. + * + ****************************************************************************/ + +#ifdef CONFIG_IMXRT_LCD_BACKLIGHT +void imxrt_backlight(bool blon) +{ + imxrt_gpio_write(GPIO_LCD_BL, blon); /* High illuminates */ +} +#endif diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_mmcsd_spi.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_mmcsd_spi.c new file mode 100644 index 000000000..561a12283 --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_mmcsd_spi.c @@ -0,0 +1,122 @@ +/**************************************************************************** + * boards/arm/imxrt/imxrt1052-ok/src/imxrt_mmcsd_spi.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include +#include +#include + +#include +#include + +#include "arm_arch.h" +#include "chip.h" +#include "imxrt_lpspi.h" + +#ifdef CONFIG_MMCSD_SPI + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifndef CONFIG_IMXRT_LPSPI1 +# error "SD driver requires CONFIG_IMXRT_LPSPI1 to be enabled" +#endif + +#ifdef CONFIG_DISABLE_MOUNTPOINT +# error "SD driver requires CONFIG_DISABLE_MOUNTPOINT to be disabled" +#endif + +/**************************************************************************** + * Private Definitions + ****************************************************************************/ + +static const int SD_SPI_PORT = CONFIG_NSH_MMCSDSPIPORTNO; /* SD is connected to SPI1 port */ + +static const int SD_SLOT_NO = 0; /* There is only one SD slot */ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/* NOTE: We are using a SDCard adapter/module without Card Detect pin! + * Then we don't need to Card Detect callback here. + */ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: imxrt_spi1register + * + * Description: + * Registers media change callback + ****************************************************************************/ + +#ifdef CONFIG_IMXRT_LPSPI1 +int imxrt_lpspi1register(struct spi_dev_s *dev, spi_mediachange_t callback, + void *arg) +{ + spiinfo("INFO: Registering spi1 device\n"); + return OK; +} +#endif + +/**************************************************************************** + * Name: imxrt_mmcsd_spi_initialize + * + * Description: + * Initialize SPI-based SD card and card detect thread. + * + ****************************************************************************/ + +int imxrt_mmcsd_spi_initialize(int minor) +{ + struct spi_dev_s *spi; + int rv; + + mcinfo("INFO: Initializing mmcsd card\n"); + + spi = imxrt_lpspibus_initialize(SD_SPI_PORT); + if (spi == NULL) + { + mcerr("ERROR: Failed to initialize SPI port %d\n", SD_SPI_PORT); + return -ENODEV; + } + + rv = mmcsd_spislotinitialize(minor, SD_SLOT_NO, spi); + if (rv < 0) + { + mcerr("ERROR: Failed to bind SPI port %d to SD slot %d\n", + SD_SPI_PORT, SD_SLOT_NO); + return rv; + } + + spiinfo("INFO: mmcsd card has been initialized successfully\n"); + return OK; +} + +#endif /* CONFIG_MMCSD_SPI */ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_sdram_ini_dcd.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_sdram_ini_dcd.c new file mode 100644 index 000000000..556930feb --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_sdram_ini_dcd.c @@ -0,0 +1,1257 @@ +/**************************************************************************** + * boards/arm/imxrt/imxrt1052-ok/src/imxrt_sdram_ini_dcd.c + * + * Copyright (C) 2017, NXP Semiconductors, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include "imxrt_flexspi_nor_boot.h" + +locate_data(".boot_hdr.dcd_data") + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +const uint8_t g_dcd_data[] = +{ + /* 0000 */ DCD_TAG_HEADER, + + 0x04, + 0x30, + 0x41, + 0xcc, + 0x03, + 0xac, + 0x04, + 0x40, + 0x0f, + 0xc0, + 0x68, + 0xff, + 0xff, + 0xff, + 0xff, + + /* 0010 */ 0x40, + + 0x0f, + 0xc0, + 0x6c, + 0xff, + 0xff, + 0xff, + 0xff, + 0x40, + 0x0f, + 0xc0, + 0x70, + 0xff, + 0xff, + 0xff, + 0xff, + + /* 0020 */ 0x40, + + 0x0f, + 0xc0, + 0x74, + 0xff, + 0xff, + 0xff, + 0xff, + 0x40, + 0x0f, + 0xc0, + 0x78, + 0xff, + 0xff, + 0xff, + 0xff, + + /* 0030 */ 0x40, + + 0x0f, + 0xc0, + 0x7c, + 0xff, + 0xff, + 0xff, + 0xff, + 0x40, + 0x0f, + 0xc0, + 0x80, + 0xff, + 0xff, + 0xff, + 0xff, + + /* 0040 */ 0x40, + + 0x0d, + 0x80, + 0x30, + 0x00, + 0x00, + 0x20, + 0x01, + 0x40, + 0x0d, + 0x81, + 0x00, + 0x00, + 0x1d, + 0x00, + 0x00, + + /* 0050 */ 0x40, + + 0x0f, + 0xc0, + 0x14, + 0x00, + 0x01, + 0x0d, + 0x40, + 0x40, + 0x1f, + 0x80, + 0x14, + 0x00, + 0x00, + 0x00, + 0x00, + + /* 0060 */ 0x40, + + 0x1f, + 0x80, + 0x18, + 0x00, + 0x00, + 0x00, + 0x00, + 0x40, + 0x1f, + 0x80, + 0x1c, + 0x00, + 0x00, + 0x00, + 0x00, + + /* 0070 */ 0x40, + + 0x1f, + 0x80, + 0x20, + 0x00, + 0x00, + 0x00, + 0x00, + 0x40, + 0x1f, + 0x80, + 0x24, + 0x00, + 0x00, + 0x00, + 0x00, + + /* 0080 */ 0x40, + + 0x1f, + 0x80, + 0x28, + 0x00, + 0x00, + 0x00, + 0x00, + 0x40, + 0x1f, + 0x80, + 0x2c, + 0x00, + 0x00, + 0x00, + 0x00, + + /* 0090 */ 0x40, + + 0x1f, + 0x80, + 0x30, + 0x00, + 0x00, + 0x00, + 0x00, + 0x40, + 0x1f, + 0x80, + 0x34, + 0x00, + 0x00, + 0x00, + 0x00, + + /* 00a0 */ 0x40, + + 0x1f, + 0x80, + 0x38, + 0x00, + 0x00, + 0x00, + 0x00, + 0x40, + 0x1f, + 0x80, + 0x3c, + 0x00, + 0x00, + 0x00, + 0x00, + + /* 00b0 */ 0x40, + + 0x1f, + 0x80, + 0x40, + 0x00, + 0x00, + 0x00, + 0x00, + 0x40, + 0x1f, + 0x80, + 0x44, + 0x00, + 0x00, + 0x00, + 0x00, + + /* 00c0 */ 0x40, + + 0x1f, + 0x80, + 0x48, + 0x00, + 0x00, + 0x00, + 0x00, + 0x40, + 0x1f, + 0x80, + 0x4c, + 0x00, + 0x00, + 0x00, + 0x00, + + /* 00d0 */ 0x40, + + 0x1f, + 0x80, + 0x50, + 0x00, + 0x00, + 0x00, + 0x00, + 0x40, + 0x1f, + 0x80, + 0x54, + 0x00, + 0x00, + 0x00, + 0x00, + + /* 00e0 */ 0x40, + + 0x1f, + 0x80, + 0x58, + 0x00, + 0x00, + 0x00, + 0x00, + 0x40, + 0x1f, + 0x80, + 0x5c, + 0x00, + 0x00, + 0x00, + 0x00, + + /* 00f0 */ 0x40, + + 0x1f, + 0x80, + 0x60, + 0x00, + 0x00, + 0x00, + 0x00, + 0x40, + 0x1f, + 0x80, + 0x64, + 0x00, + 0x00, + 0x00, + 0x00, + + /* 0100 */ 0x40, + + 0x1f, + 0x80, + 0x68, + 0x00, + 0x00, + 0x00, + 0x00, + 0x40, + 0x1f, + 0x80, + 0x6c, + 0x00, + 0x00, + 0x00, + 0x00, + + /* 0110 */ 0x40, + + 0x1f, + 0x80, + 0x70, + 0x00, + 0x00, + 0x00, + 0x00, + 0x40, + 0x1f, + 0x80, + 0x74, + 0x00, + 0x00, + 0x00, + 0x00, + + /* 0120 */ 0x40, + + 0x1f, + 0x80, + 0x78, + 0x00, + 0x00, + 0x00, + 0x00, + 0x40, + 0x1f, + 0x80, + 0x7c, + 0x00, + 0x00, + 0x00, + 0x00, + + /* 0130 */ 0x40, + + 0x1f, + 0x80, + 0x80, + 0x00, + 0x00, + 0x00, + 0x00, + 0x40, + 0x1f, + 0x80, + 0x84, + 0x00, + 0x00, + 0x00, + 0x00, + + /* 0140 */ 0x40, + + 0x1f, + 0x80, + 0x88, + 0x00, + 0x00, + 0x00, + 0x00, + 0x40, + 0x1f, + 0x80, + 0x8c, + 0x00, + 0x00, + 0x00, + 0x00, + + /* 0150 */ 0x40, + + 0x1f, + 0x80, + 0x90, + 0x00, + 0x00, + 0x00, + 0x00, + 0x40, + 0x1f, + 0x80, + 0x94, + 0x00, + 0x00, + 0x00, + 0x00, + + /* 0160 */ 0x40, + + 0x1f, + 0x80, + 0x98, + 0x00, + 0x00, + 0x00, + 0x00, + 0x40, + 0x1f, + 0x80, + 0x9c, + 0x00, + 0x00, + 0x00, + 0x00, + + /* 0170 */ 0x40, + + 0x1f, + 0x80, + 0xa0, + 0x00, + 0x00, + 0x00, + 0x00, + 0x40, + 0x1f, + 0x80, + 0xa4, + 0x00, + 0x00, + 0x00, + 0x00, + + /* 0180 */ 0x40, + + 0x1f, + 0x80, + 0xa8, + 0x00, + 0x00, + 0x00, + 0x00, + 0x40, + 0x1f, + 0x80, + 0xac, + 0x00, + 0x00, + 0x00, + 0x00, + + /* 0190 */ 0x40, + + 0x1f, + 0x80, + 0xb0, + 0x00, + 0x00, + 0x00, + 0x10, + 0x40, + 0x1f, + 0x80, + 0xb4, + 0x00, + 0x00, + 0x00, + 0x00, + + /* 01a0 */ 0x40, + + 0x1f, + 0x80, + 0xb8, + 0x00, + 0x00, + 0x00, + 0x00, + 0x40, + 0x1f, + 0x82, + 0x04, + 0x00, + 0x01, + 0x10, + 0xf9, + + /* 01b0 */ 0x40, + + 0x1f, + 0x82, + 0x08, + 0x00, + 0x01, + 0x10, + 0xf9, + 0x40, + 0x1f, + 0x82, + 0x0c, + 0x00, + 0x01, + 0x10, + 0xf9, + + /* 01c0 */ 0x40, + + 0x1f, + 0x82, + 0x10, + 0x00, + 0x01, + 0x10, + 0xf9, + 0x40, + 0x1f, + 0x82, + 0x14, + 0x00, + 0x01, + 0x10, + 0xf9, + + /* 01d0 */ 0x40, + + 0x1f, + 0x82, + 0x18, + 0x00, + 0x01, + 0x10, + 0xf9, + 0x40, + 0x1f, + 0x82, + 0x1c, + 0x00, + 0x01, + 0x10, + 0xf9, + + /* 01e0 */ 0x40, + + 0x1f, + 0x82, + 0x20, + 0x00, + 0x01, + 0x10, + 0xf9, + 0x40, + 0x1f, + 0x82, + 0x24, + 0x00, + 0x01, + 0x10, + 0xf9, + + /* 01f0 */ 0x40, + + 0x1f, + 0x82, + 0x28, + 0x00, + 0x01, + 0x10, + 0xf9, + 0x40, + 0x1f, + 0x82, + 0x2c, + 0x00, + 0x01, + 0x10, + 0xf9, + + /* 0200 */ 0x40, + + 0x1f, + 0x82, + 0x30, + 0x00, + 0x01, + 0x10, + 0xf9, + 0x40, + 0x1f, + 0x82, + 0x34, + 0x00, + 0x01, + 0x10, + 0xf9, + + /* 0210 */ 0x40, + + 0x1f, + 0x82, + 0x38, + 0x00, + 0x01, + 0x10, + 0xf9, + 0x40, + 0x1f, + 0x82, + 0x3c, + 0x00, + 0x01, + 0x10, + 0xf9, + + /* 0220 */ 0x40, + + 0x1f, + 0x82, + 0x40, + 0x00, + 0x01, + 0x10, + 0xf9, + 0x40, + 0x1f, + 0x82, + 0x44, + 0x00, + 0x01, + 0x10, + 0xf9, + + /* 0230 */ 0x40, + + 0x1f, + 0x82, + 0x48, + 0x00, + 0x01, + 0x10, + 0xf9, + 0x40, + 0x1f, + 0x82, + 0x4c, + 0x00, + 0x01, + 0x10, + 0xf9, + + /* 0240 */ 0x40, + + 0x1f, + 0x82, + 0x50, + 0x00, + 0x01, + 0x10, + 0xf9, + 0x40, + 0x1f, + 0x82, + 0x54, + 0x00, + 0x01, + 0x10, + 0xf9, + + /* 0250 */ 0x40, + + 0x1f, + 0x82, + 0x58, + 0x00, + 0x01, + 0x10, + 0xf9, + 0x40, + 0x1f, + 0x82, + 0x5c, + 0x00, + 0x01, + 0x10, + 0xf9, + + /* 0260 */ 0x40, + + 0x1f, + 0x82, + 0x60, + 0x00, + 0x01, + 0x10, + 0xf9, + 0x40, + 0x1f, + 0x82, + 0x64, + 0x00, + 0x01, + 0x10, + 0xf9, + + /* 0270 */ 0x40, + + 0x1f, + 0x82, + 0x68, + 0x00, + 0x01, + 0x10, + 0xf9, + 0x40, + 0x1f, + 0x82, + 0x6c, + 0x00, + 0x01, + 0x10, + 0xf9, + + /* 0280 */ 0x40, + + 0x1f, + 0x82, + 0x70, + 0x00, + 0x01, + 0x10, + 0xf9, + 0x40, + 0x1f, + 0x82, + 0x74, + 0x00, + 0x01, + 0x10, + 0xf9, + + /* 0290 */ 0x40, + + 0x1f, + 0x82, + 0x78, + 0x00, + 0x01, + 0x10, + 0xf9, + 0x40, + 0x1f, + 0x82, + 0x7c, + 0x00, + 0x01, + 0x10, + 0xf9, + + /* 02a0 */ 0x40, + + 0x1f, + 0x82, + 0x80, + 0x00, + 0x01, + 0x10, + 0xf9, + 0x40, + 0x1f, + 0x82, + 0x84, + 0x00, + 0x01, + 0x10, + 0xf9, + + /* 02b0 */ 0x40, + + 0x1f, + 0x82, + 0x88, + 0x00, + 0x01, + 0x10, + 0xf9, + 0x40, + 0x1f, + 0x82, + 0x8c, + 0x00, + 0x01, + 0x10, + 0xf9, + + /* 02c0 */ 0x40, + + 0x1f, + 0x82, + 0x90, + 0x00, + 0x01, + 0x10, + 0xf9, + 0x40, + 0x1f, + 0x82, + 0x94, + 0x00, + 0x01, + 0x10, + 0xf9, + + /* 02d0 */ 0x40, + + 0x1f, + 0x82, + 0x98, + 0x00, + 0x01, + 0x10, + 0xf9, + 0x40, + 0x1f, + 0x82, + 0x9c, + 0x00, + 0x01, + 0x10, + 0xf9, + + /* 02e0 */ 0x40, + + 0x1f, + 0x82, + 0xa0, + 0x00, + 0x01, + 0x10, + 0xf9, + 0x40, + 0x1f, + 0x82, + 0xa4, + 0x00, + 0x01, + 0x10, + 0xf9, + + /* 02f0 */ 0x40, + + 0x1f, + 0x82, + 0xa8, + 0x00, + 0x01, + 0x10, + 0xf9, + 0x40, + 0x2f, + 0x00, + 0x00, + 0x10, + 0x00, + 0x00, + 0x04, + + /* 0300 */ 0x40, + + 0x2f, + 0x00, + 0x08, + 0x00, + 0x03, + 0x05, + 0x24, + 0x40, + 0x2f, + 0x00, + 0x0c, + 0x06, + 0x03, + 0x05, + 0x24, + + /* 0310 */ 0x40, + + 0x2f, + 0x00, + 0x10, + 0x80, + 0x00, + 0x00, + 0x1b, + 0x40, + 0x2f, + 0x00, + 0x14, + 0x82, + 0x00, + 0x00, + 0x1b, + + /* 0320 */ 0x40, + + 0x2f, + 0x00, + 0x18, + 0x84, + 0x00, + 0x00, + 0x1b, + 0x40, + 0x2f, + 0x00, + 0x1c, + 0x86, + 0x00, + 0x00, + 0x1b, + + /* 0330 */ 0x40, + + 0x2f, + 0x00, + 0x20, + 0x90, + 0x00, + 0x00, + 0x21, + 0x40, + 0x2f, + 0x00, + 0x24, + 0xa0, + 0x00, + 0x00, + 0x19, + + /* 0340 */ 0x40, + + 0x2f, + 0x00, + 0x28, + 0xa8, + 0x00, + 0x00, + 0x17, + 0x40, + 0x2f, + 0x00, + 0x2c, + 0xa9, + 0x00, + 0x00, + 0x1b, + + /* 0350 */ 0x40, + + 0x2f, + 0x00, + 0x30, + 0x00, + 0x00, + 0x00, + 0x21, + 0x40, + 0x2f, + 0x00, + 0x04, + 0x00, + 0x00, + 0x79, + 0xa8, + + /* 0360 */ 0x40, + + 0x2f, + 0x00, + 0x40, + 0x00, + 0x00, + 0x0f, + 0x31, + 0x40, + 0x2f, + 0x00, + 0x44, + 0x00, + 0x65, + 0x29, + 0x22, + + /* 0370 */ 0x40, + + 0x2f, + 0x00, + 0x48, + 0x00, + 0x01, + 0x09, + 0x20, + 0x40, + 0x2f, + 0x00, + 0x4c, + 0x50, + 0x21, + 0x0a, + 0x08, + + /* 0380 */ 0x40, + + 0x2f, + 0x00, + 0x80, + 0x00, + 0x00, + 0x00, + 0x21, + 0x40, + 0x2f, + 0x00, + 0x84, + 0x00, + 0x88, + 0x88, + 0x88, + + /* 0390 */ 0x40, + + 0x2f, + 0x00, + 0x94, + 0x00, + 0x00, + 0x00, + 0x02, + 0x40, + 0x2f, + 0x00, + 0x98, + 0x00, + 0x00, + 0x00, + 0x00, + + /* 03a0 */ 0x40, + + 0x2f, + 0x00, + 0x90, + 0x80, + 0x00, + 0x00, + 0x00, + 0x40, + 0x2f, + 0x00, + 0x9c, + 0xa5, + 0x5a, + 0x00, + 0x0f, + + /* 03b0 */ 0xcf, + + 0x00, + 0x0c, + 0x1c, + 0x40, + 0x2f, + 0x00, + 0x3c, + 0x00, + 0x00, + 0x00, + 0x01, + 0xcc, + 0x00, + 0x14, + 0x04, + + /* 03c0 */ 0x40, + + 0x2f, + 0x00, + 0x90, + 0x80, + 0x00, + 0x00, + 0x00, + 0x40, + 0x2f, + 0x00, + 0x9c, + 0xa5, + 0x5a, + 0x00, + 0x0c, + + /* 03d0 */ 0xcf, + + 0x00, + 0x0c, + 0x1c, + 0x40, + 0x2f, + 0x00, + 0x3c, + 0x00, + 0x00, + 0x00, + 0x01, + 0xcc, + 0x00, + 0x14, + 0x04, + + /* 03e0 */ 0x40, + + 0x2f, + 0x00, + 0x90, + 0x80, + 0x00, + 0x00, + 0x00, + 0x40, + 0x2f, + 0x00, + 0x9c, + 0xa5, + 0x5a, + 0x00, + 0x0c, + + /* 03f0 */ 0xcf, + + 0x00, + 0x0c, + 0x1c, + 0x40, + 0x2f, + 0x00, + 0x3c, + 0x00, + 0x00, + 0x00, + 0x01, + 0xcc, + 0x00, + 0x1c, + 0x04, + + /* 0400 */ 0x40, + + 0x2f, + 0x00, + 0xa0, + 0x00, + 0x00, + 0x00, + 0x33, + 0x40, + 0x2f, + 0x00, + 0x90, + 0x80, + 0x00, + 0x00, + 0x00, + + /* 0410 */ 0x40, + + 0x2f, + 0x00, + 0x9c, + 0xa5, + 0x5a, + 0x00, + 0x0a, + 0xcf, + 0x00, + 0x0c, + 0x1c, + 0x40, + 0x2f, + 0x00, + 0x3c, + + /* 0420 */ 0x00, + + 0x00, + 0x00, + 0x01, + 0xcc, + 0x00, + 0x0c, + 0x04, + 0x40, + 0x2f, + 0x00, + 0x4c, + 0x50, + 0x21, + 0x0a, + 0x09, +}; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_spi.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_spi.c new file mode 100644 index 000000000..bb4702c99 --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_spi.c @@ -0,0 +1,211 @@ +/**************************************************************************** + * boards/arm/imxrt/imxrt1052-ok/src/imxrt_spi.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include +#include + +#include "arm_arch.h" + +#include "imxrt_config.h" +#include "imxrt_lpspi.h" +#include "imxrt_gpio.h" +#include "imxrt1052-ok.h" + +#if defined(CONFIG_IMXRT_LPSPI1) || defined(CONFIG_IMXRT_LPSPI2) || \ + defined(CONFIG_IMXRT_LPSPI3) || defined(CONFIG_IMXRT_LPSPI4) + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: imxrt_spidev_initialize + * + * Description: + * Called to configure SPI chip select GPIO pins for the imxrt1052-ok + * board. + * + ****************************************************************************/ + +void weak_function imxrt_spidev_initialize(void) +{ +#ifdef CONFIG_IMXRT_LPSPI1 + imxrt_config_gpio(GPIO_LPSPI1_CS); /* LPSPI1 chip select */ + imxrt_config_gpio(GPIO_MMCSD_EN); +#endif +#ifdef CONFIG_IMXRT_LPSPI3 + imxrt_config_gpio(GPIO_LPSPI3_CS); /* LPSPI3 chip select */ +#endif +} + +/**************************************************************************** + * Name: imxrt_lpspi1/2/3select and imxrt_lpspi1/2/3status + * + * Description: + * The external functions, imxrt_lpspi1/2/3select and + * imxrt_lpspi1/2/3status must be provided by board-specific logic. + * They are implementations of the select and status methods of the SPI + * interface defined by struct spi_ops_s (see include/nuttx/spi/spi.h). + * All other methods (including imxrt_lpspibus_initialize()) are provided + * by common STM32 logic. To use this common SPI logic on your board: + * + * 1. Provide logic in imxrt_boardinitialize() to configure SPI chip select + * pins. + * 2. Provide imxrt_lpspi1/2/3select() and imxrt_lpspi1/2/3status() + * functions in your board-specific logic. + * These functions will perform chip selection and status operations + * using GPIOs in the way your board is configured. + * 3. Add a calls to imxrt_lpspibus_initialize() in your low level + * application initialization logic + * 4. The handle returned by imxrt_lpspibus_initialize() may then be used + * to bind the SPI driver to higher level logic (e.g., calling + * mmcsd_spislotinitialize(), for example, will bind the SPI driver to + * the SPI MMC/SD driver). + * + ****************************************************************************/ + +#ifdef CONFIG_IMXRT_LPSPI1 +void imxrt_lpspi1select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) +{ + spiinfo("devid: %d CS: %s\n", (int)devid, + selected ? "assert" : "de-assert"); + + imxrt_gpio_write(GPIO_LPSPI1_CS, !selected); +} + +uint8_t imxrt_lpspi1status(FAR struct spi_dev_s *dev, uint32_t devid) +{ + return 0; +} +#endif + +#ifdef CONFIG_IMXRT_LPSPI2 +void imxrt_lpspi2select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) +{ + spiinfo("devid: %d CS: %s\n", (int)devid, + selected ? "assert" : "de-assert"); + + imxrt_gpio_write(GPIO_LPSPI2_CS, !selected); +} + +uint8_t imxrt_lpspi2status(FAR struct spi_dev_s *dev, uint32_t devid) +{ + return 0; +} +#endif + +#ifdef CONFIG_IMXRT_LPSPI3 +void imxrt_lpspi3select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) +{ + spiinfo("devid: %d CS: %s\n", (int)devid, + selected ? "assert" : "de-assert"); + + imxrt_gpio_write(GPIO_LPSPI3_CS, !selected); +} + +uint8_t imxrt_lpspi3status(FAR struct spi_dev_s *dev, uint32_t devid) +{ + return 0; +} +#endif + +#ifdef CONFIG_IMXRT_LPSPI4 +void imxrt_lpspi4select(FAR struct spi_dev_s *dev, uint32_t devid, + bool selected) +{ + spiinfo("devid: %d CS: %s\n", (int)devid, + selected ? "assert" : "de-assert"); + + imxrt_gpio_write(GPIO_LPSPI4_CS, !selected); +} + +uint8_t imxrt_lpspi4status(FAR struct spi_dev_s *dev, uint32_t devid) +{ + return 0; +} +#endif + +/**************************************************************************** + * Name: imxrt_lpspi1cmddata + * + * Description: + * Set or clear the SH1101A A0 or SD1306 D/C n bit to select data (true) + * or command (false). This function must be provided by platform-specific + * logic. This is an implementation of the cmddata method of the SPI + * interface defined by struct spi_ops_s (see include/nuttx/spi/spi.h). + * + * Input Parameters: + * + * spi - SPI device that controls the bus the device that requires the CMD/ + * DATA selection. + * devid - If there are multiple devices on the bus, this selects which one + * to select cmd or data. NOTE: This design restricts, for example, + * one one SPI display per SPI bus. + * cmd - true: select command; false: select data + * + * Returned Value: + * None + * + ****************************************************************************/ + +#ifdef CONFIG_SPI_CMDDATA +#ifdef CONFIG_IMXRT_LPSPI1 +int imxrt_lpspi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) +{ + return -ENODEV; +} +#endif + +#ifdef CONFIG_IMXRT_LPSPI2 +int imxrt_lpspi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) +{ + return -ENODEV; +} +#endif + +#ifdef CONFIG_IMXRT_LPSPI3 +int imxrt_lpspi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) +{ + return -ENODEV; +} +#endif + +#ifdef CONFIG_IMXRT_LPSPI4 +int imxrt_lpspi4cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) +{ + return -ENODEV; +} +#endif +#endif /* CONFIG_SPI_CMDDATA */ +#endif /* CONFIG_IMXRT_LPSPI1 || CONFIG_IMXRT_LPSPI2 */ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_userleds.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_userleds.c new file mode 100644 index 000000000..d0e565c91 --- /dev/null +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_userleds.c @@ -0,0 +1,85 @@ +/**************************************************************************** + * boards/arm/imxrt/imxrt1052-ok/src/imxrt_userleds.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/* There are four LED status indicators located on the EVK Board. The + * functions of these LEDs include: + * + * - Main Power Supply(D3) + * Green: DC 5V main supply is normal. + * Red: J2 input voltage is over 5.6V. + * Off: The board is not powered. + * - Reset RED LED(D15) + * - OpenSDA LED(D16) + * - USER LED(D18) + * + * Only a single LED, D18, is under software control. + */ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include "imxrt_gpio.h" +#include "imxrt_iomuxc.h" +#include "imxrt1052-ok.h" + +#include + +#if !defined(CONFIG_ARCH_LEDS) && defined(GPIO_LED) + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_userled_initialize + ****************************************************************************/ + +uint32_t board_userled_initialize(void) +{ + /* Configure LED GPIO for output */ + + imxrt_config_gpio(GPIO_LED); + return BOARD_NLEDS; +} + +/**************************************************************************** + * Name: board_userled + ****************************************************************************/ + +void board_userled(int led, bool ledon) +{ + imxrt_gpio_write(GPIO_LED, !ledon); /* Low illuminates */ +} + +/**************************************************************************** + * Name: board_userled_all + ****************************************************************************/ + +void board_userled_all(uint32_t ledset) +{ + /* Low illuminates */ + + imxrt_gpio_write(GPIO_LED, (ledset & BOARD_USERLED_BIT) == 0); +} + +#endif /* !CONFIG_ARCH_LEDS */ diff --git a/Ubiquitous/Nuttx/app_match_nuttx/build.sh b/Ubiquitous/Nuttx/app_match_nuttx/build.sh index 7b5b39fcc..cb656dbdb 100644 --- a/Ubiquitous/Nuttx/app_match_nuttx/build.sh +++ b/Ubiquitous/Nuttx/app_match_nuttx/build.sh @@ -18,5 +18,6 @@ cp -rf $current/nuttx $nuttx cp -rf $current/apps $nuttx cp -rf $nuttx/aiit_board/aiit-arm32-board $nuttx/nuttx/boards/arm/stm32 cp -rf $nuttx/aiit_board/aiit-riscv64-board $nuttx/nuttx/boards/risc-v/k210 +cp -rf $nuttx/aiit_board/imxrt1052-ok $nuttx/nuttx/boards/arm/imxrt cd ../nuttx diff --git a/Ubiquitous/Nuttx/app_match_nuttx/nuttx/boards/Kconfig b/Ubiquitous/Nuttx/app_match_nuttx/nuttx/boards/Kconfig index a2cd90a8c..1c5a46d02 100644 --- a/Ubiquitous/Nuttx/app_match_nuttx/nuttx/boards/Kconfig +++ b/Ubiquitous/Nuttx/app_match_nuttx/nuttx/boards/Kconfig @@ -445,6 +445,16 @@ config ARCH_BOARD_IMXRT1050_EVK This is the board configuration for the port of NuttX to the NXP i.MXRT evaluation kit, MIMXRT1050-EVKB. This board features the MIMXRT1052DVL6A MCU. +config ARCH_BOARD_IMXRT1052_OK + bool "NXP i.MX RT 1052 OK" + depends on ARCH_CHIP_MIMXRT1052DVL6A + select ARCH_HAVE_LEDS + select ARCH_HAVE_BUTTONS + select ARCH_HAVE_IRQBUTTONS + ---help--- + This is the board configuration for the port of NuttX to the NXP i.MXRT + evaluation kit, MIMXRT1052-OK. This board features the MIMXRT1052DVL6A MCU. + config ARCH_BOARD_IMXRT1060_EVK bool "NXP i.MX RT 1060 EVK" depends on ARCH_CHIP_MIMXRT1062DVL6A @@ -2382,6 +2392,7 @@ config ARCH_BOARD default "hymini-stm32v" if ARCH_BOARD_HYMINI_STM32V default "imxrt1020-evk" if ARCH_BOARD_IMXRT1020_EVK default "imxrt1050-evk" if ARCH_BOARD_IMXRT1050_EVK + default "imxrt1052-ok" if ARCH_BOARD_IMXRT1052_OK default "imxrt1060-evk" if ARCH_BOARD_IMXRT1060_EVK default "imxrt1064-evk" if ARCH_BOARD_IMXRT1064_EVK default "kwikstik-k40" if ARCH_BOARD_KWIKSTIK_K40 @@ -2660,6 +2671,9 @@ endif if ARCH_BOARD_IMXRT1050_EVK source "boards/arm/imxrt/imxrt1050-evk/Kconfig" endif +if ARCH_BOARD_IMXRT1052_OK +source "boards/arm/imxrt/imxrt1052-ok/Kconfig" +endif if ARCH_BOARD_IMXRT1060_EVK source "boards/arm/imxrt/imxrt1060-evk/Kconfig" endif From aa9d16c64dfec9f3648c806c527b84dd5960a7a1 Mon Sep 17 00:00:00 2001 From: wgz-code <820906721@qq.com> Date: Tue, 8 Mar 2022 13:21:48 +0800 Subject: [PATCH 02/18] imxrt-ok1052 board set CONFIG_RAW_BINARY=y --- Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig | 1 + .../Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig | 1 + .../Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig | 1 + Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig | 1 + 4 files changed, 4 insertions(+) diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig index 1ef5015a7..ed76b3fe5 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig @@ -35,6 +35,7 @@ CONFIG_NUTTX_USERSPACE=0x60200000 CONFIG_PASS1_BUILDIR="boards/arm/imxrt/imxrt1052-ok/kernel" CONFIG_RAM_SIZE=524288 CONFIG_RAM_START=0x20200000 +CONFIG_RAW_BINARY=y CONFIG_SCHED_WAITPID=y CONFIG_START_DAY=8 CONFIG_START_MONTH=6 diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig index 568c20516..21c8df6cf 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig @@ -33,6 +33,7 @@ CONFIG_NSH_LINELEN=64 CONFIG_NSH_READLINE=y CONFIG_RAM_SIZE=536870912 CONFIG_RAM_START=0x20200000 +CONFIG_RAW_BINARY=y CONFIG_SCHED_CPULOAD=y CONFIG_START_DAY=14 CONFIG_START_MONTH=3 diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig index bbc23cc75..1e52233e1 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig @@ -53,6 +53,7 @@ CONFIG_NSH_LINELEN=64 CONFIG_NSH_READLINE=y CONFIG_RAM_SIZE=524288 CONFIG_RAM_START=0x20200000 +CONFIG_RAW_BINARY=y CONFIG_SCHED_LPWORK=y CONFIG_START_DAY=14 CONFIG_START_MONTH=3 diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig index d69e7aecd..69c47892d 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig @@ -31,6 +31,7 @@ CONFIG_NSH_LINELEN=64 CONFIG_NSH_READLINE=y CONFIG_RAM_SIZE=524288 CONFIG_RAM_START=0x20200000 +CONFIG_RAW_BINARY=y CONFIG_START_DAY=14 CONFIG_START_MONTH=3 CONFIG_SYSTEM_NSH=y From f57bed1b8d976c3919e3ecc629cb53693a36cc0d Mon Sep 17 00:00:00 2001 From: wgz-code <820906721@qq.com> Date: Tue, 8 Mar 2022 14:07:56 +0800 Subject: [PATCH 03/18] set CONFIG_CLOCK_MONOTONIC=y on attiboard --- .../Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig | 1 + .../Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig | 1 + Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig | 1 + 3 files changed, 3 insertions(+) diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig index 21c8df6cf..75e2a5517 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig @@ -15,6 +15,7 @@ CONFIG_ARCH_STACKDUMP=y CONFIG_BOARD_LATE_INITIALIZE=y CONFIG_BOARD_LOOPSPERMSEC=20000 CONFIG_BUILTIN=y +CONFIG_CLOCK_MONOTONIC=y CONFIG_C99_BOOL8=y CONFIG_FS_PROCFS=y CONFIG_HAVE_CXX=y diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig index 1e52233e1..976517dab 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig @@ -19,6 +19,7 @@ CONFIG_ARMV7M_ICACHE=y CONFIG_ARMV7M_USEBASEPRI=y CONFIG_BOARD_LOOPSPERMSEC=104926 CONFIG_BUILTIN=y +CONFIG_CLOCK_MONOTONIC=y CONFIG_ETH0_PHY_KSZ8081=y CONFIG_FS_PROCFS=y CONFIG_IDLETHREAD_STACKSIZE=2048 diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig index 69c47892d..4dfc0e128 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig @@ -18,6 +18,7 @@ CONFIG_ARMV7M_ICACHE=y CONFIG_ARMV7M_USEBASEPRI=y CONFIG_BOARD_LOOPSPERMSEC=104926 CONFIG_BUILTIN=y +CONFIG_CLOCK_MONOTONIC=y CONFIG_FS_PROCFS=y CONFIG_IDLETHREAD_STACKSIZE=2048 CONFIG_IMXRT_LPUART1=y From 40a12583ccae2bc725ee61e1933f2967918c6690 Mon Sep 17 00:00:00 2001 From: wgz-code <820906721@qq.com> Date: Tue, 8 Mar 2022 14:53:12 +0800 Subject: [PATCH 04/18] set CONFIG_ADD_NUTTX_FETURES=y on attiboards for nuttx os --- Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig | 1 + .../Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig | 1 + .../Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig | 1 + Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig | 1 + 4 files changed, 4 insertions(+) diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig index ed76b3fe5..545fc5922 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig @@ -6,6 +6,7 @@ # modifications. # # CONFIG_ARCH_RAMFUNCS is not set +CONFIG_ADD_NUTTX_FETURES=y CONFIG_ARCH="arm" CONFIG_ARCH_BOARD="imxrt1052-ok" CONFIG_ARCH_BOARD_IMXRT1052_OK=y diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig index 75e2a5517..cb56d4c90 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig @@ -5,6 +5,7 @@ # You can then do "make savedefconfig" to generate a new defconfig file that includes your # modifications. # +CONFIG_ADD_NUTTX_FETURES=y CONFIG_ARCH="arm" CONFIG_ARCH_BOARD="imxrt1052-ok" CONFIG_ARCH_BOARD_IMXRT1052_OK=y diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig index 976517dab..38f027780 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig @@ -6,6 +6,7 @@ # modifications. # # CONFIG_ARCH_LEDS is not set +CONFIG_ADD_NUTTX_FETURES=y CONFIG_ARCH="arm" CONFIG_ARCH_BOARD="imxrt1052-ok" CONFIG_ARCH_BOARD_IMXRT1052_OK=y diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig index 4dfc0e128..da7afef51 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig @@ -5,6 +5,7 @@ # You can then do "make savedefconfig" to generate a new defconfig file that includes your # modifications. # +CONFIG_ADD_NUTTX_FETURES=y CONFIG_ARCH="arm" CONFIG_ARCH_BOARD="imxrt1052-ok" CONFIG_ARCH_BOARD_IMXRT1052_OK=y From 2f73d551eefbe070aeafeb6682eb212914939206 Mon Sep 17 00:00:00 2001 From: wgzAIIT <820906721@qq.com> Date: Fri, 18 Mar 2022 11:31:41 +0800 Subject: [PATCH 05/18] remove mxrt-ok1052 board CONFIG_RAW_BINARY=y --- Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig | 1 - .../Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig | 1 - .../Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig | 1 - Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig | 1 - 4 files changed, 4 deletions(-) diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig index 545fc5922..04e6e6908 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig @@ -36,7 +36,6 @@ CONFIG_NUTTX_USERSPACE=0x60200000 CONFIG_PASS1_BUILDIR="boards/arm/imxrt/imxrt1052-ok/kernel" CONFIG_RAM_SIZE=524288 CONFIG_RAM_START=0x20200000 -CONFIG_RAW_BINARY=y CONFIG_SCHED_WAITPID=y CONFIG_START_DAY=8 CONFIG_START_MONTH=6 diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig index cb56d4c90..fed0b9c77 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig @@ -35,7 +35,6 @@ CONFIG_NSH_LINELEN=64 CONFIG_NSH_READLINE=y CONFIG_RAM_SIZE=536870912 CONFIG_RAM_START=0x20200000 -CONFIG_RAW_BINARY=y CONFIG_SCHED_CPULOAD=y CONFIG_START_DAY=14 CONFIG_START_MONTH=3 diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig index 38f027780..9a6fce90d 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig @@ -55,7 +55,6 @@ CONFIG_NSH_LINELEN=64 CONFIG_NSH_READLINE=y CONFIG_RAM_SIZE=524288 CONFIG_RAM_START=0x20200000 -CONFIG_RAW_BINARY=y CONFIG_SCHED_LPWORK=y CONFIG_START_DAY=14 CONFIG_START_MONTH=3 diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig index da7afef51..1f5be9d79 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig @@ -33,7 +33,6 @@ CONFIG_NSH_LINELEN=64 CONFIG_NSH_READLINE=y CONFIG_RAM_SIZE=524288 CONFIG_RAM_START=0x20200000 -CONFIG_RAW_BINARY=y CONFIG_START_DAY=14 CONFIG_START_MONTH=3 CONFIG_SYSTEM_NSH=y From 6886a4d73aca46e8326a4ecc6c124a901c2025a3 Mon Sep 17 00:00:00 2001 From: wgzAIIT <820906721@qq.com> Date: Mon, 21 Mar 2022 12:06:29 +0800 Subject: [PATCH 06/18] changge pin config for chip MIMXRT1052CVL5B --- .../aiit_board/imxrt1052-ok/include/board.h | 43 ++++++++++++------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/include/board.h b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/include/board.h index f7a7e1be1..646432e5c 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/include/board.h +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/include/board.h @@ -277,39 +277,50 @@ /* LPUARTs * - * Virtual console port provided by OpenSDA on UART1 and - * Arduino RS-232 Shield on UART3. + * Virtual console port provided by OpenSDA on UART1. * */ +/* LPUART1 */ #define GPIO_LPUART1_RX (GPIO_LPUART1_RX_1|IOMUX_UART_DEFAULT) /* GPIO_AD_B0_13 */ #define GPIO_LPUART1_TX (GPIO_LPUART1_TX_1|IOMUX_UART_DEFAULT) /* GPIO_AD_B0_12 */ + +/* LPUART2 */ +#define GPIO_LPUART2_RX (GPIO_LPUART2_RX_1|IOMUX_UART_DEFAULT) /* GPIO_AD_B1_03 */ +#define GPIO_LPUART2_TX (GPIO_LPUART2_TX_1|IOMUX_UART_DEFAULT) /* GPIO_AD_B1_02 */ + +/* LPUART3 */ #define GPIO_LPUART3_RX (GPIO_LPUART3_RX_1|IOMUX_UART_DEFAULT) /* GPIO_AD_B1_07 */ #define GPIO_LPUART3_TX (GPIO_LPUART3_TX_1|IOMUX_UART_DEFAULT) /* GPIO_AD_B1_06 */ -/* LPI2Cs - * - * Arduino Connector LPI2C1 and audio/gyro IO on LPI2C3. - */ +/* LPUART4 */ +#define GPIO_LPUART4_RX (GPIO_LPUART4_RX_1|IOMUX_UART_DEFAULT) /* GPIO_SD_B1_01 */ +#define GPIO_LPUART4_TX (GPIO_LPUART4_TX_1|IOMUX_UART_DEFAULT) /* GPIO_SD_B1_00 */ +/* LPUART8 */ +#define GPIO_LPUART8_RX (GPIO_LPUART8_RX_1|IOMUX_UART_DEFAULT) /* GPIO_AD_B1_11 */ +#define GPIO_LPUART8_TX (GPIO_LPUART8_TX_1|IOMUX_UART_DEFAULT) /* GPIO_AD_B1_10 */ + + +/* LPI2C1 */ #define GPIO_LPI2C1_SDA (GPIO_LPI2C1_SDA_2|IOMUX_LPI2C_DEFAULT) /* GPIO_AD_B1_01 */ #define GPIO_LPI2C1_SCL (GPIO_LPI2C1_SCL_2|IOMUX_LPI2C_DEFAULT) /* GPIO_AD_B1_00 */ -#define GPIO_LPI2C3_SDA (GPIO_LPI2C3_SDA_2|IOMUX_LPI2C_DEFAULT) /* GPIO_AD_B1_01 */ -#define GPIO_LPI2C3_SCL (GPIO_LPI2C3_SCL_2|IOMUX_LPI2C_DEFAULT) /* GPIO_AD_B1_00 */ -/* LPSPI - * - * Arduino Connector - * - * J24 D09 GPIO_AD_B0_02 LPSPI3_SDI - * J24 D14 GPIO_AD_B0_01 LPSPI3_SDO - * J24 D15 GPIO_AD_B0_00 LPSPI3_SCK - */ +/* LPI2C3 */ +#define GPIO_LPI2C3_SDA (GPIO_LPI2C3_SDA_2|IOMUX_LPI2C_DEFAULT) /* GPIO_EMC_21 */ +#define GPIO_LPI2C3_SCL (GPIO_LPI2C3_SCL_2|IOMUX_LPI2C_DEFAULT) /* GPIO_EMC_22 */ + +/* LPSPI */ #define GPIO_LPSPI3_SCK (GPIO_LPSPI3_SCK_2|IOMUX_LPSPI_DEFAULT) /* GPIO_AD_B0_00 */ #define GPIO_LPSPI3_MISO (GPIO_LPSPI3_SDI_2|IOMUX_LPSPI_DEFAULT) /* GPIO_AD_B0_02 */ #define GPIO_LPSPI3_MOSI (GPIO_LPSPI3_SDO_2|IOMUX_LPSPI_DEFAULT) /* GPIO_AD_B0_01 */ + +/* FLEXCAN2 */ +#define GPIO_FLEXCAN2_TX (GPIO_FLEXCAN2_TX_3|IOMUX_CAN_DEFAULT) /* GPIO_AD_B0_14 */ +#define GPIO_FLEXCAN2_RX (GPIO_FLEXCAN2_RX_3|IOMUX_CAN_DEFAULT) /* GPIO_AD_B0_15 */ + /**************************************************************************** * Public Types ****************************************************************************/ From c2a949f6c878a4115f7ad83094b91aa2882c222a Mon Sep 17 00:00:00 2001 From: wgzAIIT <820906721@qq.com> Date: Mon, 21 Mar 2022 16:22:33 +0800 Subject: [PATCH 07/18] imxrt1052 CHIP_MIMXRT1052DVL6A change CHIP_MIMXRT1052CVL5B --- .../imxrt1052-ok/configs/knsh/defconfig | 2 +- .../imxrt1052-ok/configs/libcxxtest/defconfig | 2 +- .../imxrt1052-ok/configs/netnsh/defconfig | 2 +- .../imxrt1052-ok/configs/nsh/defconfig | 2 +- .../nuttx/arch/arm/include/imxrt/chip.h | 111 + .../nuttx/arch/arm/src/imxrt/Kconfig | 2013 +++++++++++++++++ .../app_match_nuttx/nuttx/boards/Kconfig | 4 +- 7 files changed, 2130 insertions(+), 6 deletions(-) create mode 100644 Ubiquitous/Nuttx/app_match_nuttx/nuttx/arch/arm/include/imxrt/chip.h create mode 100644 Ubiquitous/Nuttx/app_match_nuttx/nuttx/arch/arm/src/imxrt/Kconfig diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig index 04e6e6908..e75a746fc 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig @@ -12,7 +12,7 @@ CONFIG_ARCH_BOARD="imxrt1052-ok" CONFIG_ARCH_BOARD_IMXRT1052_OK=y CONFIG_ARCH_CHIP="imxrt" CONFIG_ARCH_CHIP_IMXRT=y -CONFIG_ARCH_CHIP_MIMXRT1052DVL6A=y +CONFIG_ARCH_CHIP_MIMXRT1052CVL5B=y CONFIG_ARCH_STACKDUMP=y CONFIG_ARMV7M_DCACHE=y CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig index fed0b9c77..a417efe5d 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig @@ -11,7 +11,7 @@ CONFIG_ARCH_BOARD="imxrt1052-ok" CONFIG_ARCH_BOARD_IMXRT1052_OK=y CONFIG_ARCH_CHIP="imxrt" CONFIG_ARCH_CHIP_IMXRT=y -CONFIG_ARCH_CHIP_MIMXRT1052DVL6A=y +CONFIG_ARCH_CHIP_MIMXRT1052CVL5B=y CONFIG_ARCH_STACKDUMP=y CONFIG_BOARD_LATE_INITIALIZE=y CONFIG_BOARD_LOOPSPERMSEC=20000 diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig index 9a6fce90d..b3998028a 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig @@ -12,7 +12,7 @@ CONFIG_ARCH_BOARD="imxrt1052-ok" CONFIG_ARCH_BOARD_IMXRT1052_OK=y CONFIG_ARCH_CHIP="imxrt" CONFIG_ARCH_CHIP_IMXRT=y -CONFIG_ARCH_CHIP_MIMXRT1052DVL6A=y +CONFIG_ARCH_CHIP_MIMXRT1052CVL5B=y CONFIG_ARCH_STACKDUMP=y CONFIG_ARMV7M_DCACHE=y CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig index 1f5be9d79..3d682848c 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig @@ -11,7 +11,7 @@ CONFIG_ARCH_BOARD="imxrt1052-ok" CONFIG_ARCH_BOARD_IMXRT1052_OK=y CONFIG_ARCH_CHIP="imxrt" CONFIG_ARCH_CHIP_IMXRT=y -CONFIG_ARCH_CHIP_MIMXRT1052DVL6A=y +CONFIG_ARCH_CHIP_MIMXRT1052CVL5B=y CONFIG_ARCH_STACKDUMP=y CONFIG_ARMV7M_DCACHE=y CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y diff --git a/Ubiquitous/Nuttx/app_match_nuttx/nuttx/arch/arm/include/imxrt/chip.h b/Ubiquitous/Nuttx/app_match_nuttx/nuttx/arch/arm/include/imxrt/chip.h new file mode 100644 index 000000000..73039331c --- /dev/null +++ b/Ubiquitous/Nuttx/app_match_nuttx/nuttx/arch/arm/include/imxrt/chip.h @@ -0,0 +1,111 @@ +/**************************************************************************** + * arch/arm/include/imxrt/chip.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __ARCH_ARM_INCLUDE_IMXRT_CHIP_H +#define __ARCH_ARM_INCLUDE_IMXRT_CHIP_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Prototypes + ****************************************************************************/ + +/* Get customizations for each supported chip */ + +#if defined(CONFIG_ARCH_CHIP_MIMXRT1021CAG4A) || \ + defined(CONFIG_ARCH_CHIP_MIMXRT1021CAF4A) || \ + defined(CONFIG_ARCH_CHIP_MIMXRT1021DAF5A) || \ + defined(CONFIG_ARCH_CHIP_MIMXRT1021DAG5A) + +/* MIMXRT1021CAG4A - 144 pin, 400MHz Industrial + * MIMXRT1021CAF4A - 100 pin, 400MHz Industrial + * MIMXRT1021DAF5A - 100 pin, 500MHz Consumer + * MIMXRT1021DAG5A - 144 pin, 500MHz Consumer + */ + +# define IMXRT_OCRAM_SIZE (256 * 1024) /* 256Kb OCRAM */ +# define IMXRT_GPIO_NPORTS 5 /* Five total ports */ + /* but 4 doesn't exist */ + +#elif defined(CONFIG_ARCH_CHIP_MIMXRT1051DVL6A) || \ + defined(CONFIG_ARCH_CHIP_MIMXRT1051CVL5A) || \ + defined(CONFIG_ARCH_CHIP_MIMXRT1052DVL6A) || \ + defined(CONFIG_ARCH_CHIP_MIMXRT1052CVL5A) || \ + defined(CONFIG_ARCH_CHIP_MIMXRT1052CVL5B) +/* MIMXRT1051CVL5A - Industrial, Reduced Features, 528MHz + * MIMXRT1051DVL6A - Consumer, Reduced Features, 600MHz + * MIMXRT1052CVL5A - Industrial, Full Feature, 528MHz + * MIMXRT1052CVL5B - Industrial, Full Feature, 528MHz + * MIMXRT1052DVL6A - Consumer, Full Feature, 600MHz + */ + +# define IMXRT_OCRAM_SIZE (512 * 1024) /* 512Kb OCRAM */ +# define IMXRT_GPIO_NPORTS 5 /* Five total ports */ + +#elif defined(CONFIG_ARCH_CHIP_MIMXRT1061DVL6A) || \ + defined(CONFIG_ARCH_CHIP_MIMXRT1061CVL5A) || \ + defined(CONFIG_ARCH_CHIP_MIMXRT1062DVL6A) || \ + defined(CONFIG_ARCH_CHIP_MIMXRT1062CVL5A) || \ + defined(CONFIG_ARCH_CHIP_MIMXRT1064DVL6A) || \ + defined(CONFIG_ARCH_CHIP_MIMXRT1064CVL5A) +/* MIMXRT1061CVL5A - Industrial, Reduced Features, 528MHz + * MIMXRT1061DVL6A - Consumer, Reduced Features, 600MHz + * MIMXRT1062CVL5A - Industrial, Full Feature, 528MHz + * MIMXRT1062DVL6A - Consumer, Full Feature, 600MHz + * MIMXRT1064CVL5A - Industrial, Full Feature, 528MHz + * MIMXRT1064DVL6A - Consumer, Full Feature, 600MHz + */ + +# define IMXRT_OCRAM_SIZE (1024 * 1024) /* 1024Kb OCRAM */ +# define IMXRT_GPIO_NPORTS 9 /* Nine total ports */ +#else +# error "Unknown i.MX RT chip type" +#endif + +/* NVIC priority levels *****************************************************/ + +/* Each priority field holds an 8-bit priority value, 0-15. The lower the + * value, the greater the priority of the corresponding interrupt. The i.MX + * RT processor implements only bits[7:4] of each field, bits[3:0] read as + * zero and ignore writes. + */ + +#define NVIC_SYSH_PRIORITY_MIN 0xf0 /* All bits[7:4] set is min pri */ +#define NVIC_SYSH_PRIORITY_DEFAULT 0x80 /* Midpoint is the default */ +#define NVIC_SYSH_PRIORITY_MAX 0x00 /* Zero is maximum priority */ +#define NVIC_SYSH_PRIORITY_STEP 0x40 /* Two bits of interrupt pri used */ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Public Functions Prototypes + ****************************************************************************/ + +#endif /* __ARCH_ARM_INCLUDE_IMXRT_CHIP_H */ diff --git a/Ubiquitous/Nuttx/app_match_nuttx/nuttx/arch/arm/src/imxrt/Kconfig b/Ubiquitous/Nuttx/app_match_nuttx/nuttx/arch/arm/src/imxrt/Kconfig new file mode 100644 index 000000000..e46a53aa1 --- /dev/null +++ b/Ubiquitous/Nuttx/app_match_nuttx/nuttx/arch/arm/src/imxrt/Kconfig @@ -0,0 +1,2013 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# + +if ARCH_CHIP_IMXRT + +comment "i.MX RT Configuration Options" + +choice + prompt "i.MX RT Chip Selection" + default ARCH_CHIP_MIMXRT1052CVL5B + depends on ARCH_CHIP_IMXRT + +config ARCH_CHIP_MIMXRT1021CAG4A + bool "MIMXRT1021CAG4A" + select ARCH_FAMILY_MIMXRT1021C + +config ARCH_CHIP_MIMXRT1021CAF4A + bool "MIMXRT1021CAF4A" + select ARCH_FAMILY_MIMXRT1021C + +config ARCH_CHIP_MIMXRT1021DAF5A + bool "MIMXRT1021DAF5A" + select ARCH_FAMILY_MIMXRT1021D + +config ARCH_CHIP_MIMXRT1021DAG5A + bool "MIMXRT1021DAG5A" + select ARCH_FAMILY_MIMXRT1021D + +config ARCH_CHIP_MIMXRT1051DVL6A + bool "MIMXRT1051DVL6A" + select ARCH_FAMILY_MIMXRT105xDVL6A + +config ARCH_CHIP_MIMXRT1051CVL5A + bool "MIMXRT1051CVL5A" + select ARCH_FAMILY_MIMXRT105xCVL5A + +config ARCH_CHIP_MIMXRT1052DVL6A + bool "MIMXRT1052DVL6A" + select ARCH_FAMILY_MIMXRT105xDVL6A + select IMXRT_HAVE_LCD + +config ARCH_CHIP_MIMXRT1052CVL5A + bool "MIMXRT1052CVL5A" + select ARCH_FAMILY_MIMXRT105xCVL5A + select IMXRT_HAVE_LCD + +config ARCH_CHIP_MIMXRT1052CVL5B + bool "MIMXRT1052CVL5B" + select ARCH_FAMILY_MIMXRT105xCVL5B + select IMXRT_HAVE_LCD + +config ARCH_CHIP_MIMXRT1061DVL6A + bool "MIMXRT1061DVL6A" + select ARCH_FAMILY_MXRT106xDVL6A + +config ARCH_CHIP_MIMXRT1061CVL5A + bool "MIMXRT1061CVL5A" + select ARCH_FAMILY_MIMXRT106xCVL5A + +config ARCH_CHIP_MIMXRT1062DVL6A + bool "MIMXRT1062DVL6A" + select ARCH_FAMILY_MXRT106xDVL6A + select IMXRT_HAVE_LCD + +config ARCH_CHIP_MIMXRT1062CVL5A + bool "MIMXRT1062DVL6A" + select ARCH_FAMILY_MIMXRT106xCVL5A + select IMXRT_HAVE_LCD + +config ARCH_CHIP_MIMXRT1064DVL6A + bool "MIMXRT1064DVL6A" + select ARCH_FAMILY_MXRT106xDVL6A + select IMXRT_HAVE_LCD + +config ARCH_CHIP_MIMXRT1064CVL5A + bool "MIMXRT1064DVL6A" + select ARCH_FAMILY_MIMXRT106xCVL5A + select IMXRT_HAVE_LCD + +endchoice # i.MX RT Chip Selection + +# i.MX RT Families + +config ARCH_FAMILY_MIMXRT1021D + bool + default n + select ARCH_FAMILY_IMXRT102x + ---help--- + i.MX RT1020 Crossover Processors for Consumer Products + +config ARCH_FAMILY_MIMXRT1021C + bool + default n + select ARCH_FAMILY_IMXRT102x + ---help--- + i.MX RT1020 Crossover Processors for Industrial Products + +config ARCH_FAMILY_IMXRT102x + bool + default n + select ARCH_HAVE_FPU + select ARCH_HAVE_DPFPU # REVISIT + select ARMV7M_HAVE_ICACHE + select ARMV7M_HAVE_DCACHE + select ARMV7M_HAVE_ITCM + select ARMV7M_HAVE_DTCM + +config ARCH_FAMILY_MIMXRT105xDVL6A + bool + default n + select ARCH_FAMILY_IMXRT105x + ---help--- + i.MX RT1050 Crossover Processors for Consumer Products + +config ARCH_FAMILY_MIMXRT105xCVL5A + bool + default n + select ARCH_FAMILY_IMXRT105x + ---help--- + i.MX RT1050 Crossover Processors for Industrial Products + +config ARCH_FAMILY_MIMXRT105xCVL5B + bool + default n + select ARCH_FAMILY_IMXRT105x + ---help--- + i.MX RT1050 Crossover Processors for Industrial Products + +config ARCH_FAMILY_IMXRT105x + bool + default n + select ARCH_HAVE_FPU + select ARCH_HAVE_DPFPU # REVISIT + select ARMV7M_HAVE_ICACHE + select ARMV7M_HAVE_DCACHE + select ARMV7M_HAVE_ITCM + select ARMV7M_HAVE_DTCM + +config ARCH_FAMILY_MXRT106xDVL6A + bool + default n + select ARCH_FAMILY_IMXRT106x + ---help--- + i.MX RT1060 Crossover Processors for Consumer Products + +config ARCH_FAMILY_MIMXRT106xCVL5A + bool + default n + select ARCH_FAMILY_IMXRT106x + ---help--- + i.MX RT1056 Crossover Processors for Industrial Products + +config ARCH_FAMILY_IMXRT106x + bool + default n + select ARCH_HAVE_FPU + select ARCH_HAVE_DPFPU # REVISIT + select ARMV7M_HAVE_ICACHE + select ARMV7M_HAVE_DCACHE + select ARMV7M_HAVE_ITCM + select ARMV7M_HAVE_DTCM + select IMXRT_HIGHSPEED_GPIO + +# Peripheral support + +config IMXRT_USDHC + bool + default n + +config IMXRT_FLEXIO + bool + default n + +config IMXRT_HAVE_LPUART + bool + default n + +config IMXRT_FLEXCAN + bool + default n + select ARCH_HAVE_NETDEV_STATISTICS + +config IMXRT_FLEXPWM + bool + default n + select ARCH_HAVE_PWM_MULTICHAN + +config IMXRT_LPI2C + bool + default n + +config IMXRT_LPSPI + bool + default n + +config IMXRT_FLEXSPI + bool + default n + +config IMXRT_ADC + bool + default n + +config IMXRT_ENC + bool + default n + +config IMXRT_HIGHSPEED_GPIO + bool + default n + +config IMXRT_HAVE_LCD + bool + default n + +config IMXRT_SEMC_INIT_DONE + bool + default n + +menu "i.MX RT Peripheral Selection" + +config IMXRT_EDMA + bool "eDMA" + default n + select ARCH_DMA + +config IMXRT_USBOTG + bool "USB EHCI" + default n + select USBHOST_HAVE_ASYNCH if USBHOST + select USBHOST_ASYNCH + +config IMXRT_USBDEV + bool "USB Device" + default n + +config IMXRT_ENET + bool "Ethernet" + default n + select ARCH_HAVE_PHY + select ARCH_PHY_INTERRUPT + select ARCH_HAVE_NETDEV_STATISTICS + +config IMXRT_LCD + bool "LCD controller" + default n + depends on IMXRT_HAVE_LCD + +config IMXRT_WDOG + bool "Watchdog 1" + default n + depends on WATCHDOG + +menu "FlexIO Peripherals" + +config IMXRT_FLEXIO1 + bool "FLEXIO1" + default n + select IMXRT_FLEXIO + +if IMXRT_FLEXIO1 + +choice + prompt "FLEXIO1 Clock Source" + default FLEXIO1_CLK_PLL3_SW + ---help--- + The clock source that drives the FLEXIO. + Used to set FLEXIO1_CLK_SEL. + +config FLEXIO1_CLK_PLL4 + bool "PLL4" + +config FLEXIO1_CLK_PLL3_PFD2 + bool "PLL3_PFD2" + +if ARCH_FAMILY_IMXRT105x || ARCH_FAMILY_IMXRT106x + +config FLEXIO1_CLK_PLL5 + bool "PLL5" + +endif # ARCH_FAMILY_IMXRT105x || ARCH_FAMILY_IMXRT106x + +config FLEXIO1_CLK_PLL3_SW + bool "PLL3_SW_CLK" + +endchoice # FLEXIO1 Clock Source + +config FLEXIO1_CLK + int + default 0 if FLEXIO1_CLK_PLL4 + default 1 if FLEXIO1_CLK_PLL3_PFD2 + default 2 if FLEXIO1_CLK_PLL5 + default 3 if FLEXIO1_CLK_PLL3_SW + +config FLEXIO1_PRED_DIVIDER + int "FLEXIO1 Predivider" + range 1 8 + default 2 + ---help--- + The clock source predivider value (FLEXIO1_PRED). [1-8] + +config FLEXIO1_PODF_DIVIDER + int "FLEXIO1 Divider" + range 1 8 + default 8 + ---help--- + The clock source divider value (FLEXIO1_PODF). [1-8] + +endif # IMXRT_FLEXIO1 + +if ARCH_FAMILY_IMXRT105x || ARCH_FAMILY_IMXRT106x + +config IMXRT_FLEXIO2 + bool "FLEXIO2" + default n + select IMXRT_FLEXIO + +if IMXRT_FLEXIO2 || IMXRT_FLEXIO3 + +choice + prompt "FLEXIO2 Clock Source" + default FLEXIO2_CLK_PLL3_SW + ---help--- + The clock source that drives the FLEXIO. + Used to set FLEXIO2_CLK_SEL. + +config FLEXIO2_CLK_PLL4 + bool "PLL4" + +config FLEXIO2_CLK_PLL3_PFD2 + bool "PLL3_PFD2" + +config FLEXIO2_CLK_PLL5 + bool "PLL5" + +config FLEXIO2_CLK_PLL3_SW + bool "PLL3_SW_CLK" + +endchoice # FLEXIO2 Clock Source + +config FLEXIO2_CLK + int + default 0 if FLEXIO2_CLK_PLL4 + default 1 if FLEXIO2_CLK_PLL3_PFD2 + default 2 if FLEXIO2_CLK_PLL5 + default 3 if FLEXIO2_CLK_PLL3_SW + +config FLEXIO2_PRED_DIVIDER + int + prompt "FLEXIO2 Predivider" + range 1 8 + default 2 + ---help--- + The clock source predivider value (FLEXIO2_PRED). [1-8] + +config FLEXIO2_PODF_DIVIDER + int + prompt "FLEXIO2 Divider" + range 1 8 + default 8 + ---help--- + The clock source divider value (FLEXIO2_PODF). [1-8] + +endif # IMXRT_FLEXIO2 || IMXRT_FLEXIO3 + +if ARCH_FAMILY_IMXRT106x + +config IMXRT_FLEXIO3 + bool "FLEXIO3" + default n + select IMXRT_FLEXIO + ---help--- + FLEXIO3 uses the FLEXIO2 clock settings. + +endif # ARCH_FAMILY_IMXRT106x +endif # ARCH_FAMILY_IMXRT105x || ARCH_FAMILY_IMXRT106x + +endmenu # FlexIO Peripherals + +menu "LPUART Peripherals" + +config IMXRT_LPUART1 + bool "LPUART1" + default n + select LPUART1_SERIALDRIVER + select ARCH_HAVE_SERIAL_TERMIOS + select IMXRT_HAVE_LPUART + +config IMXRT_LPUART2 + bool "LPUART2" + default n + select LPUART2_SERIALDRIVER + select ARCH_HAVE_SERIAL_TERMIOS + select IMXRT_HAVE_LPUART + +config IMXRT_LPUART3 + bool "LPUART3" + default n + select LPUART3_SERIALDRIVER + select ARCH_HAVE_SERIAL_TERMIOS + select IMXRT_HAVE_LPUART + +config IMXRT_LPUART4 + bool "LPUART4" + default n + select LPUART4_SERIALDRIVER + select ARCH_HAVE_SERIAL_TERMIOS + select IMXRT_HAVE_LPUART + +config IMXRT_LPUART5 + bool "LPUART5" + default n + select LPUART5_SERIALDRIVER + select ARCH_HAVE_SERIAL_TERMIOS + select IMXRT_HAVE_LPUART + +config IMXRT_LPUART6 + bool "LPUART6" + default n + select LPUART6_SERIALDRIVER + select ARCH_HAVE_SERIAL_TERMIOS + select IMXRT_HAVE_LPUART + +config IMXRT_LPUART7 + bool "LPUART7" + default n + select LPUART7_SERIALDRIVER + select ARCH_HAVE_SERIAL_TERMIOS + select IMXRT_HAVE_LPUART + +config IMXRT_LPUART8 + bool "LPUART8" + default n + select LPUART8_SERIALDRIVER + select ARCH_HAVE_SERIAL_TERMIOS + select IMXRT_HAVE_LPUART + +endmenu # LPUART Peripherals + +menu "LPUART Configuration" + depends on IMXRT_HAVE_LPUART + +config IMXRT_LPUART_INVERT + bool "Signal Invert Support" + default n + depends on IMXRT_HAVE_LPUART + ---help--- + Enable signal inversion UART support. The option enables support for the + TIOCSINVERT ioctl in the IMXRT serial driver. + +config IMXRT_LPUART_SINGLEWIRE + bool "Single Wire Support" + default n + depends on IMXRT_HAVE_LPUART + ---help--- + Enable single wire UART support. The option enables support for the + TIOCSSINGLEWIRE ioctl in the IMXRT serial driver. + +endmenu # LPUART Configuration + +menu "FLEXCAN Peripherals" + +config IMXRT_FLEXCAN1 + bool "FLEXCAN1" + default n + select IMXRT_FLEXCAN + select NET_CAN_HAVE_TX_DEADLINE + +config IMXRT_FLEXCAN2 + bool "FLEXCAN2" + default n + select IMXRT_FLEXCAN + select NET_CAN_HAVE_TX_DEADLINE + +config IMXRT_FLEXCAN3 + bool "FLEXCAN3" + default n + select IMXRT_FLEXCAN + select NET_CAN_HAVE_TX_DEADLINE + select NET_CAN_HAVE_CANFD + +if IMXRT_FLEXCAN1 || IMXRT_FLEXCAN2 || IMXRT_FLEXCAN3 + +config IMXRT_FLEXCAN_TXMB + int "Number of TX message buffers" + default 3 + ---help--- + This defines number of TX messages buffers. Please note that + maximum number of all message buffers is 13 (one MB has to + be reserved for chip errata ERR005829). + +config IMXRT_FLEXCAN_RXMB + int "Number of RX message buffers" + default 10 + ---help--- + This defines number of RX messages buffers. Please note that + maximum number of all message buffers is 13 (one MB has to + be reserved for chip errata ERR005829). + +endif + +endmenu # FLEXCAN Peripherals + +menu "FLEXCAN1 Configuration" + depends on IMXRT_FLEXCAN1 + +config FLEXCAN1_BITRATE + int "CAN bitrate" + default 1000000 + +config FLEXCAN1_SAMPLEP + int "CAN sample point" + default 80 + +endmenu # IMXRT_FLEXCAN1 + +menu "FLEXCAN2 Configuration" + depends on IMXRT_FLEXCAN2 + +config FLEXCAN2_BITRATE + int "CAN bitrate" + default 1000000 + +config FLEXCAN2_SAMPLEP + int "CAN sample point" + default 80 + +endmenu # IMXRT_FLEXCAN2 + +menu "FLEXCAN3 Configuration" + depends on IMXRT_FLEXCAN3 + +config FLEXCAN3_BITRATE + int "CAN bitrate" + depends on !NET_CAN_CANFD + default 1000000 + +config FLEXCAN3_SAMPLEP + int "CAN sample point" + depends on !NET_CAN_CANFD + default 80 + +config FLEXCAN3_ARBI_BITRATE + int "CAN FD Arbitration phase bitrate" + depends on NET_CAN_CANFD + default 1000000 + +config FLEXCAN3_ARBI_SAMPLEP + int "CAN FD Arbitration phase sample point" + depends on NET_CAN_CANFD + default 80 + +config FLEXCAN3_DATA_BITRATE + int "CAN FD Data phase bitrate" + depends on NET_CAN_CANFD + default 4000000 + +config FLEXCAN3_DATA_SAMPLEP + int "CAN FD Data phase sample point" + depends on NET_CAN_CANFD + default 90 + +endmenu # IMXRT_FLEXCAN3 + +menu "FLEXPWM Peripherals" + +config IMXRT_FLEXPWM1 + bool "FLEXPWM1" + default n + select IMXRT_FLEXPWM + +config IMXRT_FLEXPWM2 + bool "FLEXPWM2" + default n + select IMXRT_FLEXPWM + +if ARCH_FAMILY_IMXRT105x || ARCH_FAMILY_IMXRT106x + +config IMXRT_FLEXPWM3 + bool "FLEXPWM3" + default n + select IMXRT_FLEXPWM + +config IMXRT_FLEXPWM4 + bool "FLEXPWM4" + default n + select IMXRT_FLEXPWM + +endif # ARCH_FAMILY_IMXRT105x || ARCH_FAMILY_IMXRT106x + +endmenu # FLEXPWM Peripherals + +menu "FLEXPWM1 Configuration" + depends on IMXRT_FLEXPWM1 + +config IMXRT_FLEXPWM1_MOD1 + bool "FLEXPWM1 Module 1" + default n + +if IMXRT_FLEXPWM1_MOD1 + +config IMXRT_FLEXPWM1_MOD1_COMP + bool "Use complementary output" + default n + +endif + +config IMXRT_FLEXPWM1_MOD2 + bool "FLEXPWM1 Module 2" + default n + +if IMXRT_FLEXPWM1_MOD2 + +config IMXRT_FLEXPWM1_MOD2_COMP + bool "Use complementary output" + default n + +endif + +config IMXRT_FLEXPWM1_MOD3 + bool "FLEXPWM1 Module 3" + default n + +if IMXRT_FLEXPWM1_MOD3 + +config IMXRT_FLEXPWM1_MOD3_COMP + bool "Use complementary output" + default n + +endif + +config IMXRT_FLEXPWM1_MOD4 + bool "FLEXPWM1 Module 4" + default n + +if IMXRT_FLEXPWM1_MOD4 + +config IMXRT_FLEXPWM1_MOD4_COMP + bool "Use complementary output" + default n + +endif + +endmenu # IMXRT_FLEXPWM1 + +menu "FLEXPWM2 Configuration" + depends on IMXRT_FLEXPWM2 + +config IMXRT_FLEXPWM2_MOD1 + bool "FLEXPWM2 Module 1" + default n + +if IMXRT_FLEXPWM2_MOD1 + +config IMXRT_FLEXPWM2_MOD1_COMP + bool "Use complementary output" + default n + +endif + +config IMXRT_FLEXPWM2_MOD2 + bool "FLEXPWM2 Module 2" + default n + +if IMXRT_FLEXPWM2_MOD2 + +config IMXRT_FLEXPWM2_MOD2_COMP + bool "Use complementary output" + default n + +endif + +config IMXRT_FLEXPWM2_MOD3 + bool "FLEXPWM2 Module 3" + default n + +if IMXRT_FLEXPWM2_MOD3 + +config IMXRT_FLEXPWM2_MOD3_COMP + bool "Use complementary output" + default n + +endif + +config IMXRT_FLEXPWM2_MOD4 + bool "FLEXPWM2 Module 4" + default n + +if IMXRT_FLEXPWM2_MOD4 + +config IMXRT_FLEXPWM2_MOD4_COMP + bool "Use complementary output" + default n + +endif + +endmenu # IMXRT_FLEXPWM2 + +menu "FLEXPWM3 Configuration" + depends on IMXRT_FLEXPWM3 + +config IMXRT_FLEXPWM3_MOD1 + bool "FLEXPWM3 Module 1" + default n + +if IMXRT_FLEXPWM3_MOD1 + +config IMXRT_FLEXPWM3_MOD1_COMP + bool "Use complementary output" + default n + +endif + +config IMXRT_FLEXPWM3_MOD2 + bool "FLEXPWM3 Module 2" + default n + +if IMXRT_FLEXPWM3_MOD2 + +config IMXRT_FLEXPWM3_MOD2_COMP + bool "Use complementary output" + default n + +endif + +config IMXRT_FLEXPWM3_MOD3 + bool "FLEXPWM3 Module 3" + default n + +if IMXRT_FLEXPWM3_MOD3 + +config IMXRT_FLEXPWM3_MOD3_COMP + bool "Use complementary output" + default n + +endif + +config IMXRT_FLEXPWM3_MOD4 + bool "FLEXPWM3 Module 4" + default n + +if IMXRT_FLEXPWM3_MOD4 + +config IMXRT_FLEXPWM3_MOD4_COMP + bool "Use complementary output" + default n + +endif + +endmenu # IMXRT_FLEXPWM3 + +menu "FLEXPWM4 Configuration" + depends on IMXRT_FLEXPWM4 + +config IMXRT_FLEXPWM4_MOD1 + bool "FLEXPWM4 Module 1" + default n + +if IMXRT_FLEXPWM4_MOD1 + +config IMXRT_FLEXPWM4_MOD1_COMP + bool "Use complementary output" + default n + +endif + +config IMXRT_FLEXPWM4_MOD2 + bool "FLEXPWM4 Module 2" + default n + +if IMXRT_FLEXPWM4_MOD2 + +config IMXRT_FLEXPWM4_MOD2_COMP + bool "Use complementary output" + default n + +endif + +config IMXRT_FLEXPWM4_MOD3 + bool "FLEXPWM4 Module 3" + default n + +if IMXRT_FLEXPWM4_MOD3 + +config IMXRT_FLEXPWM4_MOD3_COMP + bool "Use complementary output" + default n + +endif + +config IMXRT_FLEXPWM4_MOD4 + bool "FLEXPWM4 Module 4" + default n + +if IMXRT_FLEXPWM4_MOD4 + +config IMXRT_FLEXPWM4_MOD4_COMP + bool "Use complementary output" + default n + +endif + +endmenu # IMXRT_FLEXPWM4 + +menu "LPI2C Peripherals" + +menuconfig IMXRT_LPI2C1 + bool "LPI2C1" + default n + select IMXRT_LPI2C + +if IMXRT_LPI2C1 + +config LPI2C1_BUSYIDLE + int "Bus idle timeout period in clock cycles" + default 0 + +config LPI2C1_FILTSCL + int "I2C master digital glitch filters for SCL input in clock cycles" + default 0 + +config LPI2C1_FILTSDA + int "I2C master digital glitch filters for SDA input in clock cycles" + default 0 + +endif # IMXRT_LPI2C1 + +menuconfig IMXRT_LPI2C2 + bool "LPI2C2" + default n + select IMXRT_LPI2C + +if IMXRT_LPI2C2 + +config LPI2C2_BUSYIDLE + int "Bus idle timeout period in clock cycles" + default 0 + +config LPI2C2_FILTSCL + int "I2C master digital glitch filters for SCL input in clock cycles" + default 0 + +config LPI2C2_FILTSDA + int "I2C master digital glitch filters for SDA input in clock cycles" + default 0 + +endif # IMXRT_LPI2C2 + +menuconfig IMXRT_LPI2C3 + bool "LPI2C3" + default n + select IMXRT_LPI2C + +if IMXRT_LPI2C3 + +config LPI2C3_BUSYIDLE + int "Bus idle timeout period in clock cycles" + default 0 + +config LPI2C3_FILTSCL + int "I2C master digital glitch filters for SCL input in clock cycles" + default 0 + +config LPI2C3_FILTSDA + int "I2C master digital glitch filters for SDA input in clock cycles" + default 0 + +endif # IMXRT_LPI2C3 + +menuconfig IMXRT_LPI2C4 + bool "LPI2C4" + default n + select IMXRT_LPI2C + +if IMXRT_LPI2C4 + +config LPI2C4_BUSYIDLE + int "Bus idle timeout period in clock cycles" + default 0 + +config LPI2C4_FILTSCL + int "I2C master digital glitch filters for SCL input in clock cycles" + default 0 + +config LPI2C4_FILTSDA + int "I2C master digital glitch filters for SDA input in clock cycles" + default 0 + +endif # IMXRT_LPI2C4 +endmenu # LPI2C Peripherals + +menu "LPSPI Peripherals" + +menuconfig IMXRT_LPSPI1 + bool "LPSPI1" + default n + select IMXRT_LPSPI + +menuconfig IMXRT_LPSPI2 + bool "LPSPI2" + default n + select IMXRT_LPSPI + +menuconfig IMXRT_LPSPI3 + bool "LPSPI3" + default n + select IMXRT_LPSPI + +menuconfig IMXRT_LPSPI4 + bool "LPSPI4" + default n + select IMXRT_LPSPI + +endmenu # LPSPI Peripherals + +menu "FLEXSPI Peripherals" + +menuconfig IMXRT_FLEXSPI1 + bool "FLEXSPI1" + default n + select IMXRT_FLEXSPI + +endmenu # FLEXSPI Peripherals + +menu "ADC Peripherals" + +menuconfig IMXRT_ADC1 + bool "ADC1" + default n + select IMXRT_ADC + +menuconfig IMXRT_ADC2 + bool "ADC2" + default n + select IMXRT_ADC + +endmenu + +config IMXRT_SEMC + bool "Smart External Memory Controller (SEMC)" + default n + +config IMXRT_SNVS_LPSRTC + bool "LP SRTC" + default n + select IMXRT_SNVS_HPRTC + +config IMXRT_SNVS_HPRTC + bool "HP RTC" + default n + +config IMXRT_USDHC1 + bool "USDHC1" + default n + select ARCH_HAVE_SDIO + select IMXRT_USDHC + ---help--- + Support USDHC host controller 1 + +config IMXRT_USDHC2 + bool "USDHC2" + default n + select ARCH_HAVE_SDIO + select IMXRT_USDHC + ---help--- + Support USDHC host controller 2 + +menu "ENC Peripherals" + +menuconfig IMXRT_ENC1 + bool "ENC1" + default n + select IMXRT_ENC + +if IMXRT_ENC1 + +config ENC1_INITVAL + int "Initial position counter value" + default 0 + +config ENC1_DIR + bool "Reverse positive rotation direction" + default n + ---help--- + Select if PHASEB leading PHASEA pulses is positive rotation + +config ENC1_FILTPER + int "Input filter sample period in clock cycles" + default 0 + +config ENC1_FILTCNT + int "Number of input samples that filter will compare" + default 0 + +config ENC1_MOD + bool "Enable modulo counting" + default n + +if ENC1_MOD + +config ENC1_MODULUS + hex "Modulus to wrap around" + default 0xffffffff + +endif # ENC1_MOD + +config ENC1_HIP + bool "HOME signal initializes position counter" + default n + +if ENC1_HIP + +config ENC1_HNE + bool "Initialize on negedge of HOME" + default n + +endif # ENC1_HIP + +config ENC1_XIP + bool "INDEX signal initializes position counter" + default n + +if ENC1_XIP + +config ENC1_XNE + bool "Initialize on negedge of INDEX" + default n + +endif # ENC1_XIP + +if DEBUG_SENSORS + +config ENC1_TST_DIR + bool "Generate negative test counter advances" + default n + +config ENC1_TST_PER + int "Period of test pulses in clock cycles" + default 31 + +endif # DEBUG_SENSORS + +endif # IMXRT_ENC1 + +menuconfig IMXRT_ENC2 + bool "ENC2" + default n + select IMXRT_ENC + +if IMXRT_ENC2 + +config ENC2_INITVAL + int "Initial position counter value" + default 0 + +config ENC2_DIR + bool "Reverse positive rotation direction" + default n + ---help--- + Select if PHASEB leading PHASEA pulses is positive rotation + +config ENC2_FILTPER + int "Input filter sample period in clock cycles" + default 0 + +config ENC2_FILTCNT + int "Number of input samples that filter will compare" + default 0 + +config ENC2_MOD + bool "Enable modulo counting" + default n + +if ENC2_MOD + +config ENC2_MODULUS + hex "Modulus to wrap around" + default 0xffffffff + +endif # ENC2_MOD + +config ENC2_HIP + bool "HOME signal initializes position counter" + default n + +if ENC2_HIP + +config ENC2_HNE + bool "Initialize on negedge of HOME" + default n + +endif # ENC2_HIP + +config ENC2_XIP + bool "INDEX signal initializes position counter" + default n + +if ENC2_XIP + +config ENC2_XNE + bool "Initialize on negedge of INDEX" + default n + +endif # ENC2_XIP + +if DEBUG_SENSORS + +config ENC2_TST_DIR + bool "Generate negative test counter advances" + default n + +config ENC2_TST_PER + int "Period of test pulses in clock cycles" + default 31 + +endif # DEBUG_SENSORS + +endif # IMXRT_ENC2 + +if ARCH_FAMILY_IMXRT105x || ARCH_FAMILY_IMXRT106x + +menuconfig IMXRT_ENC3 + bool "ENC3" + default n + select IMXRT_ENC + +if IMXRT_ENC3 + +config ENC3_INITVAL + int "Initial position counter value" + default 0 + +config ENC3_DIR + bool "Reverse positive rotation direction" + default n + ---help--- + Select if PHASEB leading PHASEA pulses is positive rotation + +config ENC3_FILTPER + int "Input filter sample period in clock cycles" + default 0 + +config ENC3_FILTCNT + int "Number of input samples that filter will compare" + default 0 + +config ENC3_MOD + bool "Enable modulo counting" + default n + +if ENC3_MOD + +config ENC3_MODULUS + hex "Modulus to wrap around" + default 0xffffffff + +endif # ENC3_MOD + +config ENC3_HIP + bool "HOME signal initializes position counter" + default n + +if ENC3_HIP + +config ENC3_HNE + bool "Initialize on negedge of HOME" + default n + +endif # ENC3_HIP + +config ENC3_XIP + bool "INDEX signal initializes position counter" + default n + +if ENC3_XIP + +config ENC3_XNE + bool "Initialize on negedge of INDEX" + default n + +endif # ENC3_XIP + +if DEBUG_SENSORS + +config ENC3_TST_DIR + bool "Generate negative test counter advances" + default n + +config ENC3_TST_PER + int "Period of test pulses in clock cycles" + default 31 + +endif # DEBUG_SENSORS + +endif # IMXRT_ENC3 + +menuconfig IMXRT_ENC4 + bool "ENC4" + default n + select IMXRT_ENC + +if IMXRT_ENC4 + +config ENC4_INITVAL + int "Initial position counter value" + default 0 + +config ENC4_DIR + bool "Reverse positive rotation direction" + default n + ---help--- + Select if PHASEB leading PHASEA pulses is positive rotation + +config ENC4_FILTPER + int "Input filter sample period in clock cycles" + default 0 + +config ENC4_FILTCNT + int "Number of input samples that filter will compare" + default 0 + +config ENC4_MOD + bool "Enable modulo counting" + default n + +if ENC4_MOD + +config ENC4_MODULUS + hex "Modulus to wrap around" + default 0xffffffff + +endif # ENC4_MOD + +config ENC4_HIP + bool "HOME signal initializes position counter" + default n + +if ENC4_HIP + +config ENC4_HNE + bool "Initialize on negedge of HOME" + default n + +endif # ENC4_HIP + +config ENC4_XIP + bool "INDEX signal initializes position counter" + default n + +if ENC4_XIP + +config ENC4_XNE + bool "Initialize on negedge of INDEX" + default n + +endif # ENC4_XIP + +if DEBUG_SENSORS + +config ENC4_TST_DIR + bool "Generate negative test counter advances" + default n + +config ENC4_TST_PER + int "Period of test pulses in clock cycles" + default 31 + +endif # DEBUG_SENSORS + +endif # IMXRT_ENC4 + +endif # ARCH_FAMILY_IMXRT105x || ARCH_FAMILY_IMXRT106x + +endmenu # ENC Peripherals + +endmenu # i.MX RT Peripheral Selection + +menuconfig IMXRT_GPIO_IRQ + bool "GPIO Interrupt Support" + default n + +if IMXRT_GPIO_IRQ + +config IMXRT_GPIO1_0_15_IRQ + bool "GPIO1 Pins 0-15 interrupts" + default n + +config IMXRT_GPIO1_16_31_IRQ + bool "GPIO1 Pins 16-31 interrupts" + default n + +config IMXRT_GPIO2_0_15_IRQ + bool "GPIO2 Pins 0-15 interrupts" + default n + +config IMXRT_GPIO2_16_31_IRQ + bool "GPIO2 Pins 16-31 interrupts" + default n + +config IMXRT_GPIO3_0_15_IRQ + bool "GPIO3 Pins 0-15 interrupts" + default n + +config IMXRT_GPIO3_16_31_IRQ + bool "GPIO3 Pins 16-31 interrupts" + default n + +config IMXRT_GPIO4_0_15_IRQ + bool "GPIO4 Pins 0-15 interrupts" + default n + +config IMXRT_GPIO4_16_31_IRQ + bool "GPIO4 Pins 16-31 interrupts" + default n + +config IMXRT_GPIO5_0_15_IRQ + bool "GPIO5 Pins 0-15 interrupts" + default n + +config IMXRT_GPIO5_16_31_IRQ + bool "GPIO5 Pins 16-31 interrupts" + default n + +config IMXRT_GPIO6_0_15_IRQ + bool "GPIO6 Pins 0-15 interrupts" + default n + depends on IMXRT_HIGHSPEED_GPIO + +config IMXRT_GPIO6_16_31_IRQ + bool "GPIO6 Pins 16-31 interrupts" + default n + depends on IMXRT_HIGHSPEED_GPIO + +config IMXRT_GPIO7_0_15_IRQ + bool "GPIO7 Pins 0-15 interrupts" + default n + depends on IMXRT_HIGHSPEED_GPIO + +config IMXRT_GPIO7_16_31_IRQ + bool "GPIO7 Pins 16-31 interrupts" + default n + depends on IMXRT_HIGHSPEED_GPIO + +config IMXRT_GPIO8_0_15_IRQ + bool "GPIO8 Pins 0-15 interrupts" + default n + depends on IMXRT_HIGHSPEED_GPIO + +config IMXRT_GPIO8_16_31_IRQ + bool "GPIO8 Pins 16-31 interrupts" + default n + depends on IMXRT_HIGHSPEED_GPIO + +config IMXRT_GPIO9_0_15_IRQ + bool "GPIO9 Pins 0-15 interrupts" + default n + depends on IMXRT_HIGHSPEED_GPIO + +config IMXRT_GPIO9_16_31_IRQ + bool "GPIO9 Pins 16-31 interrupts" + default n + depends on IMXRT_HIGHSPEED_GPIO + +endif # IMXRT_GPIO_IRQ + +menu "Ethernet Configuration" + depends on IMXRT_ENET + +config IMXRT_ENET_NRXBUFFERS + int "Number Rx buffers" + default 6 + +config IMXRT_ENET_NTXBUFFERS + int "Number Tx buffers" + default 2 + +config IMXRT_ENET_ENHANCEDBD + bool # not optional + default n + +config IMXRT_ENET_NETHIFS + int # Not optional + default 1 + +config IMXRT_ENET_PHYINIT + bool "Board-specific PHY Initialization" + default n + ---help--- + Some boards require specialized initialization of the PHY before it + can be used. This may include such things as configuring GPIOs, + resetting the PHY, etc. If CONFIG_IMXRT_ENET_PHYINIT is defined in + the configuration then the board specific logic must provide + imxrt_phy_boardinitialize(); The i.MXRT ENET driver will call this + function one time before it first uses the PHY. + +endmenu # IMXRT_ENET + +menu "Memory Configuration" + +config IMXRT_DTCM + int "FLEXRAM DTCM Size in K" + default 128 + depends on ARMV7M_HAVE_DTCM + +config IMXRT_ITCM + int "FLEXRAM ITCM Size in K" + default 128 + depends on ARMV7M_HAVE_ITCM + +config IMXRT_SEMC_SDRAM + bool "External SDRAM installed" + default n + depends on IMXRT_SEMC + +if IMXRT_SEMC_SDRAM + +config IMXRT_SDRAM_START + hex "SDRAM start address" + default 0x10000000 + +config IMXRT_SDRAM_SIZE + int "SDRAM size (bytes)" + default 268435456 + +endif # IMXRT_SEMC_SDRAM + +config IMXRT_SEMC_SRAM + bool "External SRAM installed" + default n + depends on IMXRT_SEMC + +if IMXRT_SEMC_SRAM + +config IMXRT_SRAM_START + hex "SRAM start address" + default 0x10000000 + +config IMXRT_SRAM_SIZE + int "SRAM size (bytes)" + default 268435456 + +endif # IMXRT_SRAM_SIZE + +config IMXRT_SEMC_NOR + bool "External NOR FLASH installed" + default n + depends on IMXRT_SEMC + +choice + prompt "i.MX RT Boot Configuration" + default IMXRT_BOOT_NOR if IMXRT_SEMC_NOR + default IMXRT_BOOT_SDRAM if IMXRT_SEMC_SDRAM && !IMXRT_SEMC_NOR + default IMXRT_BOOT_SRAM if IMXRT_SEMC_SRAM && !IMXRT_SEMC_SDRAM && !IMXRT_SEMC_NOR + default IMXRT_BOOT_OCRAM if !IMXRT_SEMC_SRAM && !IMXRT_SEMC_SDRAM && !IMXRT_SEMC_NOR + ---help--- + The startup code needs to know if the code is running from internal + OCRAM, external SDRAM, external NOR, or external SDRAM in order to + initialize properly. Note that the boot device is not known for + cases where the code is copied into RAM by a bootloader. + +config IMXRT_BOOT_OCRAM + bool "Running from internal OCRAM" + select BOOT_RUNFROMISRAM + +config IMXRT_BOOT_SDRAM + bool "Running from external SDRAM" + select BOOT_RUNFROMSDRAM + depends on IMXRT_SEMC_SDRAM + +config IMXRT_BOOT_NOR + bool "Running from external NOR FLASH" + select BOOT_RUNFROMFLASH + depends on IMXRT_SEMC_NOR + +config IMXRT_BOOT_SRAM + bool "Running from external SRAM" + select BOOT_RUNFROMEXTSRAM + depends on IMXRT_SEMC_SRAM + +endchoice # i.MX RT Boot Configuration + +choice + prompt "i.MX RT Primary RAM" + default IMXRT_OCRAM_PRIMARY + ---help--- + The primary RAM is the RAM that contains the system BLOB's .data and + .bss. The unused portion of the primary RAM will automatically be + added to the system heap. + +config IMXRT_OCRAM_PRIMARY + bool "Internal OCRAM primary" + +config IMXRT_SDRAM_PRIMARY + bool "External SDRAM primary" + depends on IMXRT_SEMC_SDRAM + +config IMXRT_SRAM_PRIMARY + bool "External SRAM primary" + depends on IMXRT_SEMC_SRAM + +endchoice # i.MX RT Primary RAM + +menu "i.MX RT Heap Configuration" + +config IMXRT_OCRAM_HEAP + bool "Add OCRAM to heap" + depends on !IMXRT_OCRAM_PRIMARY + ---help--- + Select to add the entire OCRAM to the heap + +config IMXRT_DTCM_HEAP + bool "Add DTCM to heap" + depends on IMXRT_DTCM > 0 + ---help--- + Select to add the entire DTCM to the heap + +config IMXRT_BOOTLOADER_HEAP + bool "Add ROM bootloader 40Kib RAM to heap" + default false + depends on BOOT_RUNFROMISRAM + ---help--- + Select to add the memory used by the ROM bootloader to heap + +config IMXRT_SDRAM_HEAP + bool "Add SDRAM to heap" + depends on IMXRT_SEMC_SDRAM && !IMXRT_SDRAM_PRIMARY + ---help--- + Add a region of SDRAM to the heap. A region of SDRAM will be added + to the heap that starts at (CONFIG_IMXRT_SDRAM_START + + CONFIG_IMXRT_SDRAM_HEAPOFFSET) and extends up to + (CONFIG_IMXRT_SDRAM_START + CONFIG_IMXRT_SDRAM_SIZE). Note that the + START is the actual start of SDRAM but SIZE is not necessarily the + actual SIZE. + +config IMXRT_SDRAM_HEAPOFFSET + hex "SDRAM heap offset" + default 0x0 + depends on IMXRT_SDRAM_HEAP + ---help--- + Used to reserve memory at the beginning of SDRAM for, as an example, + a framebuffer. + +config IMXRT_SRAM_HEAP + bool "Add SRAM to heap" + depends on IMXRT_SEMC_SRAM && !IMXRT_SRAM_PRIMARY + ---help--- + Add a region of SRAM to the heap. A region of SDRAM will be added + to the heap that starts at (CONFIG_IMXRT_SRAM_START + + CONFIG_IMXRT_SRAM_HEAPOFFSET) and extends up to + (CONFIG_IMXRT_SRAM_START + CONFIG_IMXRT_SRAM_SIZE). Note that the + START is the actual start of SRAM but SIZE is not necessarily the + actual SIZE. + +config IMXRT_SRAM_HEAPOFFSET + hex "SRAM heap offset" + default 0x0 + depends on IMXRT_SRAM_HEAP + ---help--- + Used to reserve memory at the beginning of SRAM for, as an example, + a framebuffer. + +endmenu # i.MX RT Heap Configuration +endmenu # Memory Configuration + +menu "LPI2C Configuration" + depends on IMXRT_LPI2C + +config IMXRT_LPI2C_DYNTIMEO + bool "Use dynamic timeouts" + default n + depends on IMXRT_LPI2C + +config IMXRT_LPI2C_DYNTIMEO_USECPERBYTE + int "Timeout Microseconds per Byte" + default 500 + depends on IMXRT_LPI2C_DYNTIMEO + +config IMXRT_LPI2C_DYNTIMEO_STARTSTOP + int "Timeout for Start/Stop (Milliseconds)" + default 1000 + depends on IMXRT_LPI2C_DYNTIMEO + +config IMXRT_LPI2C_TIMEOSEC + int "Timeout seconds" + default 0 + depends on IMXRT_LPI2C + +config IMXRT_LPI2C_TIMEOMS + int "Timeout Milliseconds" + default 500 + depends on IMXRT_LPI2C && !IMXRT_LPI2C_DYNTIMEO + +config IMXRT_LPI2C_TIMEOTICKS + int "Timeout for Done and Stop (ticks)" + default 500 + depends on IMXRT_LPI2C && !IMXRT_LPI2C_DYNTIMEO + +endmenu # LPI2C Configuration + +menu "USDHC Configuration" + depends on IMXRT_USDHC + +config IMXRT_USDHC_DMA + bool "Support DMA data transfers" + default y + select SDIO_DMA + ---help--- + Support DMA data transfers. + Enable SD card DMA data transfers. This is marginally optional. + For most usages, SD accesses will cause data overruns if used without + DMA. + +choice + prompt "Bus width for USDHC1" + default IMXRT_USDHC1_WIDTH_D1_ONLY + depends on IMXRT_USDHC1 + +config IMXRT_USDHC1_WIDTH_D1_ONLY + bool "One bit" + +config IMXRT_USDHC1_WIDTH_D1_D4 + bool "Four bit" +endchoice + +config IMXRT_USDHC1_INVERT_CD + bool "Invert the USDHC1 CD" + default n + depends on IMXRT_USDHC1 + ---help--- + If the board defines PIN_USDHC1_CD the CD_B input to the USDHC it is + assumed to be active low. Selecting IMXRT_USDHC1_INVERT_CD will make it + active high. + + If the board defines PIN_USDHC1_CD_GPIO it is assumed to be active low. + Selecting IMXRT_USDHC1_INVERT_CD will make it active high. + +choice + depends on IMXRT_USDHC2 + prompt "Bus width for USDHC2" + default IMXRT_USDHC2_WIDTH_D1_D4 + +config IMXRT_USDHC2_WIDTH_D1_ONLY + bool "One bit" + +config IMXRT_USDHC2_WIDTH_D1_D4 + bool "Four bit" + +config IMXRT_USDHC2_WIDTH_D1_D8 + bool "Eight bit" +endchoice + +config IMXRT_USDHC2_INVERT_CD + bool "Invert the USDHC2 CD" + default n + depends on IMXRT_USDHC2 + ---help--- + If the board defines PIN_USDHC2_CD the CD_B input to the USDHC it is + assumed to be active low. Selecting IMXRT_USDHC_INVERT_CD will make it + active high. + + If the board defines PIN_USDHC2_CD_GPIO it is assumed to be active low. + Selecting IMXRT_USDHC2_INVERT_CD will make it active high. + +endmenu # USDHC Configuration + +menu "eDMA Configuration" + depends on IMXRT_EDMA + +config IMXRT_EDMA_NTCD + int "Number of transfer descriptors" + default 0 + ---help--- + Number of pre-allocated transfer descriptors. Needed for scatter- + gather DMA. Make to be set to zero to disable in-memory TCDs in + which case only the TCD channel registers will be used and scatter- + will not be supported. + +config IMXRT_EDMA_ELINK + bool "Channeling Linking" + default n + ---help--- + This option enables optional minor or major loop channel linking: + + Minor loop channel linking: As the channel completes the minor + loop, this flag enables linking to another channel. The link target + channel initiates a channel service request via an internal + mechanism that sets the TCDn_CSR[START] bit of the specified + channel. + + If minor loop channel linking is disabled, this link mechanism is + suppressed in favor of the major loop channel linking. + + Major loop channel linking: As the channel completes the minor + loop, this option enables the linking to another channel. The link + target channel initiates a channel service request via an internal + mechanism that sets the TCDn_CSR[START] bit of the linked channel. + +config IMXRT_EDMA_ERCA + bool "Round Robin Channel Arbitration" + default n + ---help--- + Normally, a fixed priority arbitration is used for channel + selection. If this option is selected, round robin arbitration is + used for channel selection. + +config IMXRT_EDMA_HOE + bool "Halt On Error" + default y + ---help--- + Any error causes the HALT bit to set. Subsequently, all service + requests are ignored until the HALT bit is cleared. + +config IMXRT_EDMA_CLM + bool "Continuous Link Mode" + default n + ---help--- + By default, A minor loop channel link made to itself goes through + channel arbitration before being activated again. If this option is + selected, a minor loop channel link made to itself does not go + through channel arbitration before being activated again. Upon minor + loop completion, the channel activates again if that channel has a + minor loop channel link enabled and the link channel is itself. This + effectively applies the minor loop offsets and restarts the next + minor loop. + +config IMXRT_EDMA_EMLIM + bool "Minor Loop Mapping" + default n + ---help--- + Normally TCD word 2 is a 32-bit NBYTES field. When this option is + enabled, TCD word 2 is redefined to include individual enable fields, + an offset field, and the NBYTES field. The individual enable fields + allow the minor loop offset to be applied to the source address, the + destination address, or both. The NBYTES field is reduced when either + offset is enabled. + +config IMXRT_EDMA_EDBG + bool "Enable Debug" + default n + ---help--- + When in debug mode, the DMA stalls the start of a new channel. Executing + channels are allowed to complete. Channel execution resumes when the + system exits debug mode or the EDBG bit is cleared + +endmenu # eDMA Global Configuration + +if PM + +config IMXRT_PM_SERIAL_ACTIVITY + int "PM serial activity" + default 10 + ---help--- + PM activity reported to power management logic on every serial + interrupt. + +endif + +menu "RTC Configuration" + depends on IMXRT_SNVS_HPRTC + +config IMXRT_RTC_MAGIC_REG + int "RTC SNVS GPR" + default 0 + range 0 3 + ---help--- + The BKP register used to store/check the Magic value to determine if + RTC is already setup + +config IMXRT_RTC_MAGIC + hex "RTC Magic 1" + default 0xfacefeed + ---help--- + Value used as Magic to determine if the RTC is already setup + +endmenu + +menu "LCD Configuration" + depends on IMXRT_LCD + +config IMXRT_LCD_VIDEO_PLL_FREQ + int "Video PLL Frequency" + default 92000000 + range 41500000 1300000000 + ---help--- + Frequency of Video PLL. + +config IMXRT_LCD_VRAMBASE + hex "Video RAM base address" + default 0x80000000 + ---help--- + Base address of the video RAM frame buffer. + Default: SDRAM + +config IMXRT_LCD_REFRESH_FREQ + int "LCD refresh rate (Hz)" + default 60 + ---help--- + LCD refresh rate (Hz) + +config IMXRT_LCD_BACKLIGHT + bool "Enable backlight" + default y + ---help--- + Enable backlight support. If IMXRT_LCD_BACKLIGHT is selected, then + the board-specific logic must provide this IMXRT_backlight() + interface so that the LCD driver can turn the backlight on and off + as necessary. You should select this option and implement + IMXRT_backlight() if your board provides GPIO control over the + backlight. This interface provides only ON/OFF control of the + backlight. If you want finer control over the backlight level (for + example, using PWM), then this interface would need to be extended. + +choice + prompt "Input Bits per pixel" + default IMXRT_LCD_INPUT_BPP16 + +config IMXRT_LCD_INPUT_BPP8_LUT + bool "8 BPP Color Map" + select FB_CMAP + +config IMXRT_LCD_INPUT_BPP8 + bool "8 BPP RGB_332" + +config IMXRT_LCD_INPUT_BPP15 + bool "16 BPP RGB_555" + +config IMXRT_LCD_INPUT_BPP16 + bool "16 BPP RGB_565" + +config IMXRT_LCD_INPUT_BPP24 + bool "24 BPP RGB_888" + +config IMXRT_LCD_INPUT_BPP32 + bool "32 BPP RGB_0888" + +endchoice + +config IMXRT_LCD_BGR + bool "Blue-Green-Red color order" + default n + ---help--- + This option selects BGR color order vs. default RGB + +choice + prompt "Output Bus width" + default IMXRT_LCD_OUTPUT_16 + +config IMXRT_LCD_OUTPUT_8 + bool "8 Bit LCD Bus" + +config IMXRT_LCD_OUTPUT_16 + bool "16 Bit LCD Bus" + +config IMXRT_LCD_OUTPUT_18 + bool "18 Bit LCD Bus" + +config IMXRT_LCD_OUTPUT_24 + bool "24 Bit LCD Bus" + +endchoice + +config IMXRT_LCD_BACKCOLOR + hex "Initial background color" + default 0x0 + ---help--- + Initial background color + +config IMXRT_LCD_HWIDTH + int "Display width (pixels)" + default 480 + ---help--- + Horizontal width the display in pixels + +config IMXRT_LCD_HPULSE + int "Horizontal pulse" + default 41 + +config IMXRT_LCD_HFRONTPORCH + int "Horizontal front porch" + default 4 + +config IMXRT_LCD_HBACKPORCH + int "Horizontal back porch" + default 8 + +config IMXRT_LCD_VHEIGHT + int "Display height (rows)" + default 272 + ---help--- + Vertical height of the display in rows + +config IMXRT_LCD_VPULSE + int "Vertical pulse" + default 10 + +config IMXRT_LCD_VFRONTPORCH + int "Vertical front porch" + default 4 + +config IMXRT_LCD_VBACKPORCH + int "Vertical back porch" + default 2 + +config IMXRT_VSYNC_ACTIVE_HIGH + bool "V-sync active high" + default n + +config IMXRT_HSYNC_ACTIVE_HIGH + bool "H-sync active high" + default n + +config IMXRT_DATAEN_ACTIVE_HIGH + bool "Data enable active high" + default y + +config IMXRT_DATA_RISING_EDGE + bool "Data clock rising edge" + default y + +endmenu # LCD Configuration + +menu "Timer Configuration" + +if SCHED_TICKLESS + +config IMXRT_TICKLESS_TIMER + int "Tickless hardware timer" + default 1 + range 1 2 + ---help--- + If the Tickless OS feature is enabled, then one clock must be + assigned to provided the GPT timer needed by the OS. + +config IMXRT_TICKLESS_CHANNEL + int "Tickless timer channel" + default 1 + range 1 3 + ---help--- + If the Tickless OS feature is enabled, the one clock must be + assigned to provided the free-running timer needed by the OS + and one channel on that clock is needed to handle intervals. + +endif # SCHED_TICKLESS + +endmenu # Timer Configuration + +if IMXRT_USBOTG && USBHOST + +menu "USB host controller driver (HCD) options" + +config IMXRT_EHCI_NQHS + int "Number of Queue Head (QH) structures" + default 4 + ---help--- + Configurable number of Queue Head (QH) structures. The default is + one per Root hub port plus one for EP0 (4). + +config IMXRT_EHCI_NQTDS + int "Number of Queue Element Transfer Descriptor (qTDs)" + default 6 + ---help--- + Configurable number of Queue Element Transfer Descriptor (qTDs). + The default is one per root hub plus three from EP0 (6). + +config IMXRT_EHCI_BUFSIZE + int "Size of one request/descriptor buffer" + default 128 + ---help--- + The size of one request/descriptor buffer in bytes. The TD buffe + size must be an even number of 32-bit words and must be large enough + to hangle the largest transfer via a SETUP request. + +config IMXRT_EHCI_PREALLOCATE + bool "Preallocate descriptor pool" + default y + ---help--- + Select this option to pre-allocate EHCI queue and descriptor + structure pools in .bss. Otherwise, these pools will be + dynamically allocated using kmm_memalign(). + +endmenu # USB host controller driver (HCD) options +endif # IMXRT_USBOTG && USBHOST + +if IMXRT_USBDEV + +menu "USB device controller driver (DCD) options" + +config IMXRT_USBDEV_NOVBUS + bool "No USB VBUS sensing" + default n + +config IMXRT_USBDEV_FRAME_INTERRUPT + bool "USB frame interrupt" + default n + ---help--- + Handle USB Start-Of-Frame events. Enable reading SOF from interrupt + handler vs. simply reading on demand. Probably a bad idea... Unless + there is some issue with sampling the SOF from hardware asynchronously. + +config IMXRT_USBDEV_REGDEBUG + bool "Register level debug" + depends on DEBUG_USB_INFO + default n + ---help--- + Output detailed register-level USB device debug information. Requires + also CONFIG_DEBUG_USB_INFO. + +endmenu # USB device controller driver (DCD) options +endif # IMXRT_USBDEV + +endif # ARCH_CHIP_IMXRT diff --git a/Ubiquitous/Nuttx/app_match_nuttx/nuttx/boards/Kconfig b/Ubiquitous/Nuttx/app_match_nuttx/nuttx/boards/Kconfig index 1c5a46d02..fb486dc23 100644 --- a/Ubiquitous/Nuttx/app_match_nuttx/nuttx/boards/Kconfig +++ b/Ubiquitous/Nuttx/app_match_nuttx/nuttx/boards/Kconfig @@ -447,13 +447,13 @@ config ARCH_BOARD_IMXRT1050_EVK config ARCH_BOARD_IMXRT1052_OK bool "NXP i.MX RT 1052 OK" - depends on ARCH_CHIP_MIMXRT1052DVL6A + depends on ARCH_CHIP_MIMXRT1052CVL5B select ARCH_HAVE_LEDS select ARCH_HAVE_BUTTONS select ARCH_HAVE_IRQBUTTONS ---help--- This is the board configuration for the port of NuttX to the NXP i.MXRT - evaluation kit, MIMXRT1052-OK. This board features the MIMXRT1052DVL6A MCU. + evaluation kit, MIMXRT1052-OK. This board features the MIMXRT1052CVL5B MCU. config ARCH_BOARD_IMXRT1060_EVK bool "NXP i.MX RT 1060 EVK" From 8aa53e3aadcff21dfd295b907722a76ee10c97e1 Mon Sep 17 00:00:00 2001 From: wgzAIIT <820906721@qq.com> Date: Tue, 22 Mar 2022 10:06:28 +0800 Subject: [PATCH 08/18] change BOARD_CPU_FREQUENCY to 528000000 --- Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/include/board.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/include/board.h b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/include/board.h index 646432e5c..7c49fc26b 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/include/board.h +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/include/board.h @@ -93,6 +93,8 @@ */ #define BOARD_XTAL_FREQUENCY 24000000 +#define BOARD_CPU_FREQUENCY 528000000 + #define IMXRT_PRE_PERIPH_CLK_SEL CCM_CBCMR_PRE_PERIPH_CLK_SEL_PLL1 #define IMXRT_PERIPH_CLK_SEL CCM_CBCDR_PERIPH_CLK_SEL_PRE_PERIPH #define IMXRT_ARM_PLL_DIV_SELECT 100 @@ -118,8 +120,8 @@ #define IMXRT_USB1_PLL_DIV_SELECT CCM_ANALOG_PLL_USB1_DIV_SELECT_20 -#define BOARD_CPU_FREQUENCY \ - (BOARD_XTAL_FREQUENCY * (IMXRT_ARM_PLL_DIV_SELECT / 2)) / IMXRT_ARM_PODF_DIVIDER +// #define BOARD_CPU_FREQUENCY \ +// (BOARD_XTAL_FREQUENCY * (IMXRT_ARM_PLL_DIV_SELECT / 2)) / IMXRT_ARM_PODF_DIVIDER /* Define this to enable tracing */ From 8a7a7035b3cbfdc59091abdae70eaf8507de0522 Mon Sep 17 00:00:00 2001 From: wgzAIIT <820906721@qq.com> Date: Tue, 22 Mar 2022 17:11:31 +0800 Subject: [PATCH 09/18] set CONFIG_SCHED_WAITPID=y for disable the application is put into the background for execution --- .../Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig | 1 + .../Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig | 1 + Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig | 2 ++ 3 files changed, 4 insertions(+) diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig index a417efe5d..9c24bd419 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig @@ -36,6 +36,7 @@ CONFIG_NSH_READLINE=y CONFIG_RAM_SIZE=536870912 CONFIG_RAM_START=0x20200000 CONFIG_SCHED_CPULOAD=y +CONFIG_SCHED_WAITPID=y CONFIG_START_DAY=14 CONFIG_START_MONTH=3 CONFIG_SYSTEM_NSH=y diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig index b3998028a..b0986eb9d 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig @@ -56,6 +56,7 @@ CONFIG_NSH_READLINE=y CONFIG_RAM_SIZE=524288 CONFIG_RAM_START=0x20200000 CONFIG_SCHED_LPWORK=y +CONFIG_SCHED_WAITPID=y CONFIG_START_DAY=14 CONFIG_START_MONTH=3 CONFIG_SYSTEM_NSH=y diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig index 3d682848c..001dbabd2 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig @@ -20,6 +20,7 @@ CONFIG_ARMV7M_USEBASEPRI=y CONFIG_BOARD_LOOPSPERMSEC=104926 CONFIG_BUILTIN=y CONFIG_CLOCK_MONOTONIC=y +CONFIG_EXAMPLES_HELLO=y CONFIG_FS_PROCFS=y CONFIG_IDLETHREAD_STACKSIZE=2048 CONFIG_IMXRT_LPUART1=y @@ -33,6 +34,7 @@ CONFIG_NSH_LINELEN=64 CONFIG_NSH_READLINE=y CONFIG_RAM_SIZE=524288 CONFIG_RAM_START=0x20200000 +CONFIG_SCHED_WAITPID=y CONFIG_START_DAY=14 CONFIG_START_MONTH=3 CONFIG_SYSTEM_NSH=y From 0541171749f91e129b8604ff59aa26774f9ac1be Mon Sep 17 00:00:00 2001 From: wgzAIIT <820906721@qq.com> Date: Tue, 22 Mar 2022 18:09:29 +0800 Subject: [PATCH 10/18] set CONFIG_DEFAULT_SMALL=y for disable the application is put into the background for execution --- Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig index 001dbabd2..b337b79d1 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig @@ -19,6 +19,7 @@ CONFIG_ARMV7M_ICACHE=y CONFIG_ARMV7M_USEBASEPRI=y CONFIG_BOARD_LOOPSPERMSEC=104926 CONFIG_BUILTIN=y +CONFIG_DEFAULT_SMALL=y CONFIG_CLOCK_MONOTONIC=y CONFIG_EXAMPLES_HELLO=y CONFIG_FS_PROCFS=y From 5525c1062717ec91ab088e3c783eaa2a0871c4b2 Mon Sep 17 00:00:00 2001 From: wgzAIIT <820906721@qq.com> Date: Wed, 23 Mar 2022 09:33:38 +0800 Subject: [PATCH 11/18] set CONFIG_DEFAULT_SMALL=y for disable the application is put into the background for execution remove CONFIG_DEFAULT_SMALL=y --- Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig index b337b79d1..001dbabd2 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig @@ -19,7 +19,6 @@ CONFIG_ARMV7M_ICACHE=y CONFIG_ARMV7M_USEBASEPRI=y CONFIG_BOARD_LOOPSPERMSEC=104926 CONFIG_BUILTIN=y -CONFIG_DEFAULT_SMALL=y CONFIG_CLOCK_MONOTONIC=y CONFIG_EXAMPLES_HELLO=y CONFIG_FS_PROCFS=y From 034fb66f77a660dcfa5747e1299ae1ca6b626fd3 Mon Sep 17 00:00:00 2001 From: wgzAIIT <820906721@qq.com> Date: Wed, 23 Mar 2022 12:06:36 +0800 Subject: [PATCH 12/18] fix up_registerdump set CONFIG_ARCH_INTERRUPTSTACK --- Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig | 1 + .../Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig | 1 + .../Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig | 1 + Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig | 1 + 4 files changed, 4 insertions(+) diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig index e75a746fc..7bda4e8dd 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig @@ -13,6 +13,7 @@ CONFIG_ARCH_BOARD_IMXRT1052_OK=y CONFIG_ARCH_CHIP="imxrt" CONFIG_ARCH_CHIP_IMXRT=y CONFIG_ARCH_CHIP_MIMXRT1052CVL5B=y +CONFIG_ARCH_INTERRUPTSTACK=1536 CONFIG_ARCH_STACKDUMP=y CONFIG_ARMV7M_DCACHE=y CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig index 9c24bd419..34c5b488e 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig @@ -12,6 +12,7 @@ CONFIG_ARCH_BOARD_IMXRT1052_OK=y CONFIG_ARCH_CHIP="imxrt" CONFIG_ARCH_CHIP_IMXRT=y CONFIG_ARCH_CHIP_MIMXRT1052CVL5B=y +CONFIG_ARCH_INTERRUPTSTACK=1536 CONFIG_ARCH_STACKDUMP=y CONFIG_BOARD_LATE_INITIALIZE=y CONFIG_BOARD_LOOPSPERMSEC=20000 diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig index b0986eb9d..18528b672 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig @@ -13,6 +13,7 @@ CONFIG_ARCH_BOARD_IMXRT1052_OK=y CONFIG_ARCH_CHIP="imxrt" CONFIG_ARCH_CHIP_IMXRT=y CONFIG_ARCH_CHIP_MIMXRT1052CVL5B=y +CONFIG_ARCH_INTERRUPTSTACK=1536 CONFIG_ARCH_STACKDUMP=y CONFIG_ARMV7M_DCACHE=y CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig index 001dbabd2..516ee639e 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig @@ -12,6 +12,7 @@ CONFIG_ARCH_BOARD_IMXRT1052_OK=y CONFIG_ARCH_CHIP="imxrt" CONFIG_ARCH_CHIP_IMXRT=y CONFIG_ARCH_CHIP_MIMXRT1052CVL5B=y +CONFIG_ARCH_INTERRUPTSTACK=1536 CONFIG_ARCH_STACKDUMP=y CONFIG_ARMV7M_DCACHE=y CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y From b868fb6c8a8ac826e0e78e2fb6bf7f17088f8652 Mon Sep 17 00:00:00 2001 From: wgzAIIT <820906721@qq.com> Date: Wed, 23 Mar 2022 14:01:13 +0800 Subject: [PATCH 13/18] fix up_registerdump set CONFIG_ARCH_INTERRUPTSTACK=10240 --- Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig | 2 +- .../Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig | 2 +- .../Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig | 2 +- Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig index 7bda4e8dd..15a659983 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig @@ -13,7 +13,7 @@ CONFIG_ARCH_BOARD_IMXRT1052_OK=y CONFIG_ARCH_CHIP="imxrt" CONFIG_ARCH_CHIP_IMXRT=y CONFIG_ARCH_CHIP_MIMXRT1052CVL5B=y -CONFIG_ARCH_INTERRUPTSTACK=1536 +CONFIG_ARCH_INTERRUPTSTACK=10240 CONFIG_ARCH_STACKDUMP=y CONFIG_ARMV7M_DCACHE=y CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig index 34c5b488e..aca6fb61d 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig @@ -12,7 +12,7 @@ CONFIG_ARCH_BOARD_IMXRT1052_OK=y CONFIG_ARCH_CHIP="imxrt" CONFIG_ARCH_CHIP_IMXRT=y CONFIG_ARCH_CHIP_MIMXRT1052CVL5B=y -CONFIG_ARCH_INTERRUPTSTACK=1536 +CONFIG_ARCH_INTERRUPTSTACK=10240 CONFIG_ARCH_STACKDUMP=y CONFIG_BOARD_LATE_INITIALIZE=y CONFIG_BOARD_LOOPSPERMSEC=20000 diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig index 18528b672..8cd6f8ecf 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig @@ -13,7 +13,7 @@ CONFIG_ARCH_BOARD_IMXRT1052_OK=y CONFIG_ARCH_CHIP="imxrt" CONFIG_ARCH_CHIP_IMXRT=y CONFIG_ARCH_CHIP_MIMXRT1052CVL5B=y -CONFIG_ARCH_INTERRUPTSTACK=1536 +CONFIG_ARCH_INTERRUPTSTACK=10240 CONFIG_ARCH_STACKDUMP=y CONFIG_ARMV7M_DCACHE=y CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig index 516ee639e..9b4920876 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig @@ -12,7 +12,7 @@ CONFIG_ARCH_BOARD_IMXRT1052_OK=y CONFIG_ARCH_CHIP="imxrt" CONFIG_ARCH_CHIP_IMXRT=y CONFIG_ARCH_CHIP_MIMXRT1052CVL5B=y -CONFIG_ARCH_INTERRUPTSTACK=1536 +CONFIG_ARCH_INTERRUPTSTACK=10240 CONFIG_ARCH_STACKDUMP=y CONFIG_ARMV7M_DCACHE=y CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y From b92edeecee42b509087bdc8760eb3722f5ac174e Mon Sep 17 00:00:00 2001 From: wgzAIIT <820906721@qq.com> Date: Wed, 23 Mar 2022 14:30:05 +0800 Subject: [PATCH 14/18] add Ubiquitous/Nuttx/app_match_nuttx/nuttx/arch/arm/src/imxrt/imxrt_serial.c add imxrt_serial.c to app_match_nuttx/nuttx/arch/arm/src/imxrt --- .../nuttx/arch/arm/src/imxrt/imxrt_serial.c | 1833 +++++++++++++++++ 1 file changed, 1833 insertions(+) create mode 100644 Ubiquitous/Nuttx/app_match_nuttx/nuttx/arch/arm/src/imxrt/imxrt_serial.c diff --git a/Ubiquitous/Nuttx/app_match_nuttx/nuttx/arch/arm/src/imxrt/imxrt_serial.c b/Ubiquitous/Nuttx/app_match_nuttx/nuttx/arch/arm/src/imxrt/imxrt_serial.c new file mode 100644 index 000000000..2b9fc124d --- /dev/null +++ b/Ubiquitous/Nuttx/app_match_nuttx/nuttx/arch/arm/src/imxrt/imxrt_serial.c @@ -0,0 +1,1833 @@ +/**************************************************************************** + * arch/arm/src/imxrt/imxrt_serial.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef CONFIG_SERIAL_TERMIOS +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "chip.h" +#include "arm_arch.h" +#include "arm_internal.h" + +#include "hardware/imxrt_lpuart.h" +#include "imxrt_gpio.h" +#include "hardware/imxrt_pinmux.h" +#include "imxrt_config.h" +#include "imxrt_lowputc.h" + +#ifdef USE_SERIALDRIVER + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Which LPUART with be tty0/console and which tty1-7? The console will + * always be ttyS0. If there is no console then will use the lowest + * numbered UART. + */ + +/* First pick the console and ttys0. This could be any of LPUART1-8 */ + +#if defined(CONFIG_LPUART1_SERIAL_CONSOLE) +# define CONSOLE_DEV g_uart1port /* LPUART1 is console */ +# define TTYS0_DEV g_uart1port /* LPUART1 is ttyS0 */ +# define UART1_ASSIGNED 1 +#elif defined(CONFIG_LPUART2_SERIAL_CONSOLE) +# define CONSOLE_DEV g_uart2port /* LPUART2 is console */ +# define TTYS0_DEV g_uart2port /* LPUART2 is ttyS0 */ +# define UART2_ASSIGNED 1 +#elif defined(CONFIG_LPUART3_SERIAL_CONSOLE) +# define CONSOLE_DEV g_uart3port /* LPUART3 is console */ +# define TTYS0_DEV g_uart3port /* LPUART3 is ttyS0 */ +# define UART3_ASSIGNED 1 +#elif defined(CONFIG_LPUART4_SERIAL_CONSOLE) +# define CONSOLE_DEV g_uart4port /* LPUART4 is console */ +# define TTYS0_DEV g_uart4port /* LPUART4 is ttyS0 */ +# define UART4_ASSIGNED 1 +#elif defined(CONFIG_LPUART5_SERIAL_CONSOLE) +# define CONSOLE_DEV g_uart5port /* LPUART5 is console */ +# define TTYS0_DEV g_uart5port /* LPUART5 is ttyS0 */ +# define UART5_ASSIGNED 1 +#elif defined(CONFIG_LPUART6_SERIAL_CONSOLE) +# define CONSOLE_DEV g_uart6port /* LPUART6 is console */ +# define TTYS0_DEV g_uart6port /* LPUART6 is ttyS0 */ +# define UART6_ASSIGNED 1 +#elif defined(CONFIG_LPUART7_SERIAL_CONSOLE) +# define CONSOLE_DEV g_uart7port /* LPUART7 is console */ +# define TTYS0_DEV g_uart7port /* LPUART7 is ttyS0 */ +# define UART7_ASSIGNED 1 +#elif defined(CONFIG_LPUART8_SERIAL_CONSOLE) +# define CONSOLE_DEV g_uart8port /* LPUART8 is console */ +# define TTYS0_DEV g_uart8port /* LPUART8 is ttyS0 */ +# define UART8_ASSIGNED 1 +#else +# undef CONSOLE_DEV /* No console */ +# if defined(CONFIG_IMXRT_LPUART1) +# define TTYS0_DEV g_uart1port /* LPUART1 is ttyS0 */ +# define UART1_ASSIGNED 1 +# elif defined(CONFIG_IMXRT_LPUART2) +# define TTYS0_DEV g_uart2port /* LPUART2 is ttyS0 */ +# define UART2_ASSIGNED 1 +# elif defined(CONFIG_IMXRT_LPUART3) +# define TTYS0_DEV g_uart3port /* LPUART3 is ttyS0 */ +# define UART3_ASSIGNED 1 +# elif defined(CONFIG_IMXRT_LPUART4) +# define TTYS0_DEV g_uart4port /* LPUART4 is ttyS0 */ +# define UART4_ASSIGNED 1 +# elif defined(CONFIG_IMXRT_LPUART5) +# define TTYS0_DEV g_uart5port /* LPUART5 is ttyS0 */ +# define UART5_ASSIGNED 1 +# elif defined(CONFIG_IMXRT_LPUART6) +# define TTYS0_DEV g_uart6port /* LPUART6 is ttyS0 */ +# define UART6_ASSIGNED 1 +# elif defined(CONFIG_IMXRT_LPUART7) +# define TTYS0_DEV g_uart7port /* LPUART7 is ttyS0 */ +# define UART7_ASSIGNED 1 +# elif defined(CONFIG_IMXRT_LPUART8) +# define TTYS0_DEV g_uart8port /* LPUART8 is ttyS0 */ +# define UART8_ASSIGNED 1 +# endif +#endif + +/* Pick ttys1. This could be any of UART1-8 excluding the console UART. + * One of UART1-8 could be the console; one of UART1-8 has already been + * assigned to ttys0. + */ + +#if defined(CONFIG_IMXRT_LPUART1) && !defined(UART1_ASSIGNED) +# define TTYS1_DEV g_uart1port /* LPUART1 is ttyS1 */ +# define UART1_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART2) && !defined(UART2_ASSIGNED) +# define TTYS1_DEV g_uart2port /* LPUART2 is ttyS1 */ +# define UART2_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART3) && !defined(UART3_ASSIGNED) +# define TTYS1_DEV g_uart3port /* LPUART3 is ttyS1 */ +# define UART3_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART4) && !defined(UART4_ASSIGNED) +# define TTYS1_DEV g_uart4port /* LPUART4 is ttyS1 */ +# define UART4_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART5) && !defined(UART5_ASSIGNED) +# define TTYS1_DEV g_uart5port /* LPUART5 is ttyS1 */ +# define UART5_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART6) && !defined(UART6_ASSIGNED) +# define TTYS1_DEV g_uart6port /* LPUART6 is ttyS1 */ +# define UART6_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART7) && !defined(UART7_ASSIGNED) +# define TTYS1_DEV g_uart7port /* LPUART7 is ttyS1 */ +# define UART7_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART8) && !defined(UART8_ASSIGNED) +# define TTYS1_DEV g_uart8port /* LPUART8 is ttyS1 */ +# define UART8_ASSIGNED 1 +#endif + +/* Pick ttys2. This could be one of UART2-8. It can't be UART1 because that + * was either assigned as ttyS0 or ttys1. One of UART 1-8 could be the + * console. One of UART2-8 has already been assigned to ttys0 or ttyS1. + */ + +#if defined(CONFIG_IMXRT_LPUART2) && !defined(UART2_ASSIGNED) +# define TTYS2_DEV g_uart2port /* LPUART2 is ttyS2 */ +# define UART2_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART3) && !defined(UART3_ASSIGNED) +# define TTYS2_DEV g_uart3port /* LPUART3 is ttyS2 */ +# define UART3_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART4) && !defined(UART4_ASSIGNED) +# define TTYS2_DEV g_uart4port /* LPUART4 is ttyS2 */ +# define UART4_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART5) && !defined(UART5_ASSIGNED) +# define TTYS2_DEV g_uart5port /* LPUART5 is ttyS2 */ +# define UART5_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART6) && !defined(UART6_ASSIGNED) +# define TTYS2_DEV g_uart6port /* LPUART6 is ttyS2 */ +# define UART6_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART7) && !defined(UART7_ASSIGNED) +# define TTYS2_DEV g_uart7port /* LPUART7 is ttyS2 */ +# define UART7_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART8) && !defined(UART8_ASSIGNED) +# define TTYS2_DEV g_uart8port /* LPUART8 is ttyS2 */ +# define UART8_ASSIGNED 1 +#endif + +/* Pick ttys3. This could be one of UART3-8. It can't be UART1-2 because + * those have already been assigned to ttsyS0, 1, or 2. One of + * UART3-8 could also be the console. One of UART3-8 has already + * been assigned to ttys0, 1, or 3. + */ + +#if defined(CONFIG_IMXRT_LPUART3) && !defined(UART3_ASSIGNED) +# define TTYS3_DEV g_uart3port /* LPUART3 is ttyS3 */ +# define UART3_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART4) && !defined(UART4_ASSIGNED) +# define TTYS3_DEV g_uart4port /* LPUART4 is ttyS3 */ +# define UART4_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART5) && !defined(UART5_ASSIGNED) +# define TTYS3_DEV g_uart5port /* LPUART5 is ttyS3 */ +# define UART5_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART6) && !defined(UART6_ASSIGNED) +# define TTYS3_DEV g_uart6port /* LPUART6 is ttyS3 */ +# define UART6_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART7) && !defined(UART7_ASSIGNED) +# define TTYS3_DEV g_uart7port /* LPUART7 is ttyS3 */ +# define UART7_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART8) && !defined(UART8_ASSIGNED) +# define TTYS3_DEV g_uart8port /* LPUART8 is ttyS3 */ +# define UART8_ASSIGNED 1 +#endif + +/* Pick ttys4. This could be one of UART4-8. It can't be UART1-3 because + * those have already been assigned to ttsyS0, 1, 2 or 3. One of + * UART 4-8 could be the console. One of UART4-8 has already been + * assigned to ttys0, 1, 3, or 4. + */ + +#if defined(CONFIG_IMXRT_LPUART4) && !defined(UART4_ASSIGNED) +# define TTYS4_DEV g_uart4port /* LPUART4 is ttyS4 */ +# define UART4_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART5) && !defined(UART5_ASSIGNED) +# define TTYS4_DEV g_uart5port /* LPUART5 is ttyS4 */ +# define UART5_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART6) && !defined(UART6_ASSIGNED) +# define TTYS4_DEV g_uart6port /* LPUART6 is ttyS4 */ +# define UART6_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART7) && !defined(UART7_ASSIGNED) +# define TTYS4_DEV g_uart7port /* LPUART7 is ttyS4 */ +# define UART7_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART8) && !defined(UART8_ASSIGNED) +# define TTYS4_DEV g_uart8port /* LPUART8 is ttyS4 */ +# define UART8_ASSIGNED 1 +#endif + +/* Pick ttys5. This could be one of UART5-8. It can't be UART1-4 because + * those have already been assigned to ttsyS0, 1, 2, 3 or 4. One of + * UART 5-8 could be the console. One of UART5-8 has already been + * assigned to ttys0, 1, 2, 3, or 4. + */ + +#if defined(CONFIG_IMXRT_LPUART5) && !defined(UART5_ASSIGNED) +# define TTYS5_DEV g_uart5port /* LPUART5 is ttyS5 */ +# define UART5_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART6) && !defined(UART6_ASSIGNED) +# define TTYS5_DEV g_uart6port /* LPUART6 is ttyS5 */ +# define UART6_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART7) && !defined(UART7_ASSIGNED) +# define TTYS5_DEV g_uart7port /* LPUART7 is ttyS5 */ +# define UART7_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART8) && !defined(UART8_ASSIGNED) +# define TTYS5_DEV g_uart8port /* LPUART8 is ttyS5 */ +# define UART8_ASSIGNED 1 +#endif + +/* Pick ttys6. This could be one of UART6-8. It can't be UART1-5 because + * those have already been assigned to ttsyS0, 1, 2, 3, 4 or 5. One of + * UART 6-8 could be the console. One of UART6-8 has already been + * assigned to ttys0, 1, 2, 3, 4 or 5. + */ + +#if defined(CONFIG_IMXRT_LPUART6) && !defined(UART6_ASSIGNED) +# define TTYS6_DEV g_uart6port /* LPUART6 is ttyS5 */ +# define UART6_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART7) && !defined(UART7_ASSIGNED) +# define TTYS6_DEV g_uart7port /* LPUART7 is ttyS5 */ +# define UART7_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART8) && !defined(UART8_ASSIGNED) +# define TTYS6_DEV g_uart8port /* LPUART8 is ttyS5 */ +# define UART8_ASSIGNED 1 +#endif + +/* Pick ttys7. This could be one of UART7-8. It can't be UART1-6 because + * those have already been assigned to ttsyS0, 1, 2, 3, 4, 5 or 6. One of + * UART 7-8 could be the console. One of UART7-8 has already been + * assigned to ttys0, 1, 2, 3, 4, 5 or 6. + */ + +#if defined(CONFIG_IMXRT_LPUART7) && !defined(UART7_ASSIGNED) +# define TTYS7_DEV g_uart7port /* LPUART7 is ttyS5 */ +# define UART7_ASSIGNED 1 +#elif defined(CONFIG_IMXRT_LPUART8) && !defined(UART8_ASSIGNED) +# define TTYS7_DEV g_uart8port /* LPUART8 is ttyS5 */ +# define UART8_ASSIGNED 1 +#endif + +/* UART, if available, should have been assigned to ttyS0-7. */ + +/* Power management definitions */ + +#if defined(CONFIG_PM) && !defined(CONFIG_IMXRT_PM_SERIAL_ACTIVITY) +# define CONFIG_IMXRT_PM_SERIAL_ACTIVITY 10 +#endif + +#if defined(CONFIG_PM) +# define PM_IDLE_DOMAIN 0 /* Revisit */ +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +struct imxrt_uart_s +{ + uint32_t uartbase; /* Base address of UART registers */ + uint32_t baud; /* Configured baud */ + uint32_t ie; /* Saved enabled interrupts */ + uint8_t irq; /* IRQ associated with this UART */ + uint8_t parity; /* 0=none, 1=odd, 2=even */ + uint8_t bits; /* Number of bits (7 or 8) */ +#if defined(CONFIG_SERIAL_RS485CONTROL) || defined(CONFIG_SERIAL_IFLOWCONTROL) + uint8_t inviflow:1; /* Invert RTS sense */ + const uint32_t rts_gpio; /* U[S]ART RTS GPIO pin configuration */ +#endif +#ifdef CONFIG_SERIAL_OFLOWCONTROL + const uint32_t cts_gpio; /* U[S]ART CTS GPIO pin configuration */ +#endif +#ifdef CONFIG_IMXRT_LPUART_SINGLEWIRE + const uint32_t tx_gpio; /* TX GPIO pin configuration */ +#endif + + uint8_t stopbits2:1; /* 1: Configure with 2 stop bits vs 1 */ +#ifdef CONFIG_SERIAL_IFLOWCONTROL + uint8_t iflow:1; /* input flow control (RTS) enabled */ +#endif +#ifdef CONFIG_SERIAL_OFLOWCONTROL + uint8_t oflow:1; /* output flow control (CTS) enabled */ +#endif +#ifdef CONFIG_SERIAL_RS485CONTROL + uint8_t rs485mode:1; /* We are in RS485 (RTS on TX) mode */ +#endif +}; + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +static inline uint32_t imxrt_serialin(struct imxrt_uart_s *priv, + uint32_t offset); +static inline void imxrt_serialout(struct imxrt_uart_s *priv, + uint32_t offset, uint32_t value); +static inline void imxrt_disableuartint(struct imxrt_uart_s *priv, + uint32_t *ie); +static inline void imxrt_restoreuartint(struct imxrt_uart_s *priv, + uint32_t ie); + +static int imxrt_setup(struct uart_dev_s *dev); +static void imxrt_shutdown(struct uart_dev_s *dev); +static int imxrt_attach(struct uart_dev_s *dev); +static void imxrt_detach(struct uart_dev_s *dev); +static int imxrt_interrupt(int irq, void *context, FAR void *arg); +static int imxrt_ioctl(struct file *filep, int cmd, unsigned long arg); +static int imxrt_receive(struct uart_dev_s *dev, unsigned int *status); +static void imxrt_rxint(struct uart_dev_s *dev, bool enable); +static bool imxrt_rxavailable(struct uart_dev_s *dev); +static void imxrt_send(struct uart_dev_s *dev, int ch); +static void imxrt_txint(struct uart_dev_s *dev, bool enable); +static bool imxrt_txready(struct uart_dev_s *dev); +static bool imxrt_txempty(struct uart_dev_s *dev); + +#ifdef CONFIG_PM +static void up_pm_notify(struct pm_callback_s *cb, int dowmin, + enum pm_state_e pmstate); +static int up_pm_prepare(struct pm_callback_s *cb, int domain, + enum pm_state_e pmstate); +#endif + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/* Serial driver UART operations */ + +static const struct uart_ops_s g_uart_ops = +{ + .setup = imxrt_setup, + .shutdown = imxrt_shutdown, + .attach = imxrt_attach, + .detach = imxrt_detach, + .ioctl = imxrt_ioctl, + .receive = imxrt_receive, + .rxint = imxrt_rxint, + .rxavailable = imxrt_rxavailable, +#ifdef CONFIG_SERIAL_IFLOWCONTROL + .rxflowcontrol = NULL, +#endif + .send = imxrt_send, + .txint = imxrt_txint, + .txready = imxrt_txready, + .txempty = imxrt_txempty, +}; + +/* I/O buffers */ + +#ifdef CONFIG_IMXRT_LPUART1 +static char g_uart1rxbuffer[CONFIG_LPUART1_RXBUFSIZE]; +static char g_uart1txbuffer[CONFIG_LPUART1_TXBUFSIZE]; +#endif + +#ifdef CONFIG_IMXRT_LPUART2 +static char g_uart2rxbuffer[CONFIG_LPUART2_RXBUFSIZE]; +static char g_uart2txbuffer[CONFIG_LPUART2_TXBUFSIZE]; +#endif + +#ifdef CONFIG_IMXRT_LPUART3 +static char g_uart3rxbuffer[CONFIG_LPUART3_RXBUFSIZE]; +static char g_uart3txbuffer[CONFIG_LPUART3_TXBUFSIZE]; +#endif + +#ifdef CONFIG_IMXRT_LPUART4 +static char g_uart4rxbuffer[CONFIG_LPUART4_RXBUFSIZE]; +static char g_uart4txbuffer[CONFIG_LPUART4_TXBUFSIZE]; +#endif + +#ifdef CONFIG_IMXRT_LPUART5 +static char g_uart5rxbuffer[CONFIG_LPUART5_RXBUFSIZE]; +static char g_uart5txbuffer[CONFIG_LPUART5_TXBUFSIZE]; +#endif + +#ifdef CONFIG_IMXRT_LPUART6 +static char g_uart6rxbuffer[CONFIG_LPUART6_RXBUFSIZE]; +static char g_uart6txbuffer[CONFIG_LPUART6_TXBUFSIZE]; +#endif + +#ifdef CONFIG_IMXRT_LPUART7 +static char g_uart7rxbuffer[CONFIG_LPUART7_RXBUFSIZE]; +static char g_uart7txbuffer[CONFIG_LPUART7_TXBUFSIZE]; +#endif + +#ifdef CONFIG_IMXRT_LPUART8 +static char g_uart8rxbuffer[CONFIG_LPUART8_RXBUFSIZE]; +static char g_uart8txbuffer[CONFIG_LPUART8_TXBUFSIZE]; +#endif + +/* This describes the state of the IMXRT lpuart1 port. */ + +#ifdef CONFIG_IMXRT_LPUART1 +static struct imxrt_uart_s g_uart1priv = +{ + .uartbase = IMXRT_LPUART1_BASE, + .baud = CONFIG_LPUART1_BAUD, + .irq = IMXRT_IRQ_LPUART1, + .parity = CONFIG_LPUART1_PARITY, + .bits = CONFIG_LPUART1_BITS, + .stopbits2 = CONFIG_LPUART1_2STOP, +#if defined(CONFIG_SERIAL_OFLOWCONTROL) && defined(CONFIG_LPUART1_OFLOWCONTROL) + .oflow = 1, + .cts_gpio = GPIO_LPUART1_CTS, +#endif +#if defined(CONFIG_SERIAL_IFLOWCONTROL) && defined(CONFIG_LPUART1_IFLOWCONTROL) + .iflow = 1, +#endif +# if ((defined(CONFIG_SERIAL_RS485CONTROL) && defined(CONFIG_LPUART1_RS485RTSCONTROL)) \ + || (defined(CONFIG_SERIAL_IFLOWCONTROL) && defined(CONFIG_LPUART1_IFLOWCONTROL))) + .rts_gpio = GPIO_LPUART1_RTS, +#endif +#ifdef CONFIG_IMXRT_LPUART_SINGLEWIRE + .tx_gpio = GPIO_LPUART1_TX, +#endif + +#if (((defined(CONFIG_SERIAL_RS485CONTROL) || defined(CONFIG_SERIAL_IFLOWCONTROL))) \ + && defined(CONFIG_LPUART1_INVERTIFLOWCONTROL)) + .inviflow = 1, +#endif + +#if defined(CONFIG_SERIAL_RS485CONTROL) && defined(CONFIG_LPUART1_RS485RTSCONTROL) + .rs485mode = 1, +#endif +}; + +static struct uart_dev_s g_uart1port = +{ + .recv = + { + .size = CONFIG_LPUART1_RXBUFSIZE, + .buffer = g_uart1rxbuffer, + }, + .xmit = + { + .size = CONFIG_LPUART1_TXBUFSIZE, + .buffer = g_uart1txbuffer, + }, + .ops = &g_uart_ops, + .priv = &g_uart1priv, +}; +#endif + +/* This describes the state of the IMXRT lpuart2 port. */ + +#ifdef CONFIG_IMXRT_LPUART2 +static struct imxrt_uart_s g_uart2priv = +{ + .uartbase = IMXRT_LPUART2_BASE, + .baud = CONFIG_LPUART2_BAUD, + .irq = IMXRT_IRQ_LPUART2, + .parity = CONFIG_LPUART2_PARITY, + .bits = CONFIG_LPUART2_BITS, + .stopbits2 = CONFIG_LPUART2_2STOP, +#if defined(CONFIG_SERIAL_OFLOWCONTROL) && defined(CONFIG_LPUART2_OFLOWCONTROL) + .oflow = 1, + .cts_gpio = GPIO_LPUART2_CTS, +#endif +#if defined(CONFIG_SERIAL_IFLOWCONTROL) && defined(CONFIG_LPUART2_IFLOWCONTROL) + .iflow = 1, +#endif +# if ((defined(CONFIG_SERIAL_RS485CONTROL) && defined(CONFIG_LPUART2_RS485RTSCONTROL)) \ + || (defined(CONFIG_SERIAL_IFLOWCONTROL) && defined(CONFIG_LPUART2_IFLOWCONTROL))) + .rts_gpio = GPIO_LPUART2_RTS, +#endif +#ifdef CONFIG_IMXRT_LPUART_SINGLEWIRE + .tx_gpio = GPIO_LPUART2_TX, +#endif +#if (((defined(CONFIG_SERIAL_RS485CONTROL) || defined(CONFIG_SERIAL_IFLOWCONTROL))) \ + && defined(CONFIG_LPUART2_INVERTIFLOWCONTROL)) + .inviflow = 1, +#endif + +#if defined(CONFIG_SERIAL_RS485CONTROL) && defined(CONFIG_LPUART2_RS485RTSCONTROL) + .rs485mode = 1, +#endif +}; + +static struct uart_dev_s g_uart2port = +{ + .recv = + { + .size = CONFIG_LPUART2_RXBUFSIZE, + .buffer = g_uart2rxbuffer, + }, + .xmit = + { + .size = CONFIG_LPUART2_TXBUFSIZE, + .buffer = g_uart2txbuffer, + }, + .ops = &g_uart_ops, + .priv = &g_uart2priv, +}; +#endif + +#ifdef CONFIG_IMXRT_LPUART3 +static struct imxrt_uart_s g_uart3priv = +{ + .uartbase = IMXRT_LPUART3_BASE, + .baud = CONFIG_LPUART3_BAUD, + .irq = IMXRT_IRQ_LPUART3, + .parity = CONFIG_LPUART3_PARITY, + .bits = CONFIG_LPUART3_BITS, + .stopbits2 = CONFIG_LPUART3_2STOP, +#if defined(CONFIG_SERIAL_OFLOWCONTROL) && defined(CONFIG_LPUART3_OFLOWCONTROL) + .oflow = 1, + .cts_gpio = GPIO_LPUART3_CTS, +#endif +#if defined(CONFIG_SERIAL_IFLOWCONTROL) && defined(CONFIG_LPUART3_IFLOWCONTROL) + .iflow = 1, +#endif +# if ((defined(CONFIG_SERIAL_RS485CONTROL) && defined(CONFIG_LPUART3_RS485RTSCONTROL)) \ + || (defined(CONFIG_SERIAL_IFLOWCONTROL) && defined(CONFIG_LPUART3_IFLOWCONTROL))) + .rts_gpio = GPIO_LPUART3_RTS, +#endif +#ifdef CONFIG_IMXRT_LPUART_SINGLEWIRE + .tx_gpio = GPIO_LPUART3_TX, +#endif +#if (((defined(CONFIG_SERIAL_RS485CONTROL) || defined(CONFIG_SERIAL_IFLOWCONTROL))) \ + && defined(CONFIG_LPUART3_INVERTIFLOWCONTROL)) + .inviflow = 1, +#endif + +#if defined(CONFIG_SERIAL_RS485CONTROL) && defined(CONFIG_LPUART3_RS485RTSCONTROL) + .rs485mode = 1, +#endif +}; + +static struct uart_dev_s g_uart3port = +{ + .recv = + { + .size = CONFIG_LPUART3_RXBUFSIZE, + .buffer = g_uart3rxbuffer, + }, + .xmit = + { + .size = CONFIG_LPUART3_TXBUFSIZE, + .buffer = g_uart3txbuffer, + }, + .ops = &g_uart_ops, + .priv = &g_uart3priv, +}; +#endif + +#ifdef CONFIG_IMXRT_LPUART4 +static struct imxrt_uart_s g_uart4priv = +{ + .uartbase = IMXRT_LPUART4_BASE, + .baud = CONFIG_LPUART4_BAUD, + .irq = IMXRT_IRQ_LPUART4, + .parity = CONFIG_LPUART4_PARITY, + .bits = CONFIG_LPUART4_BITS, + .stopbits2 = CONFIG_LPUART4_2STOP, +#if defined(CONFIG_SERIAL_OFLOWCONTROL) && defined(CONFIG_LPUART4_OFLOWCONTROL) + .oflow = 1, + .cts_gpio = GPIO_LPUART4_CTS, +#endif +#if defined(CONFIG_SERIAL_IFLOWCONTROL) && defined(CONFIG_LPUART4_IFLOWCONTROL) + .iflow = 1, +#endif +# if ((defined(CONFIG_SERIAL_RS485CONTROL) && defined(CONFIG_LPUART4_RS485RTSCONTROL)) \ + || (defined(CONFIG_SERIAL_IFLOWCONTROL) && defined(CONFIG_LPUART4_IFLOWCONTROL))) + .rts_gpio = GPIO_LPUART4_RTS, +#endif +#ifdef CONFIG_IMXRT_LPUART_SINGLEWIRE + .tx_gpio = GPIO_LPUART4_TX, +#endif +#if (((defined(CONFIG_SERIAL_RS485CONTROL) || defined(CONFIG_SERIAL_IFLOWCONTROL))) \ + && defined(CONFIG_LPUART4_INVERTIFLOWCONTROL)) + .inviflow = 1, +#endif + +#if defined(CONFIG_SERIAL_RS485CONTROL) && defined(CONFIG_LPUART4_RS485RTSCONTROL) + .rs485mode = 1, +#endif +}; + +static struct uart_dev_s g_uart4port = +{ + .recv = + { + .size = CONFIG_LPUART4_RXBUFSIZE, + .buffer = g_uart4rxbuffer, + }, + .xmit = + { + .size = CONFIG_LPUART4_TXBUFSIZE, + .buffer = g_uart4txbuffer, + }, + .ops = &g_uart_ops, + .priv = &g_uart4priv, +}; +#endif + +#ifdef CONFIG_IMXRT_LPUART5 +static struct imxrt_uart_s g_uart5priv = +{ + .uartbase = IMXRT_LPUART5_BASE, + .baud = CONFIG_LPUART5_BAUD, + .irq = IMXRT_IRQ_LPUART5, + .parity = CONFIG_LPUART5_PARITY, + .bits = CONFIG_LPUART5_BITS, + .stopbits2 = CONFIG_LPUART5_2STOP, +#if defined(CONFIG_SERIAL_OFLOWCONTROL) && defined(CONFIG_LPUART5_OFLOWCONTROL) + .oflow = 1, + .cts_gpio = GPIO_LPUART5_CTS, +#endif +#if defined(CONFIG_SERIAL_IFLOWCONTROL) && defined(CONFIG_LPUART5_IFLOWCONTROL) + .iflow = 1, +#endif +# if ((defined(CONFIG_SERIAL_RS485CONTROL) && defined(CONFIG_LPUART5_RS485RTSCONTROL)) \ + || (defined(CONFIG_SERIAL_IFLOWCONTROL) && defined(CONFIG_LPUART5_IFLOWCONTROL))) + .rts_gpio = GPIO_LPUART5_RTS, +#endif +#ifdef CONFIG_IMXRT_LPUART_SINGLEWIRE + .tx_gpio = GPIO_LPUART5_TX, +#endif +#if (((defined(CONFIG_SERIAL_RS485CONTROL) || defined(CONFIG_SERIAL_IFLOWCONTROL))) \ + && defined(CONFIG_LPUART5_INVERTIFLOWCONTROL)) + .inviflow = 1, +#endif + +#if defined(CONFIG_SERIAL_RS485CONTROL) && defined(CONFIG_LPUART5_RS485RTSCONTROL) + .rs485mode = 1, +#endif +}; + +static struct uart_dev_s g_uart5port = +{ + .recv = + { + .size = CONFIG_LPUART5_RXBUFSIZE, + .buffer = g_uart5rxbuffer, + }, + .xmit = + { + .size = CONFIG_LPUART5_TXBUFSIZE, + .buffer = g_uart5txbuffer, + }, + .ops = &g_uart_ops, + .priv = &g_uart5priv, +}; +#endif + +#ifdef CONFIG_IMXRT_LPUART6 +static struct imxrt_uart_s g_uart6priv = +{ + .uartbase = IMXRT_LPUART6_BASE, + .baud = CONFIG_LPUART6_BAUD, + .irq = IMXRT_IRQ_LPUART6, + .parity = CONFIG_LPUART6_PARITY, + .bits = CONFIG_LPUART6_BITS, + .stopbits2 = CONFIG_LPUART6_2STOP, +#if defined(CONFIG_SERIAL_OFLOWCONTROL) && defined(CONFIG_LPUART6_OFLOWCONTROL) + .oflow = 1, + .cts_gpio = GPIO_LPUART6_CTS, +#endif +#if defined(CONFIG_SERIAL_IFLOWCONTROL) && defined(CONFIG_LPUART6_IFLOWCONTROL) + .iflow = 1, +#endif +# if ((defined(CONFIG_SERIAL_RS485CONTROL) && defined(CONFIG_LPUART6_RS485RTSCONTROL)) \ + || (defined(CONFIG_SERIAL_IFLOWCONTROL) && defined(CONFIG_LPUART6_IFLOWCONTROL))) + .rts_gpio = GPIO_LPUART6_RTS, +#endif +#ifdef CONFIG_IMXRT_LPUART_SINGLEWIRE + .tx_gpio = GPIO_LPUART6_TX, +#endif +#if (((defined(CONFIG_SERIAL_RS485CONTROL) || defined(CONFIG_SERIAL_IFLOWCONTROL))) \ + && defined(CONFIG_LPUART6_INVERTIFLOWCONTROL)) + .inviflow = 1, +#endif + +#if defined(CONFIG_SERIAL_RS485CONTROL) && defined(CONFIG_LPUART6_RS485RTSCONTROL) + .rs485mode = 1, +#endif +}; + +static struct uart_dev_s g_uart6port = +{ + .recv = + { + .size = CONFIG_LPUART6_RXBUFSIZE, + .buffer = g_uart6rxbuffer, + }, + .xmit = + { + .size = CONFIG_LPUART6_TXBUFSIZE, + .buffer = g_uart6txbuffer, + }, + .ops = &g_uart_ops, + .priv = &g_uart6priv, +}; +#endif + +#ifdef CONFIG_IMXRT_LPUART7 +static struct imxrt_uart_s g_uart7priv = +{ + .uartbase = IMXRT_LPUART7_BASE, + .baud = CONFIG_LPUART7_BAUD, + .irq = IMXRT_IRQ_LPUART7, + .parity = CONFIG_LPUART7_PARITY, + .bits = CONFIG_LPUART7_BITS, + .stopbits2 = CONFIG_LPUART7_2STOP, +#if defined(CONFIG_SERIAL_OFLOWCONTROL) && defined(CONFIG_LPUART7_OFLOWCONTROL) + .oflow = 1, + .cts_gpio = GPIO_LPUART7_CTS, +#endif +#if defined(CONFIG_SERIAL_IFLOWCONTROL) && defined(CONFIG_LPUART7_IFLOWCONTROL) + .iflow = 1, +#endif +# if ((defined(CONFIG_SERIAL_RS485CONTROL) && defined(CONFIG_LPUART7_RS485RTSCONTROL)) \ + || (defined(CONFIG_SERIAL_IFLOWCONTROL) && defined(CONFIG_LPUART7_IFLOWCONTROL))) + .rts_gpio = GPIO_LPUART7_RTS, +#endif +#ifdef CONFIG_IMXRT_LPUART_SINGLEWIRE + .tx_gpio = GPIO_LPUART7_TX, +#endif +#if (((defined(CONFIG_SERIAL_RS485CONTROL) || defined(CONFIG_SERIAL_IFLOWCONTROL))) \ + && defined(CONFIG_LPUART7_INVERTIFLOWCONTROL)) + .inviflow = 1, +#endif + +#if defined(CONFIG_SERIAL_RS485CONTROL) && defined(CONFIG_LPUART7_RS485RTSCONTROL) + .rs485mode = 1, +#endif +}; + +static struct uart_dev_s g_uart7port = +{ + .recv = + { + .size = CONFIG_LPUART7_RXBUFSIZE, + .buffer = g_uart7rxbuffer, + }, + .xmit = + { + .size = CONFIG_LPUART7_TXBUFSIZE, + .buffer = g_uart7txbuffer, + }, + .ops = &g_uart_ops, + .priv = &g_uart7priv, +}; +#endif + +#ifdef CONFIG_IMXRT_LPUART8 +static struct imxrt_uart_s g_uart8priv = +{ + .uartbase = IMXRT_LPUART8_BASE, + .baud = CONFIG_LPUART8_BAUD, + .irq = IMXRT_IRQ_LPUART8, + .parity = CONFIG_LPUART8_PARITY, + .bits = CONFIG_LPUART8_BITS, + .stopbits2 = CONFIG_LPUART8_2STOP, +#if defined(CONFIG_SERIAL_OFLOWCONTROL) && defined(CONFIG_LPUART8_OFLOWCONTROL) + .oflow = 1, + .cts_gpio = GPIO_LPUART8_CTS, +#endif +#if defined(CONFIG_SERIAL_IFLOWCONTROL) && defined(CONFIG_LPUART8_IFLOWCONTROL) + .iflow = 1, +#endif +# if ((defined(CONFIG_SERIAL_RS485CONTROL) && defined(CONFIG_LPUART8_RS485RTSCONTROL)) \ + || (defined(CONFIG_SERIAL_IFLOWCONTROL) && defined(CONFIG_LPUART8_IFLOWCONTROL))) + .rts_gpio = GPIO_LPUART8_RTS, +#endif +#ifdef CONFIG_IMXRT_LPUART_SINGLEWIRE + .tx_gpio = GPIO_LPUART8_TX, +#endif +#if (((defined(CONFIG_SERIAL_RS485CONTROL) || defined(CONFIG_SERIAL_IFLOWCONTROL))) \ + && defined(CONFIG_LPUART8_INVERTIFLOWCONTROL)) + .inviflow = 1, +#endif + +#if defined(CONFIG_SERIAL_RS485CONTROL) && defined(CONFIG_LPUART8_RS485RTSCONTROL) + .rs485mode = 1, +#endif +}; + +static struct uart_dev_s g_uart8port = +{ + .recv = + { + .size = CONFIG_LPUART8_RXBUFSIZE, + .buffer = g_uart8rxbuffer, + }, + .xmit = + { + .size = CONFIG_LPUART8_TXBUFSIZE, + .buffer = g_uart8txbuffer, + }, + .ops = &g_uart_ops, + .priv = &g_uart8priv, +}; +#endif + +#ifdef CONFIG_PM +static struct pm_callback_s g_serial_pmcb = +{ + .notify = up_pm_notify, + .prepare = up_pm_prepare, +}; +#endif + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: imxrt_serialin + ****************************************************************************/ + +static inline uint32_t imxrt_serialin(struct imxrt_uart_s *priv, + uint32_t offset) +{ + return getreg32(priv->uartbase + offset); +} + +/**************************************************************************** + * Name: imxrt_serialout + ****************************************************************************/ + +static inline void imxrt_serialout(struct imxrt_uart_s *priv, + uint32_t offset, uint32_t value) +{ + putreg32(value, priv->uartbase + offset); +} + +/**************************************************************************** + * Name: imxrt_disableuartint + ****************************************************************************/ + +static inline void imxrt_disableuartint(struct imxrt_uart_s *priv, + uint32_t *ie) +{ + irqstate_t flags; + uint32_t regval; + + flags = spin_lock_irqsave(NULL); + regval = imxrt_serialin(priv, IMXRT_LPUART_CTRL_OFFSET); + + /* Return the current Rx and Tx interrupt state */ + + if (ie != NULL) + { + *ie = regval & LPUART_ALL_INTS; + } + + regval &= ~LPUART_ALL_INTS; + imxrt_serialout(priv, IMXRT_LPUART_CTRL_OFFSET, regval); + spin_unlock_irqrestore(NULL, flags); +} + +/**************************************************************************** + * Name: imxrt_restoreuartint + ****************************************************************************/ + +static inline void imxrt_restoreuartint(struct imxrt_uart_s *priv, + uint32_t ie) +{ + irqstate_t flags; + uint32_t regval; + + /* Enable/disable any interrupts that are currently disabled but should be + * enabled/disabled. + */ + + flags = spin_lock_irqsave(NULL); + regval = imxrt_serialin(priv, IMXRT_LPUART_CTRL_OFFSET); + regval &= ~LPUART_ALL_INTS; + regval |= ie; + imxrt_serialout(priv, IMXRT_LPUART_CTRL_OFFSET, regval); + spin_unlock_irqrestore(NULL, flags); +} + +/**************************************************************************** + * Name: imxrt_setup + * + * Description: + * Configure the UART baud, bits, parity, fifos, etc. This + * method is called the first time that the serial port is + * opened. + * + ****************************************************************************/ + +static int imxrt_setup(struct uart_dev_s *dev) +{ + struct imxrt_uart_s *priv = (struct imxrt_uart_s *)dev->priv; +#ifndef CONFIG_SUPPRESS_LPUART_CONFIG + int ret; + struct uart_config_s config = + { + 0 + }; + + /* Configure the UART */ + + config.baud = priv->baud; /* Configured baud */ + config.parity = priv->parity; /* 0=none, 1=odd, 2=even */ + config.bits = priv->bits; /* Number of bits (5-9) */ + config.stopbits2 = priv->stopbits2; /* true: Configure with 2 stop bits instead of 1 */ +#ifdef CONFIG_SERIAL_IFLOWCONTROL + config.usects = priv->iflow; /* Flow control on inbound side */ +#endif +#ifdef CONFIG_SERIAL_OFLOWCONTROL + config.userts = priv->oflow; /* Flow control on outbound side */ +#endif +#ifdef CONFIG_SERIAL_RS485CONTROL + config.users485 = priv->rs485mode; /* Switch into RS485 mode */ +#endif +#if defined(CONFIG_SERIAL_RS485CONTROL) || defined(CONFIG_SERIAL_IFLOWCONTROL) + config.invrts = priv->inviflow; /* Inversion of outbound flow control */ +#endif + + ret = imxrt_lpuart_configure(priv->uartbase, &config); + + priv->ie = imxrt_serialin(priv, IMXRT_LPUART_CTRL_OFFSET) & \ + LPUART_ALL_INTS; + return ret; + +#else + priv->ie = imxrt_serialin(priv, IMXRT_LPUART_CTRL_OFFSET) & \ + LPUART_ALL_INTS; + return OK; +#endif +} + +/**************************************************************************** + * Name: imxrt_shutdown + * + * Description: + * Disable the UART. This method is called when the serial + * port is closed + * + ****************************************************************************/ + +static void imxrt_shutdown(struct uart_dev_s *dev) +{ + struct imxrt_uart_s *priv = (struct imxrt_uart_s *)dev->priv; + + /* Disable the UART */ + + imxrt_serialout(priv, IMXRT_LPUART_GLOBAL_OFFSET, LPUART_GLOBAL_RST); +} + +/**************************************************************************** + * Name: imxrt_attach + * + * Description: + * Configure the UART to operation in interrupt driven mode. This method + * is called when the serial port is opened. Normally, this is just after + * the setup() method is called, however, the serial console may operate + * in a non-interrupt driven mode during the boot phase. + * + * RX and TX interrupts are not enabled when by the attach method (unless + * the hardware supports multiple levels of interrupt enabling). The RX + * and TX interrupts are not enabled until the txint() and rxint() methods + * are called. + * + ****************************************************************************/ + +static int imxrt_attach(struct uart_dev_s *dev) +{ + struct imxrt_uart_s *priv = (struct imxrt_uart_s *)dev->priv; + int ret; + + /* Attach and enable the IRQ */ + + ret = irq_attach(priv->irq, imxrt_interrupt, dev); + if (ret == OK) + { + /* Enable the interrupt (RX and TX interrupts are still disabled + * in the UART + */ + + up_enable_irq(priv->irq); + } + + return ret; +} + +/**************************************************************************** + * Name: imxrt_detach + * + * Description: + * Detach UART interrupts. This method is called when the serial port is + * closed normally just before the shutdown method is called. The + * exception is the serial console which is never shutdown. + * + ****************************************************************************/ + +static void imxrt_detach(struct uart_dev_s *dev) +{ + struct imxrt_uart_s *priv = (struct imxrt_uart_s *)dev->priv; + + up_disable_irq(priv->irq); + irq_detach(priv->irq); +} + +/**************************************************************************** + * Name: imxrt_interrupt (and front-ends) + * + * Description: + * This is the common UART interrupt handler. It should call + * uart_transmitchars or uart_receivechar to perform the appropriate data + * transfers. + * + ****************************************************************************/ + +static int imxrt_interrupt(int irq, void *context, FAR void *arg) +{ + struct uart_dev_s *dev = (struct uart_dev_s *)arg; + struct imxrt_uart_s *priv; + uint32_t usr; + int passes = 0; + bool handled; + + DEBUGASSERT(dev != NULL && dev->priv != NULL); + priv = (struct imxrt_uart_s *)dev->priv; + +#if defined(CONFIG_PM) && CONFIG_IMXRT_PM_SERIAL_ACTIVITY > 0 + /* Report serial activity to the power management logic */ + + pm_activity(PM_IDLE_DOMAIN, CONFIG_IMXRT_PM_SERIAL_ACTIVITY); +#endif + + /* Loop until there are no characters to be transferred or, + * until we have been looping for a long time. + */ + + handled = true; + for (passes = 0; passes < 256 && handled; passes++) + { + handled = false; + + /* Get the current UART status and check for loop + * termination conditions + */ + + usr = imxrt_serialin(priv, IMXRT_LPUART_STAT_OFFSET); + usr &= (LPUART_STAT_RDRF | LPUART_STAT_TDRE | LPUART_STAT_OR | + LPUART_STAT_FE); + + /* Clear serial overrun and framing errors */ + + if ((usr & LPUART_STAT_OR) != 0) + { + imxrt_serialout(priv, IMXRT_LPUART_STAT_OFFSET, LPUART_STAT_OR); + } + + if ((usr & LPUART_STAT_FE) != 0) + { + imxrt_serialout(priv, IMXRT_LPUART_STAT_OFFSET, LPUART_STAT_FE); + } + + /* Handle incoming, receive bytes */ + + if ((usr & LPUART_STAT_RDRF) != 0 && + (priv->ie & LPUART_CTRL_RIE) != 0) + { + uart_recvchars(dev); + handled = true; + } + + /* Handle outgoing, transmit bytes */ + + if ((usr & LPUART_STAT_TDRE) != 0 && + (priv->ie & LPUART_CTRL_TIE) != 0) + { + uart_xmitchars(dev); + handled = true; + } + } + + return OK; +} + +/**************************************************************************** + * Name: imxrt_ioctl + * + * Description: + * All ioctl calls will be routed through this method + * + ****************************************************************************/ + +static int imxrt_ioctl(struct file *filep, int cmd, unsigned long arg) +{ +#if defined(CONFIG_SERIAL_TIOCSERGSTRUCT) || defined(CONFIG_SERIAL_TERMIOS) + struct inode *inode = filep->f_inode; + struct uart_dev_s *dev = inode->i_private; + irqstate_t flags; +#endif + int ret = OK; + + switch (cmd) + { +#ifdef CONFIG_SERIAL_TIOCSERGSTRUCT + case TIOCSERGSTRUCT: + { + struct imxrt_uart_s *user = (struct imxrt_uart_s *)arg; + if (!user) + { + ret = -EINVAL; + } + else + { + memcpy(user, dev, sizeof(struct imxrt_uart_s)); + } + } + break; +#endif + +#ifdef CONFIG_SERIAL_TERMIOS + case TCGETS: + { + struct termios *termiosp = (struct termios *)arg; + struct imxrt_uart_s *priv = (struct imxrt_uart_s *)dev->priv; + + if (!termiosp) + { + ret = -EINVAL; + break; + } + + /* Return parity */ + + termiosp->c_cflag = ((priv->parity != 0) ? PARENB : 0) | + ((priv->parity == 1) ? PARODD : 0); + + /* Return stop bits */ + + termiosp->c_cflag |= (priv->stopbits2) ? CSTOPB : 0; + + /* Return flow control */ + +#ifdef CONFIG_SERIAL_OFLOWCONTROL + termiosp->c_cflag |= ((priv->oflow) ? CCTS_OFLOW : 0); +#endif +#ifdef CONFIG_SERIAL_IFLOWCONTROL + termiosp->c_cflag |= ((priv->iflow) ? CRTS_IFLOW : 0); +#endif + /* Return baud */ + + cfsetispeed(termiosp, priv->baud); + + /* Return number of bits */ + + switch (priv->bits) + { + case 5: + termiosp->c_cflag |= CS5; + break; + + case 6: + termiosp->c_cflag |= CS6; + break; + + case 7: + termiosp->c_cflag |= CS7; + break; + + default: + case 8: + termiosp->c_cflag |= CS8; + break; + +#if defined(CS9) + case 9: + termiosp->c_cflag |= CS9; + break; +#endif + } + } + break; + + case TCSETS: + { + struct termios *termiosp = (struct termios *)arg; + struct imxrt_uart_s *priv = (struct imxrt_uart_s *)dev->priv; + uint32_t baud; + uint32_t ie; + uint8_t parity; + uint8_t nbits; + bool stop2; + + if ((!termiosp) +#ifdef CONFIG_SERIAL_OFLOWCONTROL + || ((termiosp->c_cflag & CCTS_OFLOW) && (priv->cts_gpio == 0)) +#endif +#ifdef CONFIG_SERIAL_IFLOWCONTROL + || ((termiosp->c_cflag & CRTS_IFLOW) && (priv->rts_gpio == 0)) +#endif + ) + { + ret = -EINVAL; + break; + } + + /* Decode baud. */ + + ret = OK; + baud = cfgetispeed(termiosp); + + /* Decode number of bits */ + + switch (termiosp->c_cflag & CSIZE) + { + case CS5: + nbits = 5; + break; + + case CS6: + nbits = 6; + break; + + case CS7: + nbits = 7; + break; + + case CS8: + nbits = 8; + break; + +#if defined(CS9) + case CS9: + nbits = 9; + break; +#endif + default: + ret = -EINVAL; + break; + } + + /* Decode parity */ + + if ((termiosp->c_cflag & PARENB) != 0) + { + parity = (termiosp->c_cflag & PARODD) ? 1 : 2; + } + else + { + parity = 0; + } + + /* Decode stop bits */ + + stop2 = (termiosp->c_cflag & CSTOPB) != 0; + + /* Verify that all settings are valid before committing */ + + if (ret == OK) + { + /* Commit */ + + priv->baud = baud; + priv->parity = parity; + priv->bits = nbits; + priv->stopbits2 = stop2; +#ifdef CONFIG_SERIAL_OFLOWCONTROL + priv->oflow = (termiosp->c_cflag & CCTS_OFLOW) != 0; +#endif +#ifdef CONFIG_SERIAL_IFLOWCONTROL + priv->iflow = (termiosp->c_cflag & CRTS_IFLOW) != 0; +#endif + /* effect the changes immediately - note that we do not + * implement TCSADRAIN / TCSAFLUSH + */ + + flags = spin_lock_irqsave(NULL); + imxrt_disableuartint(priv, &ie); + ret = imxrt_setup(dev); + + /* Restore the interrupt state */ + + imxrt_restoreuartint(priv, ie); + priv->ie = ie; + spin_unlock_irqrestore(NULL, flags); + } + } + break; +#endif /* CONFIG_SERIAL_TERMIOS */ + +#ifdef CONFIG_IMXRT_LPUART_SINGLEWIRE + case TIOCSSINGLEWIRE: + { + uint32_t regval; + irqstate_t flags; + struct imxrt_uart_s *priv = (struct imxrt_uart_s *)dev->priv; + + flags = spin_lock_irqsave(NULL); + regval = imxrt_serialin(priv, IMXRT_LPUART_CTRL_OFFSET); + + if ((arg & SER_SINGLEWIRE_ENABLED) != 0) + { + uint32_t gpio_val = IOMUX_OPENDRAIN; + gpio_val |= (arg & SER_SINGLEWIRE_PULL_MASK) == + SER_SINGLEWIRE_PULLUP ? + IOMUX_PULL_UP_47K : IOMUX_PULL_NONE; + gpio_val |= (arg & SER_SINGLEWIRE_PULL_MASK) == + SER_SINGLEWIRE_PULLDOWN ? + IOMUX_PULL_DOWN_100K : IOMUX_PULL_NONE; + imxrt_config_gpio((priv->tx_gpio & + ~(IOMUX_PULL_MASK | IOMUX_OPENDRAIN)) | gpio_val); + regval |= LPUART_CTRL_LOOPS | LPUART_CTRL_RSRC; + } + else + { + imxrt_config_gpio((priv->tx_gpio & ~(IOMUX_PULL_MASK | + IOMUX_OPENDRAIN)) | + IOMUX_PULL_NONE); + regval &= ~(LPUART_CTRL_LOOPS | LPUART_CTRL_RSRC); + } + + imxrt_serialout(priv, IMXRT_LPUART_CTRL_OFFSET, regval); + + spin_unlock_irqrestore(NULL, flags); + } + break; +#endif + +#ifdef CONFIG_IMXRT_LPUART_INVERT + case TIOCSINVERT: + { + uint32_t ctrl; + uint32_t stat; + uint32_t regval; + irqstate_t flags; + struct imxrt_uart_s *priv = (struct imxrt_uart_s *)dev->priv; + + flags = spin_lock_irqsave(NULL); + ctrl = imxrt_serialin(priv, IMXRT_LPUART_CTRL_OFFSET); + stat = imxrt_serialin(priv, IMXRT_LPUART_STAT_OFFSET); + regval = ctrl; + + /* {R|T}XINV bit field can only be written when the receiver + * is disabled (RE=0). + */ + + regval &= ~LPUART_CTRL_RE; + + imxrt_serialout(priv, IMXRT_LPUART_CTRL_OFFSET, regval); + + /* Enable/disable signal inversion. */ + + if (arg & SER_INVERT_ENABLED_RX) + { + stat |= LPUART_STAT_RXINV; + } + else + { + stat &= ~LPUART_STAT_RXINV; + } + + if (arg & SER_INVERT_ENABLED_TX) + { + ctrl |= LPUART_CTRL_TXINV; + } + else + { + ctrl &= ~LPUART_CTRL_TXINV; + } + + imxrt_serialout(priv, IMXRT_LPUART_STAT_OFFSET, stat); + imxrt_serialout(priv, IMXRT_LPUART_CTRL_OFFSET, ctrl); + + spin_unlock_irqrestore(NULL, flags); + } + break; +#endif + + case TIOCSBRK: /* BSD compatibility: Turn break on, unconditionally */ + case TIOCCBRK: /* BSD compatibility: Turn break off, unconditionally */ + default: + ret = -ENOTTY; + break; + } + + return ret; +} + +/**************************************************************************** + * Name: imxrt_receive + * + * Description: + * Called (usually) from the interrupt level to receive one + * character from the UART. Error bits associated with the + * receipt are provided in the return 'status'. + * + ****************************************************************************/ + +static int imxrt_receive(struct uart_dev_s *dev, unsigned int *status) +{ + struct imxrt_uart_s *priv = (struct imxrt_uart_s *)dev->priv; + uint32_t rxd; + + rxd = imxrt_serialin(priv, IMXRT_LPUART_DATA_OFFSET); + *status = rxd >> LPUART_DATA_STATUS_SHIFT; + return (rxd & LPUART_DATA_MASK) >> LPUART_DATA_SHIFT; +} + +/**************************************************************************** + * Name: imxrt_rxint + * + * Description: + * Call to enable or disable RX interrupts + * + ****************************************************************************/ + +static void imxrt_rxint(struct uart_dev_s *dev, bool enable) +{ + struct imxrt_uart_s *priv = (struct imxrt_uart_s *)dev->priv; + irqstate_t flags; + uint32_t regval; + + /* Enable interrupts for data available at Rx */ + + flags = spin_lock_irqsave(NULL); + if (enable) + { +#ifndef CONFIG_SUPPRESS_SERIAL_INTS + priv->ie |= LPUART_CTRL_RIE | LPUART_CTRL_FEIE | LPUART_CTRL_ORIE; +#endif + } + else + { + priv->ie &= ~(LPUART_CTRL_RIE | LPUART_CTRL_FEIE | LPUART_CTRL_ORIE); + } + + regval = imxrt_serialin(priv, IMXRT_LPUART_CTRL_OFFSET); + regval &= ~LPUART_ALL_INTS; + regval |= priv->ie; + imxrt_serialout(priv, IMXRT_LPUART_CTRL_OFFSET, regval); + spin_unlock_irqrestore(NULL, flags); +} + +/**************************************************************************** + * Name: imxrt_rxavailable + * + * Description: + * Return true if the receive fifo is not empty + * + ****************************************************************************/ + +static bool imxrt_rxavailable(struct uart_dev_s *dev) +{ + struct imxrt_uart_s *priv = (struct imxrt_uart_s *)dev->priv; + uint32_t regval; + + /* Return true is data is ready in the Rx FIFO */ + + regval = imxrt_serialin(priv, IMXRT_LPUART_STAT_OFFSET); + return ((regval & LPUART_STAT_RDRF) != 0); +} + +/**************************************************************************** + * Name: imxrt_send + * + * Description: + * This method will send one byte on the UART + * + ****************************************************************************/ + +static void imxrt_send(struct uart_dev_s *dev, int ch) +{ + struct imxrt_uart_s *priv = (struct imxrt_uart_s *)dev->priv; + imxrt_serialout(priv, IMXRT_LPUART_DATA_OFFSET, (uint32_t)ch); +} + +/**************************************************************************** + * Name: imxrt_txint + * + * Description: + * Call to enable or disable TX interrupts + * + ****************************************************************************/ + +static void imxrt_txint(struct uart_dev_s *dev, bool enable) +{ + struct imxrt_uart_s *priv = (struct imxrt_uart_s *)dev->priv; + irqstate_t flags; + uint32_t regval; + + /* Enable interrupt for TX complete */ + + flags = spin_lock_irqsave(NULL); + if (enable) + { +#ifndef CONFIG_SUPPRESS_SERIAL_INTS + priv->ie |= LPUART_CTRL_TIE; +#endif + } + else + { + priv->ie &= ~LPUART_CTRL_TIE; + } + + regval = imxrt_serialin(priv, IMXRT_LPUART_CTRL_OFFSET); + regval &= ~LPUART_ALL_INTS; + regval |= priv->ie; + imxrt_serialout(priv, IMXRT_LPUART_CTRL_OFFSET, regval); + spin_unlock_irqrestore(NULL, flags); +} + +/**************************************************************************** + * Name: imxrt_txready + * + * Description: + * Return true if the transmit register is available to be written to + * + ****************************************************************************/ + +static bool imxrt_txready(struct uart_dev_s *dev) +{ + struct imxrt_uart_s *priv = (struct imxrt_uart_s *)dev->priv; + uint32_t regval; + + regval = imxrt_serialin(priv, IMXRT_LPUART_STAT_OFFSET); + return ((regval & LPUART_STAT_TDRE) != 0); +} + +/**************************************************************************** + * Name: imxrt_txempty + * + * Description: + * Return true if the transmission has completed and been sent to line. + * + ****************************************************************************/ + +static bool imxrt_txempty(struct uart_dev_s *dev) +{ + struct imxrt_uart_s *priv = (struct imxrt_uart_s *)dev->priv; + uint32_t regval; + + regval = imxrt_serialin(priv, IMXRT_LPUART_STAT_OFFSET); + return ((regval & LPUART_STAT_TC) != 0); +} + +/**************************************************************************** + * Name: up_pm_notify + * + * Description: + * Notify the driver of new power state. This callback is called after + * all drivers have had the opportunity to prepare for the new power state. + * + * Input Parameters: + * + * cb - Returned to the driver. The driver version of the callback + * structure may include additional, driver-specific state data at + * the end of the structure. + * + * pmstate - Identifies the new PM state + * + * Returned Value: + * None - The driver already agreed to transition to the low power + * consumption state when when it returned OK to the prepare() call. + * + ****************************************************************************/ + +#ifdef CONFIG_PM +static void up_pm_notify(struct pm_callback_s *cb, int domain, + enum pm_state_e pmstate) +{ + switch (pmstate) + { + case(PM_NORMAL): + { + /* Logic for PM_NORMAL goes here */ + } + break; + + case(PM_IDLE): + { + /* Logic for PM_IDLE goes here */ + } + break; + + case(PM_STANDBY): + { + /* Logic for PM_STANDBY goes here */ + } + break; + + case(PM_SLEEP): + { + /* Logic for PM_SLEEP goes here */ + } + break; + + default: + + /* Should not get here */ + + break; + } +} +#endif + +/**************************************************************************** + * Name: up_pm_prepare + * + * Description: + * Request the driver to prepare for a new power state. This is a warning + * that the system is about to enter into a new power state. The driver + * should begin whatever operations that may be required to enter power + * state. The driver may abort the state change mode by returning a + * non-zero value from the callback function. + * + * Input Parameters: + * + * cb - Returned to the driver. The driver version of the callback + * structure may include additional, driver-specific state data at + * the end of the structure. + * + * pmstate - Identifies the new PM state + * + * Returned Value: + * Zero - (OK) means the event was successfully processed and that the + * driver is prepared for the PM state change. + * + * Non-zero - means that the driver is not prepared to perform the tasks + * needed achieve this power setting and will cause the state + * change to be aborted. NOTE: The prepare() method will also + * be called when reverting from lower back to higher power + * consumption modes (say because another driver refused a + * lower power state change). Drivers are not permitted to + * return non-zero values when reverting back to higher power + * consumption modes! + * + * + ****************************************************************************/ + +#ifdef CONFIG_PM +static int up_pm_prepare(struct pm_callback_s *cb, int domain, + enum pm_state_e pmstate) +{ + /* Logic to prepare for a reduced power state goes here. */ + + return OK; +} +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: imxrt_earlyserialinit + * + * Description: + * Performs the low level UART initialization early in debug so that the + * serial console will be available during bootup. This must be called + * before arm_serialinit. + * + ****************************************************************************/ + +void imxrt_earlyserialinit(void) +{ + /* NOTE: This function assumes that low level hardware configuration + * -- including all clocking and pin configuration -- was performed by the + * function imxrt_lowsetup() earlier in the boot sequence. + */ + + /* Enable the console UART. The other UARTs will be initialized if and + * when they are first opened. + */ + +#ifdef CONSOLE_DEV + CONSOLE_DEV.isconsole = true; + imxrt_setup(&CONSOLE_DEV); +#endif +} + +/**************************************************************************** + * Name: arm_serialinit + * + * Description: + * Register serial console and serial ports. This assumes + * that imxrt_earlyserialinit was called previously. + * + ****************************************************************************/ + +void arm_serialinit(void) +{ +#ifdef CONFIG_PM + int ret; + + /* Register to receive power management callbacks */ + + ret = pm_register(&g_serial_pmcb); + DEBUGASSERT(ret == OK); + UNUSED(ret); +#endif + +#ifdef CONSOLE_DEV + uart_register("/dev/console", &CONSOLE_DEV); +#endif + + /* Register all UARTs */ + + uart_register("/dev/ttyS0", &TTYS0_DEV); +#ifdef TTYS1_DEV + uart_register("/dev/ttyS1", &TTYS1_DEV); +#endif +#ifdef TTYS2_DEV + uart_register("/dev/ttyS2", &TTYS2_DEV); +#endif +#ifdef TTYS3_DEV + uart_register("/dev/ttyS3", &TTYS3_DEV); +#endif +#ifdef TTYS4_DEV + uart_register("/dev/ttyS4", &TTYS4_DEV); +#endif +#ifdef TTYS5_DEV + uart_register("/dev/ttyS5", &TTYS5_DEV); +#endif +#ifdef TTYS6_DEV + uart_register("/dev/ttyS6", &TTYS6_DEV); +#endif +#ifdef TTYS7_DEV + uart_register("/dev/ttyS7", &TTYS7_DEV); +#endif +} + +/**************************************************************************** + * Name: up_putc + * + * Description: + * Provide priority, low-level access to support OS debug writes + * + ****************************************************************************/ + +int up_putc(int ch) +{ +#ifdef CONSOLE_DEV + struct imxrt_uart_s *priv = (struct imxrt_uart_s *)CONSOLE_DEV.priv; + uint32_t ie; + + imxrt_disableuartint(priv, &ie); + + /* Check for LF */ + + if (ch == '\n') + { + /* Add CR */ + + imxrt_lowputc('\r'); + } + + imxrt_lowputc(ch); + imxrt_restoreuartint(priv, ie); +#endif + + return ch; +} + +#else /* USE_SERIALDRIVER */ + +/**************************************************************************** + * Name: up_putc + * + * Description: + * Provide priority, low-level access to support OS debug writes + * + ****************************************************************************/ + +int up_putc(int ch) +{ +#if CONSOLE_LPUART > 0 + /* Check for LF */ + + if (ch == '\n') + { + /* Add CR */ + + arm_lowputc('\r'); + } + + arm_lowputc(ch); +#endif + + return ch; +} + +#endif /* USE_SERIALDRIVER */ From 958ad986be52740e26e78df9b9a8f12164a0278b Mon Sep 17 00:00:00 2001 From: wgzAIIT <820906721@qq.com> Date: Wed, 23 Mar 2022 14:34:13 +0800 Subject: [PATCH 15/18] Register the character device according to the selected serial port number --- .../nuttx/arch/arm/src/imxrt/imxrt_serial.c | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/Ubiquitous/Nuttx/app_match_nuttx/nuttx/arch/arm/src/imxrt/imxrt_serial.c b/Ubiquitous/Nuttx/app_match_nuttx/nuttx/arch/arm/src/imxrt/imxrt_serial.c index 2b9fc124d..426ddd023 100644 --- a/Ubiquitous/Nuttx/app_match_nuttx/nuttx/arch/arm/src/imxrt/imxrt_serial.c +++ b/Ubiquitous/Nuttx/app_match_nuttx/nuttx/arch/arm/src/imxrt/imxrt_serial.c @@ -1746,27 +1746,29 @@ void arm_serialinit(void) /* Register all UARTs */ - uart_register("/dev/ttyS0", &TTYS0_DEV); -#ifdef TTYS1_DEV - uart_register("/dev/ttyS1", &TTYS1_DEV); +#ifdef CONFIG_IMXRT_LPUART1 + uart_register("/dev/ttyS1", &g_uart1port); #endif -#ifdef TTYS2_DEV - uart_register("/dev/ttyS2", &TTYS2_DEV); +#ifdef CONFIG_IMXRT_LPUART2 + uart_register("/dev/ttyS2", &g_uart2port); #endif -#ifdef TTYS3_DEV - uart_register("/dev/ttyS3", &TTYS3_DEV); +#ifdef CONFIG_IMXRT_LPUART3 + uart_register("/dev/ttyS3", &g_uart3port); #endif -#ifdef TTYS4_DEV - uart_register("/dev/ttyS4", &TTYS4_DEV); +#ifdef CONFIG_IMXRT_LPUART4 + uart_register("/dev/ttyS4", &g_uart4port); #endif -#ifdef TTYS5_DEV - uart_register("/dev/ttyS5", &TTYS5_DEV); +#ifdef CONFIG_IMXRT_LPUART5 + uart_register("/dev/ttyS5", &g_uart5port); #endif -#ifdef TTYS6_DEV - uart_register("/dev/ttyS6", &TTYS6_DEV); +#ifdef CONFIG_IMXRT_LPUART6 + uart_register("/dev/ttyS6", &g_uart6port); #endif -#ifdef TTYS7_DEV - uart_register("/dev/ttyS7", &TTYS7_DEV); +#ifdef CONFIG_IMXRT_LPUART7 + uart_register("/dev/ttyS7", &g_uart7port); +#endif +#ifdef CONFIG_IMXRT_LPUART8 + uart_register("/dev/ttyS8", &g_uart8port); #endif } From f14523331c7b104fe2ec0ddcc07725b9b7eeb7d3 Mon Sep 17 00:00:00 2001 From: wgzAIIT <820906721@qq.com> Date: Wed, 23 Mar 2022 15:06:34 +0800 Subject: [PATCH 16/18] support mulan on nuttx --- Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/include/board.h | 9 +++++++++ .../aiit_board/imxrt1052-ok/kernel/imxrt_userspace.c | 9 +++++++++ .../Nuttx/aiit_board/imxrt1052-ok/src/imxrt1052-ok.h | 9 +++++++++ .../Nuttx/aiit_board/imxrt1052-ok/src/imxrt_appinit.c | 9 +++++++++ .../Nuttx/aiit_board/imxrt1052-ok/src/imxrt_autoleds.c | 9 +++++++++ .../Nuttx/aiit_board/imxrt1052-ok/src/imxrt_boot.c | 9 +++++++++ .../Nuttx/aiit_board/imxrt1052-ok/src/imxrt_bringup.c | 9 +++++++++ .../Nuttx/aiit_board/imxrt1052-ok/src/imxrt_buttons.c | 9 +++++++++ .../Nuttx/aiit_board/imxrt1052-ok/src/imxrt_ethernet.c | 9 +++++++++ .../aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_boot.c | 9 +++++++++ .../aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_boot.h | 9 +++++++++ .../imxrt1052-ok/src/imxrt_flexspi_nor_flash.c | 9 +++++++++ .../imxrt1052-ok/src/imxrt_flexspi_nor_flash.h | 9 +++++++++ .../Nuttx/aiit_board/imxrt1052-ok/src/imxrt_gpio.c | 9 +++++++++ Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_lcd.c | 9 +++++++++ .../Nuttx/aiit_board/imxrt1052-ok/src/imxrt_mmcsd_spi.c | 9 +++++++++ .../aiit_board/imxrt1052-ok/src/imxrt_sdram_ini_dcd.c | 9 +++++++++ Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_spi.c | 9 +++++++++ .../Nuttx/aiit_board/imxrt1052-ok/src/imxrt_userleds.c | 9 +++++++++ .../app_match_nuttx/nuttx/arch/arm/include/imxrt/chip.h | 9 +++++++++ .../nuttx/arch/arm/src/imxrt/imxrt_serial.c | 9 +++++++++ 21 files changed, 189 insertions(+) diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/include/board.h b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/include/board.h index 7c49fc26b..3d91a3643 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/include/board.h +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/include/board.h @@ -18,6 +18,15 @@ * ****************************************************************************/ +/** +* @file board.h +* @brief nuttx source code +* https://github.com/apache/incubator-nuttx.git +* @version 10.2.0 +* @author AIIT XUOS Lab +* @date 2022-03-23 +*/ + #ifndef __BOARDS_ARM_IMXRT_IMXRT1052_OK_INCLUDE_BOARD_H #define __BOARDS_ARM_IMXRT_IMXRT1052_OK_INCLUDE_BOARD_H diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/kernel/imxrt_userspace.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/kernel/imxrt_userspace.c index a30557c6a..cf85a5146 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/kernel/imxrt_userspace.c +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/kernel/imxrt_userspace.c @@ -22,6 +22,15 @@ * Included Files ****************************************************************************/ +/** +* @file imxrt_userspace.c +* @brief nuttx source code +* https://github.com/apache/incubator-nuttx.git +* @version 10.2.0 +* @author AIIT XUOS Lab +* @date 2022-03-23 +*/ + #include #include diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt1052-ok.h b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt1052-ok.h index 8407404e2..18bf513fa 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt1052-ok.h +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt1052-ok.h @@ -18,6 +18,15 @@ * ****************************************************************************/ +/** +* @file imxrt1052-ok.h +* @brief nuttx source code +* https://github.com/apache/incubator-nuttx.git +* @version 10.2.0 +* @author AIIT XUOS Lab +* @date 2022-03-23 +*/ + #ifndef __BOARDS_ARM_IMXRT_IMXRT1052_OK_SRC_IMXRT1052_OK_H #define __BOARDS_ARM_IMXRT_IMXRT1052_OK_SRC_IMXRT1052_OK_H diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_appinit.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_appinit.c index bdd387ae4..370d1325a 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_appinit.c +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_appinit.c @@ -18,6 +18,15 @@ * ****************************************************************************/ +/** +* @file imxrt_appinit.c +* @brief nuttx source code +* https://github.com/apache/incubator-nuttx.git +* @version 10.2.0 +* @author AIIT XUOS Lab +* @date 2022-03-23 +*/ + /**************************************************************************** * Included Files ****************************************************************************/ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_autoleds.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_autoleds.c index 0b18c711f..f42a25bef 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_autoleds.c +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_autoleds.c @@ -18,6 +18,15 @@ * ****************************************************************************/ +/** +* @file imxrt_autoleds.c +* @brief nuttx source code +* https://github.com/apache/incubator-nuttx.git +* @version 10.2.0 +* @author AIIT XUOS Lab +* @date 2022-03-23 +*/ + /* There are four LED status indicators located on the EVK Board. The * functions of these LEDs include: * diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_boot.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_boot.c index 813931cdf..487480207 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_boot.c +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_boot.c @@ -18,6 +18,15 @@ * ****************************************************************************/ +/** +* @file imxrt_boot.c +* @brief nuttx source code +* https://github.com/apache/incubator-nuttx.git +* @version 10.2.0 +* @author AIIT XUOS Lab +* @date 2022-03-23 +*/ + /**************************************************************************** * Included Files ****************************************************************************/ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_bringup.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_bringup.c index 85f05794d..8a915e29e 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_bringup.c +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_bringup.c @@ -18,6 +18,15 @@ * ****************************************************************************/ +/** +* @file imxrt_bringup.c +* @brief nuttx source code +* https://github.com/apache/incubator-nuttx.git +* @version 10.2.0 +* @author AIIT XUOS Lab +* @date 2022-03-23 +*/ + /**************************************************************************** * Included Files ****************************************************************************/ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_buttons.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_buttons.c index f6c3b2b30..b70436a9c 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_buttons.c +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_buttons.c @@ -18,6 +18,15 @@ * ****************************************************************************/ +/** +* @file imxrt_buttons.c +* @brief nuttx source code +* https://github.com/apache/incubator-nuttx.git +* @version 10.2.0 +* @author AIIT XUOS Lab +* @date 2022-03-23 +*/ + /**************************************************************************** * Included Files ****************************************************************************/ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_ethernet.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_ethernet.c index 958aa2414..7056ce93a 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_ethernet.c +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_ethernet.c @@ -18,6 +18,15 @@ * ****************************************************************************/ +/** +* @file imxrt_ethernet.c +* @brief nuttx source code +* https://github.com/apache/incubator-nuttx.git +* @version 10.2.0 +* @author AIIT XUOS Lab +* @date 2022-03-23 +*/ + /**************************************************************************** * Included Files ****************************************************************************/ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_boot.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_boot.c index b727cf579..db6ccf282 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_boot.c +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_boot.c @@ -18,6 +18,15 @@ * ****************************************************************************/ +/** +* @file imxrt_flexspi_nor_boot.c +* @brief nuttx source code +* https://github.com/apache/incubator-nuttx.git +* @version 10.2.0 +* @author AIIT XUOS Lab +* @date 2022-03-23 +*/ + /**************************************************************************** * Included Files ****************************************************************************/ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_boot.h b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_boot.h index 807ab9b82..bcd2b5d0e 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_boot.h +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_boot.h @@ -18,6 +18,15 @@ * ****************************************************************************/ +/** +* @file imxrt_flexspi_nor_boot.h +* @brief nuttx source code +* https://github.com/apache/incubator-nuttx.git +* @version 10.2.0 +* @author AIIT XUOS Lab +* @date 2022-03-23 +*/ + #ifndef __BOARDS_ARM_IMXRT_IMXRT1052_OK_SRC_IMXRT_FLEXSPI_NOR_BOOT_H #define __BOARDS_ARM_IMXRT_IMXRT1052_OK_SRC_IMXRT_FLEXSPI_NOR_BOOT_H diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_flash.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_flash.c index 0343860ab..0f6919425 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_flash.c +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_flash.c @@ -18,6 +18,15 @@ * ****************************************************************************/ +/** +* @file imxrt_flexspi_nor_flash.c +* @brief nuttx source code +* https://github.com/apache/incubator-nuttx.git +* @version 10.2.0 +* @author AIIT XUOS Lab +* @date 2022-03-23 +*/ + /**************************************************************************** * Included Files ****************************************************************************/ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_flash.h b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_flash.h index 087a7e3ca..c94af6ee2 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_flash.h +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_flash.h @@ -18,6 +18,15 @@ * ****************************************************************************/ +/** +* @file imxrt_flexspi_nor_flash.h +* @brief nuttx source code +* https://github.com/apache/incubator-nuttx.git +* @version 10.2.0 +* @author AIIT XUOS Lab +* @date 2022-03-23 +*/ + #ifndef __BOARDS_ARM_IMXRT_IMXRT1052_OK_SRC_IMXRT_FLEXSPI_NOR_FLASH_H #define __BOARDS_ARM_IMXRT_IMXRT1052_OK_SRC_IMXRT_FLEXSPI_NOR_FLASH_H diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_gpio.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_gpio.c index c904cd5aa..0b094844b 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_gpio.c +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_gpio.c @@ -18,6 +18,15 @@ * ****************************************************************************/ +/** +* @file imxrt_gpio.c +* @brief nuttx source code +* https://github.com/apache/incubator-nuttx.git +* @version 10.2.0 +* @author AIIT XUOS Lab +* @date 2022-03-23 +*/ + /**************************************************************************** * Included Files ****************************************************************************/ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_lcd.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_lcd.c index bec6d715c..157a08dce 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_lcd.c +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_lcd.c @@ -18,6 +18,15 @@ * ****************************************************************************/ +/** +* @file imxrt_lcd.c +* @brief nuttx source code +* https://github.com/apache/incubator-nuttx.git +* @version 10.2.0 +* @author AIIT XUOS Lab +* @date 2022-03-23 +*/ + /**************************************************************************** * Included Files ****************************************************************************/ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_mmcsd_spi.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_mmcsd_spi.c index 561a12283..40df26cf9 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_mmcsd_spi.c +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_mmcsd_spi.c @@ -18,6 +18,15 @@ * ****************************************************************************/ +/** +* @file imxrt_mmcsd_spi.c +* @brief nuttx source code +* https://github.com/apache/incubator-nuttx.git +* @version 10.2.0 +* @author AIIT XUOS Lab +* @date 2022-03-23 +*/ + /**************************************************************************** * Included Files ****************************************************************************/ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_sdram_ini_dcd.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_sdram_ini_dcd.c index 556930feb..33af9d163 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_sdram_ini_dcd.c +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_sdram_ini_dcd.c @@ -31,6 +31,15 @@ * POSSIBILITY OF SUCH DAMAGE. ****************************************************************************/ +/** +* @file imxrt_sdram_ini_dcd.c +* @brief nuttx source code +* https://github.com/apache/incubator-nuttx.git +* @version 10.2.0 +* @author AIIT XUOS Lab +* @date 2022-03-23 +*/ + /**************************************************************************** * Included Files ****************************************************************************/ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_spi.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_spi.c index bb4702c99..a2239bb2f 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_spi.c +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_spi.c @@ -18,6 +18,15 @@ * ****************************************************************************/ +/** +* @file imxrt_spi.c +* @brief nuttx source code +* https://github.com/apache/incubator-nuttx.git +* @version 10.2.0 +* @author AIIT XUOS Lab +* @date 2022-03-23 +*/ + /**************************************************************************** * Included Files ****************************************************************************/ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_userleds.c b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_userleds.c index d0e565c91..8213abedc 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_userleds.c +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_userleds.c @@ -18,6 +18,15 @@ * ****************************************************************************/ +/** +* @file imxrt_userleds.c +* @brief nuttx source code +* https://github.com/apache/incubator-nuttx.git +* @version 10.2.0 +* @author AIIT XUOS Lab +* @date 2022-03-23 +*/ + /* There are four LED status indicators located on the EVK Board. The * functions of these LEDs include: * diff --git a/Ubiquitous/Nuttx/app_match_nuttx/nuttx/arch/arm/include/imxrt/chip.h b/Ubiquitous/Nuttx/app_match_nuttx/nuttx/arch/arm/include/imxrt/chip.h index 73039331c..26a96acae 100644 --- a/Ubiquitous/Nuttx/app_match_nuttx/nuttx/arch/arm/include/imxrt/chip.h +++ b/Ubiquitous/Nuttx/app_match_nuttx/nuttx/arch/arm/include/imxrt/chip.h @@ -18,6 +18,15 @@ * ****************************************************************************/ +/** +* @file chip.h +* @brief nuttx source code +* https://github.com/apache/incubator-nuttx.git +* @version 10.2.0 +* @author AIIT XUOS Lab +* @date 2022-03-23 +*/ + #ifndef __ARCH_ARM_INCLUDE_IMXRT_CHIP_H #define __ARCH_ARM_INCLUDE_IMXRT_CHIP_H diff --git a/Ubiquitous/Nuttx/app_match_nuttx/nuttx/arch/arm/src/imxrt/imxrt_serial.c b/Ubiquitous/Nuttx/app_match_nuttx/nuttx/arch/arm/src/imxrt/imxrt_serial.c index 426ddd023..895084b09 100644 --- a/Ubiquitous/Nuttx/app_match_nuttx/nuttx/arch/arm/src/imxrt/imxrt_serial.c +++ b/Ubiquitous/Nuttx/app_match_nuttx/nuttx/arch/arm/src/imxrt/imxrt_serial.c @@ -18,6 +18,15 @@ * ****************************************************************************/ +/** +* @file imxrt_serial.c +* @brief nuttx source code +* https://github.com/apache/incubator-nuttx.git +* @version 10.2.0 +* @author AIIT XUOS Lab +* @date 2022-03-23 +*/ + /**************************************************************************** * Included Files ****************************************************************************/ From 76db961420d909c5a28059eef2091b99dab0b895 Mon Sep 17 00:00:00 2001 From: wgzAIIT <820906721@qq.com> Date: Thu, 24 Mar 2022 11:29:15 +0800 Subject: [PATCH 17/18] support sdio on imxrt1052-ok --- .../Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig | 1 + .../aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig | 1 + .../Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig | 1 + .../Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig | 1 + Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/include/board.h | 7 +++++++ 5 files changed, 11 insertions(+) diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig index 15a659983..94a65b6fb 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig @@ -37,6 +37,7 @@ CONFIG_NUTTX_USERSPACE=0x60200000 CONFIG_PASS1_BUILDIR="boards/arm/imxrt/imxrt1052-ok/kernel" CONFIG_RAM_SIZE=524288 CONFIG_RAM_START=0x20200000 +CONFIG_SCHED_HPWORK=y CONFIG_SCHED_WAITPID=y CONFIG_START_DAY=8 CONFIG_START_MONTH=6 diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig index aca6fb61d..c5edee4f4 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig @@ -37,6 +37,7 @@ CONFIG_NSH_READLINE=y CONFIG_RAM_SIZE=536870912 CONFIG_RAM_START=0x20200000 CONFIG_SCHED_CPULOAD=y +CONFIG_SCHED_HPWORK=y CONFIG_SCHED_WAITPID=y CONFIG_START_DAY=14 CONFIG_START_MONTH=3 diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig index 8cd6f8ecf..0d219ec93 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig @@ -57,6 +57,7 @@ CONFIG_NSH_READLINE=y CONFIG_RAM_SIZE=524288 CONFIG_RAM_START=0x20200000 CONFIG_SCHED_LPWORK=y +CONFIG_SCHED_HPWORK=y CONFIG_SCHED_WAITPID=y CONFIG_START_DAY=14 CONFIG_START_MONTH=3 diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig index 9b4920876..e263e52f7 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig @@ -35,6 +35,7 @@ CONFIG_NSH_LINELEN=64 CONFIG_NSH_READLINE=y CONFIG_RAM_SIZE=524288 CONFIG_RAM_START=0x20200000 +CONFIG_SCHED_HPWORK=y CONFIG_SCHED_WAITPID=y CONFIG_START_DAY=14 CONFIG_START_MONTH=3 diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/include/board.h b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/include/board.h index 3d91a3643..4064a2eda 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/include/board.h +++ b/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/include/board.h @@ -207,6 +207,13 @@ * sure shapes are square with minimal ringing. */ +#define GPIO_USDHC1_DATA0 GPIO_USDHC1_DATA0_1 /* GPIO_SD_B0_02 */ +#define GPIO_USDHC1_DATA1 GPIO_USDHC1_DATA1_1 /* GPIO_SD_B0_03 */ +#define GPIO_USDHC1_DATA2 GPIO_USDHC1_DATA2_1 /* GPIO_SD_B0_04 */ +#define GPIO_USDHC1_DATA3 GPIO_USDHC1_DATA3_1 /* GPIO_SD_B0_05 */ +#define GPIO_USDHC1_CLK GPIO_USDHC1_CLK_1 /* GPIO_SD_B0_01 */ +#define GPIO_USDHC1_CMD GPIO_USDHC1_CMD_1 /* GPIO_SD_B0_00 */ + #define PIN_USDHC1_D0 (GPIO_USDHC1_DATA0 | IOMUX_USDHC1_DATAX_DEFAULT) #define PIN_USDHC1_D1 (GPIO_USDHC1_DATA1 | IOMUX_USDHC1_DATAX_DEFAULT) #define PIN_USDHC1_D2 (GPIO_USDHC1_DATA2 | IOMUX_USDHC1_DATAX_DEFAULT) From 91594e0e879c60fe198c5c9de34d41d920331e89 Mon Sep 17 00:00:00 2001 From: wgzAIIT <820906721@qq.com> Date: Thu, 24 Mar 2022 15:59:34 +0800 Subject: [PATCH 18/18] imxrt1052-ok rename as xidatong --- .../aiit_board/{imxrt1052-ok => xidatong}/Kconfig | 10 +++++----- .../configs/knsh/Make.defs | 2 +- .../configs/knsh/defconfig | 6 +++--- .../configs/libcxxtest/Make.defs | 2 +- .../configs/libcxxtest/defconfig | 4 ++-- .../configs/netnsh/defconfig | 4 ++-- .../{imxrt1052-ok => xidatong}/configs/nsh/defconfig | 4 ++-- .../{imxrt1052-ok => xidatong}/include/board.h | 8 ++++---- .../{imxrt1052-ok => xidatong}/kernel/Makefile | 2 +- .../kernel/imxrt_userspace.c | 2 +- .../{imxrt1052-ok => xidatong}/scripts/Make.defs | 2 +- .../scripts/flash-ocram.ld | 2 +- .../scripts/kernel-space.ld | 2 +- .../{imxrt1052-ok => xidatong}/scripts/memory.ld | 2 +- .../{imxrt1052-ok => xidatong}/scripts/user-space.ld | 2 +- .../{imxrt1052-ok => xidatong}/src/Makefile | 4 ++-- .../{imxrt1052-ok => xidatong}/src/imxrt_appinit.c | 4 ++-- .../{imxrt1052-ok => xidatong}/src/imxrt_autoleds.c | 4 ++-- .../{imxrt1052-ok => xidatong}/src/imxrt_boot.c | 4 ++-- .../{imxrt1052-ok => xidatong}/src/imxrt_bringup.c | 4 ++-- .../{imxrt1052-ok => xidatong}/src/imxrt_buttons.c | 4 ++-- .../{imxrt1052-ok => xidatong}/src/imxrt_ethernet.c | 4 ++-- .../src/imxrt_flexspi_nor_boot.c | 2 +- .../src/imxrt_flexspi_nor_boot.h | 12 ++++++------ .../src/imxrt_flexspi_nor_flash.c | 6 +++--- .../src/imxrt_flexspi_nor_flash.h | 8 ++++---- .../{imxrt1052-ok => xidatong}/src/imxrt_gpio.c | 4 ++-- .../{imxrt1052-ok => xidatong}/src/imxrt_lcd.c | 4 ++-- .../{imxrt1052-ok => xidatong}/src/imxrt_mmcsd_spi.c | 2 +- .../src/imxrt_sdram_ini_dcd.c | 2 +- .../{imxrt1052-ok => xidatong}/src/imxrt_spi.c | 6 +++--- .../{imxrt1052-ok => xidatong}/src/imxrt_userleds.c | 4 ++-- .../src/imxrt1052-ok.h => xidatong/src/xidatong.h} | 10 +++++----- Ubiquitous/Nuttx/app_match_nuttx/build.sh | 2 +- .../Nuttx/app_match_nuttx/nuttx/boards/Kconfig | 12 ++++++------ 35 files changed, 78 insertions(+), 78 deletions(-) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/Kconfig (69%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/configs/knsh/Make.defs (98%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/configs/knsh/defconfig (90%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/configs/libcxxtest/Make.defs (98%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/configs/libcxxtest/defconfig (94%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/configs/netnsh/defconfig (96%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/configs/nsh/defconfig (94%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/include/board.h (98%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/kernel/Makefile (98%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/kernel/imxrt_userspace.c (98%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/scripts/Make.defs (98%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/scripts/flash-ocram.ld (98%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/scripts/kernel-space.ld (97%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/scripts/memory.ld (98%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/scripts/user-space.ld (98%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/src/Makefile (95%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/src/imxrt_appinit.c (97%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/src/imxrt_autoleds.c (98%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/src/imxrt_boot.c (97%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/src/imxrt_bringup.c (98%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/src/imxrt_buttons.c (98%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/src/imxrt_ethernet.c (99%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/src/imxrt_flexspi_nor_boot.c (97%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/src/imxrt_flexspi_nor_boot.h (92%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/src/imxrt_flexspi_nor_flash.c (97%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/src/imxrt_flexspi_nor_flash.h (97%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/src/imxrt_gpio.c (98%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/src/imxrt_lcd.c (97%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/src/imxrt_mmcsd_spi.c (98%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/src/imxrt_sdram_ini_dcd.c (99%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/src/imxrt_spi.c (97%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok => xidatong}/src/imxrt_userleds.c (97%) rename Ubiquitous/Nuttx/aiit_board/{imxrt1052-ok/src/imxrt1052-ok.h => xidatong/src/xidatong.h} (96%) diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/Kconfig b/Ubiquitous/Nuttx/aiit_board/xidatong/Kconfig similarity index 69% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/Kconfig rename to Ubiquitous/Nuttx/aiit_board/xidatong/Kconfig index c4fde44a1..9238d576f 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/Kconfig +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/Kconfig @@ -3,21 +3,21 @@ # see the file kconfig-language.txt in the NuttX tools repository. # -if ARCH_BOARD_IMXRT1052_OK +if ARCH_BOARD_XIDATONG choice prompt "Boot Flash" - default IMXRT1052_OK_HYPER_FLASH + default XIDATONG_HYPER_FLASH -config IMXRT1052_OK_HYPER_FLASH +config XIDATONG_HYPER_FLASH bool "HYPER Flash" -config IMXRT1052_OK_QSPI_FLASH +config XIDATONG_QSPI_FLASH bool "QSPI Flash" endchoice # Boot Flash -config IMXRT1052_OK_SDRAM +config XIDATONG_SDRAM bool "Enable SDRAM" default n select IMXRT_SEMC_INIT_DONE diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/Make.defs b/Ubiquitous/Nuttx/aiit_board/xidatong/configs/knsh/Make.defs similarity index 98% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/Make.defs rename to Ubiquitous/Nuttx/aiit_board/xidatong/configs/knsh/Make.defs index 9f16dfe9d..3b7371cf7 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/Make.defs +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/configs/knsh/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/arm/imxrt/imxrt1052-ok/configs/knsh/Make.defs +# boards/arm/imxrt/xidatong/configs/knsh/Make.defs # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig b/Ubiquitous/Nuttx/aiit_board/xidatong/configs/knsh/defconfig similarity index 90% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig rename to Ubiquitous/Nuttx/aiit_board/xidatong/configs/knsh/defconfig index 94a65b6fb..c09996397 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/knsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/configs/knsh/defconfig @@ -8,8 +8,8 @@ # CONFIG_ARCH_RAMFUNCS is not set CONFIG_ADD_NUTTX_FETURES=y CONFIG_ARCH="arm" -CONFIG_ARCH_BOARD="imxrt1052-ok" -CONFIG_ARCH_BOARD_IMXRT1052_OK=y +CONFIG_ARCH_BOARD="xidatong" +CONFIG_ARCH_BOARD_XIDATONG=y CONFIG_ARCH_CHIP="imxrt" CONFIG_ARCH_CHIP_IMXRT=y CONFIG_ARCH_CHIP_MIMXRT1052CVL5B=y @@ -34,7 +34,7 @@ CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_LINELEN=64 CONFIG_NSH_READLINE=y CONFIG_NUTTX_USERSPACE=0x60200000 -CONFIG_PASS1_BUILDIR="boards/arm/imxrt/imxrt1052-ok/kernel" +CONFIG_PASS1_BUILDIR="boards/arm/imxrt/xidatong/kernel" CONFIG_RAM_SIZE=524288 CONFIG_RAM_START=0x20200000 CONFIG_SCHED_HPWORK=y diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/Make.defs b/Ubiquitous/Nuttx/aiit_board/xidatong/configs/libcxxtest/Make.defs similarity index 98% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/Make.defs rename to Ubiquitous/Nuttx/aiit_board/xidatong/configs/libcxxtest/Make.defs index 6e1d1be1c..8d5a217a8 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/Make.defs +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/configs/libcxxtest/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/arm/imxrt/imxrt1052-ok/configs/libcxxtest/Make.defs +# boards/arm/imxrt/xidatong/configs/libcxxtest/Make.defs # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig b/Ubiquitous/Nuttx/aiit_board/xidatong/configs/libcxxtest/defconfig similarity index 94% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig rename to Ubiquitous/Nuttx/aiit_board/xidatong/configs/libcxxtest/defconfig index c5edee4f4..415026558 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/libcxxtest/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/configs/libcxxtest/defconfig @@ -7,8 +7,8 @@ # CONFIG_ADD_NUTTX_FETURES=y CONFIG_ARCH="arm" -CONFIG_ARCH_BOARD="imxrt1052-ok" -CONFIG_ARCH_BOARD_IMXRT1052_OK=y +CONFIG_ARCH_BOARD="xidatong" +CONFIG_ARCH_BOARD_XIDATONG=y CONFIG_ARCH_CHIP="imxrt" CONFIG_ARCH_CHIP_IMXRT=y CONFIG_ARCH_CHIP_MIMXRT1052CVL5B=y diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig b/Ubiquitous/Nuttx/aiit_board/xidatong/configs/netnsh/defconfig similarity index 96% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig rename to Ubiquitous/Nuttx/aiit_board/xidatong/configs/netnsh/defconfig index 0d219ec93..a20f54881 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/netnsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/configs/netnsh/defconfig @@ -8,8 +8,8 @@ # CONFIG_ARCH_LEDS is not set CONFIG_ADD_NUTTX_FETURES=y CONFIG_ARCH="arm" -CONFIG_ARCH_BOARD="imxrt1052-ok" -CONFIG_ARCH_BOARD_IMXRT1052_OK=y +CONFIG_ARCH_BOARD="xidatong" +CONFIG_ARCH_BOARD_XIDATONG=y CONFIG_ARCH_CHIP="imxrt" CONFIG_ARCH_CHIP_IMXRT=y CONFIG_ARCH_CHIP_MIMXRT1052CVL5B=y diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig b/Ubiquitous/Nuttx/aiit_board/xidatong/configs/nsh/defconfig similarity index 94% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig rename to Ubiquitous/Nuttx/aiit_board/xidatong/configs/nsh/defconfig index e263e52f7..7a393d08d 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/configs/nsh/defconfig +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/configs/nsh/defconfig @@ -7,8 +7,8 @@ # CONFIG_ADD_NUTTX_FETURES=y CONFIG_ARCH="arm" -CONFIG_ARCH_BOARD="imxrt1052-ok" -CONFIG_ARCH_BOARD_IMXRT1052_OK=y +CONFIG_ARCH_BOARD="xidatong" +CONFIG_ARCH_BOARD_XIDATONG=y CONFIG_ARCH_CHIP="imxrt" CONFIG_ARCH_CHIP_IMXRT=y CONFIG_ARCH_CHIP_MIMXRT1052CVL5B=y diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/include/board.h b/Ubiquitous/Nuttx/aiit_board/xidatong/include/board.h similarity index 98% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/include/board.h rename to Ubiquitous/Nuttx/aiit_board/xidatong/include/board.h index 4064a2eda..076157b7c 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/include/board.h +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/include/board.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/imxrt/imxrt1052-ok/include/board.h + * boards/arm/imxrt/xidatong/include/board.h * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -27,8 +27,8 @@ * @date 2022-03-23 */ -#ifndef __BOARDS_ARM_IMXRT_IMXRT1052_OK_INCLUDE_BOARD_H -#define __BOARDS_ARM_IMXRT_IMXRT1052_OK_INCLUDE_BOARD_H +#ifndef __BOARDS_ARM_IMXRT_XIDATONG_INCLUDE_BOARD_H +#define __BOARDS_ARM_IMXRT_XIDATONG_INCLUDE_BOARD_H /**************************************************************************** * Included Files @@ -364,4 +364,4 @@ extern "C" #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_ARM_IMXRT_IMXRT1052_OK_INCLUDE_BOARD_H */ +#endif /* __BOARDS_ARM_IMXRT_XIDATONG_INCLUDE_BOARD_H */ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/kernel/Makefile b/Ubiquitous/Nuttx/aiit_board/xidatong/kernel/Makefile similarity index 98% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/kernel/Makefile rename to Ubiquitous/Nuttx/aiit_board/xidatong/kernel/Makefile index 8315d342c..147b40f82 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/kernel/Makefile +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/kernel/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/arm/imxrt/imxrt1052-ok/kernel/Makefile +# boards/arm/imxrt/xidatong/kernel/Makefile # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/kernel/imxrt_userspace.c b/Ubiquitous/Nuttx/aiit_board/xidatong/kernel/imxrt_userspace.c similarity index 98% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/kernel/imxrt_userspace.c rename to Ubiquitous/Nuttx/aiit_board/xidatong/kernel/imxrt_userspace.c index cf85a5146..6735ddec2 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/kernel/imxrt_userspace.c +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/kernel/imxrt_userspace.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/imxrt/imxrt1052-ok/kernel/imxrt_userspace.c + * boards/arm/imxrt/xidatong/kernel/imxrt_userspace.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/Make.defs b/Ubiquitous/Nuttx/aiit_board/xidatong/scripts/Make.defs similarity index 98% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/Make.defs rename to Ubiquitous/Nuttx/aiit_board/xidatong/scripts/Make.defs index 431e865cd..c3fecc52d 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/Make.defs +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/arm/imxrt/imxrt1052-ok/scripts/Make.defs +# boards/arm/imxrt/xidatong/scripts/Make.defs # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/flash-ocram.ld b/Ubiquitous/Nuttx/aiit_board/xidatong/scripts/flash-ocram.ld similarity index 98% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/flash-ocram.ld rename to Ubiquitous/Nuttx/aiit_board/xidatong/scripts/flash-ocram.ld index 4cd8da676..fb625d802 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/flash-ocram.ld +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/scripts/flash-ocram.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/imxrt/imxrt1052-ok/scripts/flash-ocram.ld + * boards/arm/imxrt/xidatong/scripts/flash-ocram.ld * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/kernel-space.ld b/Ubiquitous/Nuttx/aiit_board/xidatong/scripts/kernel-space.ld similarity index 97% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/kernel-space.ld rename to Ubiquitous/Nuttx/aiit_board/xidatong/scripts/kernel-space.ld index b50660936..7ad3587d0 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/kernel-space.ld +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/scripts/kernel-space.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/imxrt/imxrt1052-ok/scripts/kernel-space.ld + * boards/arm/imxrt/xidatong/scripts/kernel-space.ld * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/memory.ld b/Ubiquitous/Nuttx/aiit_board/xidatong/scripts/memory.ld similarity index 98% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/memory.ld rename to Ubiquitous/Nuttx/aiit_board/xidatong/scripts/memory.ld index 6486acda5..fea61bc8d 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/memory.ld +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/scripts/memory.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/imxrt/imxrt1052-ok/scripts/memory.ld + * boards/arm/imxrt/xidatong/scripts/memory.ld * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/user-space.ld b/Ubiquitous/Nuttx/aiit_board/xidatong/scripts/user-space.ld similarity index 98% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/user-space.ld rename to Ubiquitous/Nuttx/aiit_board/xidatong/scripts/user-space.ld index 5eb3f32dd..ed09f8110 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/scripts/user-space.ld +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/scripts/user-space.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/imxrt/imxrt1052-ok/scripts/user-space.ld + * boards/arm/imxrt/xidatong/scripts/user-space.ld * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/Makefile b/Ubiquitous/Nuttx/aiit_board/xidatong/src/Makefile similarity index 95% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/Makefile rename to Ubiquitous/Nuttx/aiit_board/xidatong/src/Makefile index b3d3dcf44..06e625952 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/Makefile +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/arm/imxrt/imxrt1052-ok/src/Makefile +# boards/arm/imxrt/xidatong/src/Makefile # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -62,7 +62,7 @@ ifeq ($(CONFIG_DEV_GPIO),y) CSRCS += imxrt_gpio.c endif -ifeq ($(CONFIG_IMXRT1052_OK_SDRAM),y) +ifeq ($(CONFIG_XIDATONG_SDRAM),y) CSRCS += imxrt_sdram_ini_dcd.c endif diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_appinit.c b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_appinit.c similarity index 97% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_appinit.c rename to Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_appinit.c index 370d1325a..6070be4c9 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_appinit.c +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_appinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/imxrt/imxrt1052-ok/src/imxrt_appinit.c + * boards/arm/imxrt/xidatong/src/imxrt_appinit.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -37,7 +37,7 @@ #include -#include "imxrt1052-ok.h" +#include "xidatong.h" #ifdef CONFIG_BOARDCTL diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_autoleds.c b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_autoleds.c similarity index 98% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_autoleds.c rename to Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_autoleds.c index f42a25bef..56ce9daeb 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_autoleds.c +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_autoleds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/imxrt/imxrt1052-ok/src/imxrt_autoleds.c + * boards/arm/imxrt/xidatong/src/imxrt_autoleds.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -74,7 +74,7 @@ #include "imxrt_gpio.h" #include "imxrt_iomuxc.h" -#include "imxrt1052-ok.h" +#include "xidatong.h" #include diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_boot.c b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_boot.c similarity index 97% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_boot.c rename to Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_boot.c index 487480207..81d823f5d 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_boot.c +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_boot.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/imxrt/imxrt1052-ok/src/imxrt_boot.c + * boards/arm/imxrt/xidatong/src/imxrt_boot.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -37,7 +37,7 @@ #include #include "imxrt_start.h" -#include "imxrt1052-ok.h" +#include "xidatong.h" /**************************************************************************** * Public Functions diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_bringup.c b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_bringup.c similarity index 98% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_bringup.c rename to Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_bringup.c index 8a915e29e..eda38f3b0 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_bringup.c +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_bringup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/imxrt/imxrt1052-ok/src/imxrt_bringup.c + * boards/arm/imxrt/xidatong/src/imxrt_bringup.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -47,7 +47,7 @@ # include "imxrt_usdhc.h" #endif -#include "imxrt1052-ok.h" +#include "xidatong.h" #include /* Must always be included last */ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_buttons.c b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_buttons.c similarity index 98% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_buttons.c rename to Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_buttons.c index b70436a9c..b5283cb71 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_buttons.c +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_buttons.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/imxrt/imxrt1052-ok/src/imxrt_buttons.c + * boards/arm/imxrt/xidatong/src/imxrt_buttons.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -45,7 +45,7 @@ #include "imxrt_config.h" #include "imxrt_irq.h" #include "imxrt_gpio.h" -#include "imxrt1052-ok.h" +#include "xidatong.h" #ifdef CONFIG_ARCH_BUTTONS diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_ethernet.c b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_ethernet.c similarity index 99% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_ethernet.c rename to Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_ethernet.c index 7056ce93a..dafbc9e4b 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_ethernet.c +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_ethernet.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/imxrt/imxrt1052-ok/src/imxrt_ethernet.c + * boards/arm/imxrt/xidatong/src/imxrt_ethernet.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -54,7 +54,7 @@ #include "imxrt_gpio.h" #include "imxrt_enet.h" -#include "imxrt1052-ok.h" +#include "xidatong.h" #include diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_boot.c b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_flexspi_nor_boot.c similarity index 97% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_boot.c rename to Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_flexspi_nor_boot.c index db6ccf282..c2ce4e2b1 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_boot.c +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_flexspi_nor_boot.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/imxrt/imxrt1052-ok/src/imxrt_flexspi_nor_boot.c + * boards/arm/imxrt/xidatong/src/imxrt_flexspi_nor_boot.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_boot.h b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_flexspi_nor_boot.h similarity index 92% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_boot.h rename to Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_flexspi_nor_boot.h index bcd2b5d0e..33b86eb40 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_boot.h +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_flexspi_nor_boot.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/imxrt/imxrt1052-ok/src/imxrt_flexspi_nor_boot.h + * boards/arm/imxrt/xidatong/src/imxrt_flexspi_nor_boot.h * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -27,8 +27,8 @@ * @date 2022-03-23 */ -#ifndef __BOARDS_ARM_IMXRT_IMXRT1052_OK_SRC_IMXRT_FLEXSPI_NOR_BOOT_H -#define __BOARDS_ARM_IMXRT_IMXRT1052_OK_SRC_IMXRT_FLEXSPI_NOR_BOOT_H +#ifndef __BOARDS_ARM_IMXRT_XIDATONG_SRC_IMXRT_FLEXSPI_NOR_BOOT_H +#define __BOARDS_ARM_IMXRT_XIDATONG_SRC_IMXRT_FLEXSPI_NOR_BOOT_H /**************************************************************************** * Included Files @@ -71,7 +71,7 @@ #define FLASH_END 0x7f7fffff #define SCLK 1 -#ifdef CONFIG_IMXRT1052_OK_SDRAM +#ifdef CONFIG_XIDATONG_SDRAM # define DCD_ADDRESS &g_dcd_data #else # define DCD_ADDRESS 0 @@ -144,8 +144,8 @@ struct boot_data_s extern const struct boot_data_s g_boot_data; -#ifdef CONFIG_IMXRT1052_OK_SDRAM +#ifdef CONFIG_XIDATONG_SDRAM extern const uint8_t g_dcd_data[]; #endif -#endif /* __BOARDS_ARM_IMXRT_IMXRT1052_OK_SRC_IMXRT_FLEXSPI_NOR_BOOT_H */ +#endif /* __BOARDS_ARM_IMXRT_XIDATONG_SRC_IMXRT_FLEXSPI_NOR_BOOT_H */ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_flash.c b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_flexspi_nor_flash.c similarity index 97% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_flash.c rename to Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_flexspi_nor_flash.c index 0f6919425..5ca83cd80 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_flash.c +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_flexspi_nor_flash.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/imxrt/imxrt1052-ok/src/imxrt_flexspi_nor_flash.c + * boards/arm/imxrt/xidatong/src/imxrt_flexspi_nor_flash.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -37,7 +37,7 @@ * Public Data ****************************************************************************/ -#if defined (CONFIG_IMXRT1052_OK_HYPER_FLASH) +#if defined (CONFIG_XIDATONG_HYPER_FLASH) locate_data(".boot_hdr.conf") const struct flexspi_nor_config_s g_flash_config = { @@ -84,7 +84,7 @@ const struct flexspi_nor_config_s g_flash_config = .is_uniform_blocksize = 1, }; -#elif defined (CONFIG_IMXRT1052_OK_QSPI_FLASH) +#elif defined (CONFIG_XIDATONG_QSPI_FLASH) locate_data(".boot_hdr.conf") const struct flexspi_nor_config_s g_flash_config = { diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_flash.h b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_flexspi_nor_flash.h similarity index 97% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_flash.h rename to Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_flexspi_nor_flash.h index c94af6ee2..3ea7a74d2 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_flexspi_nor_flash.h +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_flexspi_nor_flash.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/imxrt/imxrt1052-ok/src/imxrt_flexspi_nor_flash.h + * boards/arm/imxrt/xidatong/src/imxrt_flexspi_nor_flash.h * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -27,8 +27,8 @@ * @date 2022-03-23 */ -#ifndef __BOARDS_ARM_IMXRT_IMXRT1052_OK_SRC_IMXRT_FLEXSPI_NOR_FLASH_H -#define __BOARDS_ARM_IMXRT_IMXRT1052_OK_SRC_IMXRT_FLEXSPI_NOR_FLASH_H +#ifndef __BOARDS_ARM_IMXRT_XIDATONG_SRC_IMXRT_FLEXSPI_NOR_FLASH_H +#define __BOARDS_ARM_IMXRT_XIDATONG_SRC_IMXRT_FLEXSPI_NOR_FLASH_H /**************************************************************************** * Included Files @@ -356,4 +356,4 @@ struct flexspi_nor_config_s uint32_t reserve2[11]; /* Reserved for future use */ }; -#endif /* __BOARDS_ARM_IMXRT_IMXRT1052_OK_SRC_IMXRT_FLEXSPI_NOR_FLASH_H */ +#endif /* __BOARDS_ARM_IMXRT_XIDATONG_SRC_IMXRT_FLEXSPI_NOR_FLASH_H */ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_gpio.c b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_gpio.c similarity index 98% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_gpio.c rename to Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_gpio.c index 0b094844b..c5909edd2 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_gpio.c +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_gpio.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/imxrt/imxrt1052-ok/src/imxrt_gpio.c + * boards/arm/imxrt/xidatong/src/imxrt_gpio.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -46,7 +46,7 @@ #include "chip.h" #include -#include "imxrt1052-ok.h" +#include "xidatong.h" #if defined(CONFIG_DEV_GPIO) && !defined(CONFIG_GPIO_LOWER_HALF) diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_lcd.c b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_lcd.c similarity index 97% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_lcd.c rename to Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_lcd.c index 157a08dce..8b8a6c7b4 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_lcd.c +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_lcd.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/imxrt/imxrt1052-ok/src/imxrt_lcd.c + * boards/arm/imxrt/xidatong/src/imxrt_lcd.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -39,7 +39,7 @@ #include "imxrt_lcd.h" #include "imxrt_gpio.h" -#include "imxrt1052-ok.h" +#include "xidatong.h" /**************************************************************************** * Public Functions diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_mmcsd_spi.c b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_mmcsd_spi.c similarity index 98% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_mmcsd_spi.c rename to Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_mmcsd_spi.c index 40df26cf9..1f495ec14 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_mmcsd_spi.c +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_mmcsd_spi.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/imxrt/imxrt1052-ok/src/imxrt_mmcsd_spi.c + * boards/arm/imxrt/xidatong/src/imxrt_mmcsd_spi.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_sdram_ini_dcd.c b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_sdram_ini_dcd.c similarity index 99% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_sdram_ini_dcd.c rename to Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_sdram_ini_dcd.c index 33af9d163..10ffd2da3 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_sdram_ini_dcd.c +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_sdram_ini_dcd.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/imxrt/imxrt1052-ok/src/imxrt_sdram_ini_dcd.c + * boards/arm/imxrt/xidatong/src/imxrt_sdram_ini_dcd.c * * Copyright (C) 2017, NXP Semiconductors, Inc. * diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_spi.c b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_spi.c similarity index 97% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_spi.c rename to Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_spi.c index a2239bb2f..673eaec0b 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_spi.c +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_spi.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/imxrt/imxrt1052-ok/src/imxrt_spi.c + * boards/arm/imxrt/xidatong/src/imxrt_spi.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -46,7 +46,7 @@ #include "imxrt_config.h" #include "imxrt_lpspi.h" #include "imxrt_gpio.h" -#include "imxrt1052-ok.h" +#include "xidatong.h" #if defined(CONFIG_IMXRT_LPSPI1) || defined(CONFIG_IMXRT_LPSPI2) || \ defined(CONFIG_IMXRT_LPSPI3) || defined(CONFIG_IMXRT_LPSPI4) @@ -59,7 +59,7 @@ * Name: imxrt_spidev_initialize * * Description: - * Called to configure SPI chip select GPIO pins for the imxrt1052-ok + * Called to configure SPI chip select GPIO pins for the xidatong * board. * ****************************************************************************/ diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_userleds.c b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_userleds.c similarity index 97% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_userleds.c rename to Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_userleds.c index 8213abedc..1b5c187c9 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt_userleds.c +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/src/imxrt_userleds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/imxrt/imxrt1052-ok/src/imxrt_userleds.c + * boards/arm/imxrt/xidatong/src/imxrt_userleds.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -49,7 +49,7 @@ #include "imxrt_gpio.h" #include "imxrt_iomuxc.h" -#include "imxrt1052-ok.h" +#include "xidatong.h" #include diff --git a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt1052-ok.h b/Ubiquitous/Nuttx/aiit_board/xidatong/src/xidatong.h similarity index 96% rename from Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt1052-ok.h rename to Ubiquitous/Nuttx/aiit_board/xidatong/src/xidatong.h index 18bf513fa..d8828d756 100644 --- a/Ubiquitous/Nuttx/aiit_board/imxrt1052-ok/src/imxrt1052-ok.h +++ b/Ubiquitous/Nuttx/aiit_board/xidatong/src/xidatong.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arm/imxrt/imxrt1052-ok/src/imxrt1052-ok.h + * boards/arm/imxrt/xidatong/src/xidatong.h * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -19,7 +19,7 @@ ****************************************************************************/ /** -* @file imxrt1052-ok.h +* @file xidatong.h * @brief nuttx source code * https://github.com/apache/incubator-nuttx.git * @version 10.2.0 @@ -27,8 +27,8 @@ * @date 2022-03-23 */ -#ifndef __BOARDS_ARM_IMXRT_IMXRT1052_OK_SRC_IMXRT1052_OK_H -#define __BOARDS_ARM_IMXRT_IMXRT1052_OK_SRC_IMXRT1052_OK_H +#ifndef __BOARDS_ARM_IMXRT_XIDATONG_SRC_XIDATONG_H +#define __BOARDS_ARM_IMXRT_XIDATONG_SRC_XIDATONG_H /**************************************************************************** * Included Files @@ -199,4 +199,4 @@ int imxrt_gpio_initialize(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_ARM_IMXRT_IMXRT1052_OK_SRC_IMXRT1052_OK_H */ +#endif /* __BOARDS_ARM_IMXRT_XIDATONG_SRC_XIDATONG_H */ diff --git a/Ubiquitous/Nuttx/app_match_nuttx/build.sh b/Ubiquitous/Nuttx/app_match_nuttx/build.sh index cb656dbdb..7b1c6a75d 100644 --- a/Ubiquitous/Nuttx/app_match_nuttx/build.sh +++ b/Ubiquitous/Nuttx/app_match_nuttx/build.sh @@ -18,6 +18,6 @@ cp -rf $current/nuttx $nuttx cp -rf $current/apps $nuttx cp -rf $nuttx/aiit_board/aiit-arm32-board $nuttx/nuttx/boards/arm/stm32 cp -rf $nuttx/aiit_board/aiit-riscv64-board $nuttx/nuttx/boards/risc-v/k210 -cp -rf $nuttx/aiit_board/imxrt1052-ok $nuttx/nuttx/boards/arm/imxrt +cp -rf $nuttx/aiit_board/xidatong $nuttx/nuttx/boards/arm/imxrt cd ../nuttx diff --git a/Ubiquitous/Nuttx/app_match_nuttx/nuttx/boards/Kconfig b/Ubiquitous/Nuttx/app_match_nuttx/nuttx/boards/Kconfig index fb486dc23..5311f8b96 100644 --- a/Ubiquitous/Nuttx/app_match_nuttx/nuttx/boards/Kconfig +++ b/Ubiquitous/Nuttx/app_match_nuttx/nuttx/boards/Kconfig @@ -445,15 +445,15 @@ config ARCH_BOARD_IMXRT1050_EVK This is the board configuration for the port of NuttX to the NXP i.MXRT evaluation kit, MIMXRT1050-EVKB. This board features the MIMXRT1052DVL6A MCU. -config ARCH_BOARD_IMXRT1052_OK - bool "NXP i.MX RT 1052 OK" +config ARCH_BOARD_XIDATONG + bool "NXP i.MX RT 1052 XIDATONG" depends on ARCH_CHIP_MIMXRT1052CVL5B select ARCH_HAVE_LEDS select ARCH_HAVE_BUTTONS select ARCH_HAVE_IRQBUTTONS ---help--- This is the board configuration for the port of NuttX to the NXP i.MXRT - evaluation kit, MIMXRT1052-OK. This board features the MIMXRT1052CVL5B MCU. + evaluation kit, MIMXRT1052-XIDATONG. This board features the MIMXRT1052CVL5B MCU. config ARCH_BOARD_IMXRT1060_EVK bool "NXP i.MX RT 1060 EVK" @@ -2392,7 +2392,7 @@ config ARCH_BOARD default "hymini-stm32v" if ARCH_BOARD_HYMINI_STM32V default "imxrt1020-evk" if ARCH_BOARD_IMXRT1020_EVK default "imxrt1050-evk" if ARCH_BOARD_IMXRT1050_EVK - default "imxrt1052-ok" if ARCH_BOARD_IMXRT1052_OK + default "xidatong" if ARCH_BOARD_XIDATONG default "imxrt1060-evk" if ARCH_BOARD_IMXRT1060_EVK default "imxrt1064-evk" if ARCH_BOARD_IMXRT1064_EVK default "kwikstik-k40" if ARCH_BOARD_KWIKSTIK_K40 @@ -2671,8 +2671,8 @@ endif if ARCH_BOARD_IMXRT1050_EVK source "boards/arm/imxrt/imxrt1050-evk/Kconfig" endif -if ARCH_BOARD_IMXRT1052_OK -source "boards/arm/imxrt/imxrt1052-ok/Kconfig" +if ARCH_BOARD_XIDATONG +source "boards/arm/imxrt/xidatong/Kconfig" endif if ARCH_BOARD_IMXRT1060_EVK source "boards/arm/imxrt/imxrt1060-evk/Kconfig"