newlib: Introduce newlib_nano pseudomodule
This commit is contained in:
parent
5ecbcca01a
commit
2b51e4b116
@ -290,6 +290,10 @@ ifneq (,$(filter gnrc_pktdump,$(USEMODULE)))
|
|||||||
USEMODULE += od
|
USEMODULE += od
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq (,$(filter newlib_nano,$(USEMODULE)))
|
||||||
|
USEMODULE += newlib
|
||||||
|
endif
|
||||||
|
|
||||||
ifneq (,$(filter newlib,$(USEMODULE)))
|
ifneq (,$(filter newlib,$(USEMODULE)))
|
||||||
# allow custom newlib syscalls implementations by adding
|
# allow custom newlib syscalls implementations by adding
|
||||||
# newlib_syscalls_XXX to USEMODULE
|
# newlib_syscalls_XXX to USEMODULE
|
||||||
|
|||||||
@ -17,6 +17,7 @@ PSEUDOMODULES += gnrc_pktbuf
|
|||||||
PSEUDOMODULES += log
|
PSEUDOMODULES += log
|
||||||
PSEUDOMODULES += log_printfnoformat
|
PSEUDOMODULES += log_printfnoformat
|
||||||
PSEUDOMODULES += newlib
|
PSEUDOMODULES += newlib
|
||||||
|
PSEUDOMODULES += newlib_nano
|
||||||
PSEUDOMODULES += pktqueue
|
PSEUDOMODULES += pktqueue
|
||||||
PSEUDOMODULES += schedstatistics
|
PSEUDOMODULES += schedstatistics
|
||||||
PSEUDOMODULES += netif
|
PSEUDOMODULES += netif
|
||||||
|
|||||||
@ -29,10 +29,7 @@ export LINKFLAGS += $(CFLAGS_CPU) $(CFLAGS_DBG) $(CFLAGS_OPT) -static -lgcc -nos
|
|||||||
export LINKFLAGS += -Wl,--gc-sections
|
export LINKFLAGS += -Wl,--gc-sections
|
||||||
|
|
||||||
# use the nano-specs of Newlib when available
|
# use the nano-specs of Newlib when available
|
||||||
ifeq ($(shell $(LINK) -specs=nano.specs -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
|
USEMODULE += newlib_nano
|
||||||
export CFLAGS += -specs=nano.specs
|
|
||||||
export LINKFLAGS += -specs=nano.specs -lc -lnosys
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(PORT),)
|
ifeq ($(PORT),)
|
||||||
export PORT = /dev/ttyUSB0
|
export PORT = /dev/ttyUSB0
|
||||||
|
|||||||
@ -94,10 +94,7 @@ endif
|
|||||||
include $(RIOTCPU)/cortexm_common/Makefile.include
|
include $(RIOTCPU)/cortexm_common/Makefile.include
|
||||||
|
|
||||||
# use the nano-specs of Newlib when available
|
# use the nano-specs of Newlib when available
|
||||||
ifeq ($(shell $(LINK) -specs=nano.specs -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
|
USEMODULE += newlib_nano
|
||||||
export CFLAGS += -specs=nano.specs
|
|
||||||
export LINKFLAGS += -specs=nano.specs -lc -lnosys
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Avoid overriding the default rule:
|
# Avoid overriding the default rule:
|
||||||
all:
|
all:
|
||||||
|
|||||||
@ -1,5 +1,18 @@
|
|||||||
UNDEF := $(BINDIR)newlib_syscalls_default/syscalls.o $(UNDEF)
|
UNDEF := $(BINDIR)newlib_syscalls_default/syscalls.o $(UNDEF)
|
||||||
|
|
||||||
|
ifneq (,$(filter newlib_nano,$(USEMODULE)))
|
||||||
|
# Test if nano.specs is available
|
||||||
|
ifeq ($(shell $(LINK) -specs=nano.specs -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
|
||||||
|
USE_NEWLIB_NANO = 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq (1,$(USE_NEWLIB_NANO))
|
||||||
|
export LINKFLAGS += -specs=nano.specs
|
||||||
|
endif
|
||||||
|
|
||||||
|
export LINKFLAGS += -lc -lnosys
|
||||||
|
|
||||||
# Search for Newlib include directories
|
# Search for Newlib include directories
|
||||||
|
|
||||||
# Since Clang is not installed as a separate instance for each crossdev target
|
# Since Clang is not installed as a separate instance for each crossdev target
|
||||||
@ -25,15 +38,21 @@ NEWLIB_INCLUDE_PATTERNS ?= \
|
|||||||
# the patterns above. We use the -isystem gcc/clang argument to add the include
|
# the patterns above. We use the -isystem gcc/clang argument to add the include
|
||||||
# directories as system include directories, which means they will not be
|
# directories as system include directories, which means they will not be
|
||||||
# searched until after all the project specific include directories (-I/path)
|
# searched until after all the project specific include directories (-I/path)
|
||||||
NEWLIB_INCLUDES ?= \
|
NEWLIB_INCLUDE_DIR ?= $(firstword $(wildcard $(NEWLIB_INCLUDE_PATTERNS)))
|
||||||
$(foreach dir, \
|
|
||||||
$(foreach pat, $(NEWLIB_INCLUDE_PATTERNS), $(wildcard $(pat))), \
|
|
||||||
-isystem $(dir))
|
|
||||||
|
|
||||||
# If nothing was found we will try to fall back to searching for a cross-gcc in
|
# If nothing was found we will try to fall back to searching for a cross-gcc in
|
||||||
# the current PATH and use a relative path for the includes
|
# the current PATH and use a relative path for the includes
|
||||||
ifeq (,$(NEWLIB_INCLUDES))
|
ifeq (,$(NEWLIB_INCLUDE_DIR))
|
||||||
NEWLIB_INCLUDES := $(addprefix -isystem ,$(wildcard $(dir $(shell which $(PREFIX)gcc))../$(TARGET_ARCH)/include))
|
NEWLIB_INCLUDE_DIR := $(abspath $(wildcard $(dir $(shell which $(PREFIX)gcc))../$(TARGET_ARCH)/include))
|
||||||
|
endif
|
||||||
|
|
||||||
|
NEWLIB_INCLUDES := -isystem $(NEWLIB_INCLUDE_DIR)
|
||||||
|
|
||||||
|
ifeq (1,$(USE_NEWLIB_NANO))
|
||||||
|
NEWLIB_NANO_INCLUDE_DIR ?= $(NEWLIB_INCLUDE_DIR)/nano
|
||||||
|
# newlib-nano overrides newlib.h and its include dir should therefore go before
|
||||||
|
# the regular newlib include dir.
|
||||||
|
NEWLIB_INCLUDES := -isystem $(NEWLIB_NANO_INCLUDE_DIR) $(NEWLIB_INCLUDES)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Newlib includes should go before GCC includes.
|
# Newlib includes should go before GCC includes.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user