diff mbox series

[v9,03/11] package/gcc-bare-metal: new package

Message ID 20240131112223.2175855-3-neal.frager@amd.com
State Accepted
Headers show
Series [v9,01/11] toolchain/toolchain-bare-metal-buildroot: new toolchain | expand

Commit Message

Neal Frager Jan. 31, 2024, 11:22 a.m. UTC
This patch adds a new package for building gcc for a bare-metal toolchain.
The cpu architecture is defined by a toolchain-bare-metal virtual package.
While any cpu architecture could be used, the default configuration will be a
Xilinx microblaze little endian architecture, so that buildroot will be able
to build the microblaze firmware applications for zynqmp and versal.

Signed-off-by: Neal Frager <neal.frager@amd.com>
Signed-off-by: Ibai Erkiaga <ibai.erkiaga-elorza@amd.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
V1->V2:
 - removed default enable to be replaced with toolchain select config
V2->V3:
 - no changes
V3->V4:
 - split tar instruction into multiple lines
 - replaced unnecessary =? with = for assignments
 - changed xlnx-rel-v2023.1.tar.gz hash to sha256
 - improved menuconfig help comment
V4->V5:
 - moved to upstream gcc without any xilinx patches
 - reduced all lines to <80 chars
 - added license files
V5->V6:
 - migrated to toolchain-bare-metal-buildroot
V6->V7:
 - removed Config.in and hard-coded version
 - added sysroot for newlib install
V7->V8:
 - no changes
V8->V9:
 - integrated changes from Thomas
---
 DEVELOPERS                                 |  2 +
 package/gcc-bare-metal/13.2.0              |  1 +
 package/gcc-bare-metal/gcc-bare-metal.hash |  1 +
 package/gcc-bare-metal/gcc-bare-metal.mk   | 61 ++++++++++++++++++++++
 4 files changed, 65 insertions(+)
 create mode 120000 package/gcc-bare-metal/13.2.0
 create mode 120000 package/gcc-bare-metal/gcc-bare-metal.hash
 create mode 100644 package/gcc-bare-metal/gcc-bare-metal.mk

Comments

Thomas Petazzoni Feb. 6, 2024, 5:52 p.m. UTC | #1
On Wed, 31 Jan 2024 11:22:15 +0000
Neal Frager via buildroot <buildroot@buildroot.org> wrote:

> This patch adds a new package for building gcc for a bare-metal toolchain.
> The cpu architecture is defined by a toolchain-bare-metal virtual package.
> While any cpu architecture could be used, the default configuration will be a
> Xilinx microblaze little endian architecture, so that buildroot will be able
> to build the microblaze firmware applications for zynqmp and versal.
> 
> Signed-off-by: Neal Frager <neal.frager@amd.com>
> Signed-off-by: Ibai Erkiaga <ibai.erkiaga-elorza@amd.com>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
> V1->V2:
>  - removed default enable to be replaced with toolchain select config
> V2->V3:
>  - no changes
> V3->V4:
>  - split tar instruction into multiple lines
>  - replaced unnecessary =? with = for assignments
>  - changed xlnx-rel-v2023.1.tar.gz hash to sha256
>  - improved menuconfig help comment
> V4->V5:
>  - moved to upstream gcc without any xilinx patches
>  - reduced all lines to <80 chars
>  - added license files
> V5->V6:
>  - migrated to toolchain-bare-metal-buildroot
> V6->V7:
>  - removed Config.in and hard-coded version
>  - added sysroot for newlib install
> V7->V8:
>  - no changes
> V8->V9:
>  - integrated changes from Thomas
> ---
>  DEVELOPERS                                 |  2 +
>  package/gcc-bare-metal/13.2.0              |  1 +
>  package/gcc-bare-metal/gcc-bare-metal.hash |  1 +
>  package/gcc-bare-metal/gcc-bare-metal.mk   | 61 ++++++++++++++++++++++
>  4 files changed, 65 insertions(+)
>  create mode 120000 package/gcc-bare-metal/13.2.0
>  create mode 120000 package/gcc-bare-metal/gcc-bare-metal.hash
>  create mode 100644 package/gcc-bare-metal/gcc-bare-metal.mk

Applied to master, thanks.

Thomas
diff mbox series

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index e78bd4dc02..af6c01c72f 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1387,6 +1387,7 @@  F:	package/python-rpi-gpio/
 
 N:	Ibai Erkiaga <ibai.erkiaga-elorza@amd.com>
 F:	package/binutils-bare-metal/
+F:	package/gcc-bare-metal/
 F:	toolchain/toolchain-bare-metal-buildroot/
 
 N:	Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>
@@ -2243,6 +2244,7 @@  F:	configs/zynqmp_zcu104_defconfig
 F:	configs/zynqmp_zcu106_defconfig
 F:	package/binutils-bare-metal/
 F:	package/bootgen/
+F:	package/gcc-bare-metal/
 F:	package/versal-firmware/
 F:	toolchain/toolchain-bare-metal-buildroot/
 
diff --git a/package/gcc-bare-metal/13.2.0 b/package/gcc-bare-metal/13.2.0
new file mode 120000
index 0000000000..b7a75dc7dd
--- /dev/null
+++ b/package/gcc-bare-metal/13.2.0
@@ -0,0 +1 @@ 
+../gcc/13.2.0/
\ No newline at end of file
diff --git a/package/gcc-bare-metal/gcc-bare-metal.hash b/package/gcc-bare-metal/gcc-bare-metal.hash
new file mode 120000
index 0000000000..d417b0dc77
--- /dev/null
+++ b/package/gcc-bare-metal/gcc-bare-metal.hash
@@ -0,0 +1 @@ 
+../gcc/gcc.hash
\ No newline at end of file
diff --git a/package/gcc-bare-metal/gcc-bare-metal.mk b/package/gcc-bare-metal/gcc-bare-metal.mk
new file mode 100644
index 0000000000..f391f094fe
--- /dev/null
+++ b/package/gcc-bare-metal/gcc-bare-metal.mk
@@ -0,0 +1,61 @@ 
+################################################################################
+#
+# gcc-bare-metal
+#
+################################################################################
+
+HOST_GCC_BARE_METAL_VERSION = 13.2.0
+HOST_GCC_BARE_METAL_SITE = \
+	https://ftp.gnu.org/gnu/gcc/gcc-$(HOST_GCC_BARE_METAL_VERSION)
+HOST_GCC_BARE_METAL_SOURCE = gcc-$(HOST_GCC_BARE_METAL_VERSION).tar.xz
+
+HOST_GCC_BARE_METAL_LICENSE = GPL-2.0, GPL-3.0, LGPL-2.1, LGPL-3.0
+HOST_GCC_BARE_METAL_LICENSE_FILES = COPYING COPYING3 COPYING.LIB COPYING3.LIB
+
+HOST_GCC_BARE_METAL_DEPENDENCIES = \
+	host-binutils-bare-metal \
+	host-gmp \
+	host-mpc \
+	host-mpfr \
+	host-isl
+
+# gcc doesn't support in-tree build, so we create a 'build'
+# subdirectory in the gcc sources, and build from there.
+define GCC_BARE_METAL_CONFIGURE_SYMLINK
+	mkdir -p $(@D)/build
+	ln -sf ../configure $(@D)/build/configure
+endef
+
+HOST_GCC_BARE_METAL_PRE_CONFIGURE_HOOKS += GCC_BARE_METAL_CONFIGURE_SYMLINK
+HOST_GCC_BARE_METAL_SUBDIR = build
+
+HOST_GCC_BARE_METAL_MAKE_OPTS = \
+	$(HOST_GCC_COMMON_MAKE_OPTS) \
+	all-gcc \
+	all-target-libgcc
+
+HOST_GCC_BARE_METAL_INSTALL_OPTS = install-gcc install-target-libgcc
+
+HOST_GCC_BARE_METAL_CONF_OPTS = \
+	--target=$(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE) \
+	--disable-initfini_array \
+	--disable-__cxa_atexit \
+	--disable-libstdcxx-pch \
+	--with-newlib \
+	--disable-threads \
+	--enable-plugins \
+	--with-gnu-as \
+	--disable-libitm \
+	--without-long-double-128 \
+	--without-headers \
+	--enable-languages=c \
+	--disable-multilib \
+	--with-gmp=$(HOST_DIR) \
+	--with-mpc=$(HOST_DIR) \
+	--with-mpfr=$(HOST_DIR) \
+	--with-isl=$(HOST_DIR) \
+	--with-sysroot=$(TOOLCHAIN_BARE_METAL_BUILDROOT_SYSROOT) \
+	AR_FOR_TARGET=$(HOST_DIR)/bin/$(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE)-ar \
+	RANLIB_FOR_TARGET=$(HOST_DIR)/bin/$(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE)-ranlib
+
+$(eval $(host-autotools-package))