package/newlib-bare-metal: new package

This patch adds a new package for building newlib 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>
This commit is contained in:
Neal Frager 2024-01-31 11:22:16 +00:00 committed by Thomas Petazzoni
parent f1bfab23d0
commit 3b95ff658b
4 changed files with 64 additions and 0 deletions

View File

@ -1388,6 +1388,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: package/newlib-bare-metal/
F: toolchain/toolchain-bare-metal-buildroot/
N: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>
@ -2274,6 +2275,7 @@ F: configs/zynqmp_zcu106_defconfig
F: package/binutils-bare-metal/
F: package/bootgen/
F: package/gcc-bare-metal/
F: package/newlib-bare-metal/
F: package/versal-firmware/
F: toolchain/toolchain-bare-metal-buildroot/

View File

@ -0,0 +1,2 @@
config BR2_PACKAGE_NEWLIB_BARE_METAL
bool

View File

@ -0,0 +1,8 @@
# Locally calculated
sha256 0c166a39e1bf0951dfafcd68949fe0e4b6d3658081d6282f39aeefc6310f2f13 newlib-4.4.0.20231231.tar.gz
# Hashes for license files locally calculated
sha256 231f7edcc7352d7734a96eef0b8030f77982678c516876fcb81e25b32d68564c COPYING
sha256 a9bdde5616ecdd1e980b44f360600ee8783b1f99b8cc83a2beb163a0a390e861 COPYING.LIB
sha256 f3b7f3e4426b1fa6f60198dae7adfedd94b77b28db2d108adc0253575011e0ff COPYING.LIBGLOSS
sha256 422aa40293093fb54fc66e692a0d68fd0b24ed5602e5d1d33ad05ba3909057e9 COPYING.NEWLIB

View File

@ -0,0 +1,52 @@
################################################################################
#
# newlib-bare-metal
#
################################################################################
NEWLIB_BARE_METAL_VERSION = 4.4.0
NEWLIB_BARE_METAL_SITE = ftp://sourceware.org/pub/newlib
NEWLIB_BARE_METAL_SOURCE = newlib-$(NEWLIB_BARE_METAL_VERSION).20231231.tar.gz
NEWLIB_BARE_METAL_DEPENDENCIES = host-gcc-bare-metal
NEWLIB_BARE_METAL_ADD_TOOLCHAIN_DEPENDENCY = NO
NEWLIB_BARE_METAL_LICENSE = GPL-2.0, GPL-3.0, LGPL-2.1, LGPL-3.0
NEWLIB_BARE_METAL_LICENSE_FILES = \
COPYING \
COPYING.LIB \
COPYING.LIBGLOSS \
COPYING.NEWLIB
NEWLIB_BARE_METAL_INSTALL_STAGING = YES
NEWLIB_BARE_METAL_INSTALL_TARGET = NO
define NEWLIB_BARE_METAL_CONFIGURE_CMDS
(cd $(@D) && \
PATH=$(BR_PATH) \
./configure \
--target=$(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE) \
--prefix=/usr \
--enable-newlib-io-c99-formats \
--enable-newlib-io-long-long \
--enable-newlib-io-float \
--enable-newlib-io-long-double \
--disable-multilib \
)
endef
define NEWLIB_BARE_METAL_BUILD_CMDS
PATH=$(BR_PATH) $(MAKE1) -C $(@D)
endef
define NEWLIB_BARE_METAL_INSTALL_STAGING_CMDS
PATH=$(BR_PATH) $(MAKE1) -C $(@D) DESTDIR=$(TOOLCHAIN_BARE_METAL_BUILDROOT_SYSROOT) install
endef
define NEWLIB_BARE_METAL_FIXUP
mv $(TOOLCHAIN_BARE_METAL_BUILDROOT_SYSROOT)/usr/$(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE)/include \
$(TOOLCHAIN_BARE_METAL_BUILDROOT_SYSROOT)/usr/include
mv $(TOOLCHAIN_BARE_METAL_BUILDROOT_SYSROOT)/usr/$(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE)/lib \
$(TOOLCHAIN_BARE_METAL_BUILDROOT_SYSROOT)/usr/lib
endef
NEWLIB_BARE_METAL_POST_INSTALL_STAGING_HOOKS += NEWLIB_BARE_METAL_FIXUP
$(eval $(generic-package))