Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0+ |
Rick Chen | f94c44e | 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 | f94c44e | 2017-12-26 13:55:52 +0800 | [diff] [blame] | 5 | |
Lukas Auer | 0c07484 | 2018-11-22 11:26:15 +0100 | [diff] [blame] | 6 | ifeq ($(CONFIG_ARCH_RV64I),y) |
| 7 | ARCH_BASE = rv64im |
Heinrich Schuchardt | e67f34f | 2022-10-12 14:59:51 +0200 | [diff] [blame] | 8 | ABI_BASE = lp64 |
Lukas Auer | 0c07484 | 2018-11-22 11:26:15 +0100 | [diff] [blame] | 9 | endif |
| 10 | ifeq ($(CONFIG_ARCH_RV32I),y) |
| 11 | ARCH_BASE = rv32im |
Heinrich Schuchardt | e67f34f | 2022-10-12 14:59:51 +0200 | [diff] [blame] | 12 | ABI_BASE = ilp32 |
Lukas Auer | 0c07484 | 2018-11-22 11:26:15 +0100 | [diff] [blame] | 13 | endif |
| 14 | ifeq ($(CONFIG_RISCV_ISA_A),y) |
| 15 | ARCH_A = a |
| 16 | endif |
Heinrich Schuchardt | e67f34f | 2022-10-12 14:59:51 +0200 | [diff] [blame] | 17 | ifeq ($(CONFIG_RISCV_ISA_F),y) |
| 18 | ARCH_F = f |
| 19 | endif |
| 20 | ifeq ($(CONFIG_RISCV_ISA_D),y) |
| 21 | ARCH_D = d |
| 22 | ABI_D = d |
| 23 | endif |
Lukas Auer | 0c07484 | 2018-11-22 11:26:15 +0100 | [diff] [blame] | 24 | ifeq ($(CONFIG_RISCV_ISA_C),y) |
| 25 | ARCH_C = c |
| 26 | endif |
Yu Chien Peter Lin | bc5a504 | 2023-08-09 18:49:30 +0800 | [diff] [blame] | 27 | ifeq ($(CONFIG_RISCV_ISA_ZBB),y) |
| 28 | ARCH_ZBB = _zbb |
| 29 | endif |
Lukas Auer | 8176ea4 | 2018-12-12 06:12:23 -0800 | [diff] [blame] | 30 | ifeq ($(CONFIG_CMODEL_MEDLOW),y) |
| 31 | CMODEL = medlow |
| 32 | endif |
| 33 | ifeq ($(CONFIG_CMODEL_MEDANY),y) |
| 34 | CMODEL = medany |
| 35 | endif |
Lukas Auer | 0c07484 | 2018-11-22 11:26:15 +0100 | [diff] [blame] | 36 | |
Heinrich Schuchardt | e67f34f | 2022-10-12 14:59:51 +0200 | [diff] [blame] | 37 | |
Yu Chien Peter Lin | bc5a504 | 2023-08-09 18:49:30 +0800 | [diff] [blame] | 38 | RISCV_MARCH = $(ARCH_BASE)$(ARCH_A)$(ARCH_F)$(ARCH_D)$(ARCH_C)$(ARCH_ZBB) |
Heinrich Schuchardt | e67f34f | 2022-10-12 14:59:51 +0200 | [diff] [blame] | 39 | ABI = $(ABI_BASE)$(ABI_D) |
Alexandre Ghiti | 1dde977 | 2022-10-03 18:07:54 +0200 | [diff] [blame] | 40 | |
| 41 | # Newer binutils versions default to ISA spec version 20191213 which moves some |
| 42 | # instructions from the I extension to the Zicsr and Zifencei extensions. |
| 43 | toolchain-need-zicsr-zifencei := $(call cc-option-yn, -mabi=$(ABI) -march=$(RISCV_MARCH)_zicsr_zifencei) |
| 44 | ifeq ($(toolchain-need-zicsr-zifencei),y) |
| 45 | RISCV_MARCH := $(RISCV_MARCH)_zicsr_zifencei |
| 46 | endif |
| 47 | |
| 48 | ARCH_FLAGS = -march=$(RISCV_MARCH) -mabi=$(ABI) \ |
Lukas Auer | 8176ea4 | 2018-12-12 06:12:23 -0800 | [diff] [blame] | 49 | -mcmodel=$(CMODEL) |
Lukas Auer | 0c07484 | 2018-11-22 11:26:15 +0100 | [diff] [blame] | 50 | |
| 51 | PLATFORM_CPPFLAGS += $(ARCH_FLAGS) |
| 52 | CFLAGS_EFI += $(ARCH_FLAGS) |
| 53 | |
Bin Meng | b5369c5 | 2018-09-26 06:55:17 -0700 | [diff] [blame] | 54 | head-y := arch/riscv/cpu/start.o |
Rick Chen | f94c44e | 2017-12-26 13:55:52 +0800 | [diff] [blame] | 55 | |
Bin Meng | 2fab2e9 | 2018-09-26 06:55:14 -0700 | [diff] [blame] | 56 | libs-y += arch/riscv/cpu/ |
Rick Chen | f94c44e | 2017-12-26 13:55:52 +0800 | [diff] [blame] | 57 | libs-y += arch/riscv/cpu/$(CPU)/ |
| 58 | libs-y += arch/riscv/lib/ |