OpenEmbedded / Yocto Project : build from sources
How to build OE core for MPU
Note that building an entire distribution is a long process. It also requires a big amount of free disk space.
The support for Microchip MPU SoC family is included in a particular Yocto Project layer: meta-mchp. The source for this layer are hosted on Linux4Microchip GitHub account: https://github.com/linux4microchip/meta-mchp
Building environment
A step-by-step comprehensive installation is explained in the Yocto Project Quick Build. The following lines have to be considered as an add-on that is MPU specific or that can facilitate your setup.
Step by step build procedure
here is the README procedure available directly in the meta-mchp-common layer. This file in the meta-mchp layer repository must be considered as the reference and the following copy can be out-of-sync.
starting with Linux4Microchip 2025.04 release, the meta-mchp layer supports Yocto Project templates, so make sure you create a new build environment using oe-init-build-env
OpenEmbedded/Yocto Project BSP layer for Microchip's SoCs
Description
The meta-mchp-common layer consolidates common Board Support Package (BSP) components and metadata for Microchip platforms, streamlining development across various Microchip devices for use with OpenEmbedded and/or Yocto Project.
Supported Machines
The meta-mchp-common layer provides support for various Microchip platforms. For detailed information about supported machines, please refer to the documentation in the relevant sub-layers:
Prerequisites
Before starting, please refer to the Required Packages for Build Host section in the Yocto Project Documentation to install required dependencies for the build environment:
Note: Make sure to install git-lfs and repo in addition to the required packages for your Linux distribution.
For instance, on Ubuntu or Debian, these packages need to be installed on your development host:
build-essential chrpath socat cpio python3 python3-pip python3-pexpect \
xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \
pylint3 xterm repo
Usage
To integrate this layer into your Yocto Project build environment:
Clone the necessary repositories:
Create an empty directory to hold the workspace:
cd yocto-dev
Use the repo tool to fetch all the required repositories
Make sure to install the repo utility first.
Replace and with the Yocto release branch and the manifest required. For example:
Fetch all the required repositories using the following repo command:
Initialize the build environment:
The meta-mchp repository provides sample configuration templates that help set up BitBake layers and key configuration files in the Yocto build directory.
Set the TEMPLATECONF environment variable to point to the appropriate configuration template before initializing the build environment:
Replace meta-layer above with the desired layer based on your target platform. For example:
Note: Setting TEMPLATECONF is only needed the first time you will run the source command.
Then initialize the Yocto build environment:
Set the target machine and build the image:
Each sub-layer provides several images that include demos and applications tailored for its respective platform.
For more information on the supported images, please refer to the README:
Layer Dependencies
This layer depends on the following layers:
- URI: git://git.openembedded.org/meta-openembedded
- Layers: meta-oe, meta-networking, meta-python
- openembedded-core
- URI: git://git.openembedded.org/openembedded-core
- Layers: meta
For information on the specific revisions used, refer to the meta-mchp manifest repository.
Licensing
The contents of this layer are licensed under the MIT License. See COPYING.MIT for details.
Contributing
If you want to contribute changes, you can send Github pull requests at https://github.com/linux4microchip/meta-mchp/pulls.
See CONTRIBUTING.md for additional information about contribution guidelines.
Maintainers
- Hari Prasath G E <hari.prasathge@microchip.com>
- Valentina Fernandez Alanis <valentina.fernandezalanis@microchip.com>
- Dharma Balasubiramani <dharma.b@microchip.com>
OE SDK
The meta-toolchain recipes build tarballs which contain cross compilation toolchain, cross compiled libraries, includes and configuration tools suitable for application development outside OE.
The cross-compilation toolchain and all coss-compiled libraries will be present in this SDK allowing the user to exactly match what is provided in the associated Linux4SAM demo image.
If a random cross-compilation toolchain was used, it would lead to undefined symbols and unmatched library calls. With this SDK matching what is present on the target, cross-development is enhanced with all possibilities offered by shared libraries that any embedded Linux developer could expect from such a system.
This cross-development cycle doesn't have to be integrated within an OpenEmbedded integration flow: usual Makefiles, cmake, IDE... in short: any developer-friendly environment could be used allowing the separation of the development phase from the integration phase.
Build OE SDK
This SDK is generated using the bitbake handy target populate_sdk.
or
It will produce a comprehensive SDK script (auto-extracting archive) available in the deployment directory: from the build directory it is usually located in tmp/deploy/sdk.
For instance, for the sama5d27-wlsom1-ek-sd graphic image type of SDK, you can find it available in: tmp/deploy/sdk/oecore-mchp-graphics-image-x86_64-cortexa5t2hf-neon-vfpv4-sama5d27-wlsom1-ek-sd-toolchain-nodistro.0.sh
Install OE SDK
Once the SDK archive is generated, you can install it by running the script directly. Choose the appropriate script name according to your board.
Note that some of the SDK variants can apply on several boards or SoC (sama5d2 or sama5d4 SDK could match all boards equipped with these SoCs). You can check the Yocto Project SDK table for more information about the different SDK "flavors".
Some installation information will be asked to the user as well as the appropriate installation rights:
Hereunder is an example with a SDK from the Scarthgap branch of OpenEmbedded present in Linux4SAM 2024.10:
OpenEmbedded SDK installer version nodistro.0
=============================================
Enter target directory for SDK (default: /usr/local/oecore-x86_64): /opt/oecore
You are about to install the SDK to "/opt/oecore". Proceed [Y/n]? Y
[sudo] password for dharma:
Extracting SDK............................................................................................................................................................................................................................done
Setting it up... done
SDK has been successfully set up and is ready to be used.
Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
$ . /opt/oecore/environment-setup-cortexa5t2hf-neon-vfpv4-oe-linux-gnueabi
Use OE SDK
The installation directory (/opt/oecore) contains a setup script which can be sourced to initialize all required environment variables.
$ source environment-setup-cortexa5t2hf-neon-vfpv4-oe-linux-gnueabi
You can check your new environment
[...]
declare -x AR="arm-oe-linux-gnueabi-ar"
declare -x ARCH="arm"
declare -x AS="arm-oe-linux-gnueabi-as "
declare -x CC="arm-oe-linux-gnueabi-gcc -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a5 -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 --sysroot=/opt/oecore/sysroots/cortexa5t2hf-neon-vfpv4-oe-linux-gnueabi"
[...]
declare -x CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types "
declare -x CMAKE_TOOLCHAIN_FILE="/opt/oecore/sysroots/x86_64-oesdk-linux/usr/share/cmake/OEToolchainConfig.cmake"
declare -x CONFIGURE_FLAGS="--target=arm-oe-linux-gnueabi --host=arm-oe-linux-gnueabi --build=x86_64-linux --with-libtool-sysroot=/opt/oecore/sysroots/cortexa5t2hf-neon-vfpv4-oe-linux-gnueabi"
[...]
declare -x OECORE_DISTRO_VERSION="nodistro.0"
declare -x OECORE_NATIVE_SYSROOT="/opt/oecore/sysroots/x86_64-oesdk-linux"
declare -x OECORE_SDK_VERSION="nodistro.0"
declare -x OECORE_TARGET_ARCH="arm"
declare -x OECORE_TARGET_OS="linux-gnueabi"
[...]
To be able to compile the EGT demo applications provided in the Linux4SAM release, SDK needs to be generated using a clone of meta-atmel.
EGT demo applications can be compiled using the OE SDK by following the below steps
$ git clone --recursive https://github.com/linux4sam/egt.git
$ cd egt/
$ ./autogen.sh
$ ./configure --host="arm"
$ make
To use the SDK toolchain directly one can refer to the Yocto Project documentation.
Tips & tricks
BitBake
- BitBake User Manual
- BitBake Cheat Sheet
List tasks provided by a package:
bitbake -c listtasks <package_name>You can use one of those tasks to have a fine grained control over the package building.
Hello World example
Reference to the "Hello World" example.
Recent FAQ
- FAQ about audio
- Connect Module From PDA
- Yocto Project FAQ
- GUI Solutions
- SAM9X60-EK Evaluation Kit - Attaching the TM5000 WVGA Display