| ## |
| # @file Makefile.config |
| # |
| # @brief This file contains the global default tool arguments, |
| # which could be appended or overwrited by each module |
| # |
| # @author Howard Chen |
| ## |
| |
| ## |
| # @brief option flags for gcc/tcc |
| # @param CC : option for c compiler |
| # @param CXX : option for c++ compiler |
| # @param WALL : option for warning message |
| # @param DEBUG : option for debugging format |
| # @param MOPTS : option for specific target |
| # @param INCLUDE_ADD : INCLUDE ADD-ON |
| # @param LDFLAGS_ADD : LDFLAGS ADD-ON |
| # @param SYS_LIBS : SYSTEM library add for image linking |
| # @param STARTUP : startup code (if any) |
| ## |
| |
| GCC = $(CROSS)gcc |
| CC = $(GCC) |
| CXX = $(CROSS)g++ |
| ## |
| # -------------[ config for native ]------------------------------ |
| ## |
| ifeq ($(CROSS),) |
| ifeq ($(strip $(LINUX)),2) |
| #Linux kernel space |
| #MOPTS ?= -m32 -fno-builtin -D__KERNEL__ -I../linux/include -DMODULE -DMODVERSIONS -include ../linux/include/linux/modversions.h |
| MOPTS ?= -m32 -fno-builtin -D__KERNEL__ -DMODULE -DMODVERSIONS |
| CONFIG += -DLINUX |
| else |
| WALL ?= -Wall |
| DEBUGS ?= -g |
| MOPTS ?= -m32 |
| ifeq ($(strip $(LINUX)),1) |
| CONFIG += -DLINUX |
| endif |
| SYS_LIBS?= pthread rt |
| RUN ?= ./ |
| endif |
| DEF_ASFLAGS=-m32 |
| endif |
| |
| ifeq ($(strip $(CROSS)),arm-none-linux-) |
| ifeq ($(strip $(LINUX)),2) |
| #Linux kernel space |
| MOPTS ?= -fno-builtin -D__KERNEL__ -DMODULE -DMODVERSIONS |
| CONFIG += -DLINUX |
| else |
| WALL ?= -Wall |
| DEBUGS ?= -g |
| THUMB ?=-mthumb |
| MOPTS ?= -fcall-saved-r10 -march=armv5te -ffunction-sections -fdata-sections -mthumb-interwork -msoft-float |
| CONFIG += -DLINUX |
| SYS_LIBS?= pthread rt |
| RUN ?= |
| DEF_ASFLAGS = $(DEBUGS) |
| endif |
| DEF_ASFLAGS = -msoft-float -mthumb-interwork |
| endif |
| |
| ifeq ($(strip $(CROSS)),mipsel-linux-) |
| ifeq ($(strip $(LINUX)),2) |
| #Linux kernel space |
| MOPTS ?= -fno-builtin -D__KERNEL__ -DMODULE -DMODVERSIONS |
| CONFIG += -DLINUX |
| else |
| WALL ?= -Wall |
| DEBUGS ?= -g |
| #THUMB ?=-mthumb |
| #MOPTS ?= -fcall-saved-r10 -march=armv5te -ffunction-sections -fdata-sections -mthumb-interwork -msoft-float |
| CONFIG += -DLINUX |
| SYS_LIBS?= pthread rt |
| RUN ?= |
| DEF_ASFLAGS = $(DEBUGS) |
| endif |
| DEF_ASFLAGS = -msoft-float -mdsp -mdspr2 |
| endif |
| |
| ifeq ($(strip $(CROSS)),arm-linux-) |
| ifeq ($(strip $(LINUX)),2) |
| #Linux kernel space |
| MOPTS ?= -fno-builtin -D__KERNEL__ -DMODULE -DMODVERSIONS |
| CONFIG += -DLINUX |
| else |
| WALL ?= -Wall |
| DEBUGS ?= -g |
| THUMB ?=-mthumb |
| ifeq ($(PLATFORM),mt6280) |
| MOPTS ?= -fcall-saved-r10 -march=armv5te -ffunction-sections -fdata-sections -mthumb-interwork |
| else |
| ifeq ($(PLATFORM),mt6290) |
| MOPTS ?= -fcall-saved-r10 -march=armv7-a -ffunction-sections -fdata-sections -mthumb |
| else |
| ifeq ($(PLATFORM),mt6297) |
| MOPTS ?= -fcall-saved-r10 -march=armv7-a -ffunction-sections -fdata-sections -mthumb |
| else |
| ifeq ($(PLATFORM),qemu) |
| MOPTS ?= -fcall-saved-r10 -march=armv7-a -ffunction-sections -fdata-sections -mthumb |
| else |
| MOPTS ?= -fcall-saved-r10 -march=armv6zk -ffunction-sections -fdata-sections -mthumb-interwork -mfpu=vfp -mfloat-abi=softfp |
| endif |
| endif |
| endif |
| endif |
| CONFIG += -DLINUX -DBOARD_VER_$(BOARD_VER) -DREL_TYPE_$(REL_TYPE) |
| SYS_LIBS?= pthread rt |
| RUN ?= |
| DEF_ASFLAGS = $(DEBUGS) |
| endif |
| ifeq ($(PLATFORM),mt6280) |
| DEF_ASFLAGS = -mthumb-interwork |
| else |
| DEF_ASFLAGS = -mfpu=vfp -mfloat-abi=softfp -mthumb-interwork |
| endif |
| endif |
| |
| ifeq ($(strip $(CROSS)),aarch64-linux-) |
| ifeq ($(strip $(LINUX)),2) |
| #Linux kernel space |
| MOPTS ?= -fno-builtin -D__KERNEL__ -DMODULE -DMODVERSIONS |
| CONFIG += -DLINUX |
| else |
| WALL ?= -Wall |
| DEBUGS ?= -g |
| MOPTS ?= -march=armv8-a -ffunction-sections -fdata-sections |
| CONFIG += -DLINUX |
| SYS_LIBS?= pthread rt |
| RUN ?= |
| DEF_ASFLAGS = $(DEBUGS) |
| endif |
| endif |
| |
| ifeq ($(strip $(CROSS)),aarch64-poky-linux-) |
| INCLUDE_ADD += $(BB_INCLUDE_ADD) |
| LDFLAGS_ADD += $(BB_LDFLAGS_ADD) ${BB_LDPATH_ADD} |
| MOPTS += $(BB_CFLAGS_ADD) |
| ifeq ($(strip $(LINUX)),2) |
| #Linux kernel space |
| MOPTS += -fno-builtin -D__KERNEL__ -DMODULE -DMODVERSIONS |
| CONFIG += -DLINUX |
| else |
| WALL ?= -Wall |
| DEBUGS ?= -g |
| MOPTS += -march=armv8-a -ffunction-sections -fdata-sections |
| CONFIG += -DLINUX |
| SYS_LIBS?= pthread rt |
| RUN ?= |
| DEF_ASFLAGS = $(DEBUGS) |
| endif |
| endif |
| |
| ifneq ($(filter arm-poky-linux-gnueabi- arm-pokymllib32-linux-gnueabi-, $(strip $(CROSS))),) |
| INCLUDE_ADD += $(BB_INCLUDE_ADD) |
| LDFLAGS_ADD += $(BB_LDFLAGS_ADD) ${BB_LDPATH_ADD} |
| MOPTS += $(BB_CFLAGS_ADD) |
| ifeq ($(strip $(LINUX)),2) |
| #Linux kernel space |
| MOPTS ?= -fno-builtin -D__KERNEL__ -DMODULE -DMODVERSIONS |
| CONFIG += -DLINUX |
| else |
| WALL ?= -Wall |
| DEBUGS ?= -g |
| THUMB ?=-mthumb |
| MOPTS ?= -fcall-saved-r10 -march=armv7-a -ffunction-sections -fdata-sections -mthumb-interwork -mfpu=vfp -mfloat-abi=softfp -mtune=cortex-a7 |
| CONFIG += -DLINUX |
| ifeq ($(strip $(PACKAGE_ARCH)),$(filter $(strip $(PACKAGE_ARCH)), cortexa7hf-vfp-vfpv4-neon cortexa7hf-neon-vfpv4)) |
| MOPTS += -fcall-saved-r10 -march=armv7-a -ffunction-sections -fdata-sections -mthumb-interwork -mfpu=neon-vfpv4 -mfloat-abi=hard -mtune=cortex-a7 |
| CONFIG += -mhard-float |
| endif |
| ifeq ($(strip $(PACKAGE_ARCH)),$(filter $(strip $(PACKAGE_ARCH)), cortexa53hf-neon-fp-armv8)) |
| MOPTS += -mfpu=neon-fp-armv8 -mfloat-abi=hard -mcpu=cortex-a53 -mtune=cortex-a53 -ffunction-sections -fdata-sections |
| CONFIG += -mhard-float |
| endif |
| SYS_LIBS?= pthread rt |
| RUN ?= |
| DEF_ASFLAGS = $(DEBUGS) |
| endif |
| DEF_ASFLAGS = -mfpu=vfp -mfloat-abi=softfp -mthumb-interwork |
| |
| endif |
| |
| |
| ## |
| # ------------- config for arm-none-eabi- --------------------------------- |
| # @param THUMB thumb-mode switch |
| # @param ARM arm-mode switch |
| # @param EL little-endian switch |
| # @param EB big-endian switch |
| # @param COMPILER rvds/gcc switch |
| # @param INIT initial scheme |
| ## |
| ifeq ($(strip $(CROSS)),arm-none-eabi-) |
| RUN ?=mdebug 192.168.0.8 9000 |
| ifeq ($(strip $(COMPILER)),RVDS) |
| CC = tcc |
| CXX = tcc |
| endif |
| |
| ifeq ($(strip $(COMPILER)),RVDS) |
| WALL ?= |
| DEBUG ?=-g |
| THUMB ?=--thumb |
| ARM ?=--arm |
| EL ?=--littleend |
| EB ?=--bigend |
| MOPTS ?=--cpu arm9 |
| else |
| WALL ?=-Wall |
| DEBUGS ?=-gstabs |
| THUMB ?=-mthumb |
| ARM ?=-marm |
| EL ?=-mlittle-endian |
| EB ?=-mbig-endian |
| MOPTS ?=-fcall-saved-r10 -mthumb-interwork -march=armv5te -msoft-float -ffunction-sections -fdata-sections |
| endif |
| |
| ifeq ($(strip $(COMPILER)),RVDS) |
| INCLUDE_ADD += -I /usr/local/ARM/RVCT/Data/2.2/349/include/unix/ |
| endif |
| ifeq ($(strip $(NEWLIB)),1) |
| CONFIG += -DNEWLIB |
| endif |
| LD_SCRIPT ?= -Tlink.ld |
| INIT ?= base_init |
| SYS_LIBS ?= gcc c |
| SYS_LIBS += $(INIT) |
| LDFLAGS_ADD += -nostartfiles -nodefaultlibs -Wl,--gc-sections $(LD_SCRIPT) |
| STARTUP ?= $(ROOT)/lib/startup.o |
| DEF_ASFLAGS = -msoft-float -mthumb-interwork |
| endif |
| |
| ## |
| # -------------[ config for arm-none-elf- ]------------------------------ |
| # @param THUMB thumb-mode switch |
| # @param ARM arm-mode switch |
| # @param EL little-endian switch |
| # @param EB big-endian switch |
| # @param NEWLIB use toolchain supported newlib |
| # @param INIT initial scheme |
| ## |
| ifeq ($(strip $(CROSS)),arm-none-elf-) |
| |
| WALL ?=-Wall |
| DEBUGS ?=-g |
| THUMB ?=-mthumb |
| ARM ?=-marm |
| EL ?=-mlittle-endian |
| EB ?=-mbig-endian |
| MOPTS ?=-fcall-saved-r10 -mthumb-interwork -march=armv5te -msoft-float -ffunction-sections -fdata-sections |
| NEWLIB ?= 1 |
| RUN ?=mdebug 192.168.0.8 9000 |
| ifeq ($(strip $(NEWLIB)),1) |
| CONFIG += -D NEWLIB |
| SYS_LIBS ?= gcc c |
| SYS_LIBS += $(INIT) |
| LD_SCRIPT ?= -Tlink.ld |
| LDFLAGS_ADD += -nostartfiles -nodefaultlibs -Wl,--gc-sections $(LD_SCRIPT) |
| INIT ?= base_init |
| STARTUP ?= $(ROOT)/lib/startup.o -l$(INIT) |
| else |
| INCLUDE_ADD += -I $(ROOT)/include/ecos |
| SYS_LIBS ?= |
| LD_SCRIPT = -Tecos.ld # note , application with ecos must use ecos.ld |
| LDFLAGS_ADD +=-nostdlib -nodefaultlibs -nostartfiles -Wl,--gc-sections $(LD_SCRIPT) |
| endif |
| DEF_ASFLAGS = $(DEBUGS) -msoft-float -mthumb-interwork |
| CXXFLAGS_ADD = -fno-rtti -fno-exceptions |
| endif |
| |
| ## |
| # -------------[ config for i586-mingw32msvc-]------------------------------ |
| ## |
| ifeq ($(strip $(CROSS)),i586-mingw32msvc-) |
| WALL ?=-Wall |
| DEBUGS ?=-g |
| MOPTS ?=-m32 |
| SYS_LIBS ?= ws2_32 iberty |
| LDFLAGS_ADD += |
| RUN ?= |
| endif |
| |
| |
| ## |
| # @param DEF_INCLUDE: default include path |
| # @param DEF_CFLAGS: default compiler options |
| # (debugger information/ warning/ little-endian) |
| # |
| # @param DEF_ASFLAGS: default assembler options (debugger information) |
| # |
| # @param DEF_LDFLAGS: default linker options ( link with each libary specified |
| # in the $(DEP_LIBS) variable and specify the $(PREFIX)/lib and current |
| # directory as the library search path |
| ## |
| CROSS_SUP ?= arm-none-eabi- |
| ROOT ?= $(PREFIX)/$(CROSS:%-=%) |
| STRICT ?= 0 |
| ifeq ($(strip $(STRICT)),1) |
| DEF_CFLAGS = $(DEBUGS) $(MOPTS) $(WALL) -Werror |
| else |
| DEF_CFLAGS = $(DEBUGS) $(MOPTS) $(WALL) |
| endif |
| |
| DEF_INCLUDE = -I include -I $(ROOT)/include $(INCLUDE_ADD) |
| |
| SIM_LIBS ?= $(patsubst $(NAME),,$(patsubst basegltarget,baseglsim,$(DEP_LIBS))) |
| |
| ifeq ($(strip $(DEP_LIBS_AUTO)),1) |
| _DEP_LIBS?=$(shell wimac_dep.sh $(NAME) "$(DEP_LIBS)" "$(DEP_LIBS_EX)") |
| else |
| _DEP_LIBS?=$(DEP_LIBS) |
| endif |
| |
| DEP_LIBS_LD = -L. -L $(ROOT)/lib \ |
| -Xlinker --start-group -Xlinker -l$(NAME) \ |
| $(foreach _LIB, $(_DEP_LIBS), -Xlinker -l$(_LIB)) \ |
| $(foreach _LIB, $(SYS_LIBS), -Xlinker -l$(_LIB)) \ |
| -Xlinker --end-group |
| |
| DEF_LDFLAGS = $(STARTUP) $(LDFLAGS_ADD) $(DEBUGS) $(MOPTS) $(DEP_LIBS_LD) |
| |
| HEXPAD=0 |
| |
| #ifeq ($(strip $(NAME)),base) |
| #else |
| #include $(PREFIX)/.Makefile |
| #endif |