From 3a724ca78cc33face77acdfa0d054cce46441e81 Mon Sep 17 00:00:00 2001 From: Dong Heng Date: Tue, 8 May 2018 16:02:57 +0800 Subject: [PATCH] feat(kconfig): Add option to kconfig Add option to enable reent function. --- components/freertos/Kconfig | 12 ++++++ .../include/port/freertos/FreeRTOSConfig.h | 6 +++ components/newlib/Kconfig | 41 +++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 components/freertos/Kconfig create mode 100644 components/newlib/Kconfig diff --git a/components/freertos/Kconfig b/components/freertos/Kconfig new file mode 100644 index 00000000..b50d1871 --- /dev/null +++ b/components/freertos/Kconfig @@ -0,0 +1,12 @@ +menu "FreeRTOS" + +config FREERTOS_ENABLE_REENT + bool "Enable \"reent\" function" + default n + select NEWLIB_ENABLE + help + Enable "reent" function and FreeRTOS should use "reent" function of newlib. + + The configuration will enable newlib. + +endmenu diff --git a/components/freertos/include/port/freertos/FreeRTOSConfig.h b/components/freertos/include/port/freertos/FreeRTOSConfig.h index 89deb9a3..93d005b6 100644 --- a/components/freertos/include/port/freertos/FreeRTOSConfig.h +++ b/components/freertos/include/port/freertos/FreeRTOSConfig.h @@ -65,6 +65,8 @@ #ifndef FREERTOS_CONFIG_H #define FREERTOS_CONFIG_H +#include "sdkconfig.h" + /*----------------------------------------------------------- * Application specific definitions. * @@ -140,5 +142,9 @@ configKERNEL_INTERRUPT_PRIORITY setting. Here 15 corresponds to the lowest NVIC value of 255. */ #define configLIBRARY_KERNEL_INTERRUPT_PRIORITY 15 +#ifdef CONFIG_FREERTOS_ENABLE_REENT +#define configUSE_NEWLIB_REENTRANT 1 +#endif + #endif /* FREERTOS_CONFIG_H */ diff --git a/components/newlib/Kconfig b/components/newlib/Kconfig new file mode 100644 index 00000000..527130f4 --- /dev/null +++ b/components/newlib/Kconfig @@ -0,0 +1,41 @@ +menu "Newlib" + +config NEWLIB_ENABLE + bool "Enable newlib" + default y + help + If you need use you own C library, make this option disable. The libraries and + header files at this component will not be used. + + Note: ABI of the C library of your own must be same as SDK. + +choice NEWLIB_LIBRARY_LEVEL + prompt "newlib level" + default NEWLIB_LIBRARY_LEVEL_NANO + depends on NEWLIB_ENABLE + help + Choose newlib library level. + +config NEWLIB_LIBRARY_LEVEL_NORMAL + bool "normal" + help + If you need 64-bit integer formatting support or C99 features, select this + option. + +config NEWLIB_LIBRARY_LEVEL_NANO + bool "nano" + help + The newlib library which has been compiled with so-called "nano" + formatting option. This option doesn't support 64-bit integer formats and C99 + features, such as positional arguments. + + For more details about "nano" formatting option, please see newlib readme file, + search for '--enable-newlib-nano-formatted-io': + https://sourceware.org/newlib/README + + If you do not need 64-bit integer formatting support or C99 features, select this + option. + +endchoice + +endmenu