mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-05-21 17:16:29 +08:00
Merge branch 'bugfix/fix_vfs_uart_noinit_by_using_fnano_newlib' into 'master'
newlib: fix some initialization function is not done when using float nano newlib See merge request sdk/ESP8266_RTOS_SDK!1070
This commit is contained in:
@ -34,7 +34,7 @@
|
||||
#include "FreeRTOS.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"
|
||||
#endif
|
||||
|
||||
@ -163,7 +163,7 @@ void call_start_cpu(size_t start_addr)
|
||||
assert(__esp_os_init() == 0);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NEWLIB_LIBRARY_LEVEL_NORMAL) || defined(CONFIG_NEWLIB_LIBRARY_LEVEL_NANO)
|
||||
#ifndef CONFIG_NEWLIB_LIBRARY_CUSTOMER
|
||||
esp_newlib_init();
|
||||
#endif
|
||||
|
||||
|
@ -42,7 +42,7 @@ extern "C" {
|
||||
#include "xtensa_rtos.h"
|
||||
|
||||
#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"
|
||||
|
||||
#define _impure_ptr _global_impure_ptr
|
||||
|
@ -1,5 +1,5 @@
|
||||
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)
|
||||
|
@ -1,18 +1,8 @@
|
||||
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_FLOAT_NANO
|
||||
depends on NEWLIB_ENABLE
|
||||
help
|
||||
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,
|
||||
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
|
||||
|
||||
endmenu
|
||||
|
@ -1,2 +1,9 @@
|
||||
CFLAGS += -D_CLOCKS_PER_SEC_=CONFIG_FREERTOS_HZ -D_POSIX_THREADS=1 -D_UNIX98_THREAD_MUTEX_ATTRIBUTES=1
|
||||
CPPFLAGS += -D_CLOCKS_PER_SEC_=CONFIG_FREERTOS_HZ -D_POSIX_THREADS=1 -D_UNIX98_THREAD_MUTEX_ATTRIBUTES=1
|
||||
ifndef CONFIG_NEWLIB_LIBRARY_CUSTOMER
|
||||
|
||||
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_SRCDIRS := .
|
||||
|
||||
ifdef CONFIG_NEWLIB_ENABLE
|
||||
|
||||
ADD_NEW_NEWLIB := 0
|
||||
ifndef CONFIG_NEWLIB_LIBRARY_CUSTOMER
|
||||
|
||||
ifdef CONFIG_NEWLIB_LIBRARY_LEVEL_NORMAL
|
||||
LIBC_PATH := $(COMPONENT_PATH)/newlib/lib/libc.a
|
||||
LIBM_PATH := $(COMPONENT_PATH)/newlib/lib/libm.a
|
||||
ADD_NEW_NEWLIB := 1
|
||||
else
|
||||
ifdef CONFIG_NEWLIB_LIBRARY_LEVEL_NANO
|
||||
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
|
||||
LIB_PATH := $(COMPONENT_PATH)/newlib/lib/libc.a $(COMPONENT_PATH)/newlib/lib/libm.a
|
||||
else ifdef CONFIG_NEWLIB_LIBRARY_LEVEL_NANO
|
||||
LIB_PATH := $(COMPONENT_PATH)/newlib/lib/libc_nano.a $(COMPONENT_PATH)/newlib/lib/libm.a
|
||||
else ifdef CONFIG_NEWLIB_LIBRARY_LEVEL_FLOAT_NANO
|
||||
LIB_PATH := $(COMPONENT_PATH)/newlib/lib/libc_fnano.a $(COMPONENT_PATH)/newlib/lib/libm.a
|
||||
endif
|
||||
|
||||
ifeq ($(ADD_NEW_NEWLIB),1)
|
||||
COMPONENT_ADD_INCLUDEDIRS += newlib/include newlib/port/include
|
||||
COMPONENT_ADD_INCLUDEDIRS += newlib/port/include newlib/include
|
||||
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
|
||||
COMPONENT_ADD_LDFLAGS := $(COMPONENT_ADD_LDFLAGS) -u _printf_float -u _scanf_float
|
||||
endif
|
||||
COMPONENT_ADD_LINKER_DEPS := $(LIBC_PATH) $(LIBM_PATH)
|
||||
endif
|
||||
|
||||
endif
|
||||
endif # CONFIG_NEWLIB_LIBRARY_CUSTOMER
|
Reference in New Issue
Block a user