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

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

commit 48307b3a4873ed524a18f2354ba1263b7ead4329
Author: Matteo Golin <[email protected]>
AuthorDate: Wed Feb 18 23:25:09 2026 -0500

    boards/sparc: Replace board_app_initialize
    
    Replaced board_app_initialize logic with board_late_initialize.
    
    Signed-off-by: Matteo Golin <[email protected]>
---
 boards/sparc/bm3803/xx3803/src/Makefile            |   3 -
 boards/sparc/bm3803/xx3803/src/bm3803_appinit.c    | 159 ---------------------
 boards/sparc/bm3803/xx3803/src/bm3803_boot.c       | 104 +++++++++++++-
 boards/sparc/bm3823/xx3823/src/Makefile            |   4 -
 boards/sparc/bm3823/xx3823/src/bm3823_appinit.c    | 119 ---------------
 boards/sparc/bm3823/xx3823/src/bm3823_boot.c       |  63 +++++++-
 boards/sparc/s698pm/s698pm-dkit/src/Makefile       |   4 -
 .../sparc/s698pm/s698pm-dkit/src/s698pm_appinit.c  | 110 --------------
 boards/sparc/s698pm/s698pm-dkit/src/s698pm_boot.c  |  56 +++++++-
 9 files changed, 220 insertions(+), 402 deletions(-)

diff --git a/boards/sparc/bm3803/xx3803/src/Makefile 
b/boards/sparc/bm3803/xx3803/src/Makefile
index f970f8d9566..95a09a6e16e 100644
--- a/boards/sparc/bm3803/xx3803/src/Makefile
+++ b/boards/sparc/bm3803/xx3803/src/Makefile
@@ -25,12 +25,9 @@
 ASRCS =
 CSRCS = bm3803_boot.c
 
-ifeq ($(CONFIG_BOARDCTL),y)
-CSRCS += bm3803_appinit.c
 ifeq ($(CONFIG_BOARDCTL_RESET),y)
 CSRCS += bm3803_reset.c
 endif
-endif
 
 ifeq ($(CONFIG_MTD_AM29LV),y)
 CSRCS += bm3803_am29lv.c
diff --git a/boards/sparc/bm3803/xx3803/src/bm3803_appinit.c 
b/boards/sparc/bm3803/xx3803/src/bm3803_appinit.c
deleted file mode 100644
index 3564610833f..00000000000
--- a/boards/sparc/bm3803/xx3803/src/bm3803_appinit.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/****************************************************************************
- * boards/sparc/bm3803/xx3803/src/bm3803_appinit.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * 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/mount.h>
-#include <stdio.h>
-#include <syslog.h>
-
-#include <nuttx/board.h>
-#include <nuttx/timers/oneshot.h>
-#include "bm3803_wdg.h"
-#include "bm3803.h"
-#include "xx3803.h"
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/* Configuration ************************************************************/
-
-/* Assume that we support everything until convinced otherwise */
-
-#define HAVE_AM29LV      1
-
-/* Can't support the AM29LV device if it AM29LV support is not enabled */
-
-#if !defined(CONFIG_MTD_AM29LV)
-#  undef HAVE_AM29LV
-#endif
-
-/* Can't support AM29LV features if mountpoints are disabled */
-
-#ifdef CONFIG_DISABLE_MOUNTPOINT
-#  undef HAVE_AM29LV
-#endif
-
-/* Default AM29LV minor number */
-
-#if defined(HAVE_AM29LV) && !defined(CONFIG_NSH_AM29LVMINOR)
-#  define CONFIG_NSH_AM29LVMINOR 0
-#endif
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: board_app_initialize
- *
- * Description:
- *   Perform application specific initialization.  This function is never
- *   called directly from application code, but only indirectly via the
- *   (non-standard) boardctl() interface using the command BOARDIOC_INIT.
- *
- * 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 cold 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_ONESHOT
-  struct oneshot_lowerhalf_s *os = NULL;
-#endif
-  int ret;
-
-  /* Initialize and register the AM29LV FLASH file system. */
-
-#ifdef HAVE_AM29LV
-  ret = bm3803_am29lv_initialize(CONFIG_NSH_AM29LVMINOR);
-  if (ret < 0)
-    {
-      syslog(LOG_ERR, "ERROR: Failed to initialize AM29LV minor %d: %d\n",
-             CONFIG_NSH_AM29LVMINOR, ret);
-      return ret;
-    }
-#endif
-
-#ifdef CONFIG_ONESHOT
-  os = oneshot_initialize(1, 10);
-  if (os)
-    {
-      ret = oneshot_register("/dev/oneshot", os);
-    }
-#endif
-
-#ifdef CONFIG_BM3803_WDG
-  /* Initialize the watchdog timer */
-
-  bm3803_wdginitialize("/dev/watchdog0");
-#endif
-
-#ifdef CONFIG_XX3803_WDG
-  /* Start WDG kicker thread */
-
-  ret = xx3803_watchdog_initialize();
-  if (ret != OK)
-    {
-      syslog(LOG_ERR, "Failed to start watchdog thread: %d\n", ret);
-      return ret;
-    }
-#endif
-
-#ifdef CONFIG_FS_PROCFS
-  /* Mount the procfs file system */
-
-  ret = mount(NULL, BM3803_PROCFS_MOUNTPOINT, "procfs", 0, NULL);
-  if (ret < 0)
-    {
-      syslog(LOG_ERR, "Failed to mount procfs at %s: %d\n",
-           BM3803_PROCFS_MOUNTPOINT, ret);
-    }
-#endif
-
-  return ret;
-}
diff --git a/boards/sparc/bm3803/xx3803/src/bm3803_boot.c 
b/boards/sparc/bm3803/xx3803/src/bm3803_boot.c
index 2c2fd529169..e0f2f47412b 100644
--- a/boards/sparc/bm3803/xx3803/src/bm3803_boot.c
+++ b/boards/sparc/bm3803/xx3803/src/bm3803_boot.c
@@ -28,16 +28,47 @@
 
 #include <nuttx/debug.h>
 
+#include <sys/mount.h>
+#include <stdio.h>
+#include <syslog.h>
+
 #include <arch/board/board.h>
+#include <nuttx/board.h>
+#include <nuttx/timers/oneshot.h>
 
 #include "sparc_internal.h"
+#include "bm3803_wdg.h"
 #include "bm3803.h"
 #include "xx3803.h"
 
 /****************************************************************************
- * Definitions
+ * Pre-processor Definitions
  ****************************************************************************/
 
+/* Configuration ************************************************************/
+
+/* Assume that we support everything until convinced otherwise */
+
+#define HAVE_AM29LV      1
+
+/* Can't support the AM29LV device if it AM29LV support is not enabled */
+
+#if !defined(CONFIG_MTD_AM29LV)
+#  undef HAVE_AM29LV
+#endif
+
+/* Can't support AM29LV features if mountpoints are disabled */
+
+#ifdef CONFIG_DISABLE_MOUNTPOINT
+#  undef HAVE_AM29LV
+#endif
+
+/* Default AM29LV minor number */
+
+#if defined(HAVE_AM29LV) && !defined(CONFIG_NSH_AM29LVMINOR)
+#  define CONFIG_NSH_AM29LVMINOR 0
+#endif
+
 /****************************************************************************
  * Private Functions
  ****************************************************************************/
@@ -73,3 +104,74 @@ void bm3803_boardinitialize(void)
   BM3803_REG.timer_cnt1 = 0;
   BM3803_REG.timer_load1 = 0;
 }
+
+/****************************************************************************
+ * 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)
+{
+#ifdef CONFIG_ONESHOT
+  struct oneshot_lowerhalf_s *os = NULL;
+#endif
+  int ret;
+
+  /* Initialize and register the AM29LV FLASH file system. */
+
+#ifdef HAVE_AM29LV
+  ret = bm3803_am29lv_initialize(CONFIG_NSH_AM29LVMINOR);
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "ERROR: Failed to initialize AM29LV minor %d: %d\n",
+             CONFIG_NSH_AM29LVMINOR, ret);
+      return;
+    }
+#endif
+
+#ifdef CONFIG_ONESHOT
+  os = oneshot_initialize(1, 10);
+  if (os)
+    {
+      ret = oneshot_register("/dev/oneshot", os);
+    }
+#endif
+
+#ifdef CONFIG_BM3803_WDG
+  /* Initialize the watchdog timer */
+
+  bm3803_wdginitialize("/dev/watchdog0");
+#endif
+
+#ifdef CONFIG_XX3803_WDG
+  /* Start WDG kicker thread */
+
+  ret = xx3803_watchdog_initialize();
+  if (ret != OK)
+    {
+      syslog(LOG_ERR, "Failed to start watchdog thread: %d\n", ret);
+      return;
+    }
+#endif
+
+#ifdef CONFIG_FS_PROCFS
+  /* Mount the procfs file system */
+
+  ret = mount(NULL, BM3803_PROCFS_MOUNTPOINT, "procfs", 0, NULL);
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "Failed to mount procfs at %s: %d\n",
+           BM3803_PROCFS_MOUNTPOINT, ret);
+    }
+#endif
+}
+#endif /* CONFIG_BOARD_LATE_INITIALIZE */
diff --git a/boards/sparc/bm3823/xx3823/src/Makefile 
b/boards/sparc/bm3823/xx3823/src/Makefile
index 7079b5fd50f..c510a066faa 100644
--- a/boards/sparc/bm3823/xx3823/src/Makefile
+++ b/boards/sparc/bm3823/xx3823/src/Makefile
@@ -25,10 +25,6 @@
 ASRCS =
 CSRCS = bm3823_boot.c bm3823_leds.c
 
-ifeq ($(CONFIG_LIB_BOARDCTL),y)
-CSRCS += bm3823_appinit.c
-endif
-
 ifeq ($(CONFIG_MTD_AM29LV),y)
 CSRCS += bm3823_am29lv.c
 endif
diff --git a/boards/sparc/bm3823/xx3823/src/bm3823_appinit.c 
b/boards/sparc/bm3823/xx3823/src/bm3823_appinit.c
deleted file mode 100644
index 61ebbe507bc..00000000000
--- a/boards/sparc/bm3823/xx3823/src/bm3823_appinit.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/****************************************************************************
- * boards/sparc/bm3823/xx3823/src/bm3823_appinit.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * 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 <syslog.h>
-
-#include <nuttx/board.h>
-
-#include "bm3823.h"
-#include "xx3823.h"
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/* Configuration ************************************************************/
-
-/* Assume that we support everything until convinced otherwise */
-
-#define HAVE_AM29LV      1
-
-/* Can't support the AM29LV device if it AM29LV support is not enabled */
-
-#if !defined(CONFIG_MTD_AM29LV)
-#  undef HAVE_AM29LV
-#endif
-
-/* Can't support AM29LV features if mountpoints are disabled */
-
-#ifdef CONFIG_DISABLE_MOUNTPOINT
-#  undef HAVE_AM29LV
-#endif
-
-/* Default AM29LV minor number */
-
-#if defined(HAVE_AM29LV) && !defined(CONFIG_NSH_AM29LVMINOR)
-#  define CONFIG_NSH_AM29LVMINOR 0
-#endif
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: board_app_initialize
- *
- * Description:
- *   Perform application specific initialization.  This function is never
- *   called directly from application code, but only indirectly via the
- *   (non-standard) boardctl() interface using the command BOARDIOC_INIT.
- *
- * 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 cold 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)
-{
-  int ret;
-
-  /* Initialize and register the AM29LV FLASH file system. */
-
-#ifdef HAVE_AM29LV
-  ret = bm3823_am29lv_initialize(CONFIG_NSH_AM29LVMINOR);
-  if (ret < 0)
-    {
-      syslog(LOG_ERR, "ERROR: Failed to initialize AM29LV minor %d: %d\n",
-             CONFIG_NSH_AM29LVMINOR, ret);
-      return ret;
-    }
-#endif
-
-  return ret;
-}
diff --git a/boards/sparc/bm3823/xx3823/src/bm3823_boot.c 
b/boards/sparc/bm3823/xx3823/src/bm3823_boot.c
index 321be8c8a4b..43932f79dd1 100644
--- a/boards/sparc/bm3823/xx3823/src/bm3823_boot.c
+++ b/boards/sparc/bm3823/xx3823/src/bm3823_boot.c
@@ -28,16 +28,45 @@
 
 #include <nuttx/debug.h>
 
+#include <debug.h>
+#include <stdio.h>
+#include <syslog.h>
+
 #include <arch/board/board.h>
+#include <nuttx/board.h>
 
 #include "sparc_internal.h"
 #include "bm3823.h"
 #include "xx3823.h"
 
 /****************************************************************************
- * Definitions
+ * Pre-processor Definitions
  ****************************************************************************/
 
+/* Configuration ************************************************************/
+
+/* Assume that we support everything until convinced otherwise */
+
+#define HAVE_AM29LV      1
+
+/* Can't support the AM29LV device if it AM29LV support is not enabled */
+
+#if !defined(CONFIG_MTD_AM29LV)
+#  undef HAVE_AM29LV
+#endif
+
+/* Can't support AM29LV features if mountpoints are disabled */
+
+#ifdef CONFIG_DISABLE_MOUNTPOINT
+#  undef HAVE_AM29LV
+#endif
+
+/* Default AM29LV minor number */
+
+#if defined(HAVE_AM29LV) && !defined(CONFIG_NSH_AM29LVMINOR)
+#  define CONFIG_NSH_AM29LVMINOR 0
+#endif
+
 /****************************************************************************
  * Private Functions
  ****************************************************************************/
@@ -69,3 +98,35 @@ void bm3823_boardinitialize(void)
   bm3823_led_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)
+{
+  int ret;
+
+  /* Initialize and register the AM29LV FLASH file system. */
+
+#ifdef HAVE_AM29LV
+  ret = bm3823_am29lv_initialize(CONFIG_NSH_AM29LVMINOR);
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "ERROR: Failed to initialize AM29LV minor %d: %d\n",
+             CONFIG_NSH_AM29LVMINOR, ret);
+      return;
+    }
+#endif
+}
+#endif /* CONFIG_BOARD_LATE_INITIALIZE */
diff --git a/boards/sparc/s698pm/s698pm-dkit/src/Makefile 
b/boards/sparc/s698pm/s698pm-dkit/src/Makefile
index 4965f146f74..7f70cdf5f01 100644
--- a/boards/sparc/s698pm/s698pm-dkit/src/Makefile
+++ b/boards/sparc/s698pm/s698pm-dkit/src/Makefile
@@ -25,10 +25,6 @@
 ASRCS =
 CSRCS = s698pm_boot.c
 
-ifeq ($(CONFIG_BOARDCTL),y)
-CSRCS += s698pm_appinit.c
-endif
-
 ifeq ($(CONFIG_S698PM_WDG),y)
 CSRCS += s698pm_wdt.c
 endif
diff --git a/boards/sparc/s698pm/s698pm-dkit/src/s698pm_appinit.c 
b/boards/sparc/s698pm/s698pm-dkit/src/s698pm_appinit.c
deleted file mode 100644
index caf703c1dc2..00000000000
--- a/boards/sparc/s698pm/s698pm-dkit/src/s698pm_appinit.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/****************************************************************************
- * boards/sparc/s698pm/s698pm-dkit/src/s698pm_appinit.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * 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/mount.h>
-#include <stdio.h>
-#include <syslog.h>
-
-#include <nuttx/board.h>
-#include "s698pm.h"
-#include "s698pm-dkit.h"
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: board_app_initialize
- *
- * Description:
- *   Perform application specific initialization.  This function is never
- *   called directly from application code, but only indirectly via the
- *   (non-standard) boardctl() interface using the command BOARDIOC_INIT.
- *
- * 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 cold 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)
-{
-  int ret;
-
-#ifdef CONFIG_S698PM_WDG
-  /* Initialize the watchdog timer */
-
-  s698pm_wdginitialize("/dev/watchdog0");
-#endif
-
-#ifdef CONFIG_S698PM_DKIT_WDG
-  /* Start WDG kicker thread */
-
-  ret = s698pm_dkit_watchdog_initialize();
-  if (ret != OK)
-    {
-      syslog(LOG_ERR, "Failed to start watchdog thread: %d\n", ret);
-      return ret;
-    }
-#endif
-
-#ifdef CONFIG_FS_PROCFS
-  /* Mount the procfs file system */
-
-  ret = mount(NULL, S698PM_PROCFS_MOUNTPOINT, "procfs", 0, NULL);
-  if (ret < 0)
-    {
-      syslog(LOG_ERR, "Failed to mount procfs at %s: %d\n",
-             S698PM_PROCFS_MOUNTPOINT, ret);
-    }
-#endif
-
-  return ret;
-}
diff --git a/boards/sparc/s698pm/s698pm-dkit/src/s698pm_boot.c 
b/boards/sparc/s698pm/s698pm-dkit/src/s698pm_boot.c
index 98455b9b423..773a11d045e 100644
--- a/boards/sparc/s698pm/s698pm-dkit/src/s698pm_boot.c
+++ b/boards/sparc/s698pm/s698pm-dkit/src/s698pm_boot.c
@@ -28,14 +28,20 @@
 
 #include <nuttx/debug.h>
 
+#include <debug.h>
+#include <sys/mount.h>
+#include <stdio.h>
+#include <syslog.h>
+
 #include <arch/board/board.h>
+#include <nuttx/board.h>
 
 #include "sparc_internal.h"
 #include "s698pm.h"
 #include "s698pm-dkit.h"
 
 /****************************************************************************
- * Definitions
+ * Pre-processor Definitions
  ****************************************************************************/
 
 /****************************************************************************
@@ -65,3 +71,51 @@ void s698pm_boardinitialize(void)
   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)
+{
+  int ret;
+
+#ifdef CONFIG_S698PM_WDG
+  /* Initialize the watchdog timer */
+
+  s698pm_wdginitialize("/dev/watchdog0");
+#endif
+
+#ifdef CONFIG_S698PM_DKIT_WDG
+  /* Start WDG kicker thread */
+
+  ret = s698pm_dkit_watchdog_initialize();
+  if (ret != OK)
+    {
+      syslog(LOG_ERR, "Failed to start watchdog thread: %d\n", ret);
+      return;
+    }
+#endif
+
+#ifdef CONFIG_FS_PROCFS
+  /* Mount the procfs file system */
+
+  ret = mount(NULL, S698PM_PROCFS_MOUNTPOINT, "procfs", 0, NULL);
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "Failed to mount procfs at %s: %d\n",
+             S698PM_PROCFS_MOUNTPOINT, ret);
+    }
+#endif
+}
+#endif /* CONFIG_BOARD_LATE_INITIALIZE */

Reply via email to