diff --git a/common.mk b/common.mk index fcfaeee..4e8ee3a 100644 --- a/common.mk +++ b/common.mk @@ -48,6 +48,13 @@ ESPTOOL ?= esptool.py ESPPORT ?= /dev/ttyUSB0 ESPBAUD ?= 115200 +# set this to 0 if you don't need floating point support in printf/scanf +# this will save approx 14.5KB flash space and 448 bytes of statically allocated +# data RAM +# +# NB: Setting the value to 0 requires a recent esptool.py (Feb 2016 / commit ebf02c9) +PRINTF_SCANF_FLOAT_SUPPORT ?= 1 + # Set OTA to 1 to build an image that supports rBoot OTA bootloader # # Currently only works with 16mbit or more flash sizes, with 8mbit @@ -109,7 +116,7 @@ CXXFLAGS ?= $(C_CXX_FLAGS) -fno-exceptions -fno-rtti $(EXTRA_CXXFLAGS) # these aren't technically preprocesor args, but used by all 3 of C, C++, assembler CPPFLAGS += -mlongcalls -mtext-section-literals -LDFLAGS = -nostdlib -Wl,--no-check-sections -L$(BUILD_DIR)sdklib -L$(ROOT)lib -u $(ENTRY_SYMBOL) -Wl,-static -Wl,-Map=$(BUILD_DIR)$(PROGRAM).map $(EXTRA_LDFLAGS) +LDFLAGS = -nostdlib -Wl,--no-check-sections -L$(BUILD_DIR)sdklib -L$(ROOT)lib -u $(ENTRY_SYMBOL) -Wl,-static -Wl,-Map=$(BUILD_DIR)$(PROGRAM).map $(EXTRA_LDFLAGS) ifeq ($(SPLIT_SECTIONS),1) C_CXX_FLAGS += -ffunction-sections -fdata-sections @@ -202,6 +209,9 @@ INC_DIRS = $(PROGRAM_DIR) $(PROGRAM_DIR)include $(ROOT)include ifeq ($(OWN_LIBC),1) INC_DIRS += $(ROOT)libc/xtensa-lx106-elf/include LDFLAGS += -L$(ROOT)libc/xtensa-lx106-elf/lib + ifeq ($(PRINTF_SCANF_FLOAT_SUPPORT),1) + LDFLAGS += -u _printf_float -u _scanf_float + endif endif ifeq ("$(V)","1") diff --git a/libc/xtensa-lx106-elf/include/config.h b/libc/xtensa-lx106-elf/include/config.h new file mode 100644 index 0000000..6159c6f --- /dev/null +++ b/libc/xtensa-lx106-elf/include/config.h @@ -0,0 +1,43 @@ +#ifndef __SYS_CONFIG_H__ +#define __SYS_CONFIG_H__ + +#include /* floating point macros */ +#include /* POSIX defs */ + +/************************************************************************* + esp8266-specific xtensa stuff + *************************************************************************/ + +#ifndef _REENT_SMALL +#define _REENT_SMALL +#endif + +/* esp8266 hardware FIFO buffers are 128 bytes */ +#define __BUFSIZ__ 128 + +/************************************************************************* + end of esp8266-specific stuff + *************************************************************************/ + +#ifndef __EXPORT +#define __EXPORT +#endif + +#ifndef __IMPORT +#define __IMPORT +#endif + +/* Define return type of read/write routines. In POSIX, the return type + for read()/write() is "ssize_t" but legacy newlib code has been using + "int" for some time. If not specified, "int" is defaulted. */ +#ifndef _READ_WRITE_RETURN_TYPE +#define _READ_WRITE_RETURN_TYPE int +#endif +/* Define `count' parameter of read/write routines. In POSIX, the `count' + parameter is "size_t" but legacy newlib code has been using "int" for some + time. If not specified, "int" is defaulted. */ +#ifndef _READ_WRITE_BUFSIZE_TYPE +#define _READ_WRITE_BUFSIZE_TYPE int +#endif + +#endif /* __SYS_CONFIG_H__ */ diff --git a/libc/xtensa-lx106-elf/lib/libc.a b/libc/xtensa-lx106-elf/lib/libc.a index a166b9e..6a256cd 100644 Binary files a/libc/xtensa-lx106-elf/lib/libc.a and b/libc/xtensa-lx106-elf/lib/libc.a differ diff --git a/libc/xtensa-lx106-elf/lib/libg.a b/libc/xtensa-lx106-elf/lib/libg.a index a166b9e..6a256cd 100644 Binary files a/libc/xtensa-lx106-elf/lib/libg.a and b/libc/xtensa-lx106-elf/lib/libg.a differ diff --git a/libc/xtensa-lx106-elf/lib/libm.a b/libc/xtensa-lx106-elf/lib/libm.a index be41436..7d96963 100644 Binary files a/libc/xtensa-lx106-elf/lib/libm.a and b/libc/xtensa-lx106-elf/lib/libm.a differ