Normal view

There are new articles available, click to refresh the page.
Before yesterdayMain stream

A new release of Raspberry Pi OS

28 October 2024 at 17:59

labwc – a new Wayland compositor

Today we are releasing a new version of Raspberry Pi OS. This version includes a significant change, albeit one that we hope most people won’t even notice. So we thought we’d better tell you about it to make sure you do…

First, a brief history lesson. Linux desktops, like their Unix predecessors, have for many years used the X Window system. This is the underlying technology which displays the desktop, handles windows, moves the mouse, and all that other stuff that you don’t really think about because it (usually) just works. X is prehistoric in computing terms, serving us well since the early 80s. But after 40 years, cracks are beginning to show in the design of X.

As a result, many Linux distributions are moving to a new windowing technology called Wayland. Wayland has many advantages over X, particularly performance. Under X, two separate applications help draw a window:

  • the display server creates windows on the screen and gives applications a place to draw their content
  • the window manager positions windows relative to each other and decorates windows with title bars and frames.

Wayland combines these two functions into a single application called the compositor. Applications running on a Wayland system only need to talk to one thing, instead of two, to display a window. As you might imagine, this is a much more efficient way to draw application windows.

Wayland also provides a security advantage. Under X, all applications communicated back and forth with the display server; consequently, any application could observe any other application. Wayland isolates applications at the compositor level, so applications cannot observe each other.

We first started thinking about Wayland at Raspberry Pi around ten years ago; at that time, it was nowhere near ready to use. Over the last few years, we have taken cautious steps towards Wayland. When we released Bullseye back in 2021, we switched to a new X window manager, mutter, which could also be used as a Wayland compositor. We included the option to switch it to Wayland mode to see how it worked.

With the release of Bookworm in 2023, we replaced mutter with a new dedicated Wayland compositor called wayfire and made Wayland the default mode of operation for Raspberry Pi 4 and 5, while continuing to run X on lower-powered models. We spent a lot of time optimising wayfire for Raspberry Pi hardware, but it still didn’t run well enough on older Pis, so we couldn’t switch to it everywhere.

All of this was a learning experience – we learned more about Wayland, how it interacted with our hardware, and what we needed to do to get the best out of it. As we continued to work with wayfire, we realised it was developing in a direction that would make it less compatible with our hardware. At this point, we knew it wasn’t the best choice to provide a good Wayland experience for Raspberry Pis. So we started looking at alternatives.

This search eventually led us to a compositor called labwc. Our initial experiments were encouraging: we were able to use it in Raspberry Pi OS after only a few hours of work. Closer investigation revealed labwc to be a much better fit for the Raspberry Pi graphics hardware than wayfire. We contacted the developers and found that their future direction very much aligned with our own.

labwc is built on top of a system called wlroots, a set of libraries which provide the basic functionality of a Wayland system. wlroots has been developed closely alongside the Wayland protocol. Using wlroots, anyone who wants to write a Wayland compositor doesn’t need to reinvent the wheel; we can take advantage of the experience of those who designed Wayland, since they know it best.

So we made the decision to switch. For most of this year, we have been working on porting labwc to the Raspberry Pi Desktop. This has very much been a collaborative process with the developers of both labwc and wlroots: both have helped us immensely with their support as we contribute features and optimisations needed for our desktop.

After much optimisation for our hardware, we have reached the point where labwc desktops run just as fast as X on older Raspberry Pi models. Today, we make the switch with our latest desktop image: Raspberry Pi Desktop now runs Wayland by default across all models.

When you update an existing installation of Bookworm, you will see a prompt asking to switch to labwc the next time you reboot:

We recommend that most people switch to labwc.

Existing Pi 4 or 5 Bookworm installations running wayfire shouldn’t change in any noticeable way, besides the loss of a couple of animations which we haven’t yet implemented in labwc. Because we will no longer support wayfire with updates on Raspberry Pi OS, it’s best to adopt labwc as soon as possible.

Older Pis that currently use X should also switch to labwc. To ensure backwards compatibility with older applications, labwc includes a library called Xwayland, which provides a virtual X implementation running on top of Wayland. labwc provides this virtual implementation automatically for any application that isn’t compatible with Wayland. With Xwayland, you can continue to use older applications that you rely on while benefiting from the latest security and performance updates.

As with any software update, we cannot possibly test all possible configurations and applications. If you switch to labwc and experience an issue, you can always switch back to X. To do this, open a terminal window and type:

sudo raspi-config 

This launches the command-line Raspberry Pi Configuration application. Use the arrow keys to select “6 Advanced Options” and hit ‘enter’ to open the menu. Select “A6 Wayland” and choose “W1 X11 Openbox window manager with X11 backend”. Hit ‘escape’ to exit the application; when you restart your device, your desktop should restart with X.

We don’t expect this to be necessary for many people, but the option is there, just in case! Of course, if you prefer to stick with wayfire or X for any reason, the upgrade prompt offers you the option to do so – this is not a compulsory upgrade, just one that we recommend.

Improved touch screen support

While labwc is the biggest change to the OS in this release, it’s not the only one. We have also significantly improved support for using the Desktop with a touch screen. Specifically, Raspberry Pi Desktop now automatically shows and hides the virtual keyboard, and supports right-click and double-click equivalents for touch displays.

This change comes as a result of integrating the Squeekboard virtual keyboard. When the system detects a touch display, the virtual keyboard automatically displays at the bottom of the screen whenever it is possible to enter text. The keyboard also automatically hides when no text entry is possible.

This auto show and hide should work with most applications, but it isn’t supported by everything. For applications which do not support it, you can instead use the keyboard icon at the right end of the taskbar to manually toggle the keyboard on and off.

If you don’t want to use the virtual keyboard with a touch screen, or you want to use it without a touch screen and click on it with the mouse, you can turn it on or off in the Display tab of Raspberry Pi Configuration. The new virtual keyboard only works with labwc; it’s not compatible with wayfire or X.

In addition to the virtual keyboard, we added long press detection on touch screens to generate the equivalent of a right-click with a mouse. You can use this to launch context-sensitive menus anywhere in the taskbar and the file manager.

We also added double-tap detection on touch screens to generate a double-click. While this previously worked on X, it didn’t work in wayfire. Double-tap to double-click is now supported in labwc.

Better Raspberry Pi Connect integration

We’ve had a lot of very positive feedback about Raspberry Pi Connect, our remote access software that allows you to control your Raspberry Pi from any computer anywhere in the world. This release integrates Connect into the Desktop.

By default, you will now see the Connect icon in the taskbar at all times. Previously, this indicated that Connect was running. Now, the icon indicates that Connect is installed and ready to use, but is not necessarily running. Hovering the mouse over the icon brings up a tooltip displaying the current status.

You can now enable or disable Connect directly from the menu which pops up when the icon is clicked. Previously, this was an option in Raspberry Pi Configuration, but that option has been removed. Now, all the options to control Connect live in the icon menu.

If you don’t plan to use Connect, you can uninstall it from Recommended Software, or you can remove the icon from the taskbar by right-clicking the taskbar and choosing “Add / Remove Plugins…”.

Other things

This release includes some other small changes worth mentioning:

  • We rewrote the panel application for the taskbar at the top of the screen. In the previous version, even if you removed a plugin from the panel, it remained in memory. Now, when you remove a plugin, the panel never loads it into memory at all. Rather than all the individual plugins being part of a single application, each plugin is now a separate library. The panel only loads the libraries for the plugins that you choose to display on your screen. This won’t make much difference to many people, but can save you a bit of RAM if you remove several plugins. This also makes it easier to develop new plugins, both for us and third parties.
  • We introduced a new Screen Configuration tool, raindrop. This works exactly the same as the old version, arandr, and even looks similar. Under the hood, we rewrote the old application in C to improve support for labwc and touch screens. Because the new tool is native, performance should be snappier! Going forward, we’ll only maintain the new native version.

How to get it

The new release is available today in apt, Raspberry Pi Imager, or as a download from the software page on raspberrypi.com.

Black screen on boot issue (resolved)

We did have some issues on the initial release yesterday, whereby some people found that the switch to labwc caused the desktop to fail to start. Fortunately, the issue has now been fixed. It is safe to update according to the process below, so we have reinstated the update prompt described above.

If you experience problems updating and see a black screen instead of a desktop, there’s a simple fix. At the black screen, press Ctrl + Alt + F2. Authenticate at the prompt and run the following command:

sudo apt install labwc

Finally, reboot with sudo reboot. This should restore a working desktop. We apologise to anyone who was affected by this.

To update an existing Raspberry Pi OS Bookworm install to this release, run the following commands:

sudo apt update
sudo apt full-upgrade

When you next reboot, you will see the prompt described above which offers the switch to labwc.

To switch to the new Screen Configuration tool, run the following commands:

sudo apt purge arandr
sudo apt install raindrop

The new on-screen keyboard can either be installed from Recommended Software – it’s called Squeekboard – or from the command line with:

sudo apt install squeekboard wfplug-squeek

We hope you like the new desktop experience. Or perhaps more accurately, we hope you won’t notice much difference! As always, your comments are very welcome below.

The post A new release of Raspberry Pi OS appeared first on Raspberry Pi.

Boost Your Pico Projects with the new Pico VS Code Extension

18 September 2024 at 16:56

A few months back, we quietly dropped the Pico VS Code project on GitHub. It didn’t take long before the feedback started pouring in. Since then, we’ve been listening and tweaking. Now, we’re excited to officially unveil the public beta of the Raspberry Pi Pico Visual Studio Code Extension!

What is Pico VS Code?

Pico VS Code is a Microsoft Visual Studio Code extension designed to make your life easier when creating, developing, and debugging projects for Raspberry Pi Pico-series boards. Whether you’re a total beginner or a seasoned pro, this tool is here to help you dive into Pico development with confidence and ease.

If you’ve ever tried to set up an embedded development environment, you know it’s no small feat. Beginners often find themselves tangled up in the complexities of build systems, SDKs, and toolchains. And let’s not even get started on cross-compilation; developing on one machine to run code on another introduces a whole new set of challenges.

Getting all the right configurations and installations in place can be intimidating for everyone, not just those new to the game. Even experienced developers can find themselves tangled in frustrating setup processes that eat into valuable development time.

pico-vscode New C/C++ Project wizard

That’s why we created the Pico Visual Studio Code extension: a user-friendly tool that simplifies the entire development process. We wanted to offer something that takes the guesswork out of setting up your environment, so you can start coding in an interface you’re already familiar with — Visual Studio Code — as quickly as possible.

With Pico VS Code, you won’t have to worry about nitty-gritty details that trip up newcomers and sometimes stymie veterans. Instead, you’ll be able to focus on what really matters: bringing your Raspberry Pi Pico projects to life. Whether you’re working on your first blinking LED or a more complex project, Pico VSCode is there to help you get started and keep you moving forward.

How do I get Pico VS Code?

Prerequisites

To get started with the Pico VS Code extension, you’ll need to ensure that your development environment meets a few basic requirements. The extension is compatible with various platforms, including Raspberry Pi OS, Windows, macOS, and Linux, each with its own set of prerequisites.

All platforms require an install of Visual Studio Code version 1.92.1 or newer. For detailed instructions on setting up Pico VS Code on your platform, refer to the respective prerequisites outlined below.

Raspberry Pi OS

  • Ensure you are running a 64-bit distribution of Raspberry Pi OS.

Windows

  • Make sure you’re using a x86-based PC (not ARM64).

macOS

  • For macOS users, you can install all necessary dependencies by running the following command in your terminal:
xcode-select --install

Linux

  • Refer to the README.md on our GitHub page for a full list of required software. Many distros include the required software in the standard OS install.

Installing the Pico VS Code extension

You can install the extension in two ways. The first option is to install it directly from your editor’s marketplace. This provides a seamless integration and automatic updates. The second option is to download and manually install the package. This gives you more control and is helpful in restricted environments or when managing specific versions.

Install in your editor

You can download the Pico VS Code extension directly from the Visual Studio Code Marketplace within your editor.

pico-vscode marketplace page in VS Code
The marketplace page of the Raspberry Pi Pico extension within VS Code
  1. Open the “Extensions” tab on the left side of VS Code (or press Ctrl+Shift+X on Windows/Linux, or Cmd+Shift+X on macOS).
  2. In the search bar at the top, type “pico-vscode”.
  3. Once you find the extension, click “Install”. Wait until the installation completes, and you’re ready to create a Raspberry Pi Pico project.

If you’re using a different VS Code-compatible editor, the extension is also available through the OpenVSX marketplace.

Manual installation

If you prefer, you can manually install the extension by downloading the package directly. Follow these steps:

  1. Visit the pico-vscode GitHub page and download the latest .vsix file from the release assets.
  2. To install the file in VS Code:
    • Open the “Extensions” panel as described earlier.
    • Click the three-dots menu (...) above the search bar and select “Install from VSIX…”.
    • Choose the .vsix file you just downloaded.

Alternatively, you can install the .vsix file via the terminal using the following command:

code --install-extension raspberry-pi-pico-<version>.vsix

Building a blink example with Pico VS Code

To create a project based on a blink example, select “New Project From Example” in the Pico sidebar panel added by the extension. Then, search for the example you want to use — in our case, “blink” — in the project name field. Click the “Create” button to generate a project from the template.

Raspberry Pi Pico blink example generated by pico-vscode
The blink example generated by pico-vscode

Once the project is generated, it will automatically open. When a Pico project is opened, the extension configures the build system for you based on the SDK version, board type, and other settings you’ve selected. After the progress bar disappears, you can compile the project by clicking the “Compile” button in the bottom right corner. This will open an output panel where you can follow the build progress. Once completed, you should see a line like this: [61/61] Linking CXX executable blink.elf.

When it comes to uploading firmware to your Raspberry Pi Pico board, you have two options. Both require you to connect your Pico in BOOTSEL mode. To put your Pico into BOOTSEL mode, connect your Pico board to your host computer while holding the BOOTSEL button.

The easiest way to get your firmware up and running is the “Run” button. Connect your Pico board in BOOTSEL mode, hit the “Run” button, and the firmware will upload automatically. You’ll know it’s working when the tiny LED near the USB connector starts blinking as the board disconnects itself.

In addition to the blink.elf executable, you’ll find a blink.uf2 file in the build directory within your project. If you prefer to manually flash firmware, drag and drop this UF2 file onto your Pico board in BOOTSEL mode.1 Once the file has been copied onto the board, it will automatically dismount and start running the blink project. You can confirm this by observing the tiny LED near the USB connector. It should start blinking as soon as the board disconnects itself.

For debugging directly within VS Code, the extension adds configuration to your project that allow you to use the debug panel and set breakpoints, just as you would when debugging other C/C++ projects on your computer. To run in debug mode with a Debug Probe, press F5. For detailed instructions on how to correctly wire your board for debugging, refer to the Getting Started guide on our website.2

Integrated offline documentation

When developing bare-metal code for the Pico, you often need to reference an API or check hardware specifications. To streamline your workflow, we’ve integrated the documentation directly into VS Code. This allows you to quickly access the information you need without leaving your editor — or requiring an internet connection.

Raspberry Pi Pico Project in VS Code with offline documentation for ADC open to the right
A VS Code window showcasing a Pico project on the left with the offline documentation open to the right

To access the documentation, navigate to the Raspberry Pi Pico panel in your sidebar and select the topic you want to explore. The documentation will open within the editor, so you can position it wherever you need, just like any other file. This way, you can keep your code and reference materials side by side.

How to update the project configuration

A new SDK revision has been released, and you want to take advantage of its awesome new features in your Pico project. No problem — the extension has you covered. If you need to switch the target board, change the selected SDK, or adjust any other properties configured during project creation, the extension provides commands to update your project settings in just a few clicks.

For example, to switch the SDK version, you’ll find a UI element in the status bar at the bottom of the VS Code window, or in the Raspberry Pi Pico Project quick access panel in your sidebar, displaying your currently selected version. Clicking this will open a simple dialog where you can choose the new SDK version you want to use. Once selected, the extension will automatically reconfigure your project to use the new version. For optimal IntelliSense functionality, we recommended to reload your window after changing any project settings to ensure all extensions are aware of the new configuration. After the changes have been applied, the extension sends you a notification with a button that will reload the current window.

If you need to update settings other than the SDK version or board type, you can access additional commands via the VS Code command palette, which you can open with the keyboard shortcut Ctrl+Shift+P (or Cmd+Shift+P on macOS). Type “Raspberry Pi Pico,” and you’ll see a list of all available commands provided by the Pico extension. This makes it easy to adjust your project configuration as needed.

It also supports MicroPython

For beginners or developers who want to get their projects up and running on a Pico as quickly as possible, MicroPython is an excellent choice.3 It is a lean and efficient implementation of the Python 3 programming language, specifically designed to run on microcontrollers and in constrained environments. It includes a small subset of the Python standard library, making it a powerful yet lightweight option for embedded development.4

To create a Pico project using MicroPython instead of C/C++, select “New MicroPython Project”. You can find this button either in our Quick Access panel, located in your sidebar or by running the New Pico Project command and selecting MicroPython as language. This will launch the familiar project creation wizard, now tailored for setting up a MicroPython project. Choose the location for your project folder and set a name for your project. When you click “Create,” the extension generates the new project and opens it for you, just like with a C/C++ project. But instead of using C/C++, your new project uses the MicroPico extension to run your code on the board and manage project configurations.

A newly create MicroPython based MicroPico project
Raspberry Pi Pico W running the blink.py script in MicroPython

With MicroPython, you can quickly start prototyping and experimenting with your Raspberry Pi Pico-series device, making it an ideal option for both newcomers and seasoned developers alike.

Next steps

For more detailed information on using the Pico VS Code extension, including a comprehensive list of settings and additional guidance, visit our GitHub project page. It’s a great resource for getting the most out of the extension.

If you’re new to developing Pico projects, don’t forget to check out the Getting Started guide we mentioned earlier—it’s packed with helpful tips to get you up and running.

If you’re looking to create a project that leverages the advanced features of Pico-series devices — such as I2C, PIO, or enabling stdio support—be sure to explore the “New C/C++ Project” interface. This tool allows you to customize your project setup to suit your needs, so you can dive into development quickly and efficiently.

  1. https://www.raspberrypi.com/documentation/microcontrollers/c_sdk.html#your-first-binaries ↩︎
  2. https://www.raspberrypi.com/news/raspberry-pi-debug-probe-a-plug-and-play-debug-kit-for-12/ ↩︎
  3. https://www.raspberrypi.com/documentation/microcontrollers/micropython.html#what-is-micropython ↩︎
  4. https://micropython.org ↩︎

The post Boost Your Pico Projects with the new Pico VS Code Extension appeared first on Raspberry Pi.

❌
❌