Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0+ |
Rick Chen | 64d4ead | 2017-12-26 13:55:52 +0800 | [diff] [blame] | 2 | # |
| 3 | # Copyright (C) 2017 Andes Technology Corporation. |
| 4 | # Rick Chen, Andes Technology Corporation <rick@andestech.com> |
Rick Chen | 64d4ead | 2017-12-26 13:55:52 +0800 | [diff] [blame] | 5 | |
Lukas Auer | 17d3e90 | 2018-11-22 11:26:15 +0100 | [diff] [blame] | 6 | ifeq ($(CONFIG_ARCH_RV64I),y) |
| 7 | ARCH_BASE = rv64im |
| 8 | ABI = lp64 |
| 9 | endif |
| 10 | ifeq ($(CONFIG_ARCH_RV32I),y) |
| 11 | ARCH_BASE = rv32im |
| 12 | ABI = ilp32 |
| 13 | endif |
| 14 | ifeq ($(CONFIG_RISCV_ISA_A),y) |
| 15 | ARCH_A = a |
| 16 | endif |
| 17 | ifeq ($(CONFIG_RISCV_ISA_C),y) |
| 18 | ARCH_C = c |
| 19 | endif |
Lukas Auer | ecc5d83 | 2018-12-12 06:12:23 -0800 | [diff] [blame] | 20 | ifeq ($(CONFIG_CMODEL_MEDLOW),y) |
| 21 | CMODEL = medlow |
| 22 | endif |
| 23 | ifeq ($(CONFIG_CMODEL_MEDANY),y) |
| 24 | CMODEL = medany |
| 25 | endif |
Lukas Auer | 17d3e90 | 2018-11-22 11:26:15 +0100 | [diff] [blame] | 26 | |
Alexandre Ghiti | 43e1f93 | 2022-10-03 18:07:54 +0200 | [diff] [blame] | 27 | RISCV_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. |
| 31 | toolchain-need-zicsr-zifencei := $(call cc-option-yn, -mabi=$(ABI) -march=$(RISCV_MARCH)_zicsr_zifencei) |
| 32 | ifeq ($(toolchain-need-zicsr-zifencei),y) |
| 33 | RISCV_MARCH := $(RISCV_MARCH)_zicsr_zifencei |
| 34 | endif |
| 35 | |
| 36 | ARCH_FLAGS = -march=$(RISCV_MARCH) -mabi=$(ABI) \ |
Lukas Auer | ecc5d83 | 2018-12-12 06:12:23 -0800 | [diff] [blame] | 37 | -mcmodel=$(CMODEL) |
Lukas Auer | 17d3e90 | 2018-11-22 11:26:15 +0100 | [diff] [blame] | 38 | |
| 39 | PLATFORM_CPPFLAGS += $(ARCH_FLAGS) |
| 40 | CFLAGS_EFI += $(ARCH_FLAGS) |
| 41 | |
Bin Meng | bcb3843 | 2018-09-26 06:55:17 -0700 | [diff] [blame] | 42 | head-y := arch/riscv/cpu/start.o |
Rick Chen | 64d4ead | 2017-12-26 13:55:52 +0800 | [diff] [blame] | 43 | |
Bin Meng | 055700e | 2018-09-26 06:55:14 -0700 | [diff] [blame] | 44 | libs-y += arch/riscv/cpu/ |
Rick Chen | 64d4ead | 2017-12-26 13:55:52 +0800 | [diff] [blame] | 45 | libs-y += arch/riscv/cpu/$(CPU)/ |
| 46 | libs-y += arch/riscv/lib/ |