This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 3f1417ef8d boards: add nrf9160-dk board support (nrf52840 chip)
3f1417ef8d is described below

commit 3f1417ef8d8acde4be83bd95cfefbdf538d100cd
Author: raiden00pl <[email protected]>
AuthorDate: Sat Sep 23 20:27:17 2023 +0200

    boards: add nrf9160-dk board support (nrf52840 chip)
---
 .../arm/nrf52/boards/nrf9160-dk-nrf52/index.rst    |  18 ++++
 .../arm/nrf91/boards/nrf9160-dk/index.rst          |   8 +-
 boards/Kconfig                                     |   7 ++
 boards/arm/nrf52/nrf9160-dk-nrf52/CMakeLists.txt   |  21 ++++
 boards/arm/nrf52/nrf9160-dk-nrf52/Kconfig          |   8 ++
 .../nrf52/nrf9160-dk-nrf52/configs/nsh/defconfig   |  38 ++++++++
 boards/arm/nrf52/nrf9160-dk-nrf52/include/board.h  |  56 +++++++++++
 .../arm/nrf52/nrf9160-dk-nrf52/scripts/Make.defs   |  39 ++++++++
 .../nrf52/nrf9160-dk-nrf52/scripts/flash_config.ld | 107 +++++++++++++++++++++
 .../arm/nrf52/nrf9160-dk-nrf52/src/CMakeLists.txt  |  35 +++++++
 boards/arm/nrf52/nrf9160-dk-nrf52/src/Make.defs    |  31 ++++++
 .../arm/nrf52/nrf9160-dk-nrf52/src/nrf52_appinit.c |  74 ++++++++++++++
 boards/arm/nrf52/nrf9160-dk-nrf52/src/nrf52_boot.c |  79 +++++++++++++++
 .../arm/nrf52/nrf9160-dk-nrf52/src/nrf52_bringup.c |  54 +++++++++++
 .../nrf52/nrf9160-dk-nrf52/src/nrf9160-dk-nrf52.h  |  68 +++++++++++++
 boards/arm/nrf91/nrf9160-dk/include/board.h        |   4 +-
 16 files changed, 641 insertions(+), 6 deletions(-)

diff --git 
a/Documentation/platforms/arm/nrf52/boards/nrf9160-dk-nrf52/index.rst 
b/Documentation/platforms/arm/nrf52/boards/nrf9160-dk-nrf52/index.rst
new file mode 100644
index 0000000000..ccdf7e9efa
--- /dev/null
+++ b/Documentation/platforms/arm/nrf52/boards/nrf9160-dk-nrf52/index.rst
@@ -0,0 +1,18 @@
+============================
+Nordic nRF9160 DK (nRF52840)
+============================
+
+The `nRF9160-DK (PCA10090) 
<https://www.nordicsemi.com/Products/Development-hardware/nrf9160-dk>`_
+is a development board based on the nRF9160 and nRF52840 from Nordic.
+
+Serial Console
+==============
+
+UART0 is connected to the virtual COM port (VCON1):
+
+========  =====
+Signal    PIN
+========  =====
+UART0-RX  P0.03
+UART0-TX  P0.05
+========  =====
diff --git a/Documentation/platforms/arm/nrf91/boards/nrf9160-dk/index.rst 
b/Documentation/platforms/arm/nrf91/boards/nrf9160-dk/index.rst
index dc32ad5a10..89ec423ffa 100644
--- a/Documentation/platforms/arm/nrf91/boards/nrf9160-dk/index.rst
+++ b/Documentation/platforms/arm/nrf91/boards/nrf9160-dk/index.rst
@@ -1,9 +1,9 @@
-=================
-Nordic nRF9160 DK
-=================
+===========================
+Nordic nRF9160 DK (nRF9160)
+===========================
 
 The `nRF9160-DK (PCA10090) 
<https://www.nordicsemi.com/Products/Development-hardware/nrf9160-dk>`_
-is a development board based on the nRF9160 from Nordic.
+is a development board based on the nRF9160 and nRF52840 from Nordic.
 
 Serial Console
 ==============
diff --git a/boards/Kconfig b/boards/Kconfig
index ed16287614..b70fef6e35 100644
--- a/boards/Kconfig
+++ b/boards/Kconfig
@@ -1204,6 +1204,12 @@ config ARCH_BOARD_THINGY91_NRF52
        ---help---
                This option selects the Thingy:91 cellular IoT prototyping 
platform - nRF52840 chip
 
+config ARCH_BOARD_NRF9160_DK_NRF52
+       bool "Nordic nRF9160 Development Kit (PCA10090) - nRF52840"
+       depends on ARCH_CHIP_NRF52
+       ---help---
+               This option selects the nRF9160 Development Kit (PCA10090) - 
nRF52840 chip
+
 config ARCH_BOARD_NUTINY_NUC120
        bool "Nuvoton NuTiny NUC120"
        depends on ARCH_CHIP_NUC120LE3AN
@@ -3109,6 +3115,7 @@ config ARCH_BOARD
        default "nrf9160-dk"                if ARCH_BOARD_NRF9160_DK
        default "thingy91"                  if ARCH_BOARD_THINGY91
        default "thingy91-nrf52"            if ARCH_BOARD_THINGY91_NRF52
+       default "nrf9160-dk-nrf52"          if ARCH_BOARD_NRF9160_DK_NRF52
        default "ntosd-dm320"               if ARCH_BOARD_NTOSD_DM320
        default "nucleo-144"                if ARCH_BOARD_NUCLEO_144
        default "nucleo-f072rb"             if ARCH_BOARD_NUCLEO_F072RB
diff --git a/boards/arm/nrf52/nrf9160-dk-nrf52/CMakeLists.txt 
b/boards/arm/nrf52/nrf9160-dk-nrf52/CMakeLists.txt
new file mode 100644
index 0000000000..3846f4fe6f
--- /dev/null
+++ b/boards/arm/nrf52/nrf9160-dk-nrf52/CMakeLists.txt
@@ -0,0 +1,21 @@
+# 
##############################################################################
+# boards/arm/nrf52/nrf9160-dk-nrf52/CMakeLists.txt
+#
+# 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.
+#
+# 
##############################################################################
+
+add_subdirectory(src)
diff --git a/boards/arm/nrf52/nrf9160-dk-nrf52/Kconfig 
b/boards/arm/nrf52/nrf9160-dk-nrf52/Kconfig
new file mode 100644
index 0000000000..eaafaa7c73
--- /dev/null
+++ b/boards/arm/nrf52/nrf9160-dk-nrf52/Kconfig
@@ -0,0 +1,8 @@
+#
+# For a description of the syntax of this configuration file,
+# see the file kconfig-language.txt in the NuttX tools repository.
+#
+
+if ARCH_BOARD_NRF9160_DK_NRF52
+
+endif
diff --git a/boards/arm/nrf52/nrf9160-dk-nrf52/configs/nsh/defconfig 
b/boards/arm/nrf52/nrf9160-dk-nrf52/configs/nsh/defconfig
new file mode 100644
index 0000000000..190f5ed3c9
--- /dev/null
+++ b/boards/arm/nrf52/nrf9160-dk-nrf52/configs/nsh/defconfig
@@ -0,0 +1,38 @@
+#
+# 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_FPU is not set
+# CONFIG_NSH_DISABLE_IFCONFIG is not set
+# CONFIG_NSH_DISABLE_PS is not set
+CONFIG_ARCH="arm"
+CONFIG_ARCH_BOARD="nrf9160-dk-nrf52"
+CONFIG_ARCH_BOARD_NRF9160_DK_NRF52=y
+CONFIG_ARCH_CHIP="nrf52"
+CONFIG_ARCH_CHIP_NRF52840=y
+CONFIG_ARCH_CHIP_NRF52=y
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_STDARG_H=y
+CONFIG_BOARD_LOOPSPERMSEC=5500
+CONFIG_INIT_ENTRYPOINT="nsh_main"
+CONFIG_MM_REGIONS=2
+CONFIG_NRF52_UART0=y
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_LINELEN=64
+CONFIG_NSH_READLINE=y
+CONFIG_PREALLOC_TIMERS=4
+CONFIG_RAM_SIZE=65535
+CONFIG_RAM_START=0x20000000
+CONFIG_RAW_BINARY=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_WAITPID=y
+CONFIG_START_DAY=26
+CONFIG_START_MONTH=3
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+CONFIG_SYSTEM_NSH=y
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_UART0_SERIAL_CONSOLE=y
diff --git a/boards/arm/nrf52/nrf9160-dk-nrf52/include/board.h 
b/boards/arm/nrf52/nrf9160-dk-nrf52/include/board.h
new file mode 100644
index 0000000000..e8bc5620c8
--- /dev/null
+++ b/boards/arm/nrf52/nrf9160-dk-nrf52/include/board.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+ * boards/arm/nrf52/nrf9160-dk-nrf52/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_NRF52_NRF9160_DK_NRF52_INCLUDE_BOARD_H
+#define __BOARDS_ARM_NRF52_NRF9160_DK_NRF52_INCLUDE_BOARD_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Clocking *****************************************************************/
+
+#define BOARD_SYSTICK_CLOCK         (64000000)
+
+/* LED definitions **********************************************************/
+
+#define BOARD_NLEDS       0
+
+/* Button definitions *******************************************************/
+
+#define NUM_BUTTONS       0
+
+/* UART Pins ****************************************************************/
+
+/* UART0 is connected to the virtual COM1 port:
+ *   UART0_RX - P0-03
+ *   UART0_TX - P0-05
+ */
+
+#define BOARD_UART0_RX_PIN  (GPIO_INPUT  | GPIO_PORT0 | GPIO_PIN(3))
+#define BOARD_UART0_TX_PIN  (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | 
GPIO_PIN(5))
+
+#endif /* __BOARDS_ARM_NRF52_NRF9160_DK_NRF52_INCLUDE_BOARD_H */
diff --git a/boards/arm/nrf52/nrf9160-dk-nrf52/scripts/Make.defs 
b/boards/arm/nrf52/nrf9160-dk-nrf52/scripts/Make.defs
new file mode 100644
index 0000000000..7f9091ca74
--- /dev/null
+++ b/boards/arm/nrf52/nrf9160-dk-nrf52/scripts/Make.defs
@@ -0,0 +1,39 @@
+############################################################################
+# boards/arm/nrf52/nrf9160-dk-nrf52/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
+
+LDSCRIPT = flash_config.ld
+ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)
+
+ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
+
+CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) 
$(ARCHDEFINES) $(EXTRAFLAGS) -pipe
+CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
+CXXFLAGS := $(ARCHCXXFLAGS) $(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
diff --git a/boards/arm/nrf52/nrf9160-dk-nrf52/scripts/flash_config.ld 
b/boards/arm/nrf52/nrf9160-dk-nrf52/scripts/flash_config.ld
new file mode 100644
index 0000000000..569179f2da
--- /dev/null
+++ b/boards/arm/nrf52/nrf9160-dk-nrf52/scripts/flash_config.ld
@@ -0,0 +1,107 @@
+/****************************************************************************
+ * boards/arm/nrf52/nrf9160-dk-nrf52/scripts/flash_config.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.
+ *
+ ****************************************************************************/
+
+MEMORY
+{
+    progmem (rx)  : ORIGIN = 0x00000000, LENGTH = 1024K
+    datamem (rwx) : ORIGIN = 0x20000000, LENGTH = 256K
+}
+
+OUTPUT_ARCH(arm)
+ENTRY(__start)         /* Treat __start as the anchor for dead code stripping 
*/
+EXTERN(_vectors)       /* Force the vectors to be included in the output */
+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(.);
+    } > progmem
+
+    .init_section :
+    {
+        _sinit = ABSOLUTE(.);
+        KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*) 
SORT_BY_INIT_PRIORITY(.ctors.*)))
+        KEEP(*(.init_array .ctors))
+        _einit = ABSOLUTE(.);
+    } > progmem
+
+    .ARM.extab :
+    {
+        *(.ARM.extab*)
+    } > progmem
+
+    __exidx_start = ABSOLUTE(.);
+    .ARM.exidx :
+    {
+        *(.ARM.exidx*)
+    } > progmem
+    __exidx_end = ABSOLUTE(.);
+
+    _eronly = ABSOLUTE(.);
+
+    .data :
+    {
+        _sdata = ABSOLUTE(.);
+        *(.data .data.*)
+        *(.gnu.linkonce.d.*)
+        CONSTRUCTORS
+        . = ALIGN(4);
+        _edata = ABSOLUTE(.);
+    } > datamem AT > progmem
+
+    /* BSS */
+
+    .bss :
+    {
+        _sbss = ABSOLUTE(.);
+        *(.bss .bss.*)
+        *(.gnu.linkonce.b.*)
+        *(COMMON)
+        . = ALIGN(4);
+        _ebss = ABSOLUTE(.);
+    } > datamem
+
+    /* 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/boards/arm/nrf52/nrf9160-dk-nrf52/src/CMakeLists.txt 
b/boards/arm/nrf52/nrf9160-dk-nrf52/src/CMakeLists.txt
new file mode 100644
index 0000000000..ff37ce9aba
--- /dev/null
+++ b/boards/arm/nrf52/nrf9160-dk-nrf52/src/CMakeLists.txt
@@ -0,0 +1,35 @@
+# 
##############################################################################
+# boards/arm/nrf52/nrf9160-dk-nrf52/src/CMakeLists.txt
+#
+# 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.
+#
+# 
##############################################################################
+
+set(SRCS nrf52_boot.c nrf52_bringup.c)
+
+if(CONFIG_BOARDCTL)
+  list(APPEND SRCS nrf52_appinit.c)
+endif()
+
+target_sources(board PRIVATE ${SRCS})
+
+if(CONFIG_ARCH_BOARD_COMMON)
+  set_property(GLOBAL PROPERTY LD_SCRIPT
+                               "${NUTTX_COMMON_DIR}/scripts/flash_config.ld")
+else()
+  set_property(GLOBAL PROPERTY LD_SCRIPT
+                               "${NUTTX_BOARD_DIR}/scripts/flash_config.ld")
+endif()
diff --git a/boards/arm/nrf52/nrf9160-dk-nrf52/src/Make.defs 
b/boards/arm/nrf52/nrf9160-dk-nrf52/src/Make.defs
new file mode 100644
index 0000000000..96f1fac5c1
--- /dev/null
+++ b/boards/arm/nrf52/nrf9160-dk-nrf52/src/Make.defs
@@ -0,0 +1,31 @@
+############################################################################
+# boards/arm/nrf52/nrf9160-dk-nrf52/src/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)/Make.defs
+
+CSRCS = nrf52_boot.c nrf52_bringup.c
+
+ifeq ($(CONFIG_BOARDCTL),y)
+CSRCS += nrf52_appinit.c
+endif
+
+DEPPATH += --dep-path board
+VPATH += :board
+CFLAGS += 
${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board
diff --git a/boards/arm/nrf52/nrf9160-dk-nrf52/src/nrf52_appinit.c 
b/boards/arm/nrf52/nrf9160-dk-nrf52/src/nrf52_appinit.c
new file mode 100644
index 0000000000..6a06de7a72
--- /dev/null
+++ b/boards/arm/nrf52/nrf9160-dk-nrf52/src/nrf52_appinit.c
@@ -0,0 +1,74 @@
+/****************************************************************************
+ * boards/arm/nrf52/nrf9160-dk-nrf52/src/nrf52_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 <nuttx/config.h>
+
+#include <stdio.h>
+#include <debug.h>
+#include <errno.h>
+
+#include <nuttx/board.h>
+
+#include "chip.h"
+#include "nrf9160-dk-nrf52.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: board_app_initialize
+ *
+ * Description:
+ *   Perform architecture specific initialization
+ *
+ * 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)
+{
+#ifdef CONFIG_BOARD_LATE_INITIALIZE
+  /* Board initialization already performed by board_late_initialize() */
+
+  return OK;
+#else
+  /* Perform board-specific initialization */
+
+  return nrf52_bringup();
+#endif
+}
diff --git a/boards/arm/nrf52/nrf9160-dk-nrf52/src/nrf52_boot.c 
b/boards/arm/nrf52/nrf9160-dk-nrf52/src/nrf52_boot.c
new file mode 100644
index 0000000000..33c48b1a40
--- /dev/null
+++ b/boards/arm/nrf52/nrf9160-dk-nrf52/src/nrf52_boot.c
@@ -0,0 +1,79 @@
+/****************************************************************************
+ * boards/arm/nrf52/nrf9160-dk-nrf52/src/nrf52_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 <nuttx/config.h>
+
+#include <debug.h>
+
+#include <nuttx/board.h>
+#include <arch/board/board.h>
+
+#include "arm_internal.h"
+#include "nrf9160-dk-nrf52.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nrf52_board_initialize
+ *
+ * Description:
+ *   All NRF52xxx architectures must provide the following entry point.
+ *   This entry point is called early in the initialization -- after all
+ *   memory has been configured and mapped but before any devices have been
+ *   initialized.
+ *
+ ****************************************************************************/
+
+void nrf52_board_initialize(void)
+{
+  /* Configure on-board LEDs if LED support has been selected. */
+
+#ifdef CONFIG_ARCH_LEDS
+  board_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_initialize() 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-specific initialization */
+
+  nrf52_bringup();
+}
+#endif
diff --git a/boards/arm/nrf52/nrf9160-dk-nrf52/src/nrf52_bringup.c 
b/boards/arm/nrf52/nrf9160-dk-nrf52/src/nrf52_bringup.c
new file mode 100644
index 0000000000..d5bb51e644
--- /dev/null
+++ b/boards/arm/nrf52/nrf9160-dk-nrf52/src/nrf52_bringup.c
@@ -0,0 +1,54 @@
+/****************************************************************************
+ * boards/arm/nrf52/nrf9160-dk-nrf52/src/nrf52_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 <nuttx/config.h>
+
+#include <sys/types.h>
+#include <syslog.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nrf52_bringup
+ *
+ * Description:
+ *   Perform architecture-specific initialization
+ *
+ *   CONFIG_BOARD_LATE_INITIALIZE=y :
+ *     Called from board_late_initialize().
+ *
+ *   CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y :
+ *     Called from the NSH library
+ *
+ ****************************************************************************/
+
+int nrf52_bringup(void)
+{
+  int ret;
+
+  UNUSED(ret);
+  return OK;
+}
diff --git a/boards/arm/nrf52/nrf9160-dk-nrf52/src/nrf9160-dk-nrf52.h 
b/boards/arm/nrf52/nrf9160-dk-nrf52/src/nrf9160-dk-nrf52.h
new file mode 100644
index 0000000000..82fe34c862
--- /dev/null
+++ b/boards/arm/nrf52/nrf9160-dk-nrf52/src/nrf9160-dk-nrf52.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+ * boards/arm/nrf52/nrf9160-dk-nrf52/src/nrf9160-dk-nrf52.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_NRF52_NRF9160_DK_NRF52_SRC_NRF9160_DK_NRF52_H
+#define __BOARDS_ARM_NRF52_NRF9160_DK_NRF52_SRC_NRF9160_DK_NRF52_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+
+#include "nrf52_gpio.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Public Functions Prototypes
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nrf52_bringup
+ *
+ * Description:
+ *   Perform architecture-specific initialization
+ *
+ *   CONFIG_BOARD_LATE_INITIALIZE=y :
+ *     Called from board_late_initialize().
+ *
+ *   CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_BOARDCTL=y :
+ *     Called from the NSH library
+ *
+ ****************************************************************************/
+
+int nrf52_bringup(void);
+
+#endif /* __ASSEMBLY__ */
+#endif /* __BOARDS_ARM_NRF52_NRF9160_DK_NRF52_SRC_NRF9160_DK_NRF52_H */
diff --git a/boards/arm/nrf91/nrf9160-dk/include/board.h 
b/boards/arm/nrf91/nrf9160-dk/include/board.h
index 63a8901e81..312dac7b8f 100644
--- a/boards/arm/nrf91/nrf9160-dk/include/board.h
+++ b/boards/arm/nrf91/nrf9160-dk/include/board.h
@@ -95,7 +95,7 @@
 
 /* UART Pins ****************************************************************/
 
-/* UART0 is connected to the virtual COM port:
+/* UART0 is connected to the virtual COM0 port:
  *   UART0_RX - P0-28
  *   UART0_TX - P0-29
  */
@@ -103,7 +103,7 @@
 #define BOARD_UART0_RX_PIN  (GPIO_INPUT  | GPIO_PORT0 | GPIO_PIN(28))
 #define BOARD_UART0_TX_PIN  (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | 
GPIO_PIN(29))
 
-/* UART1 is connected to the virtual COM port:
+/* UART1 is connected to the virtual COM2 port:
  *   UART1_RX - P0-00
  *   UART1_TX - P0-01
  */

Reply via email to