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

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 101f4f6fef812a53e5b2638cb7ba7cf1e82e2e9c
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Sun Jun 1 12:46:46 2025 +0200

    sys/fault: Register command statically
    
    Now fault shell command is register at link time to
    reduce memory footprint.
    No change in functionality.
    
    Signed-off-by: Jerzy Kasenberg <[email protected]>
---
 sys/fault/fault_cli/pkg.yml         |  3 +--
 sys/fault/fault_cli/src/fault_cli.c | 17 +----------------
 sys/fault/fault_cli/syscfg.yml      |  4 ----
 3 files changed, 2 insertions(+), 22 deletions(-)

diff --git a/sys/fault/fault_cli/pkg.yml b/sys/fault/fault_cli/pkg.yml
index 7245af455..d2b1ad89b 100644
--- a/sys/fault/fault_cli/pkg.yml
+++ b/sys/fault/fault_cli/pkg.yml
@@ -28,5 +28,4 @@ pkg.deps:
     - "@apache-mynewt-core/sys/shell"
     - "@apache-mynewt-core/util/parse"
 
-pkg.init:
-    fault_cli_init: 'MYNEWT_VAL(FAULT_CLI_SYSINIT_STAGE)'
+pkg.whole_archive: true
diff --git a/sys/fault/fault_cli/src/fault_cli.c 
b/sys/fault/fault_cli/src/fault_cli.c
index 37fc2c130..126860f22 100644
--- a/sys/fault/fault_cli/src/fault_cli.c
+++ b/sys/fault/fault_cli/src/fault_cli.c
@@ -27,8 +27,6 @@
 #include "shell/shell.h"
 #include "fault/fault.h"
 
-static int fault_cli_cmd_fn(int argc, char **argv);
-
 static const struct shell_cmd_help fault_cli_help = {
     .summary = "Fault management",
     .usage = 
@@ -49,12 +47,6 @@ static const struct shell_cmd_help fault_cli_help = {
         "    Simulates a fatal success for the given domain.\n",
 };
 
-static const struct shell_cmd fault_cli_cmd = {
-    .sc_cmd = "fault",
-    .sc_cmd_func = fault_cli_cmd_fn,
-    .help = &fault_cli_help,
-};
-
 static int
 fault_cli_parse_domain(const char *arg)
 {
@@ -248,11 +240,4 @@ fault_cli_cmd_fn(int argc, char **argv)
     return SYS_EINVAL;
 }
 
-void
-fault_cli_init(void)
-{
-    int rc;
-
-    rc = shell_cmd_register(&fault_cli_cmd);
-    SYSINIT_PANIC_ASSERT(rc == 0);
-}
+MAKE_SHELL_CMD(fault, fault_cli_cmd_fn, &fault_cli_help)
diff --git a/sys/fault/fault_cli/syscfg.yml b/sys/fault/fault_cli/syscfg.yml
index 70b026881..9d3c811a8 100644
--- a/sys/fault/fault_cli/syscfg.yml
+++ b/sys/fault/fault_cli/syscfg.yml
@@ -18,7 +18,3 @@
 #
 
 syscfg.defs:
-    FAULT_CLI_SYSINIT_STAGE:
-        description: >
-            Sysinit stage for the fault CLI.
-        value: 520

Reply via email to