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

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

commit 8900be1de78e04938352172325367ba4f5ed5ccd
Author: Szymon Janc <[email protected]>
AuthorDate: Tue Oct 6 19:03:42 2026 +0200

    mgmt/mcumgr/os_mgmt: Remove OS abstraction layer
    
    mcumgr is now part of Mynewt core and there is no need for OS
    abstraction layer. Mynewt implementation is merged into os_mgmt.c and
    os_mgmt_impl_* functions are made static. os_mgmt_config.h is removed
    and syscfg values are used directly. Weak stubs and Mynewt port
    package are removed.
    
    LOG_SOFT_RESET setting and sys/reboot dependency are moved from port
    package to os_mgmt package.
    
    No functional changes.
    
    Assisted-by: Claude:claude-opus-5-5
---
 .../cmd/os_mgmt/include/os_mgmt/os_mgmt_config.h   |  46 ------
 .../cmd/os_mgmt/include/os_mgmt/os_mgmt_impl.h     |  84 ----------
 mgmt/mcumgr/cmd/os_mgmt/pkg.yml                    |   5 +-
 mgmt/mcumgr/cmd/os_mgmt/port/mynewt/pkg.yml        |  30 ----
 .../cmd/os_mgmt/port/mynewt/src/mynewt_os_mgmt.c   | 167 --------------------
 mgmt/mcumgr/cmd/os_mgmt/port/mynewt/syscfg.yml     |  24 ---
 mgmt/mcumgr/cmd/os_mgmt/src/os_mgmt.c              | 173 +++++++++++++++++++--
 mgmt/mcumgr/cmd/os_mgmt/src/stubs.c                |  38 -----
 mgmt/mcumgr/cmd/os_mgmt/syscfg.yml                 |   5 +
 9 files changed, 164 insertions(+), 408 deletions(-)

diff --git a/mgmt/mcumgr/cmd/os_mgmt/include/os_mgmt/os_mgmt_config.h 
b/mgmt/mcumgr/cmd/os_mgmt/include/os_mgmt/os_mgmt_config.h
deleted file mode 100644
index b07baaaf8..000000000
--- a/mgmt/mcumgr/cmd/os_mgmt/include/os_mgmt/os_mgmt_config.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#ifndef H_OS_MGMT_CONFIG_
-#define H_OS_MGMT_CONFIG_
-
-#if defined MYNEWT
-
-#include "syscfg/syscfg.h"
-
-#define OS_MGMT_RESET_MS    MYNEWT_VAL(OS_MGMT_RESET_MS)
-#define OS_MGMT_TASKSTAT    MYNEWT_VAL(OS_MGMT_TASKSTAT)
-#define OS_MGMT_ECHO        MYNEWT_VAL(OS_MGMT_ECHO)
-#define OS_MGMT_DATETIME    MYNEWT_VAL(OS_MGMT_DATETIME)
-
-#elif defined __ZEPHYR__
-
-#define OS_MGMT_RESET_MS    CONFIG_OS_MGMT_RESET_MS
-#define OS_MGMT_TASKSTAT    CONFIG_OS_MGMT_TASKSTAT
-#define OS_MGMT_ECHO        CONFIG_OS_MGMT_ECHO
-
-#else
-
-/* No direct support for this OS.  The application needs to define the above
- * settings itself.
- */
-
-#endif
-
-#endif
diff --git a/mgmt/mcumgr/cmd/os_mgmt/include/os_mgmt/os_mgmt_impl.h 
b/mgmt/mcumgr/cmd/os_mgmt/include/os_mgmt/os_mgmt_impl.h
deleted file mode 100644
index e50262b47..000000000
--- a/mgmt/mcumgr/cmd/os_mgmt/include/os_mgmt/os_mgmt_impl.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * @file
- * @brief Declares implementation-specific functions required by OS management.
- *        The default stubs can be overridden with functions that are
- *        compatible with the host OS.
- */
-
-#ifndef H_OS_MGMT_IMPL_
-#define H_OS_MGMT_IMPL_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct os_mgmt_task_info;
-
-/**
- * @brief Retrieves information about the specified task.  
- *
- * @param idx                   The index of the task to query.
- * @param out_info              On success, the requested information gets
- *                                  written here.
- *
- * @return                      0 on success;
- *                              MGMT_ERR_ENOENT if no such task exists;
- *                              Other MGMT_ERR_[...] code on failure.
- */
-int os_mgmt_impl_task_info(int idx, struct os_mgmt_task_info *out_info);
-
-/**
- * @brief Retrieves the current system date and time in textual form.
- *
- * @param datetime              Buffer where the formatted datetime string
- *                              will be written.
- * @param datetime_size         Size of the buffer in bytes. Must be at least
- *                              DATETIME_BUFSIZE.
- *
- * @return                      0 on success;
- *                              MGMT_ERR_[...] code on failure.
- */
-int os_mgmt_impl_datetime_info(char *datetime, size_t datetime_size);
-/**
- * @brief Sets the current system date and time.
- *
- * @param datetime              The datetime string to parse and apply.
- *
- * @return                      0 on success;
- *                              MGMT_ERR_[...] code on failure.
- */
-int os_mgmt_impl_datetime_set(char *datetime);
-
-/**
- * @brief Schedules a near-immediate system reset.  There must be a slight
- * delay before the reset occurs to allow time for the mgmt response to be
- * delivered.
- *
- * @return                      0 on success, MGMT_ERR_[...] code on failure.
- */
-int os_mgmt_impl_reset(unsigned int delay_ms);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/mgmt/mcumgr/cmd/os_mgmt/pkg.yml b/mgmt/mcumgr/cmd/os_mgmt/pkg.yml
index de5011a47..6f0a2b667 100644
--- a/mgmt/mcumgr/cmd/os_mgmt/pkg.yml
+++ b/mgmt/mcumgr/cmd/os_mgmt/pkg.yml
@@ -25,15 +25,14 @@ pkg.keywords:
 
 pkg.deps:
     - '@apache-mynewt-core/kernel/os'
-    - '@apache-mynewt-core/mgmt/mcumgr/cmd/os_mgmt/port/mynewt'
     - '@apache-mynewt-core/mgmt/mcumgr/mgmt'
     - '@apache-mynewt-core/encoding/cborattr'
 
 pkg.deps.OS_MGMT_DATETIME:
     - "@apache-mynewt-core/time/datetime"
 
-pkg.ign_files:
-    - "stubs.c"
+pkg.deps.LOG_SOFT_RESET:
+    - "@apache-mynewt-core/sys/reboot"
 
 pkg.init:
     os_mgmt_module_init: 'MYNEWT_VAL(OS_MGMT_SYSINIT_STAGE)'
diff --git a/mgmt/mcumgr/cmd/os_mgmt/port/mynewt/pkg.yml 
b/mgmt/mcumgr/cmd/os_mgmt/port/mynewt/pkg.yml
deleted file mode 100644
index af2d9a983..000000000
--- a/mgmt/mcumgr/cmd/os_mgmt/port/mynewt/pkg.yml
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#  http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-pkg.name: mgmt/mcumgr/cmd/os_mgmt/port/mynewt
-pkg.description: 'OS management command handlers for mcumgr.'
-pkg.author: "Apache Mynewt <[email protected]>"
-pkg.homepage: "http://mynewt.apache.org/";
-pkg.keywords:
-
-pkg.deps:
-    - '@apache-mynewt-core/mgmt/mcumgr/cmd/os_mgmt'
-    - '@apache-mynewt-core/mgmt/mcumgr/mgmt'
-pkg.deps.LOG_SOFT_RESET:
-    - '@apache-mynewt-core/sys/reboot'
diff --git a/mgmt/mcumgr/cmd/os_mgmt/port/mynewt/src/mynewt_os_mgmt.c 
b/mgmt/mcumgr/cmd/os_mgmt/port/mynewt/src/mynewt_os_mgmt.c
deleted file mode 100644
index d1b06f815..000000000
--- a/mgmt/mcumgr/cmd/os_mgmt/port/mynewt/src/mynewt_os_mgmt.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#include "hal/hal_system.h"
-#include "hal/hal_watchdog.h"
-#include "os/os.h"
-#if MYNEWT_VAL(LOG_SOFT_RESET)
-#include "reboot/log_reboot.h"
-#include "img_mgmt/img_mgmt.h"
-#endif
-#include "os_mgmt/os_mgmt_impl.h"
-#include "os_mgmt/os_mgmt.h"
-#include "mgmt/mgmt.h"
-#if MYNEWT_VAL(OS_MGMT_DATETIME)
-#include "datetime/datetime.h"
-#endif
-
-static struct os_callout mynewt_os_mgmt_reset_callout;
-
-static void
-mynewt_os_mgmt_reset_tmo(struct os_event *ev)
-{
-    /* Tickle watchdog just before re-entering bootloader.  Depending on what
-     * the system has been doing lately, the watchdog timer might be close to
-     * firing.
-     */
-    hal_watchdog_tickle();
-    hal_system_reset();
-}
-
-static uint16_t
-mynewt_os_mgmt_stack_usage(const struct os_task *task)
-{
-    struct os_task_info oti;
-
-    os_task_info_get(task, &oti);
-
-    return oti.oti_stkusage;
-}
-
-static const struct os_task *
-mynewt_os_mgmt_task_at(int idx)
-{
-    const struct os_task *task;
-    int i;
-
-    task = STAILQ_FIRST(&g_os_task_list);
-    for (i = 0; i < idx; i++) {
-        if (task == NULL) {
-            break;
-        }
-
-        task = STAILQ_NEXT(task, t_os_task_list);
-    }
-
-    return task;
-}
-
-int
-os_mgmt_impl_task_info(int idx, struct os_mgmt_task_info *out_info)
-{
-    const struct os_task *task;
-
-    task = mynewt_os_mgmt_task_at(idx);
-    if (task == NULL) {
-        return MGMT_ERR_ENOENT;
-    }
-
-    out_info->oti_prio = task->t_prio;
-    out_info->oti_taskid = task->t_taskid;
-    out_info->oti_state = task->t_state;
-    out_info->oti_stkusage = mynewt_os_mgmt_stack_usage(task);
-    out_info->oti_stksize = task->t_stacksize;
-    out_info->oti_cswcnt = task->t_ctx_sw_cnt;
-    out_info->oti_runtime = task->t_run_time;
-    out_info->oti_last_checkin = task->t_sanity_check.sc_checkin_last;
-    out_info->oti_next_checkin = task->t_sanity_check.sc_checkin_last +
-                                 task->t_sanity_check.sc_checkin_itvl;
-    strncpy(out_info->oti_name, task->t_name, sizeof out_info->oti_name - 1);
-    out_info->oti_name[sizeof out_info->oti_name - 1] = '\0';
-
-    return 0;
-}
-
-#if MYNEWT_VAL(OS_MGMT_DATETIME)
-int
-os_mgmt_impl_datetime_info(char *datetime, size_t size)
-{
-    struct os_timeval tv;
-    struct os_timezone tz;
-    int rc;
-
-    if (size < DATETIME_BUFSIZE) {
-        return MGMT_ERR_ENOMEM;
-    }
-
-    rc = os_gettimeofday(&tv, &tz);
-    if (rc != 0) {
-        return MGMT_ERR_EINVAL;
-    }
-
-    rc = datetime_format(&tv, &tz, datetime, size);
-    if (rc != 0) {
-        return MGMT_ERR_EINVAL;
-    }
-
-    return MGMT_ERR_EOK;
-}
-
-int
-os_mgmt_impl_datetime_set(char *datetime)
-{
-    struct os_timeval tv;
-    struct os_timezone tz;
-    int rc = 0;
-
-    rc = datetime_parse(datetime, &tv, &tz);
-    if (rc != 0) {
-        return MGMT_ERR_ECORRUPT;
-    }
-
-    return os_settimeofday(&tv, &tz);
-}
-#endif
-
-int
-os_mgmt_impl_reset(unsigned int delay_ms)
-{
-#if MYNEWT_VAL(LOG_SOFT_RESET)
-    struct log_reboot_info info = {
-        .reason = HAL_RESET_REQUESTED,
-        .file = NULL,
-        .line = 0,
-        .pc = 0,
-    };
-
-    if (img_mgmt_state_any_pending()) {
-        info.reason = HAL_RESET_DFU;
-    }
-#endif
-    os_callout_init(&mynewt_os_mgmt_reset_callout, os_eventq_dflt_get(),
-                    mynewt_os_mgmt_reset_tmo, NULL);
-
-#if MYNEWT_VAL(LOG_SOFT_RESET)
-    log_reboot(&info);
-#endif
-    os_callout_reset(&mynewt_os_mgmt_reset_callout,
-                     delay_ms * OS_TICKS_PER_SEC / 1000);
-
-    return 0;
-}
diff --git a/mgmt/mcumgr/cmd/os_mgmt/port/mynewt/syscfg.yml 
b/mgmt/mcumgr/cmd/os_mgmt/port/mynewt/syscfg.yml
deleted file mode 100644
index a66a4269b..000000000
--- a/mgmt/mcumgr/cmd/os_mgmt/port/mynewt/syscfg.yml
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#  http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-syscfg.defs:
-    LOG_SOFT_RESET:
-        description: >
-            Log soft resets.
-        value: 1
diff --git a/mgmt/mcumgr/cmd/os_mgmt/src/os_mgmt.c 
b/mgmt/mcumgr/cmd/os_mgmt/src/os_mgmt.c
index c5e20d33e..22ea4b42d 100644
--- a/mgmt/mcumgr/cmd/os_mgmt/src/os_mgmt.c
+++ b/mgmt/mcumgr/cmd/os_mgmt/src/os_mgmt.c
@@ -19,43 +19,184 @@
 
 #include <string.h>
 
+#include "os/mynewt.h"
+#include "hal/hal_system.h"
+#include "hal/hal_watchdog.h"
 #include "tinycbor/cbor.h"
 #include "cborattr/cborattr.h"
 #include "mgmt/mgmt.h"
 #include "os_mgmt/os_mgmt.h"
-#include "os_mgmt/os_mgmt_impl.h"
-#include "os_mgmt/os_mgmt_config.h"
-#if OS_MGMT_DATETIME
+#if MYNEWT_VAL(LOG_SOFT_RESET)
+#include "reboot/log_reboot.h"
+#include "img_mgmt/img_mgmt.h"
+#endif
+#if MYNEWT_VAL(OS_MGMT_DATETIME)
 #include "datetime/datetime.h"
 #endif
 
-#if OS_MGMT_ECHO
+static struct os_callout os_mgmt_reset_callout;
+
+static void
+os_mgmt_reset_tmo(struct os_event *ev)
+{
+    /* Tickle watchdog just before re-entering bootloader.  Depending on what
+     * the system has been doing lately, the watchdog timer might be close to
+     * firing.
+     */
+    hal_watchdog_tickle();
+    hal_system_reset();
+}
+
+#if MYNEWT_VAL(OS_MGMT_TASKSTAT)
+static uint16_t
+os_mgmt_stack_usage(const struct os_task *task)
+{
+    struct os_task_info oti;
+
+    os_task_info_get(task, &oti);
+
+    return oti.oti_stkusage;
+}
+
+static const struct os_task *
+os_mgmt_task_at(int idx)
+{
+    const struct os_task *task;
+    int i;
+
+    task = STAILQ_FIRST(&g_os_task_list);
+    for (i = 0; i < idx; i++) {
+        if (task == NULL) {
+            break;
+        }
+
+        task = STAILQ_NEXT(task, t_os_task_list);
+    }
+
+    return task;
+}
+
+static int
+os_mgmt_task_info_get(int idx, struct os_mgmt_task_info *out_info)
+{
+    const struct os_task *task;
+
+    task = os_mgmt_task_at(idx);
+    if (task == NULL) {
+        return MGMT_ERR_ENOENT;
+    }
+
+    out_info->oti_prio = task->t_prio;
+    out_info->oti_taskid = task->t_taskid;
+    out_info->oti_state = task->t_state;
+    out_info->oti_stkusage = os_mgmt_stack_usage(task);
+    out_info->oti_stksize = task->t_stacksize;
+    out_info->oti_cswcnt = task->t_ctx_sw_cnt;
+    out_info->oti_runtime = task->t_run_time;
+    out_info->oti_last_checkin = task->t_sanity_check.sc_checkin_last;
+    out_info->oti_next_checkin = task->t_sanity_check.sc_checkin_last +
+                                 task->t_sanity_check.sc_checkin_itvl;
+    strncpy(out_info->oti_name, task->t_name, sizeof out_info->oti_name - 1);
+    out_info->oti_name[sizeof out_info->oti_name - 1] = '\0';
+
+    return 0;
+}
+#endif
+
+#if MYNEWT_VAL(OS_MGMT_DATETIME)
+static int
+os_mgmt_datetime_get(char *datetime, size_t size)
+{
+    struct os_timeval tv;
+    struct os_timezone tz;
+    int rc;
+
+    if (size < DATETIME_BUFSIZE) {
+        return MGMT_ERR_ENOMEM;
+    }
+
+    rc = os_gettimeofday(&tv, &tz);
+    if (rc != 0) {
+        return MGMT_ERR_EINVAL;
+    }
+
+    rc = datetime_format(&tv, &tz, datetime, size);
+    if (rc != 0) {
+        return MGMT_ERR_EINVAL;
+    }
+
+    return MGMT_ERR_EOK;
+}
+
+static int
+os_mgmt_datetime_set(char *datetime)
+{
+    struct os_timeval tv;
+    struct os_timezone tz;
+    int rc = 0;
+
+    rc = datetime_parse(datetime, &tv, &tz);
+    if (rc != 0) {
+        return MGMT_ERR_ECORRUPT;
+    }
+
+    return os_settimeofday(&tv, &tz);
+}
+#endif
+
+static int
+os_mgmt_reset_schedule(unsigned int delay_ms)
+{
+#if MYNEWT_VAL(LOG_SOFT_RESET)
+    struct log_reboot_info info = {
+        .reason = HAL_RESET_REQUESTED,
+        .file = NULL,
+        .line = 0,
+        .pc = 0,
+    };
+
+    if (img_mgmt_state_any_pending()) {
+        info.reason = HAL_RESET_DFU;
+    }
+#endif
+    os_callout_init(&os_mgmt_reset_callout, os_eventq_dflt_get(),
+                    os_mgmt_reset_tmo, NULL);
+
+#if MYNEWT_VAL(LOG_SOFT_RESET)
+    log_reboot(&info);
+#endif
+    os_callout_reset(&os_mgmt_reset_callout, delay_ms * OS_TICKS_PER_SEC / 
1000);
+
+    return 0;
+}
+
+#if MYNEWT_VAL(OS_MGMT_ECHO)
 static mgmt_handler_fn os_mgmt_echo;
 #endif
 
 static mgmt_handler_fn os_mgmt_reset;
 
-#if OS_MGMT_TASKSTAT
+#if MYNEWT_VAL(OS_MGMT_TASKSTAT)
 static mgmt_handler_fn os_mgmt_taskstat_read;
 #endif
 
-#if OS_MGMT_DATETIME
+#if MYNEWT_VAL(OS_MGMT_DATETIME)
 static mgmt_handler_fn os_mgmt_datetime_read;
 static mgmt_handler_fn os_mgmt_datetime_write;
 #endif
 
 static const struct mgmt_handler os_mgmt_group_handlers[] = {
-#if OS_MGMT_ECHO
+#if MYNEWT_VAL(OS_MGMT_ECHO)
     [OS_MGMT_ID_ECHO] = {
         os_mgmt_echo, os_mgmt_echo
     },
 #endif
-#if OS_MGMT_TASKSTAT
+#if MYNEWT_VAL(OS_MGMT_TASKSTAT)
     [OS_MGMT_ID_TASKSTAT] = {
         os_mgmt_taskstat_read, NULL
     },
 #endif
-#if OS_MGMT_DATETIME
+#if MYNEWT_VAL(OS_MGMT_DATETIME)
     [OS_MGMT_ID_DATETIME_STR] = {
         os_mgmt_datetime_read, os_mgmt_datetime_write
     },
@@ -77,7 +218,7 @@ static struct mgmt_group os_mgmt_group = {
 /**
  * Command handler: os echo
  */
-#if OS_MGMT_ECHO
+#if MYNEWT_VAL(OS_MGMT_ECHO)
 static int
 os_mgmt_echo(struct mgmt_ctxt *ctxt)
 {
@@ -115,7 +256,7 @@ os_mgmt_echo(struct mgmt_ctxt *ctxt)
 }
 #endif
 
-#if OS_MGMT_TASKSTAT
+#if MYNEWT_VAL(OS_MGMT_TASKSTAT)
 /**
  * Encodes a single taskstat entry.
  */
@@ -177,7 +318,7 @@ os_mgmt_taskstat_read(struct mgmt_ctxt *ctxt)
 
     /* Iterate the list of tasks, encoding each. */
     for (task_idx = 0;; task_idx++) {
-        rc = os_mgmt_impl_task_info(task_idx, &task_info);
+        rc = os_mgmt_task_info_get(task_idx, &task_info);
         if (rc == MGMT_ERR_ENOENT) {
             /* No more tasks to encode. */
             break;
@@ -201,7 +342,7 @@ os_mgmt_taskstat_read(struct mgmt_ctxt *ctxt)
 }
 #endif
 
-#if OS_MGMT_DATETIME
+#if MYNEWT_VAL(OS_MGMT_DATETIME)
 /**
  * Command handler: os datetime
  */
@@ -216,7 +357,7 @@ os_mgmt_datetime_read(struct mgmt_ctxt *ctxt)
         return MGMT_ERR_ENOMEM;
     }
 
-    err = os_mgmt_impl_datetime_info(buf, sizeof(buf));
+    err = os_mgmt_datetime_get(buf, sizeof(buf));
     if (err != 0) {
         return MGMT_ERR_ENOMEM;
     }
@@ -256,7 +397,7 @@ os_mgmt_datetime_write(struct mgmt_ctxt *ctxt)
         return MGMT_ERR_EINVAL;
     }
 
-    err = os_mgmt_impl_datetime_set(datetime_buf);
+    err = os_mgmt_datetime_set(datetime_buf);
     if (err != 0) {
         return MGMT_ERR_ECORRUPT;
     }
@@ -271,7 +412,7 @@ os_mgmt_datetime_write(struct mgmt_ctxt *ctxt)
 static int
 os_mgmt_reset(struct mgmt_ctxt *ctxt)
 {
-    return os_mgmt_impl_reset(OS_MGMT_RESET_MS);
+    return os_mgmt_reset_schedule(MYNEWT_VAL(OS_MGMT_RESET_MS));
 }
 
 void
diff --git a/mgmt/mcumgr/cmd/os_mgmt/src/stubs.c 
b/mgmt/mcumgr/cmd/os_mgmt/src/stubs.c
deleted file mode 100644
index c17532bda..000000000
--- a/mgmt/mcumgr/cmd/os_mgmt/src/stubs.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * These stubs get linked in when there is no equivalent OS-specific
- * implementation.
- */
-
-#include "mgmt/mgmt.h"
-#include "os_mgmt/os_mgmt_impl.h"
-
-int __attribute__((weak))
-os_mgmt_impl_task_info(int idx, struct os_mgmt_task_info *out_info)
-{
-    return MGMT_ERR_ENOTSUP;
-}
-
-int __attribute__((weak))
-os_mgmt_impl_reset(unsigned int delay_ms)
-{
-    return MGMT_ERR_ENOTSUP;
-}
diff --git a/mgmt/mcumgr/cmd/os_mgmt/syscfg.yml 
b/mgmt/mcumgr/cmd/os_mgmt/syscfg.yml
index 8568f7824..88ecb9b07 100644
--- a/mgmt/mcumgr/cmd/os_mgmt/syscfg.yml
+++ b/mgmt/mcumgr/cmd/os_mgmt/syscfg.yml
@@ -44,3 +44,8 @@ syscfg.defs:
         description: >
             System Initialization stage for OS_MGMT package
         value: 501
+
+    LOG_SOFT_RESET:
+        description: >
+            Log soft resets.
+        value: 1

Reply via email to