In the second installment of the Zephyr series, we will actually set up a Zephyr development environment and create an environment where we can build.
Next, we will build the Zephyr application and write it to a real device to check that it works.
Don't worry, setting up your development environment is incredibly easy.
And finally, in the third session, we will create a program to blink an LED and experience Zephyr-style coding.
So let's get started.
This article will introduce how to install the Zephyr project in a Windows environment and prepare the build environment. In addition, this time we will install Visual Studio Code using Windows 11.
Note:
Here we will introduce the steps for Windows 11, but you can set it up in the same way on other operating systems by installing VS Code.
Here we will use the FRDM-MCXA153 . The same steps can be followed for NXP microcontrollers (MCX series) and crossover microcontrollers (i.MX RT series).
We will install the following items:
VS Code and MCUXpresso for VS Code extension
Zephyr development environment including Zephyr SDK
VS Code Zephyr repository
If you don't already have Visual Studio Code (VS Code) installed, search for "visual studio code" in the Microsoft Store and install it.
Next, install "MCUXpresso For VS Code".
Extensions view in VS Code Alternatively, click Ctrl+Shift+X. Click the search field at the top of the Extensions view and type "mcuxpresso" .
Select MCUXpresso for VS Code and click the "Install" button to install the extension. Once the installation is successful, it will be added to the installed list.
Open the MCUXpresso for VS Code extension. Click "Open MCUXpresso Installer" in the Quick Start panel.
Now click on the tool you need to select it.
Here we will be using the NXP onboard ICE for debugging, so the LinkServer option is required.
Tips:
NXP EVK uses LinkServer by default. Install the necessary tools for your debug probe.
LinkServer, Segger JLink and PEmicro tools are available for installation.
Once you have selected your installation options, click the "Install" button. The status bar at the bottom will display the installation status.
Restart VS Code.
Next, import the Zephyr repository.
Open the MCUXpresso view in VS Code and click Import Repository in the Quickstart panel.
Zephyr is open source and available on github. You can import this github repository.
Release tag : A stable version. You can specify various versions by specifying a tag.
main branch : latest head of Zephyr
Here, we will import the release tag v4.0.0.
Once you've finished entering the information, click Import. If you want to import the Zephyr main branch, change the revision field to main.
Note:
Importing the Zephyr repository takes time, typically around an hour.
Although not required for Zephyr projects, the MCUXpresso SDK can be imported as well.
By completing the steps up to Step 3, you are now ready to start developing applications for Zephyr OS. Finally, you will be able to import, build, and debug Zephyr sample applications.
To import a sample application from the Zephyr repository, click "Import Sample from Repository" from the Quick Start panel.
To compile and build the program, click the Build button to build the Hello World project.
It's very easy.
Zephyr is usually built using the command line, with the build started with the West command, but it can also be built with a single build button in the GUI.
There's no need to remember complicated command options.
Once the build is complete, the memory capacity and usage will be listed.
Now, we will finally write the Zephyr program to the actual device and check its operation.
Before checking the operation, connect the PC to the USB Type-C cable as shown in the photo.
There are two USB connectors installed, but connect to the J15 USB connector side.
To start debugging, click the play button "▷".
デバッグ開始Start Debugging
It will stop at the entry of the main() function, allowing you to perform step execution.
Here, press the play button for step execution to run.
Among the multiple tabs at the bottom center of VS Code, there is a serial monitor function. Set it as shown below and click "Start Monitoring" to check the Printf output (standard output).
This time, we installed the Zephyr development environment, built a Hello World project, and checked its operation on an actual device.
Using "MCUXpresso for VS Code" simplified the installation of the Zephyr development environment, dependent libraries, and tools, allowing me to set up the environment very easily and quickly.
In the next issue, we will finally introduce the world of Zephyr regarding software reusability through an LED blinking program.
(Please wait until it is released.)
Click here for the previous article
=========================
We are currently unable to respond to comments in the " Comment " section of this post .
We apologize for the inconvenience, but when making inquiries, please refer to " How to contact NXP with technical questions ( Japanese blog ) " .
(If you are already an NXP distributor or have a relationship with NXP , you may contact the person in charge directly. )
In this second installment of the Zephyr series, "Building for the first time and running it on a real device," we will introduce how to install the Zephyr development environment and build it. We will then flash it onto a real device and check that it works.