mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-05-22 17:47:04 +08:00
fix(newlib): fix some initialization function is not done when using float-nano newlib and VFS
Using option "NEWLIB_LIBRARY_CUSTOMER" instead of "NEWLIB_ENABLE".
This commit is contained in:
@ -34,7 +34,7 @@
|
|||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
|
|
||||||
#if defined(CONFIG_NEWLIB_LIBRARY_LEVEL_NORMAL) || defined(CONFIG_NEWLIB_LIBRARY_LEVEL_NANO)
|
#ifndef CONFIG_NEWLIB_LIBRARY_CUSTOMER
|
||||||
#include "esp_newlib.h"
|
#include "esp_newlib.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ void call_start_cpu(size_t start_addr)
|
|||||||
assert(__esp_os_init() == 0);
|
assert(__esp_os_init() == 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_NEWLIB_LIBRARY_LEVEL_NORMAL) || defined(CONFIG_NEWLIB_LIBRARY_LEVEL_NANO)
|
#ifndef CONFIG_NEWLIB_LIBRARY_CUSTOMER
|
||||||
esp_newlib_init();
|
esp_newlib_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ extern "C" {
|
|||||||
#include "xtensa_rtos.h"
|
#include "xtensa_rtos.h"
|
||||||
|
|
||||||
#if defined(configUSE_NEWLIB_REENTRANT) && configUSE_NEWLIB_REENTRANT == 1
|
#if defined(configUSE_NEWLIB_REENTRANT) && configUSE_NEWLIB_REENTRANT == 1
|
||||||
#if defined(CONFIG_NEWLIB_LIBRARY_LEVEL_NORMAL) || defined(CONFIG_NEWLIB_LIBRARY_LEVEL_NANO)
|
#ifndef CONFIG_NEWLIB_LIBRARY_CUSTOMER
|
||||||
#include "esp_newlib.h"
|
#include "esp_newlib.h"
|
||||||
|
|
||||||
#define _impure_ptr _global_impure_ptr
|
#define _impure_ptr _global_impure_ptr
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
set(COMPONENT_SRCDIRS newlib/port)
|
set(COMPONENT_SRCDIRS newlib/port)
|
||||||
set(COMPONENT_ADD_INCLUDEDIRS newlib/include newlib/port/include)
|
set(COMPONENT_ADD_INCLUDEDIRS newlib/port/include newlib/include)
|
||||||
|
|
||||||
|
|
||||||
if(CONFIG_NEWLIB_LIBRARY_LEVEL_NANO)
|
if(CONFIG_NEWLIB_LIBRARY_LEVEL_NANO)
|
||||||
|
@ -1,18 +1,8 @@
|
|||||||
menu "Newlib"
|
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
|
choice NEWLIB_LIBRARY_LEVEL
|
||||||
prompt "newlib level"
|
prompt "newlib level"
|
||||||
default NEWLIB_LIBRARY_LEVEL_FLOAT_NANO
|
default NEWLIB_LIBRARY_LEVEL_FLOAT_NANO
|
||||||
depends on NEWLIB_ENABLE
|
|
||||||
help
|
help
|
||||||
Choose newlib library level.
|
Choose newlib library level.
|
||||||
|
|
||||||
@ -50,6 +40,14 @@ config NEWLIB_LIBRARY_LEVEL_FLOAT_NANO
|
|||||||
If you do not need 64-bit integer formatting support and C99 features, but need float formats,
|
If you do not need 64-bit integer formatting support and C99 features, but need float formats,
|
||||||
select this option.
|
select this option.
|
||||||
|
|
||||||
|
config NEWLIB_LIBRARY_CUSTOMER
|
||||||
|
bool "customer"
|
||||||
|
help
|
||||||
|
If you need use you own C library, select this option. 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.
|
||||||
|
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
@ -1,2 +1,9 @@
|
|||||||
CFLAGS += -D_CLOCKS_PER_SEC_=CONFIG_FREERTOS_HZ -D_POSIX_THREADS=1 -D_UNIX98_THREAD_MUTEX_ATTRIBUTES=1
|
ifndef CONFIG_NEWLIB_LIBRARY_CUSTOMER
|
||||||
CPPFLAGS += -D_CLOCKS_PER_SEC_=CONFIG_FREERTOS_HZ -D_POSIX_THREADS=1 -D_UNIX98_THREAD_MUTEX_ATTRIBUTES=1
|
|
||||||
|
NEWLIB_FLAGS := -D_CLOCKS_PER_SEC_=CONFIG_FREERTOS_HZ \
|
||||||
|
-D_POSIX_THREADS=1 \
|
||||||
|
-D_UNIX98_THREAD_MUTEX_ATTRIBUTES=1
|
||||||
|
|
||||||
|
CFLAGS += $(NEWLIB_FLAGS)
|
||||||
|
CPPFLAGS += $(NEWLIB_FLAGS)
|
||||||
|
endif
|
||||||
|
@ -1,38 +1,23 @@
|
|||||||
#
|
#
|
||||||
# Component Makefile
|
# Component Makefile
|
||||||
#
|
#
|
||||||
COMPONENT_SRCDIRS := .
|
ifndef CONFIG_NEWLIB_LIBRARY_CUSTOMER
|
||||||
|
|
||||||
ifdef CONFIG_NEWLIB_ENABLE
|
|
||||||
|
|
||||||
ADD_NEW_NEWLIB := 0
|
|
||||||
|
|
||||||
ifdef CONFIG_NEWLIB_LIBRARY_LEVEL_NORMAL
|
ifdef CONFIG_NEWLIB_LIBRARY_LEVEL_NORMAL
|
||||||
LIBC_PATH := $(COMPONENT_PATH)/newlib/lib/libc.a
|
LIB_PATH := $(COMPONENT_PATH)/newlib/lib/libc.a $(COMPONENT_PATH)/newlib/lib/libm.a
|
||||||
LIBM_PATH := $(COMPONENT_PATH)/newlib/lib/libm.a
|
else ifdef CONFIG_NEWLIB_LIBRARY_LEVEL_NANO
|
||||||
ADD_NEW_NEWLIB := 1
|
LIB_PATH := $(COMPONENT_PATH)/newlib/lib/libc_nano.a $(COMPONENT_PATH)/newlib/lib/libm.a
|
||||||
else
|
else ifdef CONFIG_NEWLIB_LIBRARY_LEVEL_FLOAT_NANO
|
||||||
ifdef CONFIG_NEWLIB_LIBRARY_LEVEL_NANO
|
LIB_PATH := $(COMPONENT_PATH)/newlib/lib/libc_fnano.a $(COMPONENT_PATH)/newlib/lib/libm.a
|
||||||
LIBC_PATH := $(COMPONENT_PATH)/newlib/lib/libc_nano.a
|
|
||||||
LIBM_PATH := $(COMPONENT_PATH)/newlib/lib/libm.a
|
|
||||||
ADD_NEW_NEWLIB := 1
|
|
||||||
else
|
|
||||||
ifdef CONFIG_NEWLIB_LIBRARY_LEVEL_FLOAT_NANO
|
|
||||||
LIBC_PATH := $(COMPONENT_PATH)/newlib/lib/libc_fnano.a
|
|
||||||
LIBM_PATH := $(COMPONENT_PATH)/newlib/lib/libm.a
|
|
||||||
ADD_NEW_NEWLIB := 1
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(ADD_NEW_NEWLIB),1)
|
COMPONENT_ADD_INCLUDEDIRS += newlib/port/include newlib/include
|
||||||
COMPONENT_ADD_INCLUDEDIRS += newlib/include newlib/port/include
|
|
||||||
COMPONENT_SRCDIRS += newlib/port
|
COMPONENT_SRCDIRS += newlib/port
|
||||||
COMPONENT_ADD_LDFLAGS := $(LIBC_PATH) $(LIBM_PATH) -lnewlib
|
COMPONENT_ADD_LDFLAGS := $(LIB_PATH) -lnewlib
|
||||||
|
COMPONENT_ADD_LINKER_DEPS := $(LIB_PATH)
|
||||||
|
|
||||||
ifdef CONFIG_NEWLIB_LIBRARY_LEVEL_FLOAT_NANO
|
ifdef CONFIG_NEWLIB_LIBRARY_LEVEL_FLOAT_NANO
|
||||||
COMPONENT_ADD_LDFLAGS := $(COMPONENT_ADD_LDFLAGS) -u _printf_float -u _scanf_float
|
COMPONENT_ADD_LDFLAGS := $(COMPONENT_ADD_LDFLAGS) -u _printf_float -u _scanf_float
|
||||||
endif
|
endif
|
||||||
COMPONENT_ADD_LINKER_DEPS := $(LIBC_PATH) $(LIBM_PATH)
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
endif # CONFIG_NEWLIB_LIBRARY_CUSTOMER
|
Reference in New Issue
Block a user