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 6020e86c73ff6606c1953d317ee3066e0006b87e
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Sun Jun 1 10:24:46 2025 +0200

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

diff --git a/sys/config/pkg.yml b/sys/config/pkg.yml
index cfd8fdca1..3866f31f1 100644
--- a/sys/config/pkg.yml
+++ b/sys/config/pkg.yml
@@ -39,6 +39,8 @@ pkg.deps.CONFIG_NFFS:
 pkg.deps.CONFIG_LITTLEFS:
     - "@apache-mynewt-core/fs/littlefs"
 
+pkg.whole_archive: true
+
 pkg.init:
     config_pkg_init: 'MYNEWT_VAL(CONFIG_SYSINIT_STAGE_1)'
     config_pkg_init_stage2: 'MYNEWT_VAL(CONFIG_SYSINIT_STAGE_2)'
diff --git a/sys/config/src/config.c b/sys/config/src/config.c
index 9d9302859..b03a285e1 100644
--- a/sys/config/src/config.c
+++ b/sys/config/src/config.c
@@ -53,10 +53,6 @@ conf_init(void)
 
     (void)rc;
 
-#if MYNEWT_VAL(CONFIG_CLI)
-    rc = conf_cli_register();
-    SYSINIT_PANIC_ASSERT(rc == 0);
-#endif
 #if MYNEWT_VAL(CONFIG_MGMT)
     rc = conf_mgmt_register();
     SYSINIT_PANIC_ASSERT(rc == 0);
diff --git a/sys/config/src/config_cli.c b/sys/config/src/config_cli.c
index bd2fc0757..ebc3ede39 100644
--- a/sys/config/src/config_cli.c
+++ b/sys/config/src/config_cli.c
@@ -30,13 +30,6 @@
 #include <shell/shell.h>
 #include <console/console.h>
 
-static int shell_conf_command(int argc, char **argv);
-
-static struct shell_cmd shell_conf_cmd = {
-    .sc_cmd = "config",
-    .sc_cmd_func = shell_conf_command
-};
-
 #if (MYNEWT_VAL(CONFIG_CLI_RW) & 1) == 1
 static void
 conf_running_one(char *name, char *val)
@@ -149,10 +142,7 @@ err:
     return 0;
 }
 
-int
-conf_cli_register(void)
-{
-    return shell_cmd_register(&shell_conf_cmd);
-}
+MAKE_SHELL_CMD(config, shell_conf_command, NULL)
+
 #endif
 
diff --git a/sys/config/src/config_priv.h b/sys/config/src/config_priv.h
index 6b0178cba..f7d1e7fc2 100644
--- a/sys/config/src/config_priv.h
+++ b/sys/config/src/config_priv.h
@@ -24,7 +24,6 @@
 extern "C" {
 #endif
 
-int conf_cli_register(void);
 int conf_mgmt_register(void);
 
 struct mgmt_cbuf;

Reply via email to