libc: Added Kconfig choice to select C library

Added Kconfig choice to select C library implementation

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
This commit is contained in:
Jan Van Winkel 2019-08-15 20:39:20 +02:00 committed by Kumar Gala
commit c1f865b412
2 changed files with 45 additions and 19 deletions

View file

@ -1,6 +1,6 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
if(NOT CONFIG_NATIVE_APPLICATION) if(NOT CONFIG_EXTERNAL_LIBC)
add_subdirectory(libc) add_subdirectory(libc)
add_subdirectory(posix) add_subdirectory(posix)
endif() endif()

View file

@ -7,18 +7,44 @@
# #
menu "C Library" menu "C Library"
config REQUIRES_FULL_LIBC
bool
help
Helper symbol to indicate some feature requires a C library implementation
with more functionality than what MINIMAL_LIBC provides
choice LIBC_IMPLEMENTATION
prompt "C Library Implementation"
default EXTERNAL_LIBC if NATIVE_APPLICATION
default NEWLIB_LIBC if REQUIRES_FULL_LIBC
default MINIMAL_LIBC
config MINIMAL_LIBC
bool "Minimal C library"
depends on !NATIVE_APPLICATION depends on !NATIVE_APPLICATION
help
Build with minimal C library.
config NEWLIB_LIBC config NEWLIB_LIBC
bool "Build with newlib c library" bool "Newlib C library"
depends on !NATIVE_APPLICATION
help help
Build with newlib library. The newlib library is expected to be Build with newlib library. The newlib library is expected to be
part of the SDK in this case. part of the SDK in this case.
config EXTERNAL_LIBC
bool "External C library"
help
Build with external/user provided C library.
endchoice #LIBC_IMPLEMENTATION
if NEWLIB_LIBC
if "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "gnuarmemb" if "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "gnuarmemb"
config NEWLIB_LIBC_NANO config NEWLIB_LIBC_NANO
bool "Build with newlib-nano c library" bool "Build with newlib-nano C library"
depends on NEWLIB_LIBC
default y default y
help help
Build with newlib-nano library, for small embedded apps. Build with newlib-nano library, for small embedded apps.
@ -29,7 +55,6 @@ endif
config NEWLIB_LIBC_ALIGNED_HEAP_SIZE config NEWLIB_LIBC_ALIGNED_HEAP_SIZE
int "Newlib aligned heap size" int "Newlib aligned heap size"
depends on MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT depends on MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT
depends on NEWLIB_LIBC
depends on USERSPACE depends on USERSPACE
default 0 default 0
help help
@ -43,32 +68,22 @@ config NEWLIB_LIBC_ALIGNED_HEAP_SIZE
config NEWLIB_LIBC_FLOAT_PRINTF config NEWLIB_LIBC_FLOAT_PRINTF
bool "Build with newlib float printf" bool "Build with newlib float printf"
depends on NEWLIB_LIBC
help help
Build with floating point printf enabled. This will increase the size of Build with floating point printf enabled. This will increase the size of
the image. the image.
config NEWLIB_LIBC_FLOAT_SCANF config NEWLIB_LIBC_FLOAT_SCANF
bool "Build with newlib float scanf" bool "Build with newlib float scanf"
depends on NEWLIB_LIBC
help help
Build with floating point scanf enabled. This will increase the size of Build with floating point scanf enabled. This will increase the size of
the image. the image.
config STDOUT_CONSOLE endif #NEWLIB_LIBC
bool "Send stdout to console"
depends on CONSOLE_HAS_DRIVER
default y
help
This option directs standard output (e.g. printf) to the console
device, rather than suppressing it entirely. See also EARLY_CONSOLE
option.
# Minimal libc options if MINIMAL_LIBC
config MINIMAL_LIBC_MALLOC_ARENA_SIZE config MINIMAL_LIBC_MALLOC_ARENA_SIZE
int "Size of the minimal libc malloc arena" int "Size of the minimal libc malloc arena"
depends on !NEWLIB_LIBC
default 0 default 0
help help
Indicate the size of the memory arena used for minimal libc's Indicate the size of the memory arena used for minimal libc's
@ -77,10 +92,21 @@ config MINIMAL_LIBC_MALLOC_ARENA_SIZE
config MINIMAL_LIBC_LL_PRINTF config MINIMAL_LIBC_LL_PRINTF
bool "Build with minimal libc long long printf" if !64BIT bool "Build with minimal libc long long printf" if !64BIT
depends on !NEWLIB_LIBC
default y if 64BIT default y if 64BIT
help help
Build with long long printf enabled. This will increase the size of Build with long long printf enabled. This will increase the size of
the image. the image.
endif #MINIMAL_LIBC
config STDOUT_CONSOLE
bool "Send stdout to console"
depends on CONSOLE_HAS_DRIVER
depends on !NATIVE_APPLICATION
default y
help
This option directs standard output (e.g. printf) to the console
device, rather than suppressing it entirely. See also EARLY_CONSOLE
option.
endmenu endmenu