Image of an arrow

Introducing the v2.1 Release of the Yocto Project Extension for VS Code

Avatar

ederibaucourt

The Yocto Project’s Five-Year Plan

The Yocto Project is one of the most successful technologies to build reliable industrial-grade embedded Linux distributions. In order for the project to keep growing, the Sovereign Tech Fund has decided on a Five-Year Plan that shapes its stability and attractiveness for the years to come. These developments were carried out as part of the investment to improve the long-term sustainability of the project by attracting a new generation of developers.

Among this plan is an ambitious overhaul of the IDE support for the Yocto Project to improve the productivity and provide a smoother experience for new users. Visual Studio Code was selected, being one of the most modern and popular IDE currently used by Yocto developers and application developers alike. As a Silver member of the Yocto Project, Savoir-faire Linux was selected to fulfill this task. Indeed, our company has a lot of experience with both technologies. For instance, SEAPATH, our open-source virtualization solution for energy distribution, is based on the Yocto Project. Although VS Code extensions are written in Typescript, a web technology based on Node.js, rarely mastered by embedded developers who have experience with the Yocto Project. Hence, we assembled a diverse team for this challenge with experts from both worlds.

A brief history of the BitBake extension for VS Code

Interest in providing BitBake language support inside VS Code goes back to 2017 which quickly led to an extension that was maintained by Eugen Wiens. It has since generated more than 70k downloads! Unfortunately, Eugen did not find the time to keep developing it since 2019. Until now, this extension surprisingly still stood up. Although some features were less known and stable, the extension supplied very valuable contributions, like syntax highlighting. We have since taken over maintenance of this extension with the ambitious goal to provide a complete BitBake language and build tool IDE, that will provide all the features VS Code users are familiar with other extensions.

New language features in v2.1

We are very proud to announce the release of v2.1 which achieves most of our user experience designs. Compared to the legacy version, we have vastly improved the language features while adding a new level of interaction with the integration of BitBake commands inside the GUI. One of our first contributions was apparently small yet provides a huge productivity boost. It consists of providing hovering tool-tips with the documentation of BitBake variables, as well as completion when typing them (See animation below). This is a core feature for VS Code users, who will seamlessly use it instead of going back and forth to the Yocto Project reference manual.

Since then, we have had two major areas for language features. The first one is to ask BitBake for data and present it in the editor. We use it for instance to provide browsing definitions in inherit or require statements, and the overrides completions you can see in the video. The second one (and most challenging to implement) is to upgrade the language features inside embedded languages. The BitBake syntax allows to write Python and Bash tasks inside the recipe. We want our users to get as many features as possible, as if they had opened an editor tab for a shell or Python script. This means we need to have different completion items, definitions and hover documentations from the BitBake parts. We achieve this by querying the Python and Bash extensions on virtual documents in the background.

New build features in v2.1

Another focus of our work was to introduce a terminal free workflow for compiling and editing Yocto Project recipes. We added an extension panel for quickly browsing through recipe files that also has action buttons to quickly run builds or BitBake tasks. The same commands can be used with any opened editor through the contextual menu (Right-Clicking). There was one major challenge though: Many Yocto Project users call BitBake through various, often custom, build scripts. Some use the crops/poky docker container. Others use kas, and many run builds on a remote build server through SSH. We addressed all these use cases by crafting very flexible settings properties.

 

Lastly, we were also tasked with helping application developers working on top of the Yocto Project BSPs. Our solution revolves around devtool which can also be found in packaged Yocto eSDKs. We added a new view to quickly manage devtool workspaces. In addition, two new commands will create build and deploy tasks in the workspace that will use the proper SDK environment for cross-compiling. The more advanced command makes use of the upcoming ide-sdk plugin that will also provide sources linting and remote cross-debugging. With these tools, developers should feel right at home when developing applications with Yocto Project SDKs with an experience matching native builds.

What’s next?

Our mission is that this new tooling serves the community in the long run. Hence, we are very appreciative of any feedback on the GitHub repository, which we actively maintain. To plan for the future, we followed the best practices for unit and integration testing as well as coding practices. This way, future regressions and incompatibilities with poky updates can be easily handled. The latest release was even automatically published through our Continuous Deployment script!

More features are on the way! First, we’ll be enabling diagnostics for embedded Python and Bash sections. Moreover, we will scan recipes with `bitbake -e` to provide values and definitions of BitBake variables in context. Some users have also requested support for more platforms, so we’ll investigate porting some functionalities over to Windows and VS Code web. In the meantime we’ll keep maintaining, fixing bugs and answering to most requested features.

Links and resources

Want to find out more about this ambitious VS Code extension for the Yocto Project?

Acknowledgments

We express many thanks to the Yocto Project for entrusting us with this development. Our team especially wants to express their gratitude towards Ross Burton who has been the main referral from the Yocto Project and a huge guidance on implementing many features, as well as Michael Halstead for providing infrastructure requirements. We also want to credit Adrian Freihofer who has authored the new devtool ide-sdk plugin and Eugen Wiens, originally the main contributor and maintainer of the project.

Leave a comment

Your email address will not be published. Required fields are marked *


Similar articles

Image of an arrow

What’s new? We’re happy to announce the release of v2.5.0, which includes a few new features as well as quality-of-life improvements and minor bug fixes. Here is the change log: Add Yocto variables renaming across a recipe file Add code suggestions for SRC_URI local files Add code suggestions for recipe names in variables (DEPENDS, RDEPENDS, […]

Nuremberg, April 9th, 2024 – In an era where cybersecurity threats are increasingly sophisticated and pervasive, Savoir-faire Linux, a leading provider in open-source technological innovation and software engineering for embedded systems across North America and Europe, is proud to announce the launch of its Cybersecurity professional services tailored specifically for product engineering and embedded systems. […]

Savoir-faire Linux is happy to introduce the v2.4.0 release of the official Yocto Project extension for VS Code. These developments were carried out as part of the investment provided by the Sovereign Tech Fund to the Yocto Project to improves the long-term sustainability of the project by attracting a new generation of developers. The changelog […]

Savoir-faire Linux is proud to introduce the v2.3.0 release of the official Yocto Project extension for VS Code. These developments were carried out as part of the investment provided by the Sovereign Tech Fund to the Yocto Project to improves the long-term sustainability of the project by attracting a new generation of developers. The changelog […]

Savoir-faire Linux is proud to announce the v2.2.0 release of the official Yocto Project extension for VS Code. These developments were carried out as part of the investment provided by the Sovereign Tech Fund to the Yocto Project to improves the long-term sustainability of the project by attracting a new generation of developers. The changelog […]