yuezonghe | 824eb0c | 2024-06-27 02:32:26 -0700 | [diff] [blame] | 1 | # /*****************************************************************************
|
| 2 | #* °æÈ¨ËùÓÐ (C)2014, ÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£
|
| 3 | #*
|
| 4 | #* ÎļþÃû³Æ: gcc_arm_linux.mk
|
| 5 | #* Îļþ±êʶ: gcc_arm_linux.mk
|
| 6 | #* ÄÚÈÝÕªÒª: linux gcc±àÒëÆ÷ÅäÖÃÎļþ
|
| 7 | #* ʹÓ÷½·¨: include gcc_arm_linux.mk
|
| 8 | #*
|
| 9 | #* ÐÞ¸ÄÈÕÆÚ °æ±¾ºÅ Ð޸ıê¼Ç ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ
|
| 10 | #* -----------------------------------------------------------------------------
|
| 11 | #* 2014/09/09 V1.0 Create ÁõÑÇÄÏ ´´½¨
|
| 12 | #*
|
| 13 | # ******************************************************************************/
|
| 14 |
|
| 15 | #===============================================================================
|
| 16 | # compiler tools path, CROSS_COMPILE_ROOT is set in root Makefile
|
| 17 | #===============================================================================
|
| 18 | GCC_ROOT = $(CROSS_COMPILE_ROOT)
|
| 19 | GCC_BIN = $(GCC_ROOT)/bin
|
| 20 | GCC_LIB = $(GCC_ROOT)/lib
|
| 21 |
|
| 22 | #===============================================================================
|
| 23 | # compiler tools setup
|
| 24 | #===============================================================================
|
| 25 | CC = $(GCC_BIN)/$(CROSS_COMPILE_PREFIX)gcc
|
| 26 | CXX = $(GCC_BIN)/$(CROSS_COMPILE_PREFIX)gcc
|
| 27 | ASM = $(GCC_BIN)/$(CROSS_COMPILE_PREFIX)as
|
| 28 | AR = $(GCC_BIN)/$(CROSS_COMPILE_PREFIX)ar
|
| 29 | AR2 = $(GCC_BIN)/$(CROSS_COMPILE_PREFIX)gcc-ar
|
| 30 | LD = $(GCC_BIN)/$(CROSS_COMPILE_PREFIX)ld
|
| 31 | ELF2BIN = $(GCC_BIN)/$(CROSS_COMPILE_PREFIX)objcopy
|
| 32 | ELF2SYM = $(GCC_BIN)/$(CROSS_COMPILE_PREFIX)nm
|
| 33 |
|
| 34 | #===============================================================================
|
| 35 | # C include path setup
|
| 36 | #===============================================================================
|
| 37 | INCLUDE = -I$(LINUX_ROOT)/arch/arm/include \
|
| 38 | -I$(LINUX_ROOT)/arch/arm/include/uapi \
|
| 39 | -I$(LINUX_ROOT)/arch/arm/include/generated \
|
| 40 | -I$(LINUX_ROOT)/include \
|
| 41 | -I$(LINUX_ROOT)/include/uapi \
|
| 42 | -I$(LINUX_ROOT)/kernel \
|
| 43 | -include $(LINUX_ROOT)/include/linux/kconfig.h \
|
| 44 | -I$(LINUX_ROOT)/arch/arm/mach-$(PRJ_NAME)/include
|
| 45 |
|
| 46 | #===============================================================================
|
| 47 | # C++ STL(standard template library) include path setup
|
| 48 | #===============================================================================
|
| 49 | STDINCLUDE +=
|
| 50 |
|
| 51 | #===============================================================================
|
| 52 | # gcc flags setup
|
| 53 | #===============================================================================
|
| 54 | export CCFLAGS = -nostdinc -isystem $(CROSS_COMPILE_INCLUDE)
|
| 55 | export CCFLAGS += -mlittle-endian -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common
|
| 56 | export CCFLAGS += -Wno-format-security -fno-delete-null-pointer-checks
|
| 57 | #export CCFLAGS += -marm -fno-dwarf2-cfi-asm -mabi=aapcs-linux -mno-thumb-interwork -funwind-tables
|
| 58 | export CCFLAGS += -fno-dwarf2-cfi-asm -mabi=aapcs-linux
|
| 59 | ifeq ($(CONFIG_MIN_8M_VERSION), n)
|
| 60 | CCFLAGS += -funwind-tables
|
| 61 | endif
|
| 62 | export CCFLAGS += -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector
|
| 63 | export CCFLAGS += -Wno-unused-but-set-variable -fomit-frame-pointer -g -fno-inline-functions-called-once
|
| 64 | export CCFLAGS += -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack
|
| 65 | export CCFLAGS += -Wno-redundant-decls -Wno-write-strings
|
| 66 | export CCFLAGS += -march=$(CPU_ARCH) -mno-unaligned-access
|
| 67 | #export CCFLAGS += -finstrument-functions
|
| 68 |
|
| 69 | export CCFLAGS += -fno-short-enums -fsigned-char -fstrict-volatile-bitfields
|
| 70 | export CCFLAGS += -fno-schedule-insns -fno-schedule-insns2
|
| 71 | export CCFLAGS += -Wfatal-errors -Wno-declaration-after-statement -Wno-unused-value
|
| 72 | export CCFLAGS += -Wno-unused-variable -Wno-unused-function -Wno-missing-braces
|
| 73 | export CCFLAGS += -Wno-unknown-pragmas -Wno-format-extra-args
|
| 74 | export CCFLAGS += -D__KERNEL__ -D__LINUX_ARM_ARCH__=7
|
| 75 |
|
| 76 | ifeq ($(THUMB), yes)
|
| 77 | export CCFLAGS += -mthumb -mthumb-interwork -Wa,-mimplicit-it=thumb
|
| 78 | ifeq ($(USE_CPPS_KO), yes)
|
| 79 | export CCFLAGS += -mlong-calls
|
| 80 | endif
|
| 81 | else
|
| 82 | export CCFLAGS += -marm
|
| 83 | endif
|
| 84 |
|
| 85 | ifeq ($(CONFIG_MIN_8M_VERSION), y)
|
| 86 | export CCFLAGS += -ffunction-sections
|
| 87 | endif
|
| 88 |
|
| 89 | export CCFLAGS += -Wl,--gc-sections
|
| 90 | export CCFLAGS += -g -Os -MD -c
|
| 91 | export CXXFLAGS = $(CCFLAGS)
|
| 92 |
|
| 93 | #===============================================================================
|
| 94 | # assembler flags setup
|
| 95 | #===============================================================================
|
| 96 | ASFLAGS = -march=$(CPU_ARCH)
|
| 97 |
|
| 98 | #===============================================================================
|
| 99 | # archieve flags setup
|
| 100 | #===============================================================================
|
| 101 | ARFLAGS = -rcs
|
| 102 | ARFLAGS2 = rcSTPD
|
| 103 |
|
| 104 |
|
| 105 | #===============================================================================
|
| 106 | # library include path setup
|
| 107 | #===============================================================================
|
| 108 | LDFLAG = -Wl,--no-check-sections -nostartfiles -L$(GCC_LIB) -T$(PRJ_PATH)/ws/dosmake/makefw/os/tos/tos.ld
|
| 109 |
|
| 110 | #===============================================================================
|
| 111 | # ld setup
|
| 112 | #===============================================================================
|
| 113 | LDOUT =
|
| 114 | LDMAP =
|
| 115 |
|
| 116 | #===============================================================================
|
| 117 | # elf to binary flags setup
|
| 118 | #===============================================================================
|
| 119 | ELF2BINOUT = -O binary
|
| 120 |
|
| 121 | #===============================================================================
|
| 122 | # elf to symbol flags setup
|
| 123 | #===============================================================================
|
| 124 | ELF2SYMOUT = -nCS --size-sort
|
| 125 |
|
| 126 | #===============================================================================
|
| 127 | # user defintion
|
| 128 | #===============================================================================
|
| 129 | export PLAT_GCC_OPTIMIZE = -O2
|
| 130 | export COM_GCC_OPTIMIZE = -O2
|
| 131 | export DRV_GCC_OPTIMIZE = -O2
|
| 132 | export PS_GCC_OPTIMIZE = -O2
|
| 133 | export TOOLS_GCC_OPTIMIZE = -O2
|
| 134 |
|