Developing in C for the ATmega328P: Using Windows Terminal

Where I demonstrate using a new application Windows Terminal with Windows Subsystem for Linux (WSL) to ease C development in Windows.

Sources

Introduction

Microsoft has introduced a new application for interacting with the command line. The new application called Windows Terminal or Terminal will work with both the Windows environment, Azure Cloud environments and with WSL. The best part(s) about it, is that it is blazingly fast and is highly configurable. Windows Terminal is great and I love it!

Clarification on Windows Terminal

Note: Microsoft has also clarified that Command Prompt and PowerShell, like WSL and bash, are shells and not terminals, therefore they have no user interface (UI) of their own. Windows Console, on the other hand, is the standard Windows developer app with a UI that’s been available as an interface for command-line tools since Windows NT through to Windows 10.

An Example

Install and Open

Install the Windows Terminal application via the Windows Store. Be sure the version you install was developed by Microsoft. Once installed, you may open using the Open button in the Store or in subsequent uses, search for Terminal in the Windows Search bar and open it there. It might be helpful to pin to the Taskbar for future access.

When it is first opened, it will be in the Command prompt or Windows environment.

Terminal Opens in Windows Environment

Terminal Opens in Windows Environment

Large Version to see detail

Launch WSL

Enter wsl.exe to enter the Windows Subsystem for Linux environment. In the example, I have also entered pwd to determine where I am in the file system. In my case, I am in my Windows home folder, however, I want to be in my Linux home folder. When I enter cd with no parameters, it will default to my Linux home folder.

Launch WSL via wsl.exe

Launch WSL via wsl.exe

Large Version to see detail

Update Software

Just like Windows, it is important to keep the Linux environment up to date for security. I use this command to update and upgrade the software in one line:

sudo apt update && sudo apt upgrade -y
  • sudo for super user access, your password will be required
  • && means chain these commands, start the second, once the first command is finished
  • -y means automatically respond with a yes to the prompts

(As this was the second time I had performed this operation, no updates were found.)

Update the software

Update the software

Large Version to see detail

Complile/Link/Load Example

Here is the example from Setup where I manually go through and compile, link and load the software on to the Uno. Important: Make sure you have accessed the Uno via the Arduino IDE otherwise avrdude will fail. You will need to do this, after every time you have restarted you computer.

Example of compile/link/load of Uno

Example of compile/link/load of Uno

Large Version to see detail

Customization

If you really want to understand how to customize Windows Terminal, here is a great example!

Comments powered by Talkyard.