blob: 93db917ed36383341bdc00223e6a61cceaed651c [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001# /*****************************************************************************
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#===============================================================================
18GCC_ROOT = $(CROSS_COMPILE_ROOT)
19GCC_BIN = $(GCC_ROOT)/bin
20GCC_LIB = $(GCC_ROOT)/lib
21
22#===============================================================================
23# compiler tools setup
24#===============================================================================
25CC = $(GCC_BIN)/$(CROSS_COMPILE_PREFIX)gcc
26CXX = $(GCC_BIN)/$(CROSS_COMPILE_PREFIX)gcc
27ASM = $(GCC_BIN)/$(CROSS_COMPILE_PREFIX)as
28AR = $(GCC_BIN)/$(CROSS_COMPILE_PREFIX)ar
29AR2 = $(GCC_BIN)/$(CROSS_COMPILE_PREFIX)gcc-ar
30LD = $(GCC_BIN)/$(CROSS_COMPILE_PREFIX)ld
31ELF2BIN = $(GCC_BIN)/$(CROSS_COMPILE_PREFIX)objcopy
32ELF2SYM = $(GCC_BIN)/$(CROSS_COMPILE_PREFIX)nm
33
34#===============================================================================
35# C include path setup
36#===============================================================================
37INCLUDE = -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#===============================================================================
49STDINCLUDE +=
50
51#===============================================================================
52# gcc flags setup
53#===============================================================================
54export CCFLAGS = -nostdinc -isystem $(CROSS_COMPILE_INCLUDE)
55export CCFLAGS += -mlittle-endian -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common
56export 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
58export CCFLAGS += -fno-dwarf2-cfi-asm -mabi=aapcs-linux
59ifeq ($(CONFIG_MIN_8M_VERSION), n)
60CCFLAGS += -funwind-tables
61endif
62export CCFLAGS += -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector
63export CCFLAGS += -Wno-unused-but-set-variable -fomit-frame-pointer -g -fno-inline-functions-called-once
64export CCFLAGS += -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack
65export CCFLAGS += -Wno-redundant-decls -Wno-write-strings
66export CCFLAGS += -march=$(CPU_ARCH) -mno-unaligned-access
67#export CCFLAGS += -finstrument-functions
68
69export CCFLAGS += -fno-short-enums -fsigned-char -fstrict-volatile-bitfields
70export CCFLAGS += -fno-schedule-insns -fno-schedule-insns2
71export CCFLAGS += -Wfatal-errors -Wno-declaration-after-statement -Wno-unused-value
72export CCFLAGS += -Wno-unused-variable -Wno-unused-function -Wno-missing-braces
73export CCFLAGS += -Wno-unknown-pragmas -Wno-format-extra-args
74export CCFLAGS += -D__KERNEL__ -D__LINUX_ARM_ARCH__=7
75
76ifeq ($(THUMB), yes)
77export CCFLAGS += -mthumb -mthumb-interwork -Wa,-mimplicit-it=thumb
78ifeq ($(USE_CPPS_KO), yes)
79export CCFLAGS += -mlong-calls
80endif
81else
82export CCFLAGS += -marm
83endif
84
85ifeq ($(CONFIG_MIN_8M_VERSION), y)
86export CCFLAGS += -ffunction-sections
87endif
88
89export CCFLAGS += -Wl,--gc-sections
90export CCFLAGS += -g -Os -MD -c
91export CXXFLAGS = $(CCFLAGS)
92
93#===============================================================================
94# assembler flags setup
95#===============================================================================
96ASFLAGS = -march=$(CPU_ARCH)
97
98#===============================================================================
99# archieve flags setup
100#===============================================================================
101ARFLAGS = -rcs
102ARFLAGS2 = rcSTPD
103
104
105#===============================================================================
106# library include path setup
107#===============================================================================
108LDFLAG = -Wl,--no-check-sections -nostartfiles -L$(GCC_LIB) -T$(PRJ_PATH)/ws/dosmake/makefw/os/tos/tos.ld
109
110#===============================================================================
111# ld setup
112#===============================================================================
113LDOUT =
114LDMAP =
115
116#===============================================================================
117# elf to binary flags setup
118#===============================================================================
119ELF2BINOUT = -O binary
120
121#===============================================================================
122# elf to symbol flags setup
123#===============================================================================
124ELF2SYMOUT = -nCS --size-sort
125
126#===============================================================================
127# user defintion
128#===============================================================================
129export PLAT_GCC_OPTIMIZE = -O2
130export COM_GCC_OPTIMIZE = -O2
131export DRV_GCC_OPTIMIZE = -O2
132export PS_GCC_OPTIMIZE = -O2
133export TOOLS_GCC_OPTIMIZE = -O2
134