blob: 243fa5364e3f01e15bca31d86de5fd7f9e02e4db [file] [log] [blame]
Ronald G. Minniche0e784a2014-11-26 19:25:47 +00001################################################################################
2##
3## This file is part of the coreboot project.
4##
5## Copyright (C) 2014 The ChromiumOS Authors
6##
7## This program is free software; you can redistribute it and/or modify
8## it under the terms of the GNU General Public License as published by
9## the Free Software Foundation; version 2 of the License.
10##
11## This program is distributed in the hope that it will be useful,
12## but WITHOUT ANY WARRANTY; without even the implied warranty of
13## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14## GNU General Public License for more details.
15##
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000016################################################################################
17
Jonathan Neuschäfer1282b8d2016-06-10 19:35:15 +020018riscv_flags = -I$(src)/arch/riscv/ -mcmodel=medany
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000019
20riscv_asm_flags =
21
Julius Wernerfffee872016-03-07 17:55:43 -080022ifeq ($(CONFIG_ARCH_RAMSTAGE_RISCV),y)
23check-ramstage-overlap-regions += stack
24endif
25
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000026################################################################################
27## bootblock
28################################################################################
29ifeq ($(CONFIG_ARCH_BOOTBLOCK_RISCV),y)
30
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000031bootblock-y = bootblock.S stages.c
Thaminda Edirisooriya95ba4c82015-08-26 14:54:31 -070032bootblock-y += trap_util.S
33bootblock-y += trap_handler.c
Thaminda Edirisooriyaa47738d2015-08-26 15:39:16 -070034bootblock-y += virtual_memory.c
Aaron Durbinb3847e62015-03-20 15:55:08 -050035bootblock-y += boot.c
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000036bootblock-y += rom_media.c
Jonathan Neuschäferf934efc2016-06-10 19:35:15 +020037bootblock-y += misc.c
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000038bootblock-y += \
39 $(top)/src/lib/memchr.c \
40 $(top)/src/lib/memcmp.c \
41 $(top)/src/lib/memcpy.c \
42 $(top)/src/lib/memmove.c \
43 $(top)/src/lib/memset.c
44
Julius Wernerec5e5e02014-08-20 15:29:56 -070045$(objcbfs)/bootblock.debug: $$(bootblock-objs)
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000046 @printf " LINK $(subst $(obj)/,,$(@))\n"
Aaron Durbind4dd44c2015-09-06 10:15:17 -050047 $(LD_bootblock) $(LDFLAGS_bootblock) -o $@ -L$(obj) \
Nico Huber81b09f42016-01-23 00:50:00 +010048 -T $(call src-to-obj,bootblock,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) --whole-archive --start-group $(filter-out %.ld,$(bootblock-objs)) \
Patrick Georgi3332f332015-07-18 00:25:12 +020049 $(LIBGCC_FILE_NAME_bootblock) --end-group $(COMPILER_RT_bootblock)
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000050
Jonathan Neuschäfer1282b8d2016-06-10 19:35:15 +020051bootblock-c-ccopts += $(riscv_flags)
52bootblock-S-ccopts += $(riscv_asm_flags)
53
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000054endif
55
56################################################################################
57## romstage
58################################################################################
59ifeq ($(CONFIG_ARCH_ROMSTAGE_RISCV),y)
60
Aaron Durbinb3847e62015-03-20 15:55:08 -050061romstage-y += boot.c
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000062romstage-y += stages.c
63romstage-y += rom_media.c
Jonathan Neuschäferf934efc2016-06-10 19:35:15 +020064romstage-y += misc.c
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000065romstage-y += \
66 $(top)/src/lib/memchr.c \
67 $(top)/src/lib/memcmp.c \
68 $(top)/src/lib/memcpy.c \
69 $(top)/src/lib/memmove.c \
70 $(top)/src/lib/memset.c
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000071
72romstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
73
74# Build the romstage
75
Julius Wernerec5e5e02014-08-20 15:29:56 -070076$(objcbfs)/romstage.debug: $$(romstage-objs)
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000077 @printf " LINK $(subst $(obj)/,,$(@))\n"
Nico Huber81b09f42016-01-23 00:50:00 +010078 $(LD_romstage) $(LDFLAGS_romstage) -o $@ -L$(obj) -T $(call src-to-obj,romstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) --whole-archive --start-group $(filter-out %.ld,$(romstage-objs)) --end-group $(COMPILER_RT_romstage)
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000079
80romstage-c-ccopts += $(riscv_flags)
81romstage-S-ccopts += $(riscv_asm_flags)
82
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000083endif
84
85################################################################################
86## ramstage
87################################################################################
88ifeq ($(CONFIG_ARCH_RAMSTAGE_RISCV),y)
89
90ramstage-y =
Thaminda Edirisooriyaa47738d2015-08-26 15:39:16 -070091ramstage-y += trap_handler.c
92ramstage-y += virtual_memory.c
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000093ramstage-y += rom_media.c
94ramstage-y += stages.c
95ramstage-y += misc.c
96ramstage-y += boot.c
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000097ramstage-y += tables.c
98ramstage-y += \
99 $(top)/src/lib/memchr.c \
100 $(top)/src/lib/memcmp.c \
101 $(top)/src/lib/memcpy.c \
102 $(top)/src/lib/memmove.c \
103 $(top)/src/lib/memset.c
104
105$(eval $(call create_class_compiler,rmodules,riscv))
106
107ramstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
108
109ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/mainboard.c
110
111# Build the ramstage
112
Julius Wernerec5e5e02014-08-20 15:29:56 -0700113$(objcbfs)/ramstage.debug: $$(ramstage-objs)
Ronald G. Minniche0e784a2014-11-26 19:25:47 +0000114 @printf " CC $(subst $(obj)/,,$(@))\n"
Nico Huber81b09f42016-01-23 00:50:00 +0100115 $(LD_ramstage) $(LDFLAGS_ramstage) -o $@ -L$(obj) -T $(call src-to-obj,ramstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) --whole-archive --start-group $(filter-out %.ld,$(ramstage-objs)) --end-group $(COMPILER_RT_ramstage)
Ronald G. Minniche0e784a2014-11-26 19:25:47 +0000116
117ramstage-c-ccopts += $(riscv_flags)
118ramstage-S-ccopts += $(riscv_asm_flags)
119
120endif