diff options
| author | Alejandro Hernandez Samaniego <alejandro@enedino.org> | 2024-06-18 12:12:26 -0600 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-07-26 12:28:42 +0100 |
| commit | 09b49a35e1cd68f2e7aac35c8094adfc3ca38685 (patch) | |
| tree | 0dca38b6f20a5f90d89c339ebc675bae6e3c0715 /meta/conf | |
| parent | beabc787cacb9b399f19eac39903948154dcce18 (diff) | |
| download | poky-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.inc | 2 | ||||
| -rw-r--r-- | meta/conf/distro/include/tclibc-picolibc.inc | 40 | ||||
| -rw-r--r-- | meta/conf/documentation.conf | 2 | ||||
| -rw-r--r-- | meta/conf/machine/include/riscv/arch-riscv.inc | 1 |
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>" | |||
| 576 | RECIPE_MAINTAINER:pn-perf = "Bruce Ashfield <bruce.ashfield@gmail.com>" | 576 | RECIPE_MAINTAINER:pn-perf = "Bruce Ashfield <bruce.ashfield@gmail.com>" |
| 577 | RECIPE_MAINTAINER:pn-perl = "Alexander Kanavin <alex.kanavin@gmail.com>" | 577 | RECIPE_MAINTAINER:pn-perl = "Alexander Kanavin <alex.kanavin@gmail.com>" |
| 578 | RECIPE_MAINTAINER:pn-perlcross = "Alexander Kanavin <alex.kanavin@gmail.com>" | 578 | RECIPE_MAINTAINER:pn-perlcross = "Alexander Kanavin <alex.kanavin@gmail.com>" |
| 579 | RECIPE_MAINTAINER:pn-picolibc = "Alejandro Hernandez <alejandro@enedino.org>" | ||
| 580 | RECIPE_MAINTAINER:pn-picolibc-helloworld = "Alejandro Hernandez <alejandro@enedino.org>" | ||
| 579 | RECIPE_MAINTAINER:pn-piglit = "Ross Burton <ross.burton@arm.com>" | 581 | RECIPE_MAINTAINER:pn-piglit = "Ross Burton <ross.burton@arm.com>" |
| 580 | RECIPE_MAINTAINER:pn-pigz = "Hongxu Jia <hongxu.jia@windriver.com>" | 582 | RECIPE_MAINTAINER:pn-pigz = "Hongxu Jia <hongxu.jia@windriver.com>" |
| 581 | RECIPE_MAINTAINER:pn-pinentry = "Unassigned <unassigned@yoctoproject.org>" | 583 | RECIPE_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 | |||
| 5 | LIBCEXTENSION = "-picolibc" | ||
| 6 | LIBCOVERRIDE = ":libc-picolibc" | ||
| 7 | |||
| 8 | PREFERRED_PROVIDER_virtual/libc ?= "picolibc" | ||
| 9 | PREFERRED_PROVIDER_virtual/libiconv ?= "picolibc" | ||
| 10 | PREFERRED_PROVIDER_virtual/libintl ?= "picolibc" | ||
| 11 | PREFERRED_PROVIDER_virtual/nativesdk-libintl ?= "nativesdk-glibc" | ||
| 12 | PREFERRED_PROVIDER_virtual/nativesdk-libiconv ?= "nativesdk-glibc" | ||
| 13 | |||
| 14 | DISTRO_FEATURES_BACKFILL_CONSIDERED += "ldconfig" | ||
| 15 | |||
| 16 | IMAGE_LINGUAS = "" | ||
| 17 | |||
| 18 | LIBC_DEPENDENCIES = " \ | ||
| 19 | picolibc-dbg \ | ||
| 20 | picolibc-dev \ | ||
| 21 | libgcc-dev \ | ||
| 22 | libgcc-dbg \ | ||
| 23 | libstdc++-dev \ | ||
| 24 | libstdc++-staticdev \ | ||
| 25 | " | ||
| 26 | |||
| 27 | ASSUME_PROVIDED += "virtual/crypt" | ||
| 28 | |||
| 29 | TARGET_OS = "elf" | ||
| 30 | TARGET_OS:arm = "eabi" | ||
| 31 | |||
| 32 | TOOLCHAIN_HOST_TASK ?= "packagegroup-cross-canadian-${MACHINE} nativesdk-qemu nativesdk-sdk-provides-dummy" | ||
| 33 | TOOLCHAIN_TARGET_TASK ?= "${LIBC_DEPENDENCIES}" | ||
| 34 | TOOLCHAIN_NEED_CONFIGSITE_CACHE:remove = "zlib ncurses" | ||
| 35 | |||
| 36 | # RISCV linker doesnt support PIE | ||
| 37 | SECURITY_CFLAGS:libc-picolibc:qemuriscv32 = "${SECURITY_NOPIE_CFLAGS}" | ||
| 38 | SECURITY_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 | |||
| 421 | TARGET_OS[doc] = "Specifies the target's operating system." | 421 | TARGET_OS[doc] = "Specifies the target's operating system." |
| 422 | TARGET_PREFIX[doc] = "The prefix for the cross-compile toolchain (e.g. arm-linux-)." | 422 | TARGET_PREFIX[doc] = "The prefix for the cross-compile toolchain (e.g. arm-linux-)." |
| 423 | TARGET_SYS[doc] = "The target system is comprised of TARGET_ARCH,TARGET_VENDOR and TARGET_OS." | 423 | TARGET_SYS[doc] = "The target system is comprised of TARGET_ARCH,TARGET_VENDOR and TARGET_OS." |
| 424 | TCLIBC[doc] = "Specifies C library (libc) variant to use during the build process. You can select 'baremetal', 'glibc', 'musl' or 'newlib'." | 424 | TCLIBC[doc] = "Specifies C library (libc) variant to use during the build process. You can select 'baremetal', 'glibc', 'musl', 'newlib', or 'picolibc'." |
| 425 | TCMODE[doc] = "Enables an external toolchain (where provided by an additional layer) if set to a value other than 'default'." | 425 | TCMODE[doc] = "Enables an external toolchain (where provided by an additional layer) if set to a value other than 'default'." |
| 426 | TESTIMAGE_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." | 426 | TESTIMAGE_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." |
| 427 | TEST_QEMUBOOT_TIMEOUT[doc] = "The time in seconds allowed for an image to boot before automated runtime tests begin to run against an image." | 427 | TEST_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' |
| 13 | LINKER_HASH_STYLE:libc-newlib = "" | 13 | LINKER_HASH_STYLE:libc-newlib = "" |
| 14 | LINKER_HASH_STYLE:libc-picolibc = "" | ||
| 14 | # Fix: ld: unrecognized option '--hash-style=gnu' | 15 | # Fix: ld: unrecognized option '--hash-style=gnu' |
| 15 | LINKER_HASH_STYLE:libc-baremetal = "" | 16 | LINKER_HASH_STYLE:libc-baremetal = "" |
