summaryrefslogtreecommitdiffstats
path: root/meta/conf
diff options
context:
space:
mode:
authorAlejandro Hernandez Samaniego <alejandro@enedino.org>2024-06-18 12:12:26 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-07-26 12:28:42 +0100
commit09b49a35e1cd68f2e7aac35c8094adfc3ca38685 (patch)
tree0dca38b6f20a5f90d89c339ebc675bae6e3c0715 /meta/conf
parentbeabc787cacb9b399f19eac39903948154dcce18 (diff)
downloadpoky-09b49a35e1cd68f2e7aac35c8094adfc3ca38685.tar.gz
tclibc-picolibc: Adds a new TCLIBC variant to build with picolibc as C library
Enables usage of TCLIBC=picolibc extending OE functionality to build and use picolibc based toolchains to build baremetal applications. Picolibc is a set of standard C libraries, both libc and libm, designed for smaller embedded systems with limited ROM and RAM. Picolibc includes code from Newlib and AVR Libc, but adresses some of newlibs concerns, it retains newlibs directory structure, math, string and locale implementations, but removed the GPL bits used to build the library, swiches old C style code for C18 and replaces autotools with meson. This patch adds a picolibc recipe for the C library, a picolibc-helloworld recipe that contains an example application and a testcase that builds it. Picolibc can be built for ARM and RISCV architectures, its been tested both for 32 and 64 bits, the provided example recipe produces the following output: hello, world Runqemu does not automatically show any output since it hides QEMU stderr which is where the QEMU monitors output is directed to when using semihosting, but, manually running the same QEMU command does work properly. (From OE-Core rev: c7535ecaccb72ef21a61f9aec5c68e61fb4f6fb6) Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandro@enedino.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/conf')
-rw-r--r--meta/conf/distro/include/maintainers.inc2
-rw-r--r--meta/conf/distro/include/tclibc-picolibc.inc40
-rw-r--r--meta/conf/documentation.conf2
-rw-r--r--meta/conf/machine/include/riscv/arch-riscv.inc1
4 files changed, 44 insertions, 1 deletions
diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc
index 37ad293e32..cf9fda812f 100644
--- a/meta/conf/distro/include/maintainers.inc
+++ b/meta/conf/distro/include/maintainers.inc
@@ -576,6 +576,8 @@ RECIPE_MAINTAINER:pn-pcmanfm = "Alexander Kanavin <alex.kanavin@gmail.com>"
576RECIPE_MAINTAINER:pn-perf = "Bruce Ashfield <bruce.ashfield@gmail.com>" 576RECIPE_MAINTAINER:pn-perf = "Bruce Ashfield <bruce.ashfield@gmail.com>"
577RECIPE_MAINTAINER:pn-perl = "Alexander Kanavin <alex.kanavin@gmail.com>" 577RECIPE_MAINTAINER:pn-perl = "Alexander Kanavin <alex.kanavin@gmail.com>"
578RECIPE_MAINTAINER:pn-perlcross = "Alexander Kanavin <alex.kanavin@gmail.com>" 578RECIPE_MAINTAINER:pn-perlcross = "Alexander Kanavin <alex.kanavin@gmail.com>"
579RECIPE_MAINTAINER:pn-picolibc = "Alejandro Hernandez <alejandro@enedino.org>"
580RECIPE_MAINTAINER:pn-picolibc-helloworld = "Alejandro Hernandez <alejandro@enedino.org>"
579RECIPE_MAINTAINER:pn-piglit = "Ross Burton <ross.burton@arm.com>" 581RECIPE_MAINTAINER:pn-piglit = "Ross Burton <ross.burton@arm.com>"
580RECIPE_MAINTAINER:pn-pigz = "Hongxu Jia <hongxu.jia@windriver.com>" 582RECIPE_MAINTAINER:pn-pigz = "Hongxu Jia <hongxu.jia@windriver.com>"
581RECIPE_MAINTAINER:pn-pinentry = "Unassigned <unassigned@yoctoproject.org>" 583RECIPE_MAINTAINER:pn-pinentry = "Unassigned <unassigned@yoctoproject.org>"
diff --git a/meta/conf/distro/include/tclibc-picolibc.inc b/meta/conf/distro/include/tclibc-picolibc.inc
new file mode 100644
index 0000000000..203765dfcb
--- /dev/null
+++ b/meta/conf/distro/include/tclibc-picolibc.inc
@@ -0,0 +1,40 @@
1#
2# Picolibc configuration
3#
4
5LIBCEXTENSION = "-picolibc"
6LIBCOVERRIDE = ":libc-picolibc"
7
8PREFERRED_PROVIDER_virtual/libc ?= "picolibc"
9PREFERRED_PROVIDER_virtual/libiconv ?= "picolibc"
10PREFERRED_PROVIDER_virtual/libintl ?= "picolibc"
11PREFERRED_PROVIDER_virtual/nativesdk-libintl ?= "nativesdk-glibc"
12PREFERRED_PROVIDER_virtual/nativesdk-libiconv ?= "nativesdk-glibc"
13
14DISTRO_FEATURES_BACKFILL_CONSIDERED += "ldconfig"
15
16IMAGE_LINGUAS = ""
17
18LIBC_DEPENDENCIES = " \
19 picolibc-dbg \
20 picolibc-dev \
21 libgcc-dev \
22 libgcc-dbg \
23 libstdc++-dev \
24 libstdc++-staticdev \
25"
26
27ASSUME_PROVIDED += "virtual/crypt"
28
29TARGET_OS = "elf"
30TARGET_OS:arm = "eabi"
31
32TOOLCHAIN_HOST_TASK ?= "packagegroup-cross-canadian-${MACHINE} nativesdk-qemu nativesdk-sdk-provides-dummy"
33TOOLCHAIN_TARGET_TASK ?= "${LIBC_DEPENDENCIES}"
34TOOLCHAIN_NEED_CONFIGSITE_CACHE:remove = "zlib ncurses"
35
36# RISCV linker doesnt support PIE
37SECURITY_CFLAGS:libc-picolibc:qemuriscv32 = "${SECURITY_NOPIE_CFLAGS}"
38SECURITY_CFLAGS:libc-picolibc:qemuriscv64 = "${SECURITY_NOPIE_CFLAGS}"
39
40
diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
index 155353eafc..e912e91265 100644
--- a/meta/conf/documentation.conf
+++ b/meta/conf/documentation.conf
@@ -421,7 +421,7 @@ TARGET_FPU[doc] = "Specifies the method for handling FPU code. For FPU-less targ
421TARGET_OS[doc] = "Specifies the target's operating system." 421TARGET_OS[doc] = "Specifies the target's operating system."
422TARGET_PREFIX[doc] = "The prefix for the cross-compile toolchain (e.g. arm-linux-)." 422TARGET_PREFIX[doc] = "The prefix for the cross-compile toolchain (e.g. arm-linux-)."
423TARGET_SYS[doc] = "The target system is comprised of TARGET_ARCH,TARGET_VENDOR and TARGET_OS." 423TARGET_SYS[doc] = "The target system is comprised of TARGET_ARCH,TARGET_VENDOR and TARGET_OS."
424TCLIBC[doc] = "Specifies C library (libc) variant to use during the build process. You can select 'baremetal', 'glibc', 'musl' or 'newlib'." 424TCLIBC[doc] = "Specifies C library (libc) variant to use during the build process. You can select 'baremetal', 'glibc', 'musl', 'newlib', or 'picolibc'."
425TCMODE[doc] = "Enables an external toolchain (where provided by an additional layer) if set to a value other than 'default'." 425TCMODE[doc] = "Enables an external toolchain (where provided by an additional layer) if set to a value other than 'default'."
426TESTIMAGE_AUTO[doc] = "Enables test booting of virtual machine images under the QEMU emulator after any root filesystems are created and runs tests against those images each time an image is built." 426TESTIMAGE_AUTO[doc] = "Enables test booting of virtual machine images under the QEMU emulator after any root filesystems are created and runs tests against those images each time an image is built."
427TEST_QEMUBOOT_TIMEOUT[doc] = "The time in seconds allowed for an image to boot before automated runtime tests begin to run against an image." 427TEST_QEMUBOOT_TIMEOUT[doc] = "The time in seconds allowed for an image to boot before automated runtime tests begin to run against an image."
diff --git a/meta/conf/machine/include/riscv/arch-riscv.inc b/meta/conf/machine/include/riscv/arch-riscv.inc
index 230a266563..b34064e78f 100644
--- a/meta/conf/machine/include/riscv/arch-riscv.inc
+++ b/meta/conf/machine/include/riscv/arch-riscv.inc
@@ -11,5 +11,6 @@ TUNE_CCARGS:append = "${@bb.utils.contains('TUNE_FEATURES', 'riscv64nc', ' -marc
11 11
12# Fix: ld: unrecognized option '--hash-style=sysv' 12# Fix: ld: unrecognized option '--hash-style=sysv'
13LINKER_HASH_STYLE:libc-newlib = "" 13LINKER_HASH_STYLE:libc-newlib = ""
14LINKER_HASH_STYLE:libc-picolibc = ""
14# Fix: ld: unrecognized option '--hash-style=gnu' 15# Fix: ld: unrecognized option '--hash-style=gnu'
15LINKER_HASH_STYLE:libc-baremetal = "" 16LINKER_HASH_STYLE:libc-baremetal = ""