boards/nrf5340-dk: add RPMSG HCI controller support and examples
This commit is contained in:
parent
bd9bfa9302
commit
d3fd1f50aa
@ -0,0 +1,68 @@
|
||||
#
|
||||
# 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_NET_ETHERNET is not set
|
||||
# CONFIG_NET_IPv4 is not set
|
||||
# CONFIG_STANDARD_SERIAL is not set
|
||||
CONFIG_ALLOW_BSD_COMPONENTS=y
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="nrf5340-dk"
|
||||
CONFIG_ARCH_BOARD_NRF5340_DK=y
|
||||
CONFIG_ARCH_CHIP="nrf53"
|
||||
CONFIG_ARCH_CHIP_NRF5340=y
|
||||
CONFIG_ARCH_CHIP_NRF5340_CPUAPP=y
|
||||
CONFIG_ARCH_CHIP_NRF53=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_ARCH_STDARG_H=y
|
||||
CONFIG_BLUETOOTH_MAX_CONN=2
|
||||
CONFIG_BLUETOOTH_RPMSG=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=5500
|
||||
CONFIG_BTSAK=y
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEV_SIMPLE_ADDRENV=y
|
||||
CONFIG_DRIVERS_BLUETOOTH=y
|
||||
CONFIG_DRIVERS_WIRELESS=y
|
||||
CONFIG_EXPERIMENTAL=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_IDLETHREAD_STACKSIZE=2048
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_MM_REGIONS=2
|
||||
CONFIG_NET=y
|
||||
CONFIG_NETDEV_LATEINIT=y
|
||||
CONFIG_NET_BLUETOOTH=y
|
||||
CONFIG_NRF53_OSCILLATOR_LFXO=y
|
||||
CONFIG_NRF53_UART0=y
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_DISABLE_IFUPDOWN=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_LINELEN=64
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_OPENAMP=y
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
CONFIG_PTHREAD_MUTEX_TYPES=y
|
||||
CONFIG_RAM_SIZE=524288
|
||||
CONFIG_RAM_START=0x20000000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_RPTUN=y
|
||||
CONFIG_RPTUN_LOCAL_CPUNAME="cpuapp"
|
||||
CONFIG_RPTUN_PING=y
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SIG_EVTHREAD=y
|
||||
CONFIG_STACK_CANARIES=y
|
||||
CONFIG_STACK_COLORATION=y
|
||||
CONFIG_STACK_USAGE=y
|
||||
CONFIG_START_DAY=26
|
||||
CONFIG_START_MONTH=3
|
||||
CONFIG_SYMTAB_ORDEREDBYNAME=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_TASK_NAME_SIZE=64
|
||||
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||
CONFIG_WIRELESS=y
|
||||
CONFIG_WIRELESS_BLUETOOTH=y
|
@ -0,0 +1,69 @@
|
||||
#
|
||||
# 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_NET_ETHERNET is not set
|
||||
# CONFIG_NET_IPv4 is not set
|
||||
# CONFIG_STANDARD_SERIAL is not set
|
||||
# CONFIG_WIRELESS_BLUETOOTH_HOST is not set
|
||||
CONFIG_ALLOW_BSD_COMPONENTS=y
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="nrf5340-dk"
|
||||
CONFIG_ARCH_BOARD_NRF5340_DK=y
|
||||
CONFIG_ARCH_CHIP="nrf53"
|
||||
CONFIG_ARCH_CHIP_NRF5340=y
|
||||
CONFIG_ARCH_CHIP_NRF5340_CPUAPP=y
|
||||
CONFIG_ARCH_CHIP_NRF53=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_ARCH_STDARG_H=y
|
||||
CONFIG_BLUETOOTH_MAX_CONN=2
|
||||
CONFIG_BLUETOOTH_RPMSG=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=5500
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEV_SIMPLE_ADDRENV=y
|
||||
CONFIG_DRIVERS_BLUETOOTH=y
|
||||
CONFIG_DRIVERS_WIRELESS=y
|
||||
CONFIG_EXPERIMENTAL=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_IDLETHREAD_STACKSIZE=2048
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_MM_REGIONS=2
|
||||
CONFIG_NET=y
|
||||
CONFIG_NETDEV_LATEINIT=y
|
||||
CONFIG_NET_BLUETOOTH=y
|
||||
CONFIG_NIMBLE=y
|
||||
CONFIG_NRF53_OSCILLATOR_LFXO=y
|
||||
CONFIG_NRF53_UART0=y
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_DISABLE_IFUPDOWN=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_LINELEN=64
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_OPENAMP=y
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
CONFIG_PTHREAD_MUTEX_TYPES=y
|
||||
CONFIG_RAM_SIZE=524288
|
||||
CONFIG_RAM_START=0x20000000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_RPTUN=y
|
||||
CONFIG_RPTUN_LOCAL_CPUNAME="cpuapp"
|
||||
CONFIG_RPTUN_PING=y
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SIG_EVTHREAD=y
|
||||
CONFIG_STACK_CANARIES=y
|
||||
CONFIG_STACK_COLORATION=y
|
||||
CONFIG_STACK_USAGE=y
|
||||
CONFIG_START_DAY=26
|
||||
CONFIG_START_MONTH=3
|
||||
CONFIG_SYMTAB_ORDEREDBYNAME=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_TASK_NAME_SIZE=64
|
||||
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||
CONFIG_WIRELESS=y
|
||||
CONFIG_WIRELESS_BLUETOOTH=y
|
@ -0,0 +1,55 @@
|
||||
#
|
||||
# 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_STANDARD_SERIAL is not set
|
||||
CONFIG_ALLOW_BSDNORDIC_COMPONENTS=y
|
||||
CONFIG_ALLOW_BSD_COMPONENTS=y
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="nrf5340-dk"
|
||||
CONFIG_ARCH_BOARD_NRF5340_DK=y
|
||||
CONFIG_ARCH_CHIP="nrf53"
|
||||
CONFIG_ARCH_CHIP_NRF5340=y
|
||||
CONFIG_ARCH_CHIP_NRF5340_CPUNET=y
|
||||
CONFIG_ARCH_CHIP_NRF53=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_ARCH_STDARG_H=y
|
||||
CONFIG_BLUETOOTH_RPMSG_SERVER=y
|
||||
CONFIG_BOARDCTL=y
|
||||
CONFIG_BOARDCTL_MKRD=y
|
||||
CONFIG_BOARD_LATE_INITIALIZE=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=5500
|
||||
CONFIG_DEV_SIMPLE_ADDRENV=y
|
||||
CONFIG_DRIVERS_BLUETOOTH=y
|
||||
CONFIG_DRIVERS_WIRELESS=y
|
||||
CONFIG_EXAMPLES_HELLO=y
|
||||
CONFIG_EXPERIMENTAL=y
|
||||
CONFIG_INIT_ENTRYPOINT="hello_main"
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_MM_REGIONS=2
|
||||
CONFIG_NRF53_SDC_MAX_COUNT=2
|
||||
CONFIG_NRF53_SDC_PUB_ADDR=0x0102030405
|
||||
CONFIG_NRF53_SOFTDEVICE_CONTROLLER=y
|
||||
CONFIG_NRF53_UART0=y
|
||||
CONFIG_OPENAMP=y
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
CONFIG_RAM_SIZE=65535
|
||||
CONFIG_RAM_START=0x21000000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_RPTUN=y
|
||||
CONFIG_RPTUN_LOCAL_CPUNAME="cpunet"
|
||||
CONFIG_RPTUN_PING=y
|
||||
CONFIG_RPTUN_STACKSIZE=2048
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_LPWORK=y
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_START_DAY=26
|
||||
CONFIG_START_MONTH=3
|
||||
CONFIG_SYMTAB_ORDEREDBYNAME=y
|
||||
CONFIG_SYSLOG_MAX_CHANNELS=2
|
||||
CONFIG_SYSTEM_READLINE=y
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_UART0_SERIAL_CONSOLE=y
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <syslog.h>
|
||||
|
||||
@ -32,6 +33,9 @@
|
||||
#ifdef CONFIG_USERLED
|
||||
# include <nuttx/leds/userled.h>
|
||||
#endif
|
||||
#ifdef CONFIG_RPMSG_UART
|
||||
# include <nuttx/serial/uart_rpmsg.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_INPUT_BUTTONS
|
||||
# include <nuttx/input/buttons.h>
|
||||
@ -42,6 +46,13 @@
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_RPTUN
|
||||
# include <nuttx/wireless/bluetooth/bt_rpmsghci.h>
|
||||
# ifdef CONFIG_UART_BTH4
|
||||
# include <nuttx/serial/uart_bth4.h>
|
||||
# endif
|
||||
# ifdef CONFIG_NET_BLUETOOTH
|
||||
# include <nuttx/wireless/bluetooth/bt_driver.h>
|
||||
# endif
|
||||
# include "nrf53_rptun.h"
|
||||
#endif
|
||||
|
||||
@ -53,10 +64,101 @@
|
||||
|
||||
#define NRF53_TIMER (0)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NRF53_APPCORE
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nrf53_appcore_bleinit
|
||||
****************************************************************************/
|
||||
|
||||
static int nrf53_appcore_bleinit(void)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
#ifdef CONFIG_BLUETOOTH_RPMSG
|
||||
struct bt_driver_s *bt_dev = NULL;
|
||||
|
||||
bt_dev = rpmsghci_register("appcore", "bthci");
|
||||
if (bt_dev == NULL)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: rpmsghci_register() failed: %d\n", -errno);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
# ifdef CONFIG_UART_BTH4
|
||||
/* Register UART BT H4 device */
|
||||
|
||||
ret = uart_bth4_register("/dev/ttyHCI", bt_dev);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "bt_bth4_register error: %d\n", ret);
|
||||
}
|
||||
# elif defined(CONFIG_NET_BLUETOOTH)
|
||||
/* Register network device */
|
||||
|
||||
ret = bt_netdev_register(bt_dev);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "bt_netdev_register error: %d\n", ret);
|
||||
}
|
||||
# else
|
||||
# error
|
||||
# endif
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nrf53_netcore_bleinit
|
||||
****************************************************************************/
|
||||
|
||||
static int nrf53_netcore_bleinit(void)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
#ifdef CONFIG_NRF53_SOFTDEVICE_CONTROLLER
|
||||
# ifdef CONFIG_BLUETOOTH_RPMSG_SERVER
|
||||
ret = nrf53_rpmsghci_server_initialize("bthci");
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: nrf53_rpmsghci_server_initialize() failed: %d\n",
|
||||
ret);
|
||||
}
|
||||
# else
|
||||
ret = nrf53_sdc_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: nrf53_sdc_initialize() failed: %d\n", ret);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RPMSG_UART
|
||||
void rpmsg_serialinit(void)
|
||||
{
|
||||
#ifdef CONFIG_NRF53_APPCORE
|
||||
uart_rpmsg_init("appcore", "proxy", 4096, false);
|
||||
#else
|
||||
uart_rpmsg_init("netcore", "proxy", 4096, true);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nrf53_bringup
|
||||
*
|
||||
@ -150,12 +252,19 @@ int nrf53_bringup(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NRF53_SOFTDEVICE_CONTROLLER
|
||||
ret = nrf53_sdc_initialize();
|
||||
/* Initialize BLE */
|
||||
|
||||
#ifdef CONFIG_NRF53_APPCORE
|
||||
ret = nrf53_appcore_bleinit();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: nrf53_sdc_initialize() failed: %d\n", ret);
|
||||
syslog(LOG_ERR, "ERROR: nrf53_appcore_bleinit failed: %d\n", ret);
|
||||
}
|
||||
#else
|
||||
ret = nrf53_netcore_bleinit();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: nrf53_netcore_bleinit failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user