From 88758a810731c978e08d985d603b2aad82283663 Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Wed, 8 Mar 2023 09:08:58 +0100 Subject: [PATCH] porting/nuttx/example: perform initialization if not done by NSH For example, when Nimble NuttX example is the entry point for users applications. --- porting/examples/nuttx/main.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/porting/examples/nuttx/main.c b/porting/examples/nuttx/main.c index 7492e120e..9eeddec83 100644 --- a/porting/examples/nuttx/main.c +++ b/porting/examples/nuttx/main.c @@ -24,6 +24,9 @@ #include #include #include +#include + +#include "netutils/netinit.h" #include "nimble/nimble_npl.h" #include "nimble/nimble_port.h" @@ -71,6 +74,18 @@ int main(int argc, char *argv[]) ble_hci_sock_set_device(atoi(argv[1])); } +#ifndef CONFIG_NSH_ARCHINIT + /* Perform architecture-specific initialization */ + + boardctl(BOARDIOC_INIT, 0); +#endif + +#ifndef CONFIG_NSH_NETINIT + /* Bring up the network */ + + netinit_bringup(); +#endif + printf("port init\n"); nimble_port_init();