summaryrefslogtreecommitdiff
path: root/big-little/Makefile
blob: 1718987db8e059fe84dc38dc225af5b4b288694d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
#
# Copyright (c) 2012, ARM Limited. All rights reserved.
#
# Redistribution and use in source and binary forms, with
# or without modification, are permitted provided that the
# following conditions are met:
#
# Redistributions of source code must retain the above
# copyright notice, this list of conditions and the
# following disclaimer.
#
# Redistributions in binary form must reproduce the
# above copyright notice, this list of conditions and
# the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# Neither the name of ARM nor the names of its
# contributors may be used to endorse or promote products
# derived from this software without specific prior written
# permission.
#

# Decrease the verbosity of the make script
# can be made verbose by passing V=1 at the make command line
ifdef V
  KBUILD_VERBOSE = $(V)
else
  KBUILD_VERBOSE = 0
endif

ifeq "$(KBUILD_VERBOSE)" "0"
	Q=@
else
	Q=
endif

HIBASE?=0x8ff
DEBUG=TRUE

###############################################################################################################
# Shared/External Virtual GIC defines
SVGIC_OBJS		+=	sh_vgic.o
###############################################################################################################
# Switcher defines
SWITCHER		?=	TRUE
ASYNC			?=	FALSE
HYP_TIMERS		?=	TRUE
RAND_ASYNC		?=	FALSE
BOOT_CLUSTER		?=	0
HOST_CLUSTER		?=	1
FLUSH_OB_L2		?=	TRUE
FLUSH_L2_FIX		?=	FALSE
TUBE			?=	FALSE
FM_BETA			?=	FALSE

ifeq ($(SWITCHER), TRUE)
ifeq ($(ASYNC), FALSE)
HYP_TIMERS		=	FALSE
endif

vpath			%.c	switcher switcher/trigger switcher/context common/ lib/ secure_world/ ../acsr
vpath			%.s	switcher switcher/trigger switcher/context common/ lib/ secure_world/ ../acsr

SWITCHER_OBJS		=	ns_context.o hyp_setup.o pagetable_setup.o virt_helpers.o 	\
				vgiclib.o vgic_handle.o uart.o v7.o gic.o handle_switchover.o tube.o ipi.o v7_c.o	\
				virt_events.o bakery.o vgic_setup.o async_switchover.o hyp_vectors.o helpers.o	\
				debug_helpers.o

SECURE_ENTRY_POINT	=	monmode_vector_table

SECURE_OBJS		+=	secure_context.o monmode_vectors.o flat_pagetable.o virt_helpers.o virt_events.o \
				secure_resets.o bakery.o tube.o helpers.o

SECURE_ASFLAGS		=	--apcs /inter --cpu=Eagle --keep --fpu=none --pd "FM_BETA SETL {$(FM_BETA)}"

SECURE_CFLAGS		= 	-Iinclude -I. -Isecure_world -I../acsr  --cpu=Eagle --fpu=none -O2 \
				-DHOST_CLUSTER=$(HOST_CLUSTER) -DSWITCHER=$(SWITCHER) \
				-DFLUSH_OB_L2=$(FLUSH_OB_L2) -DTUBE=$(TUBE) -DFLUSH_L2_FIX=$(FLUSH_L2_FIX) -DFM_BETA=$(FM_BETA)

SECURE_LDFLAGS		=	--verbose --map --fpu=none --symbols --noremove --datacompressor=off \
		 		--entry $(SECURE_ENTRY_POINT)  --scatter $(SECURE_MAPFILE) --predefine="-DFM_BETA=$(FM_BETA)"

SWITCHER_ASFLAGS	+=	--pd "ASYNC_SWITCH SETL {$(ASYNC)}" 		\
				--pd "RAND_ASYNC SETL {$(RAND_ASYNC)}" 		\
				--pd "HOST_CLUSTER SETA $(HOST_CLUSTER)" 	\
				--pd "USE_HYP_TIMERS SETL {$(HYP_TIMERS)}" 	\
				--pd "SWITCHER SETL {$(SWITCHER)}"

SWITCHER_CFLAGS		+=	-DASYNC_SWITCH=$(ASYNC) 	\
				-DRAND_ASYNC=$(RAND_ASYNC) 	\
				-DBOOT_CLUSTER=$(BOOT_CLUSTER)	\
				-DHOST_CLUSTER=$(HOST_CLUSTER) 	\
				-DUSE_HYP_TIMERS=$(HYP_TIMERS) 	\
				-DFLUSH_OB_L2=$(FLUSH_OB_L2) 	\
				-DTUBE=$(TUBE)	 		\
				-DFLUSH_L2_FIX=$(FLUSH_L2_FIX)	\
				-DSWITCHER=$(SWITCHER)
endif

###############################################################################################################
# Virtualisor defines
CMOP_DEBUG		?= 	FALSE
VIRTUALISOR_CFLAGS	+= 	-DCMOP_DEBUG=$(CMOP_DEBUG)
VIRTUALISOR_ASFLAGS	+= 	--pd "CMOP_DEBUG SETL {$(CMOP_DEBUG)}"

vpath			%.c	virtualisor virtualisor/cpus/a15 virtualisor/cpus/a7

VIRTUALISOR_OBJS	+=	virt_handle.o virt_setup.o virt_context.o cache_geom.o mem_trap.o vgic_trap_handler.o \
				kfscb_trap_handler.o pmu_trap_handler.o a7.o a15.o

###############################################################################################################

OBJS			+=	cci.o

ASFLAGS			=	--apcs /inter --cpu=Eagle --keep --fpu=none 	\
				$(SWITCHER_ASFLAGS)				\
				$(VIRTUALISOR_ASFLAGS) 

CFLAGS			= 	-Iinclude -I. -Ivirtualisor/include -Ivirtualisor/cpus/a7/include	\
				-Ivirtualisor/cpus/a15/include -I../acsr				\
				--cpu=Eagle --fpu=none -O2 $(SWITCHER_CFLAGS) $(VIRTUALISOR_CFLAGS) 

ifdef DEBUG
CFLAGS			+= 	-g -O0
ASFLAGS			+= 	-g
SECURE_CFLAGS		+= 	-g -O0
SECURE_ASFLAGS		+= 	-g
endif

LDFLAGS			=	--verbose --map --fpu=none --symbols --noremove --datacompressor=off --entry $(ENTRY_POINT) --scatter $(MAPFILE)
OBJS			+= 	$(SWITCHER_OBJS) $(VIRTUALISOR_OBJS) $(SVGIC_OBJS)
ENTRY_POINT		=	bl_setup
LISTFILE		=	bl_syms.txt
SECURE_LISTFILE		=	bl_sec_syms.txt
MAPFILE			=	bl.scf
SECURE_MAPFILE		=	bl-sec.scf

CC			=	armcc
AS			=	armasm
AR			=	armar
LD			=	armlink


ifeq ($(FM_BETA), FALSE)
all:			bl.axf bl_sec.axf wboot.bin
else
all:			bl.axf bl_sec.axf
endif

clean:
			@echo "  CLEAN"
			$(Q)rm -rf *.zi
			$(Q)rm -rf *.dump
			$(Q)rm -rf *.bin
			$(Q)rm -f *.axf
			$(Q)rm -f *.o
			$(Q)rm -f *.ar
			$(Q)rm -f *.map
			$(Q)rm -f *.scf
			$(Q)rm -f $(LISTFILE)
			$(Q)rm -f $(SECURE_LISTFILE)

dump:			
			@echo "  OBJDUMP"
			fromelf --text -c bl.axf > bl.dump
			fromelf --text -c bl_sec.axf > bl_sec.dump

%.o:			%.s 
			@echo "  AS      $<"
			$(Q)$(AS) $(ASFLAGS) $< -o $@

%.o:			%.c
			@echo "  CC      $<"
			$(Q)$(CC) $(CFLAGS) -c $< -o $@

bl.axf: 		$(OBJS)
			$(Q)cat $(MAPFILE).template > $(MAPFILE)
			$(Q)sed -i -e "s/HIBASE/${HIBASE}/g" $(MAPFILE)
			@echo "  LD      $@"
			$(Q)$(LD) $(LDFLAGS) --symdefs=bl_symdef.o $(OBJS) -o $@ > $(LISTFILE)

ifeq ($(FM_BETA), FALSE)
wboot.axf:		ve_reset_handler.o
			@echo "  LD      $@"
			$(Q)$(LD) --ro-base=0x0 $< -o $@ > $(LISTFILE)

wboot.bin:		wboot.axf
			@echo "  BIN      $@"
			$(Q)fromelf --bin $< --output $@
else
SECURE_OBJS		+= ve_reset_handler.o
wboot.bin:
endif

bl.ar:			$(OBJS)
			@echo "  AR      $@"
			$(Q)$(AR) -r $@ $(OBJS)

%.bin: 			%.axf
			fromelf --bin $< --output $@

ve_reset_handler.o:	ve_reset_handler.s
			@echo "  AS      $<"
			$(Q)$(AS) $(SECURE_ASFLAGS) $< -o $@

secure_resets.o:	secure_resets.c
			@echo "  CC      $<"
			$(Q)$(CC) $(SECURE_CFLAGS) -c $< -o $@

monmode_vectors.o:	monmode_vectors.s 
			@echo "  AS      $<"
			$(Q)$(AS) $(SECURE_ASFLAGS) $< -o $@

flat_pagetable.o:	flat_pagetable.s 
			@echo "  AS      $<"
			$(Q)$(AS) $(SECURE_ASFLAGS) $< -o $@

secure_context.o:	secure_context.c
			@echo "  CC      $<"
			$(Q)$(CC) $(SECURE_CFLAGS) -c $< -o $@

bl_sec.axf:		$(SECURE_OBJS)
			$(Q)cat $(SECURE_MAPFILE).template > $(SECURE_MAPFILE)
			$(Q)sed -i -e "s/HIBASE/${HIBASE}/g" $(SECURE_MAPFILE)
			$(Q)$(LD) $(SECURE_LDFLAGS) --symdefs=bl_sec_symdef.o $(SECURE_OBJS) -o $@ > $(SECURE_LISTFILE)

bl_sec.ar: 		$(SECURE_OBJS)
			$(Q)$(AR) -r $@ $(SECURE_OBJS)