boards: initial support for nrf9160-dk
This commit is contained in:
parent
56961d9f34
commit
3d9a64ce27
@ -1137,6 +1137,15 @@ config ARCH_BOARD_THINGY53
|
||||
---help---
|
||||
This option selects the Thingy:53 multi-protocol IoT prototyping platform
|
||||
|
||||
config ARCH_BOARD_NRF9160_DK
|
||||
bool "Nordic nRF9160 Development Kit (PCA10090)"
|
||||
depends on ARCH_CHIP_NRF91
|
||||
select ARCH_HAVE_LEDS
|
||||
select ARCH_HAVE_BUTTONS
|
||||
select ARCH_HAVE_IRQBUTTONS
|
||||
---help---
|
||||
This option selects the nRF9160 Development Kit (PCA10090)
|
||||
|
||||
config ARCH_BOARD_NUTINY_NUC120
|
||||
bool "Nuvoton NuTiny NUC120"
|
||||
depends on ARCH_CHIP_NUC120LE3AN
|
||||
@ -2953,6 +2962,7 @@ config ARCH_BOARD
|
||||
default "nrf5340-dk" if ARCH_BOARD_NRF5340_DK
|
||||
default "nrf5340-audio-dk" if ARCH_BOARD_NRF5340_AUDIO_DK
|
||||
default "thingy53" if ARCH_BOARD_THINGY53
|
||||
default "nrf9160-dk" if ARCH_BOARD_NRF9160_DK
|
||||
default "ntosd-dm320" if ARCH_BOARD_NTOSD_DM320
|
||||
default "nucleo-144" if ARCH_BOARD_NUCLEO_144
|
||||
default "nucleo-f072rb" if ARCH_BOARD_NUCLEO_F072RB
|
||||
@ -4046,6 +4056,9 @@ endif
|
||||
if ARCH_CHIP_NRF53
|
||||
source "boards/arm/nrf53/common/Kconfig"
|
||||
endif
|
||||
if ARCH_CHIP_NRF91
|
||||
source "boards/arm/nrf91/common/Kconfig"
|
||||
endif
|
||||
endif
|
||||
|
||||
config BOARD_CRASHDUMP
|
||||
|
4
boards/arm/nrf91/common/Kconfig
Normal file
4
boards/arm/nrf91/common/Kconfig
Normal file
@ -0,0 +1,4 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
33
boards/arm/nrf91/common/Makefile
Normal file
33
boards/arm/nrf91/common/Makefile
Normal file
@ -0,0 +1,33 @@
|
||||
#############################################################################
|
||||
# boards/arm/nrf91/common/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
|
||||
|
||||
include board/Make.defs
|
||||
include src/Make.defs
|
||||
|
||||
DEPPATH += --dep-path board
|
||||
DEPPATH += --dep-path src
|
||||
|
||||
include $(TOPDIR)/boards/Board.mk
|
||||
|
||||
ARCHSRCDIR = $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src
|
||||
BOARDDIR = $(ARCHSRCDIR)$(DELIM)board
|
||||
CFLAGS += ${INCDIR_PREFIX}$(BOARDDIR)$(DELIM)include
|
55
boards/arm/nrf91/common/include/nrf91_timer.h
Normal file
55
boards/arm/nrf91/common/include/nrf91_timer.h
Normal file
@ -0,0 +1,55 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/nrf91/common/include/nrf91_timer.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_NRF91_COMMON_INCLUDE_NRF91_TIMER_H
|
||||
#define __BOARDS_ARM_NRF91_COMMON_INCLUDE_NRF91_TIMER_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <nuttx/timers/timer.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nrf91_timer_driver_setup
|
||||
*
|
||||
* Description:
|
||||
* Configure the timer driver.
|
||||
*
|
||||
* Input Parameters:
|
||||
* devpath - The full path to the timer device. This should be of the
|
||||
* form /dev/timer0
|
||||
* timer - The timer's number.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; A negated errno value is returned
|
||||
* to indicate the nature of any failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int nrf91_timer_driver_setup(const char *devpath, int timer);
|
||||
|
||||
#endif /* __BOARDS_ARM_NRF91_COMMON_INCLUDE_NRF91_TIMER_H */
|
31
boards/arm/nrf91/common/src/Make.defs
Normal file
31
boards/arm/nrf91/common/src/Make.defs
Normal file
@ -0,0 +1,31 @@
|
||||
#############################################################################
|
||||
# boards/arm/nrf91/common/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.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
ifeq ($(CONFIG_ARCH_BOARD_COMMON),y)
|
||||
|
||||
ifeq ($(CONFIG_NRF91_TIMER),y)
|
||||
CSRCS += nrf91_timer.c
|
||||
endif
|
||||
|
||||
DEPPATH += --dep-path src
|
||||
VPATH += :src
|
||||
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)src
|
||||
|
||||
endif
|
55
boards/arm/nrf91/common/src/nrf91_timer.c
Normal file
55
boards/arm/nrf91/common/src/nrf91_timer.c
Normal file
@ -0,0 +1,55 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/nrf91/common/src/nrf91_timer.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 <nuttx/timers/timer.h>
|
||||
|
||||
#include "nrf91_tim_lowerhalf.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nrf91_timer_driver_setup
|
||||
*
|
||||
* Description:
|
||||
* Configure the timer driver.
|
||||
*
|
||||
* Input Parameters:
|
||||
* devpath - The full path to the timer device. This should be of the
|
||||
* form /dev/timer0
|
||||
* timer - The timer's number.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; A negated errno value is returned
|
||||
* to indicate the nature of any failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int nrf91_timer_driver_setup(const char *devpath, int timer)
|
||||
{
|
||||
return nrf91_timer_initialize(devpath, timer);
|
||||
}
|
8
boards/arm/nrf91/nrf9160-dk/Kconfig
Normal file
8
boards/arm/nrf91/nrf9160-dk/Kconfig
Normal file
@ -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
|
||||
|
||||
endif
|
42
boards/arm/nrf91/nrf9160-dk/configs/nsh/defconfig
Normal file
42
boards/arm/nrf91/nrf9160-dk/configs/nsh/defconfig
Normal file
@ -0,0 +1,42 @@
|
||||
#
|
||||
# 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_NSH_DISABLE_IFCONFIG is not set
|
||||
# CONFIG_NSH_DISABLE_PS is not set
|
||||
# CONFIG_STANDARD_SERIAL is not set
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="nrf9160-dk"
|
||||
CONFIG_ARCH_BOARD_NRF9160_DK=y
|
||||
CONFIG_ARCH_CHIP="nrf91"
|
||||
CONFIG_ARCH_CHIP_NRF9160=y
|
||||
CONFIG_ARCH_CHIP_NRF91=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_ARCH_STDARG_H=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=5500
|
||||
CONFIG_DEBUG_FEATURES=y
|
||||
CONFIG_DEBUG_FULLOPT=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_EXPERIMENTAL=y
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_MM_REGIONS=2
|
||||
CONFIG_NRF91_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=262144
|
||||
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
|
@ -0,0 +1,50 @@
|
||||
#
|
||||
# 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_NSH_DISABLE_IFCONFIG is not set
|
||||
# CONFIG_NSH_DISABLE_PS is not set
|
||||
# CONFIG_STANDARD_SERIAL is not set
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="nrf9160-dk"
|
||||
CONFIG_ARCH_BOARD_NRF9160_DK=y
|
||||
CONFIG_ARCH_CHIP="nrf91"
|
||||
CONFIG_ARCH_CHIP_NRF9160=y
|
||||
CONFIG_ARCH_CHIP_NRF91=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_ARCH_STDARG_H=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=5500
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEBUG_FEATURES=y
|
||||
CONFIG_DEBUG_FULLOPT=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_EXPERIMENTAL=y
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_MM_REGIONS=2
|
||||
CONFIG_NRF91_RTC0=y
|
||||
CONFIG_NRF91_SYSTIMER_RTC=y
|
||||
CONFIG_NRF91_UART0=y
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_LINELEN=64
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
CONFIG_RAM_SIZE=262144
|
||||
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_TESTING_OSTEST=y
|
||||
CONFIG_TIMER=y
|
||||
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||
CONFIG_USEC_PER_TICK=10000
|
106
boards/arm/nrf91/nrf9160-dk/include/board.h
Normal file
106
boards/arm/nrf91/nrf9160-dk/include/board.h
Normal file
@ -0,0 +1,106 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/nrf91/nrf9160-dk/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_NRF91_NRF9160_DK_INCLUDE_BOARD_H
|
||||
#define __BOARDS_ARM_NRF91_NRF9160_DK_INCLUDE_BOARD_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_NRF91_GPIOTE)
|
||||
# include <nuttx/irq.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Clocking *****************************************************************/
|
||||
|
||||
#define BOARD_SYSTICK_CLOCK (64000000)
|
||||
|
||||
/* LED definitions **********************************************************/
|
||||
|
||||
/* A low output illuminates the LED.
|
||||
*
|
||||
* LED index values for use with board_userled()
|
||||
*/
|
||||
|
||||
#define BOARD_LED1 0
|
||||
#define BOARD_LED2 1
|
||||
#define BOARD_LED3 2
|
||||
#define BOARD_LED4 3
|
||||
#define BOARD_NLEDS 4
|
||||
|
||||
/* LED bits for use with board_userled_all() */
|
||||
|
||||
#define BOARD_LED1_BIT (1 << BOARD_LED1)
|
||||
#define BOARD_LED2_BIT (1 << BOARD_LED2)
|
||||
#define BOARD_LED3_BIT (1 << BOARD_LED3)
|
||||
#define BOARD_LED4_BIT (1 << BOARD_LED4)
|
||||
|
||||
/* If CONFIG_ARCH_LEDS is defined, the LED will be controlled as follows
|
||||
* for NuttX debug functionality (where NC means "No Change").
|
||||
*/
|
||||
|
||||
#define LED_STARTED 0 /* OFF */
|
||||
#define LED_HEAPALLOCATE 0 /* OFF */
|
||||
#define LED_IRQSENABLED 0 /* OFF */
|
||||
#define LED_STACKCREATED 1 /* ON */
|
||||
#define LED_INIRQ 2 /* NC */
|
||||
#define LED_SIGNAL 2 /* NC */
|
||||
#define LED_ASSERTION 2 /* NC */
|
||||
#define LED_PANIC 3 /* Flashing */
|
||||
|
||||
/* If CONFIG_ARCH_LEDS is not defined, then the LEDs are completely under
|
||||
* control of the application. The following interfaces are then available
|
||||
* for application control of the LEDs:
|
||||
*
|
||||
* uint32_t board_userled_initialize(void);
|
||||
* void board_userled(int led, bool ledon);
|
||||
* void board_userled_all(uint32_t ledset);
|
||||
*/
|
||||
|
||||
/* Button definitions *******************************************************/
|
||||
|
||||
/* Board supports 2 buttons. */
|
||||
|
||||
#define BUTTON_BTN1 0
|
||||
#define BUTTON_BTN2 1
|
||||
#define NUM_BUTTONS 2
|
||||
|
||||
#define BUTTON_BTN1_BIT (1 << BUTTON_BTN1)
|
||||
#define BUTTON_BTN2_BIT (1 << BUTTON_BTN2)
|
||||
|
||||
/* UART Pins ****************************************************************/
|
||||
|
||||
/* UART0 is connected to the virtual COM port:
|
||||
* UART0_RX - P0-28
|
||||
* UART0_TX - P0-29
|
||||
*/
|
||||
|
||||
#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))
|
||||
|
||||
#endif /* __BOARDS_ARM_NRF91_NRF9160_DK_INCLUDE_BOARD_H */
|
38
boards/arm/nrf91/nrf9160-dk/scripts/Make.defs
Normal file
38
boards/arm/nrf91/nrf9160-dk/scripts/Make.defs
Normal file
@ -0,0 +1,38 @@
|
||||
############################################################################
|
||||
# boards/arm/nrf91/nrf9160-dk/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/armv8-m/Toolchain.defs
|
||||
|
||||
ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)flash_app.ld
|
||||
|
||||
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
|
116
boards/arm/nrf91/nrf9160-dk/scripts/flash_app.ld
Normal file
116
boards/arm/nrf91/nrf9160-dk/scripts/flash_app.ld
Normal file
@ -0,0 +1,116 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/nrf91/nrf9160-dk/scripts/flash_app.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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#ifdef CONFIG_NRF91_MODEM_SHMEM_SIZE
|
||||
# define NRF91_SHMEM_SIZE (CONFIG_NRF91_MODEM_SHMEM_SIZE)
|
||||
#else
|
||||
# define NRF91_SHMEM_SIZE (0)
|
||||
#endif
|
||||
|
||||
MEMORY
|
||||
{
|
||||
progmem (rx) : ORIGIN = 0x00000000,
|
||||
LENGTH = 1024K
|
||||
datamem (rwx) : ORIGIN = 0x20000000 + NRF91_SHMEM_SIZE,
|
||||
LENGTH = 256K - NRF91_SHMEM_SIZE
|
||||
}
|
||||
|
||||
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(.);
|
||||
*(.init_array .init_array.*)
|
||||
_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) }
|
||||
}
|
41
boards/arm/nrf91/nrf9160-dk/src/Make.defs
Normal file
41
boards/arm/nrf91/nrf9160-dk/src/Make.defs
Normal file
@ -0,0 +1,41 @@
|
||||
############################################################################
|
||||
# boards/arm/nrf91/nrf9160-dk/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 = nrf91_boot.c nrf91_bringup.c
|
||||
|
||||
ifeq ($(CONFIG_BOARDCTL),y)
|
||||
CSRCS += nrf91_appinit.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_LEDS),y)
|
||||
CSRCS += nrf91_autoleds.c
|
||||
else
|
||||
CSRCS += nrf91_userleds.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_BUTTONS),y)
|
||||
CSRCS += nrf91_buttons.c
|
||||
endif
|
||||
|
||||
DEPPATH += --dep-path board
|
||||
VPATH += :board
|
||||
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board
|
96
boards/arm/nrf91/nrf9160-dk/src/nrf9160-dk.h
Normal file
96
boards/arm/nrf91/nrf9160-dk/src/nrf9160-dk.h
Normal file
@ -0,0 +1,96 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/nrf91/nrf9160-dk/src/nrf9160-dk.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_NRF91_NRF9160_DK_SRC_NRF9160_DK_H
|
||||
#define __BOARDS_ARM_NRF91_NRF9160_DK_SRC_NRF9160_DK_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
||||
#include "nrf91_gpio.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
/* procfs File System */
|
||||
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
# ifdef CONFIG_NSH_PROC_MOUNTPOINT
|
||||
# define NRF91_PROCFS_MOUNTPOINT CONFIG_NSH_PROC_MOUNTPOINT
|
||||
# else
|
||||
# define NRF91_PROCFS_MOUNTPOINT "/proc"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* LED definitions **********************************************************/
|
||||
|
||||
/* Definitions to configure LED GPIO as outputs */
|
||||
|
||||
#define GPIO_LED1 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN(2))
|
||||
#define GPIO_LED2 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN(3))
|
||||
#define GPIO_LED3 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN(4))
|
||||
#define GPIO_LED4 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN(5))
|
||||
|
||||
/* Button definitions *******************************************************/
|
||||
|
||||
/* Board supports four buttons. */
|
||||
|
||||
#define GPIO_BUTTON1 (GPIO_INPUT | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN(6))
|
||||
#define GPIO_BUTTON2 (GPIO_INPUT | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN(7))
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nrf91_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 nrf91_bringup(void);
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARDS_ARM_NRF91_NRF9160_DK_SRC_NRF9160_DK_H */
|
88
boards/arm/nrf91/nrf9160-dk/src/nrf91_appinit.c
Normal file
88
boards/arm/nrf91/nrf9160-dk/src/nrf91_appinit.c
Normal file
@ -0,0 +1,88 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/nrf91/nrf9160-dk/src/nrf91_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.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: arm_netinitialize
|
||||
*
|
||||
* Description:
|
||||
* Dummy function expected to start-up logic.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_NET) && !defined(CONFIG_NETDEV_LATEINIT)
|
||||
void arm_netinitialize(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* 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 nrf91_bringup();
|
||||
#endif
|
||||
}
|
127
boards/arm/nrf91/nrf9160-dk/src/nrf91_autoleds.c
Normal file
127
boards/arm/nrf91/nrf9160-dk/src/nrf91_autoleds.c
Normal file
@ -0,0 +1,127 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/nrf91/nrf9160-dk/src/nrf91_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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "arm_internal.h"
|
||||
#include "nrf9160-dk.h"
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
|
||||
#define LED_ON 0
|
||||
#define LED_OFF 1
|
||||
|
||||
/* This array maps an LED number to GPIO pin configuration */
|
||||
|
||||
static const uint32_t g_ledcfg[BOARD_NLEDS] =
|
||||
{
|
||||
#if 0 < BOARD_NLEDS
|
||||
GPIO_LED1,
|
||||
#endif
|
||||
#if 1 < BOARD_NLEDS
|
||||
GPIO_LED2,
|
||||
#endif
|
||||
#if 2 < BOARD_NLEDS
|
||||
GPIO_LED3,
|
||||
#endif
|
||||
#if 3 < BOARD_NLEDS
|
||||
GPIO_LED4,
|
||||
#endif
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: led_dumppins
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef LED_VERBOSE
|
||||
static void led_dumppins(const char *msg)
|
||||
{
|
||||
nrf91_pin_dump(PINCONFIG_LED, msg);
|
||||
nrf91_gpio_dump(GPIO_LED, msg);
|
||||
}
|
||||
#else
|
||||
# define led_dumppins(m)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_initialize
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_initialize(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Configure LED pin as a GPIO outputs */
|
||||
|
||||
led_dumppins("board_autoled_initialize() Entry)");
|
||||
|
||||
for (i = 0; i < BOARD_NLEDS; i++)
|
||||
{
|
||||
nrf91_gpio_config(g_ledcfg[i]);
|
||||
}
|
||||
|
||||
led_dumppins("board_autoled_initialize() Exit");
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_on
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_on(int led)
|
||||
{
|
||||
if ((unsigned)led < BOARD_NLEDS)
|
||||
{
|
||||
nrf91_gpio_write(g_ledcfg[led], LED_ON);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_off
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_off(int led)
|
||||
{
|
||||
if ((unsigned)led < BOARD_NLEDS)
|
||||
{
|
||||
nrf91_gpio_write(g_ledcfg[led], LED_OFF);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ARCH_LEDS */
|
79
boards/arm/nrf91/nrf9160-dk/src/nrf91_boot.c
Normal file
79
boards/arm/nrf91/nrf9160-dk/src/nrf91_boot.c
Normal file
@ -0,0 +1,79 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/nrf91/nrf9160-dk/src/nrf91_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.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nrf91_board_initialize
|
||||
*
|
||||
* Description:
|
||||
* All NRF91xxx 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 nrf91_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 */
|
||||
|
||||
nrf91_bringup();
|
||||
}
|
||||
#endif
|
136
boards/arm/nrf91/nrf9160-dk/src/nrf91_bringup.c
Normal file
136
boards/arm/nrf91/nrf9160-dk/src/nrf91_bringup.c
Normal file
@ -0,0 +1,136 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/nrf91/nrf9160-dk/src/nrf91_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 <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#ifdef CONFIG_USERLED
|
||||
# include <nuttx/leds/userled.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_INPUT_BUTTONS
|
||||
# include <nuttx/input/buttons.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NRF91_MODEM
|
||||
# include "nrf91_modem.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NRF91_MODEM_AT
|
||||
# include "nrf91_modem_at.h"
|
||||
#endif
|
||||
|
||||
#include "nrf9160-dk.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nrf91_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 nrf91_bringup(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
/* Mount the procfs file system */
|
||||
|
||||
ret = nx_mount(NULL, NRF91_PROCFS_MOUNTPOINT, "procfs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to mount the PROC filesystem: %d\n", ret);
|
||||
}
|
||||
#endif /* CONFIG_FS_PROCFS */
|
||||
|
||||
#ifdef CONFIG_USERLED
|
||||
/* Register the LED driver */
|
||||
|
||||
ret = userled_lower_initialize(CONFIG_EXAMPLES_LEDS_DEVPATH);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_INPUT_BUTTONS
|
||||
/* Register the BUTTON driver */
|
||||
|
||||
ret = btn_lower_initialize("/dev/buttons");
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: btn_lower_initialize() failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NRF91_MODEM
|
||||
/* Initialize modem */
|
||||
|
||||
ret = nrf91_modem_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to initialize modem%d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NRF91_MODEM_AT
|
||||
/* Initialize modem AT interface */
|
||||
|
||||
ret = nrf91_at_register("/dev/modem");
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to initialize AT interface%d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
UNUSED(ret);
|
||||
return OK;
|
||||
}
|
151
boards/arm/nrf91/nrf9160-dk/src/nrf91_buttons.c
Normal file
151
boards/arm/nrf91/nrf9160-dk/src/nrf91_buttons.c
Normal file
@ -0,0 +1,151 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/nrf91/nrf9160-dk/src/nrf91_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 <nuttx/config.h>
|
||||
|
||||
#include <debug.h>
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "nrf91_gpio.h"
|
||||
#include "nrf91_gpiote.h"
|
||||
|
||||
#include "nrf9160-dk.h"
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Pin configuration for each nrf9160 button. This array is indexed by
|
||||
* the BUTTON_* definitions in board.h
|
||||
*/
|
||||
|
||||
static const uint32_t g_buttons[NUM_BUTTONS] =
|
||||
{
|
||||
GPIO_BUTTON1,
|
||||
GPIO_BUTTON2
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* 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)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Configure the GPIO pins as inputs. */
|
||||
|
||||
for (i = 0; i < NUM_BUTTONS; i++)
|
||||
{
|
||||
nrf91_gpio_config(g_buttons[i]);
|
||||
}
|
||||
|
||||
return NUM_BUTTONS;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint32_t ret = 0;
|
||||
int i;
|
||||
|
||||
/* Check that state of each key */
|
||||
|
||||
for (i = 0; i < NUM_BUTTONS; i++)
|
||||
{
|
||||
/* A LOW value means that the key is pressed. */
|
||||
|
||||
bool released = nrf91_gpio_read(g_buttons[BUTTON_BTN1]);
|
||||
|
||||
/* Accumulate the set of depressed (not released) keys */
|
||||
|
||||
if (!released)
|
||||
{
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Button support.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 32-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* 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, void *arg)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
ret = nrf91_gpiote_set_event(g_buttons[id], true, true, irqhandler, arg);
|
||||
if (ret < 0)
|
||||
{
|
||||
ierr("ERROR: nrf91_gpiote_set_event\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_ARCH_BUTTONS */
|
148
boards/arm/nrf91/nrf9160-dk/src/nrf91_userleds.c
Normal file
148
boards/arm/nrf91/nrf9160-dk/src/nrf91_userleds.c
Normal file
@ -0,0 +1,148 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/nrf91/nrf9160-dk/src/nrf91_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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "arm_internal.h"
|
||||
#include "nrf9160-dk.h"
|
||||
|
||||
#ifndef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* LED definitions **********************************************************/
|
||||
|
||||
/* If CONFIG_ARCH_LEDS is not defined, then the LEDs are completely under
|
||||
* control of the application. The following interfaces are then available
|
||||
* for application control of the LEDs:
|
||||
*
|
||||
* uint32_t board_userled_initialize(void);
|
||||
* void board_userled(int led, bool ledon);
|
||||
* void board_userled_all(uint32_t ledset);
|
||||
*/
|
||||
|
||||
#define LED_ON 0
|
||||
#define LED_OFF 1
|
||||
|
||||
/* This array maps an LED number to GPIO pin configuration */
|
||||
|
||||
static const uint32_t g_ledcfg[BOARD_NLEDS] =
|
||||
{
|
||||
#if 0 < BOARD_NLEDS
|
||||
GPIO_LED1,
|
||||
#endif
|
||||
#if 1 < BOARD_NLEDS
|
||||
GPIO_LED2,
|
||||
#endif
|
||||
#if 2 < BOARD_NLEDS
|
||||
GPIO_LED3,
|
||||
#endif
|
||||
#if 3 < BOARD_NLEDS
|
||||
GPIO_LED4,
|
||||
#endif
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: led_dumppins
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef LED_VERBOSE
|
||||
static void led_dumppins(const char *msg)
|
||||
{
|
||||
nrf91_pin_dump(PINCONFIG_LED, msg);
|
||||
nrf91_gpio_dump(GPIO_LED, msg);
|
||||
}
|
||||
#else
|
||||
# define led_dumppins(m)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_initialize
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t board_userled_initialize(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Configure LED pin as a GPIO outputs */
|
||||
|
||||
led_dumppins("board_userled_initialize() Entry)");
|
||||
|
||||
/* Configure GPIO as an outputs */
|
||||
|
||||
for (i = 0; i < BOARD_NLEDS; i++)
|
||||
{
|
||||
nrf91_gpio_config(g_ledcfg[i]);
|
||||
}
|
||||
|
||||
led_dumppins("board_userled_initialize() Exit");
|
||||
return BOARD_NLEDS;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled(int led, bool ledon)
|
||||
{
|
||||
if ((unsigned)led < BOARD_NLEDS)
|
||||
{
|
||||
nrf91_gpio_write(g_ledcfg[led], ledon ? LED_ON : LED_OFF);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_all
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled_all(uint32_t ledset)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Configure LED1-8 GPIOs for output */
|
||||
|
||||
for (i = 0; i < BOARD_NLEDS; i++)
|
||||
{
|
||||
nrf91_gpio_write(g_ledcfg[i], (ledset & (1 << i)) ? LED_ON : LED_OFF);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_ARCH_LEDS */
|
Loading…
Reference in New Issue
Block a user