boards/nrf52: add Arduino Nano 33 BLE Rev2 board
This commit is contained in:
parent
f9dbeaef86
commit
a1d7b2961d
@ -1111,6 +1111,13 @@ config ARCH_BOARD_ARDUINO_NANO_33BLE
|
|||||||
---help---
|
---help---
|
||||||
Arduino Nano 33 BLE Sense based on Nordic nRF52840
|
Arduino Nano 33 BLE Sense based on Nordic nRF52840
|
||||||
|
|
||||||
|
config ARCH_BOARD_ARDUINO_NANO_33BLE_REV2
|
||||||
|
bool "Arduino Nano 33 BLE Sense Rev2 based on Nordic nRF52840"
|
||||||
|
depends on ARCH_CHIP_NRF52
|
||||||
|
select ARCH_HAVE_LEDS
|
||||||
|
---help---
|
||||||
|
Arduino Nano 33 BLE Sense Rev2 based on Nordic nRF52840
|
||||||
|
|
||||||
config ARCH_BOARD_THINGY52
|
config ARCH_BOARD_THINGY52
|
||||||
bool "Nordic Thingy:52 Prototyping platform"
|
bool "Nordic Thingy:52 Prototyping platform"
|
||||||
depends on ARCH_CHIP_NRF52
|
depends on ARCH_CHIP_NRF52
|
||||||
@ -2887,6 +2894,7 @@ config ARCH_BOARD
|
|||||||
default "arduino-due" if ARCH_BOARD_ARDUINO_DUE
|
default "arduino-due" if ARCH_BOARD_ARDUINO_DUE
|
||||||
default "arduino-m0" if ARCH_BOARD_ARDUINO_M0
|
default "arduino-m0" if ARCH_BOARD_ARDUINO_M0
|
||||||
default "arduino-nano-33ble" if ARCH_BOARD_ARDUINO_NANO_33BLE
|
default "arduino-nano-33ble" if ARCH_BOARD_ARDUINO_NANO_33BLE
|
||||||
|
default "arduino-nano-33ble-rev2" if ARCH_BOARD_ARDUINO_NANO_33BLE_REV2
|
||||||
default "arty_a7" if ARCH_BOARD_ARTY_A7
|
default "arty_a7" if ARCH_BOARD_ARTY_A7
|
||||||
default "avr32dev1" if ARCH_BOARD_AVR32DEV1
|
default "avr32dev1" if ARCH_BOARD_AVR32DEV1
|
||||||
default "axoloti" if ARCH_BOARD_AXOLOTI
|
default "axoloti" if ARCH_BOARD_AXOLOTI
|
||||||
@ -3456,6 +3464,9 @@ endif
|
|||||||
if ARCH_BOARD_ARDUINO_NANO_33BLE
|
if ARCH_BOARD_ARDUINO_NANO_33BLE
|
||||||
source "boards/arm/nrf52/arduino-nano-33ble/Kconfig"
|
source "boards/arm/nrf52/arduino-nano-33ble/Kconfig"
|
||||||
endif
|
endif
|
||||||
|
if ARCH_BOARD_ARDUINO_NANO_33BLE_REV2
|
||||||
|
source "boards/arm/nrf52/arduino-nano-33ble-rev2/Kconfig"
|
||||||
|
endif
|
||||||
if ARCH_BOARD_CIRCUIT_EXPRESS
|
if ARCH_BOARD_CIRCUIT_EXPRESS
|
||||||
source "boards/arm/samd2l2/circuit-express/Kconfig"
|
source "boards/arm/samd2l2/circuit-express/Kconfig"
|
||||||
endif
|
endif
|
||||||
|
@ -450,6 +450,9 @@ boards/hc/mcs92s12ne6/ne64badge
|
|||||||
boards/arm/nrf52/arduino-nano-33ble
|
boards/arm/nrf52/arduino-nano-33ble
|
||||||
NuttX port to the Arduino Nano 33 BLE Sense board
|
NuttX port to the Arduino Nano 33 BLE Sense board
|
||||||
|
|
||||||
|
boards/arm/nrf52/arduino-nano-33ble-rev2
|
||||||
|
NuttX port to the Arduino Nano 33 BLE Sense Rev2 board
|
||||||
|
|
||||||
boards/arm/nrf52/nrf52-feather
|
boards/arm/nrf52/nrf52-feather
|
||||||
NuttX port to the Adafruit nRF52832 Feather board
|
NuttX port to the Adafruit nRF52832 Feather board
|
||||||
|
|
||||||
|
21
boards/arm/nrf52/arduino-nano-33ble-rev2/CMakeLists.txt
Normal file
21
boards/arm/nrf52/arduino-nano-33ble-rev2/CMakeLists.txt
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# ##############################################################################
|
||||||
|
# boards/arm/nrf52/arduino-nano-33ble-rev2/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)
|
12
boards/arm/nrf52/arduino-nano-33ble-rev2/Kconfig
Normal file
12
boards/arm/nrf52/arduino-nano-33ble-rev2/Kconfig
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#
|
||||||
|
# For a description of the syntax of this configuration file,
|
||||||
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||||
|
#
|
||||||
|
|
||||||
|
if ARCH_BOARD_ARDUINO_NANO_33BLE_REV2
|
||||||
|
config ARDUINONANO33BLEREV2_ARDUINO_BOOTLOADER
|
||||||
|
bool "Use Arduino bootloader"
|
||||||
|
default y
|
||||||
|
---help---
|
||||||
|
Use the Arduino bootloader to load the NuttX binary.
|
||||||
|
endif
|
@ -0,0 +1,41 @@
|
|||||||
|
#
|
||||||
|
# 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="arduino-nano-33ble-rev2"
|
||||||
|
CONFIG_ARCH_BOARD_ARDUINO_NANO_33BLE_REV2=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_FAT_LCNAMES=y
|
||||||
|
CONFIG_FAT_LFN=y
|
||||||
|
CONFIG_FS_FAT=y
|
||||||
|
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
|
@ -0,0 +1,45 @@
|
|||||||
|
#
|
||||||
|
# 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_DEV_CONSOLE is not set
|
||||||
|
# CONFIG_SYSLOG_DEFAULT is not set
|
||||||
|
CONFIG_ARCH="arm"
|
||||||
|
CONFIG_ARCH_BOARD="arduino-nano-33ble-rev2"
|
||||||
|
CONFIG_ARCH_BOARD_ARDUINO_NANO_33BLE_REV2=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_BOARDCTL_USBDEVCTRL=y
|
||||||
|
CONFIG_BOARD_LOOPSPERMSEC=5500
|
||||||
|
CONFIG_BUILTIN=y
|
||||||
|
CONFIG_CDCACM=y
|
||||||
|
CONFIG_CDCACM_CONSOLE=y
|
||||||
|
CONFIG_DEBUG_FULLOPT=y
|
||||||
|
CONFIG_DEBUG_SYMBOLS=y
|
||||||
|
CONFIG_EXAMPLES_HELLO=y
|
||||||
|
CONFIG_IDLETHREAD_STACKSIZE=2048
|
||||||
|
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||||
|
CONFIG_MM_REGIONS=2
|
||||||
|
CONFIG_NRF52_HFCLK_XTAL=y
|
||||||
|
CONFIG_NRF52_USBDEV=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=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_SYSTEM_NSH=y
|
125
boards/arm/nrf52/arduino-nano-33ble-rev2/include/board.h
Normal file
125
boards/arm/nrf52/arduino-nano-33ble-rev2/include/board.h
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/arm/nrf52/arduino-nano-33ble-rev2/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_ARDUINO_NANO_33BLE_REV2_INCLUDE_BOARD_H
|
||||||
|
#define __BOARDS_ARM_NRF52_ARDUINO_NANO_33BLE_REV2_INCLUDE_BOARD_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_NRF52_GPIOTE)
|
||||||
|
# include <nuttx/irq.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Clocking *****************************************************************/
|
||||||
|
|
||||||
|
#define BOARD_SYSTICK_CLOCK (64000000)
|
||||||
|
|
||||||
|
/* LED definitions **********************************************************/
|
||||||
|
|
||||||
|
/* 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_LED5 4
|
||||||
|
#define BOARD_NLEDS 5
|
||||||
|
|
||||||
|
/* 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)
|
||||||
|
#define BOARD_LED5_BIT (1 << BOARD_LED5)
|
||||||
|
|
||||||
|
/* If CONFIG_ARCH_LEDS is defined, the LED will be controlled as follows
|
||||||
|
* for NuttX debug functionality.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define LED_STARTED 0
|
||||||
|
#define LED_HEAPALLOCATE 1
|
||||||
|
#define LED_IRQSENABLED 2
|
||||||
|
#define LED_STACKCREATED 3
|
||||||
|
#define LED_INIRQ 4
|
||||||
|
#define LED_SIGNAL 5
|
||||||
|
#define LED_ASSERTION 6
|
||||||
|
#define LED_PANIC 7
|
||||||
|
|
||||||
|
/* 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 no buttons. */
|
||||||
|
|
||||||
|
#define NUM_BUTTONS 0
|
||||||
|
|
||||||
|
/* UART Pins ****************************************************************/
|
||||||
|
|
||||||
|
/* The following definitions must be provided so that the NRF52 serial
|
||||||
|
* driver can set up the UART for the serial console properly.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define BOARD_UART0_RX_PIN (GPIO_INPUT | GPIO_PORT1 | GPIO_PIN(10))
|
||||||
|
#define BOARD_UART0_TX_PIN (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT1 | GPIO_PIN(3))
|
||||||
|
|
||||||
|
/* Sensor Power Pin *********************************************************/
|
||||||
|
|
||||||
|
/* The VDD_ENV must be driven high in order for sensors to receive power. */
|
||||||
|
|
||||||
|
#define BOARD_VDD_ENV_PIN (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN(22))
|
||||||
|
|
||||||
|
/* I2C Pins *****************************************************************/
|
||||||
|
|
||||||
|
/* I2C0 (TWI0) - Internal I2C
|
||||||
|
* I2C0_SCL - P0.15
|
||||||
|
* I2C0_SDA - P0.14
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define BOARD_I2C0_SCL_PIN (GPIO_OUTPUT | GPIO_PORT0 | GPIO_PIN(15))
|
||||||
|
#define BOARD_I2C0_SDA_PIN (GPIO_INPUT | GPIO_PORT0 | GPIO_PIN(14))
|
||||||
|
#define BOARD_I2C0_PULLUP_PIN (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT1 | GPIO_PIN(0))
|
||||||
|
|
||||||
|
/* I2C1 (TWI1) - External I2C
|
||||||
|
* I2C1_SCL - P0.2
|
||||||
|
* I2C1_SDA - P0.31
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define BOARD_I2C1_SCL_PIN (GPIO_OUTPUT | GPIO_PORT0 | GPIO_PIN(2))
|
||||||
|
#define BOARD_I2C1_SDA_PIN (GPIO_INPUT | GPIO_PORT0 | GPIO_PIN(31))
|
||||||
|
|
||||||
|
#endif /* __BOARDS_ARM_NRF52_ARDUINO_NANO_33BLE_REV2_INCLUDE_BOARD_H */
|
39
boards/arm/nrf52/arduino-nano-33ble-rev2/scripts/Make.defs
Normal file
39
boards/arm/nrf52/arduino-nano-33ble-rev2/scripts/Make.defs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
############################################################################
|
||||||
|
# boards/arm/nrf52/arduino-nano-33ble-rev2/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
|
115
boards/arm/nrf52/arduino-nano-33ble-rev2/scripts/flash_config.ld
Normal file
115
boards/arm/nrf52/arduino-nano-33ble-rev2/scripts/flash_config.ld
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/arm/nrf52/arduino-nano-33ble-rev2/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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#if CONFIG_ARDUINONANO33BLEREV2_ARDUINO_BOOTLOADER
|
||||||
|
# define FLASH_START_ADDR 0x00010000
|
||||||
|
# define FLASH_LENGTH 960K
|
||||||
|
#else
|
||||||
|
# define FLASH_START_ADDR 0x00000000
|
||||||
|
# define FLASH_LENGTH 1024K
|
||||||
|
#endif
|
||||||
|
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
progmem (rx) : ORIGIN = FLASH_START_ADDR, LENGTH = FLASH_LENGTH
|
||||||
|
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(.);
|
||||||
|
*(.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) }
|
||||||
|
}
|
49
boards/arm/nrf52/arduino-nano-33ble-rev2/src/CMakeLists.txt
Normal file
49
boards/arm/nrf52/arduino-nano-33ble-rev2/src/CMakeLists.txt
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
# ##############################################################################
|
||||||
|
# boards/arm/nrf52/arduino-nano-33ble-rev2/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()
|
||||||
|
|
||||||
|
if(CONFIG_ARCH_LEDS)
|
||||||
|
list(APPEND SRCS nrf52_autoleds.c)
|
||||||
|
else()
|
||||||
|
list(APPEND SRCS nrf52_userleds.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_USBDEV)
|
||||||
|
list(APPEND SRCS nrf52_usb.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_USBDEV_COMPOSITE)
|
||||||
|
list(APPEND SRCS nrf52_composite.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()
|
45
boards/arm/nrf52/arduino-nano-33ble-rev2/src/Make.defs
Normal file
45
boards/arm/nrf52/arduino-nano-33ble-rev2/src/Make.defs
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
############################################################################
|
||||||
|
# boards/arm/nrf52/arduino-nano-33ble-rev2/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
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_LEDS),y)
|
||||||
|
CSRCS += nrf52_autoleds.c
|
||||||
|
else
|
||||||
|
CSRCS += nrf52_userleds.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_USBDEV),y)
|
||||||
|
CSRCS += nrf52_usb.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_USBDEV_COMPOSITE),y)
|
||||||
|
CSRCS += nrf52_composite.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
DEPPATH += --dep-path board
|
||||||
|
VPATH += :board
|
||||||
|
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board
|
@ -0,0 +1,88 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/arm/nrf52/arduino-nano-33ble-rev2/src/arduino-nano-33ble.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_ARDUINO_NANO_33BLE_REV2_SRC_ARDUINO_NANO_33BLE_H
|
||||||
|
#define __BOARDS_ARM_NRF52_ARDUINO_NANO_33BLE_REV2_SRC_ARDUINO_NANO_33BLE_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
#include <nuttx/compiler.h>
|
||||||
|
|
||||||
|
#include "nrf52_gpio.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* LED definitions **********************************************************/
|
||||||
|
|
||||||
|
/* Definitions to configure LED GPIO as outputs */
|
||||||
|
|
||||||
|
/* 0 = power, 1 = main, 2 = red, 3 = green, 4 = blue
|
||||||
|
* Power and main are active high, RGB are active low
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define GPIO_LED1 (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORT1 | GPIO_PIN(9))
|
||||||
|
#define GPIO_LED2 (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORT0 | GPIO_PIN(13))
|
||||||
|
#define GPIO_LED3 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN(24))
|
||||||
|
#define GPIO_LED4 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN(16))
|
||||||
|
#define GPIO_LED5 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN(6))
|
||||||
|
|
||||||
|
/* Button definitions *******************************************************/
|
||||||
|
|
||||||
|
/* Board supports no buttons. (Reset button hardwired to return to
|
||||||
|
* bootloader.)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* 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_ARDUINO_NANO_33BLE_REV2_SRC_ARDUINO_NANO_33BLE_H */
|
74
boards/arm/nrf52/arduino-nano-33ble-rev2/src/nrf52_appinit.c
Normal file
74
boards/arm/nrf52/arduino-nano-33ble-rev2/src/nrf52_appinit.c
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/arm/nrf52/arduino-nano-33ble-rev2/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 "arduino-nano-33ble.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
|
||||||
|
}
|
169
boards/arm/nrf52/arduino-nano-33ble-rev2/src/nrf52_autoleds.c
Normal file
169
boards/arm/nrf52/arduino-nano-33ble-rev2/src/nrf52_autoleds.c
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/arm/nrf52/arduino-nano-33ble-rev2/src/nrf52_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 "arduino-nano-33ble.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_LEDS
|
||||||
|
|
||||||
|
/* This array maps an LED number to GPIO pin configuration */
|
||||||
|
|
||||||
|
static const uint32_t g_ledcfg[BOARD_NLEDS] =
|
||||||
|
{
|
||||||
|
GPIO_LED1,
|
||||||
|
GPIO_LED2,
|
||||||
|
GPIO_LED3,
|
||||||
|
GPIO_LED4,
|
||||||
|
GPIO_LED5
|
||||||
|
};
|
||||||
|
|
||||||
|
static const uint32_t g_ledoff[BOARD_NLEDS] =
|
||||||
|
{
|
||||||
|
0, 0, 1, 1, 1
|
||||||
|
};
|
||||||
|
|
||||||
|
static const uint32_t g_ledon[BOARD_NLEDS] =
|
||||||
|
{
|
||||||
|
1, 1, 0, 0, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: led_dumppins
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef LED_VERBOSE
|
||||||
|
static void led_dumppins(const char *msg)
|
||||||
|
{
|
||||||
|
nrf52_pin_dump(PINCONFIG_LED, msg);
|
||||||
|
nrf52_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++)
|
||||||
|
{
|
||||||
|
nrf52_gpio_config(g_ledcfg[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
led_dumppins("board_autoled_initialize() Exit");
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_autoled_on
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_autoled_on(int led)
|
||||||
|
{
|
||||||
|
switch (led)
|
||||||
|
{
|
||||||
|
case LED_STARTED: /* Power */
|
||||||
|
nrf52_gpio_write(g_ledcfg[0], g_ledon[0]);
|
||||||
|
break;
|
||||||
|
case LED_HEAPALLOCATE: /* Yellow (red + green) only */
|
||||||
|
nrf52_gpio_write(g_ledcfg[2], g_ledon[2]);
|
||||||
|
nrf52_gpio_write(g_ledcfg[3], g_ledon[3]);
|
||||||
|
nrf52_gpio_write(g_ledcfg[4], g_ledoff[4]);
|
||||||
|
break;
|
||||||
|
case LED_IRQSENABLED: /* Green only */
|
||||||
|
nrf52_gpio_write(g_ledcfg[2], g_ledoff[2]);
|
||||||
|
nrf52_gpio_write(g_ledcfg[3], g_ledon[3]);
|
||||||
|
nrf52_gpio_write(g_ledcfg[4], g_ledoff[4]);
|
||||||
|
break;
|
||||||
|
case LED_STACKCREATED: /* Main LED */
|
||||||
|
nrf52_gpio_write(g_ledcfg[1], g_ledon[1]);
|
||||||
|
break;
|
||||||
|
case LED_INIRQ: /* Red added to the green for LED_IRQSENABLED */
|
||||||
|
nrf52_gpio_write(g_ledcfg[2], g_ledon[2]);
|
||||||
|
break;
|
||||||
|
case LED_SIGNAL: /* Blue added to the green for LED_IRQSENABLED */
|
||||||
|
nrf52_gpio_write(g_ledcfg[4], g_ledon[4]);
|
||||||
|
break;
|
||||||
|
case LED_ASSERTION: /* Red only */
|
||||||
|
case LED_PANIC: /* Red only, system will cause blink */
|
||||||
|
nrf52_gpio_write(g_ledcfg[2], g_ledon[2]);
|
||||||
|
nrf52_gpio_write(g_ledcfg[3], g_ledoff[3]);
|
||||||
|
nrf52_gpio_write(g_ledcfg[4], g_ledoff[4]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_autoled_off
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void board_autoled_off(int led)
|
||||||
|
{
|
||||||
|
switch (led)
|
||||||
|
{
|
||||||
|
case LED_INIRQ: /* Red added to the green for LED_IRQSENABLED */
|
||||||
|
nrf52_gpio_write(g_ledcfg[2], g_ledoff[2]);
|
||||||
|
break;
|
||||||
|
case LED_SIGNAL: /* Blue added to the green for LED_IRQSENABLED */
|
||||||
|
nrf52_gpio_write(g_ledcfg[4], g_ledoff[4]);
|
||||||
|
break;
|
||||||
|
case LED_ASSERTION: /* Red only */
|
||||||
|
case LED_PANIC: /* Red only, system will cause blink */
|
||||||
|
nrf52_gpio_write(g_ledcfg[2], g_ledoff[2]);
|
||||||
|
nrf52_gpio_write(g_ledcfg[3], g_ledoff[3]);
|
||||||
|
nrf52_gpio_write(g_ledcfg[4], g_ledoff[4]);
|
||||||
|
break;
|
||||||
|
default: /* Others never turn off */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_ARCH_LEDS */
|
84
boards/arm/nrf52/arduino-nano-33ble-rev2/src/nrf52_boot.c
Normal file
84
boards/arm/nrf52/arduino-nano-33ble-rev2/src/nrf52_boot.c
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/arm/nrf52/arduino-nano-33ble-rev2/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 "arduino-nano-33ble.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
|
||||||
|
|
||||||
|
/* If I2C 0 is enabled and we are master, engage pullup resistor. */
|
||||||
|
#ifdef CONFIG_NRF52_I2C0_MASTER
|
||||||
|
nrf52_gpio_config(BOARD_I2C0_PULLUP_PIN);
|
||||||
|
#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
|
142
boards/arm/nrf52/arduino-nano-33ble-rev2/src/nrf52_bringup.c
Normal file
142
boards/arm/nrf52/arduino-nano-33ble-rev2/src/nrf52_bringup.c
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/arm/nrf52/arduino-nano-33ble-rev2/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>
|
||||||
|
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_USERLED
|
||||||
|
# include <nuttx/leds/userled.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "hardware/nrf52_clock.h"
|
||||||
|
#include "arm_internal.h"
|
||||||
|
#include "arduino-nano-33ble.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: nrf52_i2c_register
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Register one I2C drivers for the I2C tool.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#if defined(CONFIG_I2C) && defined(CONFIG_SYSTEM_I2CTOOL)
|
||||||
|
static void nrf52_i2c_register(int bus)
|
||||||
|
{
|
||||||
|
struct i2c_master_s *i2c;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
i2c = nrf52_i2cbus_initialize(bus);
|
||||||
|
if (i2c == NULL)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: Failed to get I2C%d interface\n", bus);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = i2c_register(i2c, bus);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: Failed to register I2C%d driver: %d\n",
|
||||||
|
bus, ret);
|
||||||
|
nrf52_i2cbus_uninitialize(i2c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: nrf52_i2ctool
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Register I2C drivers for the I2C tool.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#if defined(CONFIG_I2C) && defined(CONFIG_SYSTEM_I2CTOOL)
|
||||||
|
static void nrf52_i2ctool(void)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_NRF52_I2C0
|
||||||
|
nrf52_i2c_register(0);
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_NRF52_I2C1
|
||||||
|
nrf52_i2c_register(1);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
#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_SENSORS
|
||||||
|
/* Provide power to the sensors and give them time to stabilize. */
|
||||||
|
|
||||||
|
nrf52_gpio_config(BOARD_VDD_ENV_PIN);
|
||||||
|
up_mdelay(20);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* If I2C 0 is enabled and we are master, engage pullup resistor and
|
||||||
|
* disable trace.
|
||||||
|
*/
|
||||||
|
#ifdef CONFIG_NRF52_I2C0_MASTER
|
||||||
|
nrf52_gpio_config(BOARD_I2C0_PULLUP_PIN);
|
||||||
|
putreg32(0, NRF52_CLOCK_TRACECONFIG);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
UNUSED(ret);
|
||||||
|
return OK;
|
||||||
|
}
|
177
boards/arm/nrf52/arduino-nano-33ble-rev2/src/nrf52_composite.c
Normal file
177
boards/arm/nrf52/arduino-nano-33ble-rev2/src/nrf52_composite.c
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/arm/nrf52/arduino-nano-33ble-rev2/src/nrf52_composite.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 <assert.h>
|
||||||
|
|
||||||
|
#include <nuttx/usb/usbdev.h>
|
||||||
|
#include <nuttx/usb/cdcacm.h>
|
||||||
|
#include <nuttx/usb/rndis.h>
|
||||||
|
#include <nuttx/usb/composite.h>
|
||||||
|
|
||||||
|
#include "nrf52_usbd.h"
|
||||||
|
|
||||||
|
#include "arduino-nano-33ble.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void *board_composite0_connect(void)
|
||||||
|
{
|
||||||
|
struct composite_devdesc_s dev[2];
|
||||||
|
int ifnobase = 0;
|
||||||
|
int strbase = COMPOSITE_NSTRIDS;
|
||||||
|
int dev_idx = 0;
|
||||||
|
int epin = 1;
|
||||||
|
int epout = 1;
|
||||||
|
|
||||||
|
#ifdef CONFIG_RNDIS_COMPOSITE
|
||||||
|
/* Configure the RNDIS USB device */
|
||||||
|
|
||||||
|
/* Ask the RNDIS driver to fill in the constants we didn't
|
||||||
|
* know here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
usbdev_rndis_get_composite_devdesc(&dev[dev_idx]);
|
||||||
|
|
||||||
|
/* Interfaces */
|
||||||
|
|
||||||
|
dev[dev_idx].devinfo.ifnobase = ifnobase;
|
||||||
|
dev[dev_idx].minor = 0;
|
||||||
|
|
||||||
|
/* Strings */
|
||||||
|
|
||||||
|
dev[dev_idx].devinfo.strbase = strbase;
|
||||||
|
|
||||||
|
/* Endpoints */
|
||||||
|
|
||||||
|
dev[dev_idx].devinfo.epno[RNDIS_EP_INTIN_IDX] = epin++;
|
||||||
|
dev[dev_idx].devinfo.epno[RNDIS_EP_BULKIN_IDX] = epin++;
|
||||||
|
dev[dev_idx].devinfo.epno[RNDIS_EP_BULKOUT_IDX] = epout++;
|
||||||
|
|
||||||
|
/* Count up the base numbers */
|
||||||
|
|
||||||
|
ifnobase += dev[dev_idx].devinfo.ninterfaces;
|
||||||
|
strbase += dev[dev_idx].devinfo.nstrings;
|
||||||
|
|
||||||
|
dev_idx += 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_CDCACM_COMPOSITE
|
||||||
|
/* Configure the CDC/ACM device */
|
||||||
|
|
||||||
|
/* Ask the cdcacm driver to fill in the constants we didn't
|
||||||
|
* know here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
cdcacm_get_composite_devdesc(&dev[dev_idx]);
|
||||||
|
|
||||||
|
/* Overwrite and correct some values... */
|
||||||
|
|
||||||
|
/* The callback functions for the CDC/ACM class */
|
||||||
|
|
||||||
|
dev[dev_idx].classobject = cdcacm_classobject;
|
||||||
|
dev[dev_idx].uninitialize = cdcacm_uninitialize;
|
||||||
|
|
||||||
|
/* Interfaces */
|
||||||
|
|
||||||
|
dev[dev_idx].devinfo.ifnobase = ifnobase; /* Offset to Interface-IDs */
|
||||||
|
dev[dev_idx].minor = 0; /* The minor interface number */
|
||||||
|
|
||||||
|
/* Strings */
|
||||||
|
|
||||||
|
dev[dev_idx].devinfo.strbase = strbase; /* Offset to String Numbers */
|
||||||
|
|
||||||
|
/* Endpoints */
|
||||||
|
|
||||||
|
dev[dev_idx].devinfo.epno[CDCACM_EP_INTIN_IDX] = epin++;
|
||||||
|
dev[dev_idx].devinfo.epno[CDCACM_EP_BULKIN_IDX] = epin++;
|
||||||
|
dev[dev_idx].devinfo.epno[CDCACM_EP_BULKOUT_IDX] = epout++;
|
||||||
|
|
||||||
|
/* Count up the base numbers */
|
||||||
|
|
||||||
|
ifnobase += dev[dev_idx].devinfo.ninterfaces;
|
||||||
|
strbase += dev[dev_idx].devinfo.nstrings;
|
||||||
|
|
||||||
|
dev_idx += 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
DEBUGASSERT(epin <= NRF52_NENDPOINTS);
|
||||||
|
DEBUGASSERT(epout <= NRF52_NENDPOINTS);
|
||||||
|
|
||||||
|
return composite_initialize(dev_idx, dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_composite_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Perform architecture specific initialization of a composite USB device.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int board_composite_initialize(int port)
|
||||||
|
{
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_composite_connect
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Connect the USB composite device on the specified USB device port using
|
||||||
|
* the specified configuration. The interpretation of the configid is
|
||||||
|
* board specific.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* port - The USB device port.
|
||||||
|
* configid - The USB composite configuration
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* A non-NULL handle value is returned on success. NULL is returned on
|
||||||
|
* any failure.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void *board_composite_connect(int port, int configid)
|
||||||
|
{
|
||||||
|
if (configid == 0)
|
||||||
|
{
|
||||||
|
return board_composite0_connect();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
56
boards/arm/nrf52/arduino-nano-33ble-rev2/src/nrf52_usb.c
Normal file
56
boards/arm/nrf52/arduino-nano-33ble-rev2/src/nrf52_usb.c
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/arm/nrf52/arduino-nano-33ble-rev2/src/nrf52_usb.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/usb/usbdev.h>
|
||||||
|
|
||||||
|
#include "nrf52_usbd.h"
|
||||||
|
|
||||||
|
#include "arduino-nano-33ble.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: nrf52_usbsuspend
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Board logic must provide the nrf52_usbsuspend logic if the USBDEV
|
||||||
|
* driver is used. This function is called whenever the USB enters or
|
||||||
|
* leaves suspend mode.
|
||||||
|
* This is an opportunity for the board logic to shutdown clocks, power,
|
||||||
|
* etc. while the USB is suspended.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void nrf52_usbsuspend(struct usbdev_s *dev, bool resume)
|
||||||
|
{
|
||||||
|
uinfo("resume: %d\n", resume);
|
||||||
|
}
|
149
boards/arm/nrf52/arduino-nano-33ble-rev2/src/nrf52_userleds.c
Normal file
149
boards/arm/nrf52/arduino-nano-33ble-rev2/src/nrf52_userleds.c
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/arm/nrf52/arduino-nano-33ble-rev2/src/nrf52_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 "arduino-nano-33ble.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);
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* This array maps an LED number to GPIO pin configuration */
|
||||||
|
|
||||||
|
static const uint32_t g_ledcfg[BOARD_NLEDS] =
|
||||||
|
{
|
||||||
|
GPIO_LED1,
|
||||||
|
GPIO_LED2,
|
||||||
|
GPIO_LED3,
|
||||||
|
GPIO_LED4,
|
||||||
|
GPIO_LED5
|
||||||
|
};
|
||||||
|
|
||||||
|
static const uint32_t g_ledoff[BOARD_NLEDS] =
|
||||||
|
{
|
||||||
|
0, 0, 1, 1, 1
|
||||||
|
};
|
||||||
|
|
||||||
|
static const uint32_t g_ledon[BOARD_NLEDS] =
|
||||||
|
{
|
||||||
|
1, 1, 0, 0, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: led_dumppins
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef LED_VERBOSE
|
||||||
|
static void led_dumppins(const char *msg)
|
||||||
|
{
|
||||||
|
nrf52_pin_dump(PINCONFIG_LED, msg);
|
||||||
|
nrf52_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++)
|
||||||
|
{
|
||||||
|
nrf52_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)
|
||||||
|
{
|
||||||
|
nrf52_gpio_write(g_ledcfg[led], ledon ? g_ledon[led] : g_ledoff[led]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* 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++)
|
||||||
|
{
|
||||||
|
nrf52_gpio_write(g_ledcfg[i], (ledset & (1 << i)) ? g_ledon[led] :
|
||||||
|
g_ledoff[led]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* !CONFIG_ARCH_LEDS */
|
@ -99,8 +99,8 @@
|
|||||||
|
|
||||||
/* Sensor Power Pin *********************************************************/
|
/* Sensor Power Pin *********************************************************/
|
||||||
|
|
||||||
/* The VDD_ENV must be driven high in order for sensors to receive power.
|
/* The VDD_ENV must be driven high in order for sensors to receive power. */
|
||||||
*/
|
|
||||||
#define BOARD_VDD_ENV_PIN (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN(22))
|
#define BOARD_VDD_ENV_PIN (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN(22))
|
||||||
|
|
||||||
/* I2C Pins *****************************************************************/
|
/* I2C Pins *****************************************************************/
|
||||||
|
@ -20,11 +20,11 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#if CONFIG_ARDUINONANO33BLE_ARDUINO_BOOTLOADER
|
#if CONFIG_ARDUINONANO33BLE_ARDUINO_BOOTLOADER
|
||||||
#define FLASH_START_ADDR 0x00010000
|
# define FLASH_START_ADDR 0x00010000
|
||||||
#define FLASH_LENGTH 960K
|
# define FLASH_LENGTH 960K
|
||||||
#else
|
#else
|
||||||
#define FLASH_START_ADDR 0x00000000
|
# define FLASH_START_ADDR 0x00000000
|
||||||
#define FLASH_LENGTH 1024K
|
# define FLASH_LENGTH 1024K
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MEMORY
|
MEMORY
|
||||||
|
Loading…
Reference in New Issue
Block a user