blob: 53d1194ffb6426d1942d7a815064b5070342eb85 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001# SPDX-License-Identifier: GPL-2.0+
Rick Chenf94c44e2017-12-26 13:55:52 +08002#
3# Copyright (C) 2017 Andes Technology Corporation.
4# Rick Chen, Andes Technology Corporation <rick@andestech.com>
Rick Chenf94c44e2017-12-26 13:55:52 +08005
Lukas Auer0c074842018-11-22 11:26:15 +01006ifeq ($(CONFIG_ARCH_RV64I),y)
7 ARCH_BASE = rv64im
8 ABI = lp64
9endif
10ifeq ($(CONFIG_ARCH_RV32I),y)
11 ARCH_BASE = rv32im
12 ABI = ilp32
13endif
14ifeq ($(CONFIG_RISCV_ISA_A),y)
15 ARCH_A = a
16endif
17ifeq ($(CONFIG_RISCV_ISA_C),y)
18 ARCH_C = c
19endif
Lukas Auer8176ea42018-12-12 06:12:23 -080020ifeq ($(CONFIG_CMODEL_MEDLOW),y)
21 CMODEL = medlow
22endif
23ifeq ($(CONFIG_CMODEL_MEDANY),y)
24 CMODEL = medany
25endif
Lukas Auer0c074842018-11-22 11:26:15 +010026
Alexandre Ghiti1dde9772022-10-03 18:07:54 +020027RISCV_MARCH = $(ARCH_BASE)$(ARCH_A)$(ARCH_C)
28
29# Newer binutils versions default to ISA spec version 20191213 which moves some
30# instructions from the I extension to the Zicsr and Zifencei extensions.
31toolchain-need-zicsr-zifencei := $(call cc-option-yn, -mabi=$(ABI) -march=$(RISCV_MARCH)_zicsr_zifencei)
32ifeq ($(toolchain-need-zicsr-zifencei),y)
33 RISCV_MARCH := $(RISCV_MARCH)_zicsr_zifencei
34endif
35
36ARCH_FLAGS = -march=$(RISCV_MARCH) -mabi=$(ABI) \
Lukas Auer8176ea42018-12-12 06:12:23 -080037 -mcmodel=$(CMODEL)
Lukas Auer0c074842018-11-22 11:26:15 +010038
39PLATFORM_CPPFLAGS += $(ARCH_FLAGS)
40CFLAGS_EFI += $(ARCH_FLAGS)
41
Bin Mengb5369c52018-09-26 06:55:17 -070042head-y := arch/riscv/cpu/start.o
Rick Chenf94c44e2017-12-26 13:55:52 +080043
Bin Meng2fab2e92018-09-26 06:55:14 -070044libs-y += arch/riscv/cpu/
Rick Chenf94c44e2017-12-26 13:55:52 +080045libs-y += arch/riscv/cpu/$(CPU)/
46libs-y += arch/riscv/lib/