From e79685c302645266f8adfd73fa6ccdf0119b8190 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Tue, 24 Jun 2025 16:17:33 +0200 Subject: [PATCH 1/2] shell: move date_service to sys_clock api MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit move date_service from posix api to sys_clock api. Signed-off-by: Fin Maaß --- subsys/shell/modules/Kconfig | 1 - subsys/shell/modules/date_service.c | 12 +++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/subsys/shell/modules/Kconfig b/subsys/shell/modules/Kconfig index 84e4a879f83a..c09d08ae70b8 100644 --- a/subsys/shell/modules/Kconfig +++ b/subsys/shell/modules/Kconfig @@ -11,7 +11,6 @@ config DEVICE_SHELL config DATE_SHELL bool "Date shell" - depends on POSIX_TIMERS default y if !SHELL_MINIMAL help This shell provides access to date and time based on Unix time. diff --git a/subsys/shell/modules/date_service.c b/subsys/shell/modules/date_service.c index 4cfc7e75c0d7..95ce21185c8b 100644 --- a/subsys/shell/modules/date_service.c +++ b/subsys/shell/modules/date_service.c @@ -13,12 +13,6 @@ #include -#if defined(CONFIG_ARCH_POSIX) && defined(CONFIG_EXTERNAL_LIBC) -#include -#else -#include -#endif - #define HELP_NONE "[none]" #define HELP_DATE_SET "[Y-m-d] " @@ -144,7 +138,7 @@ static int cmd_date_set(const struct shell *sh, size_t argc, char **argv) struct tm tm; int ret; - clock_gettime(CLOCK_REALTIME, &tp); + sys_clock_gettime(SYS_CLOCK_REALTIME, &tp); gmtime_r(&tp.tv_sec, &tm); @@ -177,7 +171,7 @@ static int cmd_date_set(const struct shell *sh, size_t argc, char **argv) } tp.tv_nsec = 0; - ret = clock_settime(CLOCK_REALTIME, &tp); + ret = sys_clock_settime(SYS_CLOCK_REALTIME, &tp); if (ret != 0) { shell_error(sh, "Could not set date %d", ret); return -EINVAL; @@ -193,7 +187,7 @@ static int cmd_date_get(const struct shell *sh, size_t argc, char **argv) struct timespec tp; struct tm tm; - clock_gettime(CLOCK_REALTIME, &tp); + sys_clock_gettime(SYS_CLOCK_REALTIME, &tp); gmtime_r(&tp.tv_sec, &tm); From e4cb1f9f9cf0e9d54f6e4015d878ac503370b4c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Tue, 24 Jun 2025 16:18:57 +0200 Subject: [PATCH 2/2] samples: shell: remove CONFIG_POSIX_TIMERS dep MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit remove CONFIG_POSIX_TIMERS dependency as date_service shell no longer needs that. Signed-off-by: Fin Maaß --- samples/subsys/shell/shell_module/overlay-usb.conf | 7 ------- samples/subsys/shell/shell_module/prj.conf | 2 -- samples/subsys/shell/shell_module/prj_getopt.conf | 2 -- samples/subsys/shell/shell_module/prj_login.conf | 2 -- samples/subsys/shell/shell_module/sample.yaml | 2 +- 5 files changed, 1 insertion(+), 14 deletions(-) diff --git a/samples/subsys/shell/shell_module/overlay-usb.conf b/samples/subsys/shell/shell_module/overlay-usb.conf index f5e0e86d60bb..487745947302 100644 --- a/samples/subsys/shell/shell_module/overlay-usb.conf +++ b/samples/subsys/shell/shell_module/overlay-usb.conf @@ -4,10 +4,3 @@ CONFIG_SHELL_BACKEND_SERIAL_CHECK_DTR=y CONFIG_USB_CDC_ACM_LOG_LEVEL_OFF=y CONFIG_UART_LINE_CTRL=y CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n - -# POSIX_TIMERS requires an embedded C library while the native USB driver is incompatible with it. -# So let's disable it. Once USB_NATIVE_POSIX supports embedded C libraries this can be removed. -CONFIG_POSIX_API=n -CONFIG_POSIX_TIMERS=n -# DATE_SHELL requires POSIX_TIMERS -CONFIG_DATE_SHELL=n diff --git a/samples/subsys/shell/shell_module/prj.conf b/samples/subsys/shell/shell_module/prj.conf index ff7c665b3815..ed5230fb73f9 100644 --- a/samples/subsys/shell/shell_module/prj.conf +++ b/samples/subsys/shell/shell_module/prj.conf @@ -9,8 +9,6 @@ CONFIG_THREAD_MONITOR=y CONFIG_BOOT_BANNER=n CONFIG_THREAD_NAME=y CONFIG_DEVICE_SHELL=y -CONFIG_POSIX_API=y -CONFIG_POSIX_TIMERS=y CONFIG_DATE_SHELL=y CONFIG_THREAD_RUNTIME_STATS=y CONFIG_THREAD_RUNTIME_STATS_USE_TIMING_FUNCTIONS=y diff --git a/samples/subsys/shell/shell_module/prj_getopt.conf b/samples/subsys/shell/shell_module/prj_getopt.conf index 8f04ab27d7c6..4d3abc9e3b48 100644 --- a/samples/subsys/shell/shell_module/prj_getopt.conf +++ b/samples/subsys/shell/shell_module/prj_getopt.conf @@ -9,7 +9,5 @@ CONFIG_THREAD_MONITOR=y CONFIG_BOOT_BANNER=n CONFIG_THREAD_NAME=y CONFIG_DEVICE_SHELL=y -CONFIG_POSIX_API=y -CONFIG_POSIX_TIMERS=y CONFIG_DATE_SHELL=y CONFIG_THREAD_RUNTIME_STATS=y diff --git a/samples/subsys/shell/shell_module/prj_login.conf b/samples/subsys/shell/shell_module/prj_login.conf index 470a41044f82..a6fa07f01efa 100644 --- a/samples/subsys/shell/shell_module/prj_login.conf +++ b/samples/subsys/shell/shell_module/prj_login.conf @@ -8,8 +8,6 @@ CONFIG_THREAD_MONITOR=y CONFIG_BOOT_BANNER=n CONFIG_THREAD_NAME=y CONFIG_DEVICE_SHELL=y -CONFIG_POSIX_API=y -CONFIG_POSIX_TIMERS=y CONFIG_DATE_SHELL=y CONFIG_THREAD_RUNTIME_STATS=y diff --git a/samples/subsys/shell/shell_module/sample.yaml b/samples/subsys/shell/shell_module/sample.yaml index 917def7ece67..5f8e045f488c 100644 --- a/samples/subsys/shell/shell_module/sample.yaml +++ b/samples/subsys/shell/shell_module/sample.yaml @@ -1,7 +1,7 @@ sample: name: Shell Sample common: - filter: not CONFIG_NATIVE_LIBC and not CONFIG_SOC_SERIES_BSIM_NRFXX + filter: not CONFIG_SOC_SERIES_BSIM_NRFXX tests: sample.shell.shell_module: platform_exclude: qemu_rx