Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Ceresoli via buildroot <buildroot@buildroot.org>
To: Neal Frager <neal.frager@amd.com>
Cc: ibai.erkiaga-elorza@amd.com, michal.simek@amd.com,
	thomas.petazzoni@bootlin.com, buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH v3 2/6] package/gcc-bare-metal: new package
Date: Fri, 22 Sep 2023 14:53:26 +0200	[thread overview]
Message-ID: <20230922145326.348c9e2b@booty> (raw)
In-Reply-To: <20230904100443.1613306-2-neal.frager@amd.com>

On Mon, 4 Sep 2023 11:04:39 +0100
Neal Frager <neal.frager@amd.com> 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.
> 
> When configured for the Xilinx microblaze architecture, all of the gcc
> patches that are applied to the Xilinx distributed toolchain will be applied
> in order to generate a toolchain that is equivalent to what Xilinx distributes.
> 
> Signed-off-by: Ibai Erkiaga-Elorza <ibai.erkiaga-elorza@amd.com>
> Signed-off-by: Neal Frager <neal.frager@amd.com>
> ---
> V1->V2:
>  - removed default enable to be replaced with toolchain select config
> V2->V3:
>  - no changes
> ---
>  DEVELOPERS                                 |  2 +
>  package/gcc-bare-metal/Config.in.host      | 18 ++++++
>  package/gcc-bare-metal/gcc-bare-metal.hash |  5 ++
>  package/gcc-bare-metal/gcc-bare-metal.mk   | 67 ++++++++++++++++++++++
>  4 files changed, 92 insertions(+)
>  create mode 100644 package/gcc-bare-metal/Config.in.host
>  create mode 100644 package/gcc-bare-metal/gcc-bare-metal.hash
>  create mode 100644 package/gcc-bare-metal/gcc-bare-metal.mk
> 
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 1ebdf0a2c9..9fc597da07 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -1329,6 +1329,7 @@ F:	package/python-rpi-gpio/
>  
>  N:	Ibai Erkiaga-Elorza <ibai.erkiaga-elorza@amd.com>
>  F:	package/binutils-bare-metal/
> +F:	package/gcc-bare-metal/
>  
>  N:	Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>
>  F:	package/angularjs/
> @@ -2196,6 +2197,7 @@ F:	configs/zynqmp_zcu102_defconfig
>  F:	configs/zynqmp_zcu106_defconfig
>  F:	package/binutils-bare-metal/
>  F:	package/bootgen/
> +F:	package/gcc-bare-metal/
>  F:	package/versal-firmware/
>  
>  N:	Nicola Di Lieto <nicola.dilieto@gmail.com>
> diff --git a/package/gcc-bare-metal/Config.in.host b/package/gcc-bare-metal/Config.in.host
> new file mode 100644
> index 0000000000..9e28e862ec
> --- /dev/null
> +++ b/package/gcc-bare-metal/Config.in.host
> @@ -0,0 +1,18 @@
> +config BR2_PACKAGE_HOST_GCC_BARE_METAL
> +	bool "host gcc-bare-metal"
> +	help
> +	  gcc-bare-metal is a host utility for a bare-metal toolchain

"Build GCC for a bare-metal toolchain" seems fore accurate.

> +
> +if BR2_PACKAGE_HOST_GCC_BARE_METAL
> +
> +config BR2_PACKAGE_HOST_GCC_BARE_METAL_VERSION
> +	string
> +	default "12.2.0"
> +	
> +config BR2_PACKAGE_HOST_GCC_BARE_METAL_EXTRA_CONFIG_OPTIONS
> +	string "Additional gcc options"
> +	default ""
> +	help
> +	  Any additional gcc options you may want to include.
> +
> +endif #BR2_PACKAGE_HOST_GCC_BARE_METAL
> diff --git a/package/gcc-bare-metal/gcc-bare-metal.hash b/package/gcc-bare-metal/gcc-bare-metal.hash
> new file mode 100644
> index 0000000000..d505540bf9
> --- /dev/null
> +++ b/package/gcc-bare-metal/gcc-bare-metal.hash
> @@ -0,0 +1,5 @@
> +# From https://gcc.gnu.org/pub/gcc/releases/gcc-12.2.0/sha512.sum
> +sha512  e9e857bd81bf7a370307d6848c81b2f5403db8c7b5207f54bce3f3faac3bde63445684092c2bc1a2427cddb6f7746496d9fbbef05fbbd77f2810b2998f1f9173  gcc-12.2.0.tar.xz
> +
> +# locally computed
> +sha512  bf3561c3495dd112b269a2c21dd758c1e5e7a73f959052f63511313e44222ce85b8db81e8de3b60b2c0bb8668ee834ac85036517fb6970e06fe352765dd127d0  xlnx-rel-v2023.1.tar.gz
> 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..fd84450007
> --- /dev/null
> +++ b/package/gcc-bare-metal/gcc-bare-metal.mk
> @@ -0,0 +1,67 @@
> +################################################################################
> +#
> +# gcc-bare-metal
> +#
> +################################################################################
> +
> +HOST_GCC_BARE_METAL_VERSION = $(call qstrip,$(BR2_PACKAGE_GCC_BARE_METAL_VERSION))
> +ifeq ($(HOST_GCC_BARE_METAL_VERSION),)
> +HOST_GCC_BARE_METAL_VERSION = 12.2.0
> +endif
> +
> +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

Using '?=' in these two lines seems useless, you should use '='.

> +
> +HOST_GCC_BARE_METAL_DEPENDENCIES = host-binutils-bare-metal host-gmp host-mpc host-mpfr host-isl
> +
> +# if toolchain is for microblazeel-xilinx, apply Xilinx patch set
> +ifeq ($(BR2_PACKAGE_HOST_TOOLCHAIN_BARE_METAL_ARCH),"microblazeel-xilinx")
> +HOST_GCC_BARE_METAL_EXTRA_DOWNLOADS = https://github.com/Xilinx/meta-xilinx/archive/refs/tags/xlnx-rel-v2023.1.tar.gz

Same concerns as those I expressed for patch 1. Some of the gcc patches
look really not well maintained too, such as patch 1 introducing an
obvious mistake and patch 3 fixing it, what about squashing them?

> +define HOST_GCC_BARE_METAL_EXTRACT_PATCHES
> +  mkdir -p $(@D)/patches
> +  tar -xf $(HOST_GCC_BARE_METAL_DL_DIR)/xlnx-rel-v2023.1.tar.gz --strip-components=5 -C $(@D)/patches meta-xilinx-xlnx-rel-v2023.1/meta-microblaze/recipes-devtools/gcc/gcc-12
> +endef
> +HOST_GCC_BARE_METAL_POST_EXTRACT_HOOKS += HOST_GCC_BARE_METAL_EXTRACT_PATCHES
> +
> +define HOST_GCC_BARE_METAL_APPLY_LOCAL_PATCHES
> +        $(APPLY_PATCHES) $(@D) $(@D)/patches *.patch;
> +endef
> +HOST_GCC_BARE_METAL_POST_PATCH_HOOKS += HOST_GCC_BARE_METAL_APPLY_LOCAL_PATCHES
> +endif
> +
> +# gcc doesn't support in-tree build, so we create a 'build'
> +# subdirectory in the gcc sources, and build from there.

This comment is actually more useful than the on in gcc.mk from which I
guess you took inspiration. Thanks! You may want to replace the
original comment in gcc.mk with your version.

Otherwise looks good.

Luca

-- 
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2023-09-22 13:09 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-04 10:04 [Buildroot] [PATCH v3 1/6] package/binutils-bare-metal: new package Neal Frager via buildroot
2023-09-04 10:04 ` [Buildroot] [PATCH v3 2/6] package/gcc-bare-metal: " Neal Frager via buildroot
2023-09-22 12:53   ` Luca Ceresoli via buildroot [this message]
2023-09-04 10:04 ` [Buildroot] [PATCH v3 3/6] package/newlib-bare-metal: " Neal Frager via buildroot
2023-09-22 12:54   ` Luca Ceresoli via buildroot
2023-09-04 10:04 ` [Buildroot] [PATCH v3 4/6] package/toolchain-bare-metal: " Neal Frager via buildroot
2023-09-22 12:55   ` Luca Ceresoli via buildroot
2023-09-04 10:04 ` [Buildroot] [PATCH v3 5/6] boot/zynqmp-firmware: new boot firmware Neal Frager via buildroot
2023-09-22 12:57   ` Luca Ceresoli via buildroot
2023-09-04 10:04 ` [Buildroot] [PATCH v3 6/6] boot/uboot.mk: new zynqmp pmufw build option Neal Frager via buildroot
2023-09-22 12:58   ` Luca Ceresoli via buildroot
2023-09-22 12:52 ` [Buildroot] [PATCH v3 1/6] package/binutils-bare-metal: new package Luca Ceresoli via buildroot
2023-09-22 13:34   ` Frager, Neal via buildroot
2023-09-22 13:57     ` Luca Ceresoli via buildroot
2023-09-22 14:57       ` Frager, Neal via buildroot
     [not found]         ` <MN0PR12MB60045761B225083426E7B1A1A0FFA@MN0PR12MB6004.namprd12.prod.outlook.com>
2023-09-23  9:50           ` Frager, Neal via buildroot
2023-09-25  2:59             ` Luca Ceresoli via buildroot
2023-09-25  3:43               ` Frager, Neal via buildroot
2023-10-01 11:24                 ` Peter Korsgaard
2023-10-01 16:11                   ` Frager, Neal via buildroot
2023-10-03  7:15                     ` Luca Ceresoli via buildroot
2023-10-04 21:57                       ` Thomas Petazzoni via buildroot
2023-10-05  5:59                         ` Frager, Neal via buildroot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230922145326.348c9e2b@booty \
    --to=buildroot@buildroot.org \
    --cc=ibai.erkiaga-elorza@amd.com \
    --cc=luca.ceresoli@bootlin.com \
    --cc=michal.simek@amd.com \
    --cc=neal.frager@amd.com \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox