From patchwork Tue Oct 30 12:55:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Auer X-Patchwork-Id: 990827 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aisec.fraunhofer.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42ksKS623Bz9s4s for ; Wed, 31 Oct 2018 00:10:51 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id C75C9C220F7; Tue, 30 Oct 2018 12:59:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 90F77C220EF; Tue, 30 Oct 2018 12:57:31 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D79F0C22130; Tue, 30 Oct 2018 12:57:17 +0000 (UTC) Received: from mail-edgeKA24.fraunhofer.de (mail-edgeka24.fraunhofer.de [153.96.1.24]) by lists.denx.de (Postfix) with ESMTPS id B0C83C2210C for ; Tue, 30 Oct 2018 12:57:13 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2FoAQC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBUwUBAQsBggRmgSeHQIUtj3ABlHUUgWYNH4ERgzwCgyUiNgsNAQMBAQIBAQICAmkcDIQfXz4GeRBRVwYOBYMhAYIAAaotg3GGNQkBhzeEJoFYP4hmgQiFDgKOdJAcBwKBDoEEBIRVihELGIIehxyHDpNqAYM7gUoFLYFVMxokgzsJghoah2eGNG4Bi3cBAQ X-IPAS-Result: A2FoAQC/VNhb/xoBYJlkHAEBAQQBAQcEAQGBUwUBAQsBggRmgSeHQIUtj3ABlHUUgWYNH4ERgzwCgyUiNgsNAQMBAQIBAQICAmkcDIQfXz4GeRBRVwYOBYMhAYIAAaotg3GGNQkBhzeEJoFYP4hmgQiFDgKOdJAcBwKBDoEEBIRVihELGIIehxyHDpNqAYM7gUoFLYFVMxokgzsJghoah2eGNG4Bi3cBAQ X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="10904631" Received: from mail-mtaka26.fraunhofer.de ([153.96.1.26]) by mail-edgeKA24.fraunhofer.de with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 13:57:12 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BRAACMVNhb/xBhWMBkHAEBAQQBAQcEAQGBUwUBAQsBgmptOoxtpGYUgWYNH4RNAoNGNgsNAQMBAQIBAQJtHAyFOwZ5EFFXBg4FgyEBggGqLoomCQGHN4V+P4hmgQiFDgKOdJAcBwKBDoEEBIRVihELGIIehxyHDpcmgUoFLIFVMxokgzsJghoah2eGND4wAYt3AQE X-IronPort-AV: E=Sophos;i="5.54,444,1534802400"; d="scan'208";a="16525643" Received: from fgdemucivp01ltm.xch.fraunhofer.de (HELO FGDEMUCIMP12EXC.ads.fraunhofer.de) ([192.88.97.16]) by mail-mtaKA26.fraunhofer.de with ESMTP/TLS/AES256-SHA; 30 Oct 2018 13:57:12 +0100 Received: from muc-nb-035.aisec.fraunhofer.de (10.80.233.51) by FGDEMUCIMP12EXC.ads.fraunhofer.de (10.80.232.43) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 30 Oct 2018 13:57:11 +0100 From: Lukas Auer To: Date: Tue, 30 Oct 2018 13:55:29 +0100 Message-ID: <20181030125553.5230-7-lukas.auer@aisec.fraunhofer.de> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> References: <20181030125553.5230-1-lukas.auer@aisec.fraunhofer.de> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-11.0.0.4179-8.200.1013-24188.007 X-TM-AS-Result: No--10.597300-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No Subject: [U-Boot] [PATCH v2 06/29] riscv: set -march and -mabi based on the Kconfig configuration X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Use the new Kconfig entries to construct the ISA string for the -march compiler flag. The -mabi compiler flag is selected based on the base integer instruction set. With this change, the C (compressed instructions) ISA extension is now enabled for all boards with CONFIG_RISCV_ISA_C set. Buildman reports a decrease in binary size of 71590 bytes. Signed-off-by: Lukas Auer Reviewed-by: Bin Meng --- Changes in v2: - Change ISA string construction, as suggested by Bin Meng arch/riscv/Makefile | 20 ++++++++++++++++++++ arch/riscv/config.mk | 4 ---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index 8fb6a889d8..55d7c6550e 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -3,6 +3,26 @@ # Copyright (C) 2017 Andes Technology Corporation. # Rick Chen, Andes Technology Corporation +ifeq ($(CONFIG_ARCH_RV64I),y) + ARCH_BASE = rv64im + ABI = lp64 +endif +ifeq ($(CONFIG_ARCH_RV32I),y) + ARCH_BASE = rv32im + ABI = ilp32 +endif +ifeq ($(CONFIG_RISCV_ISA_A),y) + ARCH_A = a +endif +ifeq ($(CONFIG_RISCV_ISA_C),y) + ARCH_C = c +endif + +ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_C) -mabi=$(ABI) + +PLATFORM_CPPFLAGS += $(ARCH_FLAGS) +CFLAGS_EFI += $(ARCH_FLAGS) + head-y := arch/riscv/cpu/start.o libs-y += arch/riscv/cpu/ diff --git a/arch/riscv/config.mk b/arch/riscv/config.mk index ed9eb0c24c..9088b9ef2c 100644 --- a/arch/riscv/config.mk +++ b/arch/riscv/config.mk @@ -14,16 +14,12 @@ 64bit-emul := elf64lriscv ifdef CONFIG_32BIT -PLATFORM_CPPFLAGS += -march=rv32ima -mabi=ilp32 PLATFORM_LDFLAGS += -m $(32bit-emul) -CFLAGS_EFI += -march=rv32ima -mabi=ilp32 EFI_LDS := elf_riscv32_efi.lds endif ifdef CONFIG_64BIT -PLATFORM_CPPFLAGS += -march=rv64ima -mabi=lp64 PLATFORM_LDFLAGS += -m $(64bit-emul) -CFLAGS_EFI += -march=rv64ima -mabi=lp64 EFI_LDS := elf_riscv64_efi.lds endif