You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2026/10/16 14:15:40 UTC

(nuttx-apps) branch master updated: system/nxinit: use per-core trigger key

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 06a5ce3ed system/nxinit: use per-core trigger key
06a5ce3ed is described below

commit 06a5ce3ede22c8488bb7a2a7dc2b49d5c3e7049f
Author: wangjianyu3 <wa...@xiaomi.com>
AuthorDate: Wed Oct 14 15:01:55 2026 +0800

    system/nxinit: use per-core trigger key
    
    Triggers were written to the property "default" shared by all cores, so
    other cores re-ran the same "on" actions. Use init.trigger.<core>.
    
    Cross-core trigger examples:
      on property:init.trigger.ap=appinit   # wait for ap's appinit
      setprop init.trigger.audio appinit    # trigger audio's appinit
    
    Assisted-by: OpenCode:claude-sonnet-5 Kiro:claude-opus-5.5
    Signed-off-by: wangjianyu3 <wa...@xiaomi.com>
---
 system/nxinit/action.c |  6 ++----
 system/nxinit/action.h | 18 ++++++++++++++++++
 system/nxinit/init.c   |  6 ++++++
 3 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/system/nxinit/action.c b/system/nxinit/action.c
index d83790a27..11d5c5ed8 100644
--- a/system/nxinit/action.c
+++ b/system/nxinit/action.c
@@ -47,8 +47,6 @@
 #define ACTION_SECTION_PROP_PREFIX "property:"
 #define ACTION_SECTION_AND_PREFIX  "&&"
 
-#define ACTION_PROP_KEY_DEFAULT    "default"
-
 /****************************************************************************
  * Private Types
  ****************************************************************************/
@@ -356,7 +354,7 @@ void init_action_trigger_event(FAR struct action_manager_s *am,
 int init_action_add_event(FAR struct action_manager_s *am,
                           FAR const char *event)
 {
-  return init_property_set(am->prop, ACTION_PROP_KEY_DEFAULT, event);
+  return init_property_set(am->prop, ACTION_TRIGGER_KEY(am), event);
 }
 
 /****************************************************************************
@@ -511,7 +509,7 @@ int init_action_parse(FAR const struct parser_s *parser,
             {
               char tmp[CONFIG_SYSTEM_NXINIT_RC_LINE_MAX];
 
-              sprintf(tmp, ":%s=%s", ACTION_PROP_KEY_DEFAULT, argv[ret]);
+              sprintf(tmp, ":%s=%s", ACTION_TRIGGER_KEY(am), argv[ret]);
               n = parse_event(tmp, a->events, nitems(a->events));
               if (n < 0)
                 {
diff --git a/system/nxinit/action.h b/system/nxinit/action.h
index b1d547b0a..27ff190c2 100644
--- a/system/nxinit/action.h
+++ b/system/nxinit/action.h
@@ -34,6 +34,21 @@
 
 #include "parser.h"
 
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define ACTION_PROP_KEY_TRIGGER "init.trigger"
+
+#ifdef CONFIG_BMP
+#  define ACTION_TRIGGER_KEY(am) ((am)->trigger_key)
+#elif defined(CONFIG_RPMSG_LOCAL_CPUNAME)
+#  define ACTION_TRIGGER_KEY(am) \
+     ACTION_PROP_KEY_TRIGGER "." CONFIG_RPMSG_LOCAL_CPUNAME
+#else
+#  define ACTION_TRIGGER_KEY(am) ACTION_PROP_KEY_TRIGGER
+#endif
+
 /****************************************************************************
  * Public Types
  ****************************************************************************/
@@ -88,6 +103,9 @@ struct action_manager_s
   FAR struct init_poller_s *prop;
 
   sigset_t sigmask;               /* Signal mask before init blocked all */
+#ifdef CONFIG_BMP
+  char trigger_key[64];
+#endif
 };
 
 /* Event evaluation result reported by init_action_event_cb.
diff --git a/system/nxinit/init.c b/system/nxinit/init.c
index ddb783db2..cda3317d9 100644
--- a/system/nxinit/init.c
+++ b/system/nxinit/init.c
@@ -29,6 +29,7 @@
 #include <errno.h>
 #include <inttypes.h>
 #include <poll.h>
+#include <sched.h>
 #include <stdio.h>
 #include <string.h>
 #include <sys/boardctl.h>
@@ -227,6 +228,11 @@ int main(int argc, FAR char *argv[])
   size_t i;
   int r;
 
+#ifdef CONFIG_BMP
+  snprintf(ACTION_TRIGGER_KEY(&am), sizeof(ACTION_TRIGGER_KEY(&am)),
+           ACTION_PROP_KEY_TRIGGER ".core%d", sched_getcpu());
+#endif
+
   sigfillset(&mask);
   r = sigprocmask(SIG_BLOCK, &mask, &am.sigmask);
   sigemptyset(&mask);