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 15cc2b31721032c3597e4d9bfdf2ab402532140d
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Sat May 31 00:45:30 2025 +0200

    sys/shell: Register os commands staticaly
    
    Shell commands are now registered at link time
    instead of compile time to compat module commands.
    
    Signed-off-by: Jerzy Kasenberg <[email protected]>
---
 sys/shell/src/shell_os.c   | 28 ++++++----------------------
 sys/shell/src/shell_priv.h |  1 -
 2 files changed, 6 insertions(+), 23 deletions(-)

diff --git a/sys/shell/src/shell_os.c b/sys/shell/src/shell_os.c
index 9d65ca4d4..d65dae1bc 100644
--- a/sys/shell/src/shell_os.c
+++ b/sys/shell/src/shell_os.c
@@ -273,25 +273,9 @@ static const struct shell_cmd_help ls_dev_help = {
 };
 #endif
 
-static const struct shell_cmd os_commands[] = {
-    SHELL_CMD_EXT("tasks", shell_os_tasks_display_cmd, &tasks_help),
-    SHELL_CMD_EXT("mpool", shell_os_mpool_display_cmd, &mpool_help),
-    SHELL_CMD_EXT("date", shell_os_date_cmd, &date_help),
-    SHELL_CMD_EXT("reset", shell_os_reset_cmd, &reset_help),
-    SHELL_CMD_EXT("reset_cause", shell_os_print_reset_cause, 
&print_reset_cause_help),
-    SHELL_CMD_EXT("lsdev", shell_os_ls_dev_cmd, &ls_dev_help),
-    { 0 },
-};
-
-void
-shell_os_register(void)
-{
-    const struct shell_cmd *cmd;
-    int rc;
-
-    for (cmd = os_commands; cmd->sc_cmd != NULL; cmd++) {
-        rc = shell_cmd_register(cmd);
-        SYSINIT_PANIC_ASSERT_MSG(
-            rc == 0, "Failed to register OS shell commands");
-    }
-}
+MAKE_SHELL_EXT_CMD(tasks, shell_os_tasks_display_cmd, &tasks_help)
+MAKE_SHELL_EXT_CMD(mpool, shell_os_mpool_display_cmd, &mpool_help)
+MAKE_SHELL_EXT_CMD(date, shell_os_date_cmd, &date_help)
+MAKE_SHELL_EXT_CMD(reset, shell_os_reset_cmd, &reset_help)
+MAKE_SHELL_EXT_CMD(reset_cause, shell_os_print_reset_cause, 
&print_reset_cause_help)
+MAKE_SHELL_EXT_CMD(lsdev, shell_os_ls_dev_cmd, &ls_dev_help)
diff --git a/sys/shell/src/shell_priv.h b/sys/shell/src/shell_priv.h
index 22e97ba88..6c85d1ac7 100644
--- a/sys/shell/src/shell_priv.h
+++ b/sys/shell/src/shell_priv.h
@@ -49,7 +49,6 @@ void shell_nlip_init(void);
 void shell_nlip_clear_pkt(void);
 #endif
 
-void shell_os_register(void);
 void shell_prompt_register(void);
 
 #if MYNEWT_VAL(SHELL_BRIDGE)

Reply via email to