Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 1 | ################################################################################ |
| 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. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 16 | ################################################################################ |
| 17 | |
Jonathan Neuschäfer | 2764919 | 2018-02-13 14:01:22 +0100 | [diff] [blame] | 18 | ################################################################################ |
| 19 | ## RISC-V specific options |
| 20 | ################################################################################ |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 21 | |
Julius Werner | fffee87 | 2016-03-07 17:55:43 -0800 | [diff] [blame] | 22 | ifeq ($(CONFIG_ARCH_RAMSTAGE_RISCV),y) |
| 23 | check-ramstage-overlap-regions += stack |
| 24 | endif |
| 25 | |
Jonathan Neuschäfer | 2764919 | 2018-02-13 14:01:22 +0100 | [diff] [blame] | 26 | riscv_arch = rv64imafd |
| 27 | |
| 28 | ifeq ($(CONFIG_ARCH_RISCV_COMPRESSED),y) |
| 29 | riscv_arch := $(riscv_arch)c |
| 30 | endif |
| 31 | |
| 32 | riscv_flags = -I$(src)/arch/riscv/ -mcmodel=medany -march=$(riscv_arch) |
| 33 | |
| 34 | riscv_asm_flags = -march=$(riscv_arch) |
| 35 | |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 36 | ################################################################################ |
| 37 | ## bootblock |
| 38 | ################################################################################ |
| 39 | ifeq ($(CONFIG_ARCH_BOOTBLOCK_RISCV),y) |
| 40 | |
Jonathan Neuschäfer | 8e63017 | 2016-07-24 18:12:09 +0200 | [diff] [blame] | 41 | bootblock-y += id.S |
| 42 | $(call src-to-obj,bootblock,$(dir)/id.S): $(obj)/build.h |
| 43 | |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 44 | bootblock-y = bootblock.S stages.c |
Thaminda Edirisooriya | 95ba4c8 | 2015-08-26 14:54:31 -0700 | [diff] [blame] | 45 | bootblock-y += trap_util.S |
| 46 | bootblock-y += trap_handler.c |
Jonathan Neuschäfer | 99f2f11 | 2016-10-28 00:25:02 +0200 | [diff] [blame] | 47 | bootblock-y += mcall.c |
Thaminda Edirisooriya | a47738d | 2015-08-26 15:39:16 -0700 | [diff] [blame] | 48 | bootblock-y += virtual_memory.c |
Aaron Durbin | b3847e6 | 2015-03-20 15:55:08 -0500 | [diff] [blame] | 49 | bootblock-y += boot.c |
Jonathan Neuschäfer | f934efc | 2016-06-10 19:35:15 +0200 | [diff] [blame] | 50 | bootblock-y += misc.c |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 51 | bootblock-y += \ |
| 52 | $(top)/src/lib/memchr.c \ |
| 53 | $(top)/src/lib/memcmp.c \ |
| 54 | $(top)/src/lib/memcpy.c \ |
| 55 | $(top)/src/lib/memmove.c \ |
Jonathan Neuschäfer | c0c31b6 | 2017-11-20 00:57:32 +0100 | [diff] [blame] | 56 | $(top)/src/lib/memset.c |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 57 | |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 58 | $(objcbfs)/bootblock.debug: $$(bootblock-objs) |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 59 | @printf " LINK $(subst $(obj)/,,$(@))\n" |
Aaron Durbin | d4dd44c | 2015-09-06 10:15:17 -0500 | [diff] [blame] | 60 | $(LD_bootblock) $(LDFLAGS_bootblock) -o $@ -L$(obj) \ |
Nico Huber | 81b09f4 | 2016-01-23 00:50:00 +0100 | [diff] [blame] | 61 | -T $(call src-to-obj,bootblock,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) --whole-archive --start-group $(filter-out %.ld,$(bootblock-objs)) \ |
Patrick Georgi | 3332f33 | 2015-07-18 00:25:12 +0200 | [diff] [blame] | 62 | $(LIBGCC_FILE_NAME_bootblock) --end-group $(COMPILER_RT_bootblock) |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 63 | |
Jonathan Neuschäfer | 1282b8d | 2016-06-10 19:35:15 +0200 | [diff] [blame] | 64 | bootblock-c-ccopts += $(riscv_flags) |
| 65 | bootblock-S-ccopts += $(riscv_asm_flags) |
| 66 | |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 67 | endif |
| 68 | |
| 69 | ################################################################################ |
| 70 | ## romstage |
| 71 | ################################################################################ |
| 72 | ifeq ($(CONFIG_ARCH_ROMSTAGE_RISCV),y) |
| 73 | |
Aaron Durbin | b3847e6 | 2015-03-20 15:55:08 -0500 | [diff] [blame] | 74 | romstage-y += boot.c |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 75 | romstage-y += stages.c |
Jonathan Neuschäfer | f934efc | 2016-06-10 19:35:15 +0200 | [diff] [blame] | 76 | romstage-y += misc.c |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 77 | romstage-y += \ |
| 78 | $(top)/src/lib/memchr.c \ |
| 79 | $(top)/src/lib/memcmp.c \ |
| 80 | $(top)/src/lib/memcpy.c \ |
| 81 | $(top)/src/lib/memmove.c \ |
Jonathan Neuschäfer | c0c31b6 | 2017-11-20 00:57:32 +0100 | [diff] [blame] | 82 | $(top)/src/lib/memset.c |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 83 | |
| 84 | romstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c |
| 85 | |
| 86 | # Build the romstage |
| 87 | |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 88 | $(objcbfs)/romstage.debug: $$(romstage-objs) |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 89 | @printf " LINK $(subst $(obj)/,,$(@))\n" |
Nico Huber | 81b09f4 | 2016-01-23 00:50:00 +0100 | [diff] [blame] | 90 | $(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. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 91 | |
| 92 | romstage-c-ccopts += $(riscv_flags) |
| 93 | romstage-S-ccopts += $(riscv_asm_flags) |
| 94 | |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 95 | endif |
| 96 | |
| 97 | ################################################################################ |
| 98 | ## ramstage |
| 99 | ################################################################################ |
| 100 | ifeq ($(CONFIG_ARCH_RAMSTAGE_RISCV),y) |
| 101 | |
| 102 | ramstage-y = |
Thaminda Edirisooriya | a47738d | 2015-08-26 15:39:16 -0700 | [diff] [blame] | 103 | ramstage-y += virtual_memory.c |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 104 | ramstage-y += stages.c |
| 105 | ramstage-y += misc.c |
| 106 | ramstage-y += boot.c |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 107 | ramstage-y += tables.c |
Ronald G. Minnich | 5965cba | 2016-10-19 08:07:13 -0700 | [diff] [blame] | 108 | ramstage-y += payload.S |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 109 | ramstage-y += \ |
| 110 | $(top)/src/lib/memchr.c \ |
| 111 | $(top)/src/lib/memcmp.c \ |
| 112 | $(top)/src/lib/memcpy.c \ |
| 113 | $(top)/src/lib/memmove.c \ |
Jonathan Neuschäfer | c0c31b6 | 2017-11-20 00:57:32 +0100 | [diff] [blame] | 114 | $(top)/src/lib/memset.c |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 115 | |
| 116 | $(eval $(call create_class_compiler,rmodules,riscv)) |
| 117 | |
| 118 | ramstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c |
| 119 | |
| 120 | ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/mainboard.c |
| 121 | |
| 122 | # Build the ramstage |
| 123 | |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 124 | $(objcbfs)/ramstage.debug: $$(ramstage-objs) |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 125 | @printf " CC $(subst $(obj)/,,$(@))\n" |
Nico Huber | 81b09f4 | 2016-01-23 00:50:00 +0100 | [diff] [blame] | 126 | $(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. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 127 | |
| 128 | ramstage-c-ccopts += $(riscv_flags) |
| 129 | ramstage-S-ccopts += $(riscv_asm_flags) |
| 130 | |
| 131 | endif |