libc: share time() between minimal libc and armclang libc
Introduce a place to share implementations of libc functions that are needed by different libc versions. Place time() in this common location so it can be shared when building for either minimal libc or armclang libc. Signed-off-by: Kumar Gala <kumar.gala@intel.com>
This commit is contained in:
parent
a7aafcbbdc
commit
672aeace88
8 changed files with 16 additions and 1 deletions
|
|
@ -15,6 +15,7 @@ choice LIBC_IMPLEMENTATION
|
|||
|
||||
config ARMCLANG_STD_LIBC
|
||||
bool "ARM Compiler C library"
|
||||
select COMMON_LIBC_TIME if POSIX_CLOCK
|
||||
help
|
||||
Use the full Arm Compiler runtime libraries.
|
||||
A reduced Zephyr minimal libc will be used for library functionality
|
||||
|
|
|
|||
|
|
@ -5,3 +5,5 @@ add_subdirectory_ifdef(CONFIG_ARMCLANG_STD_LIBC armstdc)
|
|||
add_subdirectory_ifdef(CONFIG_MINIMAL_LIBC minimal)
|
||||
add_subdirectory_ifdef(CONFIG_NEWLIB_LIBC newlib)
|
||||
add_subdirectory_ifdef(CONFIG_PICOLIBC picolibc)
|
||||
|
||||
add_subdirectory(common)
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ endchoice # LIBC_IMPLEMENTATION
|
|||
config HAS_NEWLIB_LIBC_NANO
|
||||
bool
|
||||
|
||||
rsource "common/Kconfig"
|
||||
rsource "minimal/Kconfig"
|
||||
rsource "newlib/Kconfig"
|
||||
rsource "picolibc/Kconfig"
|
||||
|
|
|
|||
4
lib/libc/common/CMakeLists.txt
Normal file
4
lib/libc/common/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
zephyr_library()
|
||||
zephyr_library_sources_ifdef(CONFIG_COMMON_LIBC_TIME source/time/time.c)
|
||||
7
lib/libc/common/Kconfig
Normal file
7
lib/libc/common/Kconfig
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# Copyright (c) 2023 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
config COMMON_LIBC_TIME
|
||||
bool
|
||||
help
|
||||
common implementation of time().
|
||||
|
|
@ -33,7 +33,6 @@ zephyr_library_sources(
|
|||
|
||||
if(CONFIG_MINIMAL_LIBC_TIME)
|
||||
zephyr_library_sources(source/time/gmtime.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_POSIX_CLOCK source/time/time.c)
|
||||
endif()
|
||||
|
||||
zephyr_library_sources_ifdef(CONFIG_MINIMAL_LIBC_RAND source/stdlib/rand.c)
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ config MINIMAL_LIBC_RAND
|
|||
|
||||
config MINIMAL_LIBC_TIME
|
||||
bool "Time functions"
|
||||
select COMMON_LIBC_TIME if POSIX_CLOCK
|
||||
default y
|
||||
help
|
||||
Enable time() and gmtime_r() for the minimal libc.
|
||||
|
|
|
|||
Loading…
Reference in a new issue