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-apps.git

commit 6d178011d5b636a2a802dea38d890cb191e8af7a
Author: jingfei <[email protected]>
AuthorDate: Sun Nov 23 22:11:50 2025 +0800

    system/nxinit: Add start_cpu support for action
    
    Add support for starting a cpu's software.
    Depends on `BOARDCTL_START_CPU`.
    
    Signed-off-by: jingfei <[email protected]>
---
 system/nxinit/builtin.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/system/nxinit/builtin.c b/system/nxinit/builtin.c
index 807bfb734..8ebeb4c02 100644
--- a/system/nxinit/builtin.c
+++ b/system/nxinit/builtin.c
@@ -77,6 +77,11 @@ static int cmd_boot(FAR struct action_manager_s *am,
                     int argc, FAR char **argv);
 #endif
 
+#ifdef CONFIG_BOARDCTL_START_CPU
+static int cmd_start_cpu(FAR struct action_manager_s *am,
+                         int argc, FAR char **argv);
+#endif
+
 /****************************************************************************
  * Private Data
  ****************************************************************************/
@@ -85,6 +90,9 @@ static const struct cmd_map_s g_builtin[] =
 {
 #ifdef CONFIG_BOARDCTL_BOOT_IMAGE
   {"boot", 1, 3, cmd_boot},
+#endif
+#ifdef CONFIG_BOARDCTL_START_CPU
+  {"start_cpu", 1, 3, cmd_start_cpu},
 #endif
   {"class_start", 2, 2, cmd_class_start},
   {"class_stop", 2, 2, cmd_class_stop},
@@ -128,6 +136,22 @@ static int cmd_boot(FAR struct action_manager_s *am,
 }
 #endif
 
+#ifdef CONFIG_BOARDCTL_START_CPU
+static int cmd_start_cpu(FAR struct action_manager_s *am,
+                         int argc, FAR char **argv)
+{
+  int cpuid = 0;
+
+  if (argc > 1)
+    {
+      cpuid = strtol(argv[1], NULL, 0);
+    }
+
+  init_info("start cpu %d", cpuid);
+  return boardctl(BOARDIOC_START_CPU, cpuid);
+}
+#endif
+
 static int cmd_class_start(FAR struct action_manager_s *am,
                            int argc, FAR char **argv)
 {

Reply via email to