summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe/baremetal-image.bbclass
Commit message (Collapse)AuthorAgeFilesLines
* tclibc-picolibc: Adds a new TCLIBC variant to build with picolibc as C libraryAlejandro Hernandez Samaniego2024-07-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* classes-recipe/baremetal-image: Add image file manifestJoshua Watt2024-07-131-3/+29
| | | | | | | | | | | Downstream tasks may want to know what image files were written so write out a manifest in do_image_complete. The format of the manifest is the same as the one in image.bbclass (From OE-Core rev: 4c4f1e020533c26f90e95960745f6de90d77e64e) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* newlib: Use mcmodel=medany for RISCV64Alejandro Hernandez Samaniego2024-05-281-1/+1
| | | | | | | | | | | | | | | | | | It was previously discovered that mcmodel=medany should be used for RISCV64, however this was only being set for the applications themselves, but not for newlib, this meant that we ended up with C library that used a code model and an application that used another one which is not something we want. Pass mcmodel=medany when building newlib for RISCV64 as well. Also, s/CFLAGS/TARGET_CFLAGS to standarize across recipes, the variable expansion provides no functional difference at this point. (From OE-Core rev: 3ed0a2fab5dbc37dd352ead8846da6aae5de5c20) Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandro@enedino.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* classes/recipes: Switch to use inherit_deferRichard Purdie2024-01-181-1/+1
| | | | | | | | | | | | | | | | | Now that bitbake supports the use of inherit_defer, switch all conditional (variable based) inherits to use this instead. This leads to more a more deterministic user experience since there is no longer an immediate expansion and later changes to the variables in question (e.g. a bbappend) are accounted for. This patch tries to ensure the behaviour before/after remains as unchanged as it reasonably can, e.g. by always inherting populate_sdk_base. native and nativesdk continue to need to be inherited last, hence being used with inherit_defer in a handful of very specific cases. (From OE-Core rev: 451363438d38bd4552d5bcec4a92332f5819a5d4) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* baremetal-helloworld: Enable x86 and x86-64 portsAlejandro Hernandez Samaniego2023-01-121-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - The qemux86 port for helloworld-baremetal builds in the standard way, however, it uses NASM syntax for the startup code, hence we include a dependency to nasm-native, QEMU forces us to use an ELF file rather than a bin file to boot from this architecture using the -kernel parameter. - QEMU refuses to boot using the -kernel parameter for files containing an ELF64 header [1], instead, it requires a multiboot2 compatible image. We could create an image that contains a multiboot2 header by piggybacking into grub2-native, specifically grub-mkrescue, but it requires some extra runtime dependencies (xorriso which is currently part of meta-oe), and assumes a grub installation exists on the host. Due to host contamination and dependency complications, we dont rely on grub2, but rather do this process manually instead, the x86-64 port contains a stage1 bootloader, stage2 bootloader and a 64 bit baremetal app (multiboot2 compatible), booting into real (16 bit), protected (32 bit) and long (64 bit) modes, eventually running the helloworld-baremetal app. This is the reason why we need the code changes to use a separate Makefile, and create an image specifically for qemux86-64. $ runqemu nographic Booting from ROM.. Hello OpenEmbedded on x86! $ runqemu nographic Starting Stage 1 Bootloader Loading Stage 2 Bootloader Stage 2 Loaded. Jumping to Stage2 Bootloader In Stage 2 Done Hello OpenEmbedded on x86-64! [1] https://gitlab.com/qemu-project/qemu/-/blob/v7.2.0/hw/i386/multiboot.c#L199 (From OE-Core rev: 1dffd81b2991f90ab95cb36d8ff7626efd21434f) Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandro@enedino.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* baremetal-image: Avoid overriding qemu variables from IMAGE_CLASSESAlejandro Hernandez Samaniego2022-12-091-9/+11
| | | | | | | | | | | | | | | | | Since qemuboot is part of IMAGE_CLASSES via qemu.inc it is being inherited before we set the QB_FOO variables. Since our variables have conditional definitions and at that point they've already been defined by qemuboot, we can no longer define them in our class. Move the IMAGE_CLASSES inherit to execute it after we set the QB_FOO variables to fix booting via runqemu. (From OE-Core rev: 8ed78ec262b2502dc3b673b24a868a3eec616a20) Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandro@enedino.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* baremetal-image.bbclass: Emulate image.bbclass to handle new classes scopeAlejandro Hernandez Samaniego2022-08-311-0/+9
| | | | | | | | | | | | | | | | | | | | The new classes scope implemented on commit 7bd328f9d made testimage.bbclass (and perhaps others) stop working for baremetal-images, the expected way to run testimage is no longer to use INHERIT but to use IMAGE_CLASSES instead, however this functionality was not implemented in the baremetal-image class until now. Emulate image.bbclass allowing the baremetal-image class to use IMAGE_CLASSES to fix this issue. Set defaults for IMAGE_FEATURES to allow bitbake checks to pass properly. (From OE-Core rev: bf083929ecd69a144fedeef5a8725775f632a16c) Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandro@enedino.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* classes: Update classes to match new bitbake class scope functionalityRichard Purdie2022-08-121-0/+128
Move classes to classes-global or classes-recipe as appropriate to take advantage of new bitbake functionality to check class scope/usage. (From OE-Core rev: f5c128008365e141082c129417eb72d2751e8045) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>