blob: 0f3eb0f82b878b5ee0e38383e806ebeb702de127 [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##
16## You should have received a copy of the GNU General Public License
17## along with this program; if not, write to the Free Software
Patrick Georgib890a122015-03-26 15:17:45 +010018## Foundation, Inc.
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000019##
20################################################################################
21
22riscv_flags = -I$(src)/arch/riscv/
23
24riscv_asm_flags =
25
26################################################################################
27## bootblock
28################################################################################
29ifeq ($(CONFIG_ARCH_BOOTBLOCK_RISCV),y)
30
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000031bootblock-y = bootblock.S stages.c
Aaron Durbinb3847e62015-03-20 15:55:08 -050032bootblock-y += boot.c
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000033bootblock-y += rom_media.c
34bootblock-y += \
35 $(top)/src/lib/memchr.c \
36 $(top)/src/lib/memcmp.c \
37 $(top)/src/lib/memcpy.c \
38 $(top)/src/lib/memmove.c \
39 $(top)/src/lib/memset.c
40
Julius Wernerec5e5e02014-08-20 15:29:56 -070041$(objcbfs)/bootblock.debug: $$(bootblock-objs)
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000042 @printf " LINK $(subst $(obj)/,,$(@))\n"
Patrick Georgi828e0e82015-04-04 15:50:20 +020043 $(LD_bootblock) --gc-sections -static -o $@ -L$(obj) \
Patrick Georgieec8dfb2015-05-07 22:24:41 +020044 -T $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.bootblock.ld --whole-archive --start-group $(filter-out %.ld,$(bootblock-objs)) \
Patrick Georgi3332f332015-07-18 00:25:12 +020045 $(LIBGCC_FILE_NAME_bootblock) --end-group $(COMPILER_RT_bootblock)
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000046
47endif
48
49################################################################################
50## romstage
51################################################################################
52ifeq ($(CONFIG_ARCH_ROMSTAGE_RISCV),y)
53
Aaron Durbinb3847e62015-03-20 15:55:08 -050054romstage-y += boot.c
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000055romstage-y += stages.c
56romstage-y += rom_media.c
57romstage-y += \
58 $(top)/src/lib/memchr.c \
59 $(top)/src/lib/memcmp.c \
60 $(top)/src/lib/memcpy.c \
61 $(top)/src/lib/memmove.c \
62 $(top)/src/lib/memset.c
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000063
64romstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
65
66# Build the romstage
67
Julius Wernerec5e5e02014-08-20 15:29:56 -070068$(objcbfs)/romstage.debug: $$(romstage-objs)
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000069 @printf " LINK $(subst $(obj)/,,$(@))\n"
Patrick Georgi3332f332015-07-18 00:25:12 +020070 $(LD_romstage) --gc-sections -static -o $@ -L$(obj) -T $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.romstage.ld --whole-archive --start-group $(filter-out %.ld,$(romstage-objs)) --end-group $(COMPILER_RT_romstage)
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000071
72romstage-c-ccopts += $(riscv_flags)
73romstage-S-ccopts += $(riscv_asm_flags)
74
Julius Wernerefcee762014-11-10 13:14:24 -080075CBFSTOOL_PRE1_OPTS = -v -m riscv -s $(CONFIG_CBFS_SIZE)
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000076CBFSTOOL_PRE_OPTS = -v
77
78endif
79
80################################################################################
81## ramstage
82################################################################################
83ifeq ($(CONFIG_ARCH_RAMSTAGE_RISCV),y)
84
85ramstage-y =
86ramstage-y += rom_media.c
87ramstage-y += stages.c
88ramstage-y += misc.c
89ramstage-y += boot.c
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000090ramstage-y += tables.c
91ramstage-y += \
92 $(top)/src/lib/memchr.c \
93 $(top)/src/lib/memcmp.c \
94 $(top)/src/lib/memcpy.c \
95 $(top)/src/lib/memmove.c \
96 $(top)/src/lib/memset.c
97
98$(eval $(call create_class_compiler,rmodules,riscv))
99
100ramstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
101
102ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/mainboard.c
103
104# Build the ramstage
105
Julius Wernerec5e5e02014-08-20 15:29:56 -0700106$(objcbfs)/ramstage.debug: $$(ramstage-objs)
Ronald G. Minniche0e784a2014-11-26 19:25:47 +0000107 @printf " CC $(subst $(obj)/,,$(@))\n"
Patrick Georgi3332f332015-07-18 00:25:12 +0200108 $(LD_ramstage) --gc-sections -static -o $@ -L$(obj) -T $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.ramstage.ld --whole-archive --start-group $(filter-out %.ld,$(ramstage-objs)) --end-group $(COMPILER_RT_ramstage)
Ronald G. Minniche0e784a2014-11-26 19:25:47 +0000109
110ramstage-c-ccopts += $(riscv_flags)
111ramstage-S-ccopts += $(riscv_asm_flags)
112
113endif