You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/12/17 17:24:55 UTC

[incubator-nuttx] 02/04: boards/arm/nrf52/nrf52832-dk: add procfs support

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

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

commit 2bb01b25bd1c26320a971d6becad95966e2ec9ac
Author: raiden00pl <ra...@railab.me>
AuthorDate: Fri Dec 17 15:53:10 2021 +0100

    boards/arm/nrf52/nrf52832-dk: add procfs support
---
 boards/arm/nrf52/nrf52832-dk/src/nrf52832-dk.h   | 12 ++++++++++++
 boards/arm/nrf52/nrf52832-dk/src/nrf52_bringup.c | 15 +++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/boards/arm/nrf52/nrf52832-dk/src/nrf52832-dk.h b/boards/arm/nrf52/nrf52832-dk/src/nrf52832-dk.h
index e3a379b..bdf5c8f 100644
--- a/boards/arm/nrf52/nrf52832-dk/src/nrf52832-dk.h
+++ b/boards/arm/nrf52/nrf52832-dk/src/nrf52832-dk.h
@@ -34,6 +34,18 @@
  * Pre-processor Definitions
  ****************************************************************************/
 
+/* Configuration ************************************************************/
+
+/* procfs File System */
+
+#ifdef CONFIG_FS_PROCFS
+#  ifdef CONFIG_NSH_PROC_MOUNTPOINT
+#    define NRF52_PROCFS_MOUNTPOINT CONFIG_NSH_PROC_MOUNTPOINT
+#  else
+#    define NRF52_PROCFS_MOUNTPOINT "/proc"
+#  endif
+#endif
+
 /* LED definitions **********************************************************/
 
 /* Definitions to configure LED GPIO as outputs */
diff --git a/boards/arm/nrf52/nrf52832-dk/src/nrf52_bringup.c b/boards/arm/nrf52/nrf52832-dk/src/nrf52_bringup.c
index 43f7c76..5f37940 100644
--- a/boards/arm/nrf52/nrf52832-dk/src/nrf52_bringup.c
+++ b/boards/arm/nrf52/nrf52832-dk/src/nrf52_bringup.c
@@ -27,6 +27,8 @@
 #include <sys/types.h>
 #include <syslog.h>
 
+#include <nuttx/fs/fs.h>
+
 #ifdef CONFIG_NRF52_WDT
 #  include "nrf52_wdt_lowerhalf.h"
 #endif
@@ -35,6 +37,8 @@
 #  include <nuttx/leds/userled.h>
 #endif
 
+#include "nrf52832-dk.h"
+
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
@@ -57,6 +61,17 @@ int nrf52_bringup(void)
 {
   int ret;
 
+#ifdef CONFIG_FS_PROCFS
+  /* Mount the procfs file system */
+
+  ret = nx_mount(NULL, NRF52_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_NRF52_WDT
   /* Start Watchdog timer */