|
| 1 | +ifeq (, $(NEWLIB_BASE)) |
| 2 | + NEWLIB_BASE := $(RIOTBASE)/toolchain/x86/i586-none-elf |
| 3 | + |
| 4 | + ifneq (0, $(shell test -e "$(NEWLIB_BASE)/lib/libc.a" && echo $$?)) |
| 5 | + NEWLIB_PRECOMPILED_NAME := i586-newlib_2.1.0_tlsf.txz |
| 6 | + NEWLIB_PRECOMPILED := http://download.riot-os.org/$(NEWLIB_PRECOMPILED_NAME) |
| 7 | + |
| 8 | + $(warning "Precompiled newlib is missing in $(NEWLIB_BASE)") |
| 9 | + $(warning "Downloading from $(NEWLIB_PRECOMPILED)") |
| 10 | + |
| 11 | + $(shell cd $(RIOTBASE) && wget -qO- "$(NEWLIB_PRECOMPILED)" | tar xJ) |
| 12 | + endif |
| 13 | +endif |
| 14 | + |
| 15 | +ifeq (,$(BUILD_INCLUDE_BASE)) |
| 16 | + GCC_BUILD_TRIPLET ?= $(shell gcc -dumpmachine) |
| 17 | + GCC_BUILD_VERSION ?= $(shell gcc -dumpversion) |
| 18 | + BUILD_INCLUDE_BASE = /usr/lib/gcc/$(GCC_BUILD_TRIPLET)/$(GCC_BUILD_VERSION) |
| 19 | + |
| 20 | + ifeq (,$(shell echo $(GCC_BUILD_TRIPLET) | sed -e 's,-.*,,' | grep -e '\(x\|i[3-7]\)86')) |
| 21 | + $(warning Your build machine is a(n) $(GCC_BUILD_TRIPLET).) |
| 22 | + $(warning Since this is not IA32 compatible, you must set BUILD_INCLUDE_BASE explicitly!) |
| 23 | + endif |
| 24 | +endif |
| 25 | + |
| 26 | +export INCLUDES += -isystem $(BUILD_INCLUDE_BASE)/include \ |
| 27 | + -isystem $(NEWLIB_BASE)/include \ |
| 28 | + -isystem $(NEWLIB_BASE)/sys-include \ |
| 29 | + -isystem $(BUILD_INCLUDE_BASE)/include-fixed \ |
| 30 | + -I$(RIOTBOARD)/x86-multiboot-common/include |
| 31 | +export CPU = x86 |
| 32 | + |
| 33 | +# toolchain config |
| 34 | +export CC ?= $(PREFIX)gcc |
| 35 | +export AR ?= $(PREFIX)ar |
| 36 | +export AS ?= $(PREFIX)as |
| 37 | +export RANLIB ?= $(PREFIX)ranlib |
| 38 | +export LINK ?= $(RIOTBASE)/boards/x86-multiboot-common/dist/link $(PREFIX)gcc |
| 39 | +export SIZE ?= $(PREFIX)size |
| 40 | +export OBJCOPY ?= $(PREFIX)objcopy |
| 41 | + |
| 42 | +export CFLAGS += -m32 -mfpmath=387 -ffreestanding -nostdlib -nostdinc -fno-builtin |
| 43 | +export OFLAGS = -O binary |
| 44 | + |
| 45 | +LINKFLAGS += -m32 -nostdlib -nostdinc -nostartfiles -nodefaultlibs \ |
| 46 | + --prefix=$(NEWLIB_BASE) \ |
| 47 | + -Wl,-rpath,$(NEWLIB_BASE)/lib \ |
| 48 | + -T $(RIOTBASE)/boards/x86-multiboot-common/linker.ld |
| 49 | +UNDEF += $(BINDIR)x86-multiboot-common_base/startup.o |
| 50 | + |
| 51 | +#CFLAGS += -ffunction-sections -fdata-sections |
| 52 | +#LINKFLAGS += -Wl,--gc-sections |
| 53 | +#CFLAGS += -Wall -Wextra -Werror -pedantic -pedantic-errors \ |
| 54 | + |
| 55 | +BASELIBS += $(NEWLIB_BASE)/lib/libc.a \ |
| 56 | + $(NEWLIB_BASE)/lib/libm.a |
0 commit comments