lib: posix: Kconfig: Allow to enable individual components
Allow to enable individual POSIX components, like Pthreads. CONFIG_POSIX_API now just enables all of individual POSIX components, and sets up environment suitable to easily port POSIX applications to Zephyr. Fixes: #12965 Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
This commit is contained in:
parent
a4c319681c
commit
0dcee73fe1
3 changed files with 20 additions and 8 deletions
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
if(NOT CONFIG_NATIVE_APPLICATION)
|
if(NOT CONFIG_NATIVE_APPLICATION)
|
||||||
add_subdirectory(libc)
|
add_subdirectory(libc)
|
||||||
|
add_subdirectory(posix)
|
||||||
endif()
|
endif()
|
||||||
add_subdirectory_ifdef(CONFIG_POSIX_API posix)
|
|
||||||
add_subdirectory_ifdef(CONFIG_CMSIS_RTOS_V1 cmsis_rtos_v1)
|
add_subdirectory_ifdef(CONFIG_CMSIS_RTOS_V1 cmsis_rtos_v1)
|
||||||
add_subdirectory_ifdef(CONFIG_CMSIS_RTOS_V2 cmsis_rtos_v2)
|
add_subdirectory_ifdef(CONFIG_CMSIS_RTOS_V2 cmsis_rtos_v2)
|
||||||
add_subdirectory(gui)
|
add_subdirectory(gui)
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
|
|
||||||
zephyr_interface_library_named(posix_subsys)
|
zephyr_interface_library_named(posix_subsys)
|
||||||
|
|
||||||
target_include_directories(posix_subsys INTERFACE ${ZEPHYR_BASE}/include/posix)
|
if(CONFIG_POSIX_API)
|
||||||
|
target_include_directories(posix_subsys INTERFACE ${ZEPHYR_BASE}/include/posix)
|
||||||
|
endif()
|
||||||
|
|
||||||
zephyr_library()
|
zephyr_library()
|
||||||
zephyr_library_sources(pthread_common.c)
|
zephyr_library_sources(pthread_common.c)
|
||||||
|
@ -11,10 +13,10 @@ zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC pthread_cond.c)
|
||||||
zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC pthread_mutex.c)
|
zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC pthread_mutex.c)
|
||||||
zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC pthread_barrier.c)
|
zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC pthread_barrier.c)
|
||||||
zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC pthread.c)
|
zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC pthread.c)
|
||||||
zephyr_library_sources(pthread_sched.c)
|
zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC pthread_sched.c)
|
||||||
zephyr_library_sources(clock.c)
|
zephyr_library_sources_ifdef(CONFIG_POSIX_CLOCK clock.c)
|
||||||
zephyr_library_sources(sleep.c)
|
zephyr_library_sources_ifdef(CONFIG_POSIX_CLOCK sleep.c)
|
||||||
zephyr_library_sources(timer.c)
|
zephyr_library_sources_ifdef(CONFIG_POSIX_CLOCK timer.c)
|
||||||
zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC pthread_rwlock.c)
|
zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC pthread_rwlock.c)
|
||||||
zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC semaphore.c)
|
zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC semaphore.c)
|
||||||
zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC pthread_key.c)
|
zephyr_library_sources_ifdef(CONFIG_PTHREAD_IPC pthread_key.c)
|
||||||
|
|
|
@ -19,10 +19,9 @@ config POSIX_API
|
||||||
Enable mostly-standards-compliant implementations of
|
Enable mostly-standards-compliant implementations of
|
||||||
various POSIX (IEEE 1003.1) APIs.
|
various POSIX (IEEE 1003.1) APIs.
|
||||||
|
|
||||||
if POSIX_API
|
|
||||||
|
|
||||||
config PTHREAD_IPC
|
config PTHREAD_IPC
|
||||||
bool "POSIX pthread IPC API"
|
bool "POSIX pthread IPC API"
|
||||||
|
default y if POSIX_API
|
||||||
help
|
help
|
||||||
This enables a mostly-standards-compliant implementation of
|
This enables a mostly-standards-compliant implementation of
|
||||||
the pthread mutex, condition variable and barrier IPC
|
the pthread mutex, condition variable and barrier IPC
|
||||||
|
@ -45,6 +44,13 @@ config SEM_VALUE_MAX
|
||||||
|
|
||||||
endif # PTHREAD_IPC
|
endif # PTHREAD_IPC
|
||||||
|
|
||||||
|
config POSIX_CLOCK
|
||||||
|
bool "POSIX clock, timer, and sleep APIs"
|
||||||
|
default y if POSIX_API
|
||||||
|
help
|
||||||
|
This enables POSIX clock\_\*(), timer\_\*(), and \*sleep()
|
||||||
|
functions.
|
||||||
|
|
||||||
config MAX_TIMER_COUNT
|
config MAX_TIMER_COUNT
|
||||||
int "Maximum timer count in POSIX application"
|
int "Maximum timer count in POSIX application"
|
||||||
default 5
|
default 5
|
||||||
|
@ -54,6 +60,7 @@ config MAX_TIMER_COUNT
|
||||||
|
|
||||||
config POSIX_MQUEUE
|
config POSIX_MQUEUE
|
||||||
bool "Enable POSIX message queue"
|
bool "Enable POSIX message queue"
|
||||||
|
default y if POSIX_API
|
||||||
help
|
help
|
||||||
This enabled POSIX message queue related APIs.
|
This enabled POSIX message queue related APIs.
|
||||||
|
|
||||||
|
@ -83,6 +90,7 @@ endif
|
||||||
if FILE_SYSTEM
|
if FILE_SYSTEM
|
||||||
config POSIX_FS
|
config POSIX_FS
|
||||||
bool "Enable POSIX file system API support"
|
bool "Enable POSIX file system API support"
|
||||||
|
default y if POSIX_API
|
||||||
help
|
help
|
||||||
This enables POSIX style file system related APIs.
|
This enables POSIX style file system related APIs.
|
||||||
|
|
||||||
|
@ -96,6 +104,8 @@ config POSIX_MAX_OPEN_FILES
|
||||||
endif
|
endif
|
||||||
endif # FILE_SYSTEM
|
endif # FILE_SYSTEM
|
||||||
|
|
||||||
|
if POSIX_API
|
||||||
|
|
||||||
# The name of this option is mandated by zephyr_interface_library_named
|
# The name of this option is mandated by zephyr_interface_library_named
|
||||||
# cmake directive.
|
# cmake directive.
|
||||||
config APP_LINK_WITH_POSIX_SUBSYS
|
config APP_LINK_WITH_POSIX_SUBSYS
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue