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 | ## |
| 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 Georgi | b890a12 | 2015-03-26 15:17:45 +0100 | [diff] [blame] | 18 | ## Foundation, Inc. |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 19 | ## |
| 20 | ################################################################################ |
| 21 | |
| 22 | riscv_flags = -I$(src)/arch/riscv/ |
| 23 | |
| 24 | riscv_asm_flags = |
| 25 | |
| 26 | ################################################################################ |
| 27 | ## bootblock |
| 28 | ################################################################################ |
| 29 | ifeq ($(CONFIG_ARCH_BOOTBLOCK_RISCV),y) |
| 30 | |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 31 | bootblock-y = bootblock.S stages.c |
Aaron Durbin | b3847e6 | 2015-03-20 15:55:08 -0500 | [diff] [blame] | 32 | bootblock-y += boot.c |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 33 | bootblock-y += rom_media.c |
| 34 | bootblock-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 Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 41 | $(objcbfs)/bootblock.debug: $$(bootblock-objs) |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 42 | @printf " LINK $(subst $(obj)/,,$(@))\n" |
Patrick Georgi | 828e0e8 | 2015-04-04 15:50:20 +0200 | [diff] [blame] | 43 | $(LD_bootblock) --gc-sections -static -o $@ -L$(obj) \ |
Patrick Georgi | eec8dfb | 2015-05-07 22:24:41 +0200 | [diff] [blame] | 44 | -T $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.bootblock.ld --whole-archive --start-group $(filter-out %.ld,$(bootblock-objs)) \ |
Patrick Georgi | 3332f33 | 2015-07-18 00:25:12 +0200 | [diff] [blame] | 45 | $(LIBGCC_FILE_NAME_bootblock) --end-group $(COMPILER_RT_bootblock) |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 46 | |
| 47 | endif |
| 48 | |
| 49 | ################################################################################ |
| 50 | ## romstage |
| 51 | ################################################################################ |
| 52 | ifeq ($(CONFIG_ARCH_ROMSTAGE_RISCV),y) |
| 53 | |
Aaron Durbin | b3847e6 | 2015-03-20 15:55:08 -0500 | [diff] [blame] | 54 | romstage-y += boot.c |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 55 | romstage-y += stages.c |
| 56 | romstage-y += rom_media.c |
| 57 | romstage-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. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 63 | |
| 64 | romstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c |
| 65 | |
| 66 | # Build the romstage |
| 67 | |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 68 | $(objcbfs)/romstage.debug: $$(romstage-objs) |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 69 | @printf " LINK $(subst $(obj)/,,$(@))\n" |
Patrick Georgi | 3332f33 | 2015-07-18 00:25:12 +0200 | [diff] [blame] | 70 | $(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. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 71 | |
| 72 | romstage-c-ccopts += $(riscv_flags) |
| 73 | romstage-S-ccopts += $(riscv_asm_flags) |
| 74 | |
Julius Werner | efcee76 | 2014-11-10 13:14:24 -0800 | [diff] [blame] | 75 | CBFSTOOL_PRE1_OPTS = -v -m riscv -s $(CONFIG_CBFS_SIZE) |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 76 | CBFSTOOL_PRE_OPTS = -v |
| 77 | |
| 78 | endif |
| 79 | |
| 80 | ################################################################################ |
| 81 | ## ramstage |
| 82 | ################################################################################ |
| 83 | ifeq ($(CONFIG_ARCH_RAMSTAGE_RISCV),y) |
| 84 | |
| 85 | ramstage-y = |
| 86 | ramstage-y += rom_media.c |
| 87 | ramstage-y += stages.c |
| 88 | ramstage-y += misc.c |
| 89 | ramstage-y += boot.c |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 90 | ramstage-y += tables.c |
| 91 | ramstage-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 | |
| 100 | ramstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c |
| 101 | |
| 102 | ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/mainboard.c |
| 103 | |
| 104 | # Build the ramstage |
| 105 | |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 106 | $(objcbfs)/ramstage.debug: $$(ramstage-objs) |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 107 | @printf " CC $(subst $(obj)/,,$(@))\n" |
Patrick Georgi | 3332f33 | 2015-07-18 00:25:12 +0200 | [diff] [blame] | 108 | $(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. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 109 | |
| 110 | ramstage-c-ccopts += $(riscv_flags) |
| 111 | ramstage-S-ccopts += $(riscv_asm_flags) |
| 112 | |
| 113 | endif |